From e5b13cb10de209f924fdf9478214bcf7e4008d6d Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 28 Feb 2008 20:51:43 -0800 Subject: [NETNS]: Process devinet ioctl in the correct namespace. Add namespace parameter to devinet_ioctl and locate device inside it for state changes. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/linux/inetdevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index fc4e3db649e..da05ab47ff2 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h @@ -129,7 +129,7 @@ extern int unregister_inetaddr_notifier(struct notifier_block *nb); extern struct net_device *ip_dev_find(struct net *net, __be32 addr); extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); -extern int devinet_ioctl(unsigned int cmd, void __user *); +extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *); extern void devinet_init(void); extern struct in_device *inetdev_by_index(struct net *, int); extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); -- cgit v1.2.3 From 99cd07a537bf4c7c954f31611e30064407104410 Mon Sep 17 00:00:00 2001 From: Juha-Matti Tapio Date: Thu, 28 Feb 2008 20:55:46 -0800 Subject: [IPV6]: Fix source address selection for ORCHID addresses Skip the prefix length matching in source address selection for orchid -> non-orchid addresses. Overlay Routable Cryptographic Hash IDentifiers (RFC 4843, 2001:10::/28) are currenty not globally reachable. Without this check a host with an ORCHID address can end up preferring those over regular addresses when talking to other regular hosts in the 2001::/16 range thus breaking non-orchid connections. Signed-off-by: Juha-Matti Tapio Signed-off-by: David S. Miller --- include/net/ipv6.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/net/ipv6.h b/include/net/ipv6.h index c0c019f72ba..8b05c65415c 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -383,6 +383,16 @@ static inline int ipv6_addr_v4mapped(const struct in6_addr *a) a->s6_addr32[2] == htonl(0x0000ffff)); } +/* + * Check for a RFC 4843 ORCHID address + * (Overlay Routable Cryptographic Hash Identifiers) + */ +static inline int ipv6_addr_orchid(const struct in6_addr *a) +{ + return ((a->s6_addr32[0] & htonl(0xfffffff0)) + == htonl(0x20010010)); +} + /* * find the first different bit between two addresses * length of address must be a multiple of 32bits -- cgit v1.2.3 From 4c563f7669c10a12354b72b518c2287ffc6ebfb3 Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Thu, 28 Feb 2008 21:31:08 -0800 Subject: [XFRM]: Speed up xfrm_policy and xfrm_state walking Change xfrm_policy and xfrm_state walking algorithm from O(n^2) to O(n). This is achieved adding the entries to one more list which is used solely for walking the entries. This also fixes some races where the dump can have duplicate or missing entries when the SPD/SADB is modified during an ongoing dump. Dumping SADB with 20000 entries using "time ip xfrm state" the sys time dropped from 1.012s to 0.080s. Signed-off-by: Timo Teras Signed-off-by: David S. Miller --- include/linux/xfrm.h | 3 ++- include/net/xfrm.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index e31b8c84f2c..0c82c80b277 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h @@ -113,7 +113,8 @@ enum { XFRM_POLICY_TYPE_MAIN = 0, XFRM_POLICY_TYPE_SUB = 1, - XFRM_POLICY_TYPE_MAX = 2 + XFRM_POLICY_TYPE_MAX = 2, + XFRM_POLICY_TYPE_ANY = 255 }; enum diff --git a/include/net/xfrm.h b/include/net/xfrm.h index eea7785cc75..9b620566519 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -121,6 +121,7 @@ extern struct mutex xfrm_cfg_mutex; struct xfrm_state { /* Note: bydst is re-used during gc */ + struct list_head all; struct hlist_node bydst; struct hlist_node bysrc; struct hlist_node byspi; @@ -424,6 +425,7 @@ struct xfrm_tmpl struct xfrm_policy { struct xfrm_policy *next; + struct list_head bytype; struct hlist_node bydst; struct hlist_node byidx; @@ -1160,6 +1162,18 @@ struct xfrm6_tunnel { int priority; }; +struct xfrm_state_walk { + struct xfrm_state *state; + int count; + u8 proto; +}; + +struct xfrm_policy_walk { + struct xfrm_policy *policy; + int count; + u8 type, cur_type; +}; + extern void xfrm_init(void); extern void xfrm4_init(void); extern void xfrm_state_init(void); @@ -1184,7 +1198,23 @@ static inline void xfrm6_fini(void) extern int xfrm_proc_init(void); #endif -extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *); +static inline void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto) +{ + walk->proto = proto; + walk->state = NULL; + walk->count = 0; +} + +static inline void xfrm_state_walk_done(struct xfrm_state_walk *walk) +{ + if (walk->state != NULL) { + xfrm_state_put(walk->state); + walk->state = NULL; + } +} + +extern int xfrm_state_walk(struct xfrm_state_walk *walk, + int (*func)(struct xfrm_state *, int, void*), void *); extern struct xfrm_state *xfrm_state_alloc(void); extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, struct flowi *fl, struct xfrm_tmpl *tmpl, @@ -1306,7 +1336,25 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) #endif struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); -extern int xfrm_policy_walk(u8 type, int (*func)(struct xfrm_policy *, int, int, void*), void *); + +static inline void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type) +{ + walk->cur_type = XFRM_POLICY_TYPE_MAIN; + walk->type = type; + walk->policy = NULL; + walk->count = 0; +} + +static inline void xfrm_policy_walk_done(struct xfrm_policy_walk *walk) +{ + if (walk->policy != NULL) { + xfrm_pol_put(walk->policy); + walk->policy = NULL; + } +} + +extern int xfrm_policy_walk(struct xfrm_policy_walk *walk, + int (*func)(struct xfrm_policy *, int, int, void*), void *); int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, struct xfrm_selector *sel, -- cgit v1.2.3 From 9b0f976f27f00a81cf47643d90854659626795b4 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Fri, 29 Feb 2008 11:13:15 -0800 Subject: [INET]: Remove struct net_proto_family* from _init calls. struct net_proto_family* is not used in icmp[v6]_init, ndisc_init, igmp_init and tcp_v4_init. Remove it. Signed-off-by: Denis V. Lunev Acked-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/linux/icmpv6.h | 2 +- include/net/icmp.h | 2 +- include/net/ndisc.h | 4 ++-- include/net/tcp.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index 7c5e9817e99..8f86d6b621c 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h @@ -176,7 +176,7 @@ extern void icmpv6_send(struct sk_buff *skb, __u32 info, struct net_device *dev); -extern int icmpv6_init(struct net_proto_family *ops); +extern int icmpv6_init(void); extern int icmpv6_err_convert(int type, int code, int *err); extern void icmpv6_cleanup(void); diff --git a/include/net/icmp.h b/include/net/icmp.h index 9f7ef3c8bae..7bf714d9d7c 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h @@ -48,7 +48,7 @@ struct sk_buff; extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); extern int icmp_rcv(struct sk_buff *skb); extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); -extern void icmp_init(struct net_proto_family *ops); +extern void icmp_init(void); extern void icmp_out_count(unsigned char type); /* Move into dst.h ? */ diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 59b70624b05..5aedf324de6 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -77,7 +77,7 @@ struct nd_opt_hdr { } __attribute__((__packed__)); -extern int ndisc_init(struct net_proto_family *ops); +extern int ndisc_init(void); extern void ndisc_cleanup(void); @@ -107,7 +107,7 @@ extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *d /* * IGMP */ -extern int igmp6_init(struct net_proto_family *ops); +extern int igmp6_init(void); extern void igmp6_cleanup(void); diff --git a/include/net/tcp.h b/include/net/tcp.h index 7de4ea3a04d..ae9774b478f 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1373,7 +1373,7 @@ struct tcp_request_sock_ops { #endif }; -extern void tcp_v4_init(struct net_proto_family *ops); +extern void tcp_v4_init(void); extern void tcp_init(void); #endif /* _TCP_H */ -- cgit v1.2.3 From a5710d6582868a96cf0fe02eac11d34cfbc783c9 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Fri, 29 Feb 2008 11:14:50 -0800 Subject: [ICMP]: Add return code to icmp_init. icmp_init could fail and this is normal for namespace other than initial. So, the panic should be triggered only on init_net initialization path. Additionally create rollback path for icmp_init as a separate function. It will also be used later during namespace destruction. Signed-off-by: Denis V. Lunev Acked-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/icmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/icmp.h b/include/net/icmp.h index 7bf714d9d7c..faba64db8ff 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h @@ -48,7 +48,7 @@ struct sk_buff; extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); extern int icmp_rcv(struct sk_buff *skb); extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); -extern void icmp_init(void); +extern int icmp_init(void); extern void icmp_out_count(unsigned char type); /* Move into dst.h ? */ -- cgit v1.2.3 From edf0208702007ec1f6a36756fdd005f771a4cf17 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Fri, 29 Feb 2008 11:18:32 -0800 Subject: [NET]: Make netlink_kernel_release publically available as sk_release_kernel. This staff will be needed for non-netlink kernel sockets, which should also not pin a namespace like tcp_socket and icmp_socket. Signed-off-by: Denis V. Lunev Acked-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/sock.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index fd987608765..39112e75411 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -850,6 +850,7 @@ extern struct sock *sk_alloc(struct net *net, int family, gfp_t priority, struct proto *prot); extern void sk_free(struct sock *sk); +extern void sk_release_kernel(struct sock *sk); extern struct sock *sk_clone(const struct sock *sk, const gfp_t priority); @@ -1333,6 +1334,18 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e } #endif +/* + * Kernel sockets, f.e. rtnl or icmp_socket, are a part of a namespace. + * They should not hold a referrence to a namespace in order to allow + * to stop it. + * Sockets after sk_change_net should be released using sk_release_kernel + */ +static inline void sk_change_net(struct sock *sk, struct net *net) +{ + put_net(sk->sk_net); + sk->sk_net = net; +} + extern void sock_enable_timestamp(struct sock *sk); extern int sock_get_timestamp(struct sock *, struct timeval __user *); extern int sock_get_timestampns(struct sock *, struct timespec __user *); -- cgit v1.2.3 From 4a6ad7a141cbee2cf074e6cf8dc527b231b69ece Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Fri, 29 Feb 2008 11:19:58 -0800 Subject: [NETNS]: Make icmp_sk per namespace. All preparations are done. Now just add a hook to perform an initialization on namespace startup and replace icmp_sk macro with proper inline call. Signed-off-by: Denis V. Lunev Acked-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/netns/ipv4.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index a9b4f608629..504fde17452 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -26,6 +26,8 @@ struct netns_ipv4 { struct hlist_head *fib_table_hash; struct sock *fibnl; + struct sock **icmp_sk; + struct netns_frags frags; #ifdef CONFIG_NETFILTER struct xt_table *iptable_filter; -- cgit v1.2.3 From 98c6d1b261e74750e6c56ede26dc295201c4a8b2 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Fri, 29 Feb 2008 11:21:22 -0800 Subject: [NETNS]: Make icmpv6_sk per namespace. All preparations are done. Now just add a hook to perform an initialization on namespace startup and replace icmpv6_sk macro with proper inline call. Actual namespace the packet belongs too will be passed later along with the one for the routing. Signed-off-by: Denis V. Lunev Acked-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/netns/ipv6.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 1dd7de4e419..82623d3a8e3 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -36,5 +36,6 @@ struct netns_ipv6 { struct xt_table *ip6table_mangle; struct xt_table *ip6table_raw; #endif + struct sock **icmp_sk; }; #endif -- cgit v1.2.3 From 58fbbed4fbc0094fc808a568fe99a915f85402ee Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Fri, 29 Feb 2008 11:40:56 -0800 Subject: [SCTP]: extend exported data in /proc/net/sctp/assoc RFC 3873 specifies several MIB objects that can't be obtained by the current data set exported by /proc/sys/net/sctp/assoc. This patch adds the missing pieces of data that allow us to compute all the objects in the sctpAssocTable object. Signed-off-by: Neil Horman Signed-off-by: Vlad Yasevich Signed-off-by: David S. Miller --- include/net/sctp/structs.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 9c827a749b6..8966599ddb9 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -1661,6 +1661,9 @@ struct sctp_association { /* Transport to which SHUTDOWN chunk was last sent. */ struct sctp_transport *shutdown_last_sent_to; + /* How many times have we resent a SHUTDOWN */ + int shutdown_retries; + /* Transport to which INIT chunk was last sent. */ struct sctp_transport *init_last_sent_to; @@ -1695,6 +1698,11 @@ struct sctp_association { */ __u16 unack_data; + /* The total number of data chunks that we've had to retransmit + * as the result of a T3 timer expiration + */ + __u32 rtx_data_chunks; + /* This is the association's receive buffer space. This value is used * to set a_rwnd field in an INIT or a SACK chunk. */ -- cgit v1.2.3 From fd80eb942ad9761f241c9b287b3b9a342b20690d Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Fri, 29 Feb 2008 11:43:03 -0800 Subject: [INET]: Remove struct dst_entry *dst from request_sock_ops.rtx_syn_ack. It looks like dst parameter is used in this API due to historical reasons. Actually, it is really used in the direct call to tcp_v4_send_synack only. So, create a wrapper for tcp_v4_send_synack and remove dst from rtx_syn_ack. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/request_sock.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/request_sock.h b/include/net/request_sock.h index cff4608179c..040780add35 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h @@ -31,8 +31,7 @@ struct request_sock_ops { int obj_size; struct kmem_cache *slab; int (*rtx_syn_ack)(struct sock *sk, - struct request_sock *req, - struct dst_entry *dst); + struct request_sock *req); void (*send_ack)(struct sk_buff *skb, struct request_sock *req); void (*send_reset)(struct sock *sk, -- cgit v1.2.3 From a90bcbd651b453d8259243115696c11b864b30fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Fri, 29 Feb 2008 11:45:34 -0800 Subject: [SCTP]: Kill unused static inline sctp_sysctl_jiffies_ms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the patch: $ git-grep sctp_sysctl_jiffies_ms | wc -l 0 Signed-off-by: Ilpo Järvinen Acked-by: Vlad Yasevich Signed-off-by: David S. Miller --- include/net/sctp/sctp.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include') diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 57df27f1958..a653eb3e1e7 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -368,11 +368,6 @@ void sctp_sysctl_unregister(void); #else static inline void sctp_sysctl_register(void) { return; } static inline void sctp_sysctl_unregister(void) { return; } -static inline int sctp_sysctl_jiffies_ms(ctl_table *table, int __user *name, int nlen, - void __user *oldval, size_t __user *oldlenp, - void __user *newval, size_t newlen) { - return -ENOSYS; -} #endif /* Size of Supported Address Parameter for 'x' address types. */ -- cgit v1.2.3 From 03a64c93b68e1eff299b9bbbb0d13105171cddc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Fri, 29 Feb 2008 11:46:17 -0800 Subject: [LLC]: Kill static inline llc_addrany MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the patch: $ git-grep llc_addrany | wc -l 0 Signed-off-by: Ilpo Järvinen Acked-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- include/net/llc_if.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include') diff --git a/include/net/llc_if.h b/include/net/llc_if.h index c608812a8e8..b595a004d31 100644 --- a/include/net/llc_if.h +++ b/include/net/llc_if.h @@ -74,11 +74,6 @@ static inline int llc_mac_null(const u8 *mac) return is_zero_ether_addr(mac); } -static inline int llc_addrany(const struct llc_addr *addr) -{ - return llc_mac_null(addr->mac) && !addr->lsap; -} - static inline int llc_mac_multicast(const u8 *mac) { return is_multicast_ether_addr(mac); -- cgit v1.2.3 From 0df3ef45a3d7b59cc53ce4e3611033c6e3b51a1b Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Mon, 28 Jan 2008 14:07:15 +0200 Subject: mac80211: A-MPDU Tx add session's and low level driver's API This patch adds the API for 3 stages in A-MPDU Tx session flow: - request mac80211 to start/stop A-MPDU Tx session for specific TID. such a request should be issued by a load aware element, either mac80211 itself or external element. - requests by mac80211 to low-level driver to start/stop Tx aggregation. notice that low level driver responds now with Starting Sequence Number. - async feedback by low-level to mac80211 to inform that HW is ready for next A-MPDU Tx state. Changes in API to Rx A-MPDU were also made, reflected in iwlwifi changes as well. Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- include/net/mac80211.h | 86 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 9083bafb63c..3bbc33cc2b9 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -967,10 +967,14 @@ enum ieee80211_filter_flags { * &struct ieee80211_ops to indicate which action is needed. * @IEEE80211_AMPDU_RX_START: start Rx aggregation * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation + * @IEEE80211_AMPDU_TX_START: start Tx aggregation + * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation */ enum ieee80211_ampdu_mlme_action { IEEE80211_AMPDU_RX_START, IEEE80211_AMPDU_RX_STOP, + IEEE80211_AMPDU_TX_START, + IEEE80211_AMPDU_TX_STOP, }; /** @@ -1111,7 +1115,8 @@ enum ieee80211_ampdu_mlme_action { * The RA/TID combination determines the destination and TID we want * the ampdu action to be performed for. The action is defined through * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) - * is the first frame we expect to perform the action on. + * is the first frame we expect to perform the action on. notice + * that TX/RX_STOP can pass NULL for this parameter. */ struct ieee80211_ops { int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, @@ -1162,7 +1167,7 @@ struct ieee80211_ops { int (*conf_ht)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); int (*ampdu_action)(struct ieee80211_hw *hw, enum ieee80211_ampdu_mlme_action action, - const u8 *ra, u16 tid, u16 ssn); + const u8 *addr, u16 tid, u16 *ssn); }; /** @@ -1574,4 +1579,81 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, struct ieee80211_vif *vif), void *data); +/** + * ieee80211_start_tx_ba_session - Start a tx Block Ack session. + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * @ra: receiver address of the BA session recipient + * @tid: the TID to BA on. + * @return: success if addBA request was sent, failure otherwise + * + * Although mac80211/low level driver/user space application can estimate + * the need to start aggregation on a certain RA/TID, the session level + * will be managed by the mac80211. + */ +int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid); + +/** + * ieee80211_start_tx_ba_cb - low level driver ready to aggregate. + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * @ra: receiver address of the BA session recipient. + * @tid: the TID to BA on. + * + * This function must be called by low level driver once it has + * finished with preparations for the BA session. + */ +void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid); + +/** + * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * @ra: receiver address of the BA session recipient. + * @tid: the TID to BA on. + * + * This function must be called by low level driver once it has + * finished with preparations for the BA session. + * This version of the function is irq safe. + */ +void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, + u16 tid); + +/** + * ieee80211_stop_tx_ba_session - Stop a Block Ack session. + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * @ra: receiver address of the BA session recipient + * @tid: the TID to stop BA. + * @initiator: if indicates initiator DELBA frame will be sent. + * @return: error if no sta with matching da found, success otherwise + * + * Although mac80211/low level driver/user space application can estimate + * the need to stop aggregation on a certain RA/TID, the session level + * will be managed by the mac80211. + */ +int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, + u8 *ra, u16 tid, + enum ieee80211_back_parties initiator); + +/** + * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate. + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * @ra: receiver address of the BA session recipient. + * @tid: the desired TID to BA on. + * + * This function must be called by low level driver once it has + * finished with preparations for the BA session tear down. + */ +void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid); + +/** + * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * @ra: receiver address of the BA session recipient. + * @tid: the desired TID to BA on. + * + * This function must be called by low level driver once it has + * finished with preparations for the BA session tear down. + * This version of the function is irq safe. + */ +void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, + u16 tid); + #endif /* MAC80211_H */ -- cgit v1.2.3 From 9e7234923789897858e1a475c579b5e2e6ad5b74 Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Mon, 28 Jan 2008 14:07:18 +0200 Subject: mac80211: A-MPDU Tx adding qdisc support This patch allows qdisc support in A-MPDU Tx. a method to handle QoS <-> TID switches is present in this patch. Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- include/net/mac80211.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 3bbc33cc2b9..0ce2e94dc84 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -246,6 +246,7 @@ struct ieee80211_tx_queue_stats_data { * @IEEE80211_TX_QUEUE_AFTER_BEACON: transmit queue for frames to be * sent after a beacon * @IEEE80211_TX_QUEUE_BEACON: transmit queue for beacon frames + * @NUM_TX_DATA_QUEUES_AMPDU: adding more queues for A-MPDU */ enum ieee80211_tx_queue { IEEE80211_TX_QUEUE_DATA0, @@ -261,11 +262,12 @@ enum ieee80211_tx_queue { * this struct need to have fixed values. As soon as it is removed, we can * fix these entries. */ IEEE80211_TX_QUEUE_AFTER_BEACON = 6, - IEEE80211_TX_QUEUE_BEACON = 7 + IEEE80211_TX_QUEUE_BEACON = 7, + NUM_TX_DATA_QUEUES_AMPDU = 16 }; struct ieee80211_tx_queue_stats { - struct ieee80211_tx_queue_stats_data data[NUM_TX_DATA_QUEUES]; + struct ieee80211_tx_queue_stats_data data[NUM_TX_DATA_QUEUES_AMPDU]; }; struct ieee80211_low_level_stats { @@ -348,6 +350,8 @@ struct ieee80211_tx_control { #define IEEE80211_TXCTL_EAPOL_FRAME (1<<11) /* internal to mac80211 */ #define IEEE80211_TXCTL_SEND_AFTER_DTIM (1<<12) /* send this frame after DTIM * beacon */ +#define IEEE80211_TXCTL_AMPDU (1<<13) /* this frame should be sent + * as part of an A-MPDU */ u32 flags; /* tx control flags defined * above */ u8 key_idx; /* keyidx from hw->set_key(), undefined if -- cgit v1.2.3 From 483fdcecc564ae6b011148a758517cf561f65678 Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Mon, 28 Jan 2008 14:07:21 +0200 Subject: mac80211: A-MPDU Tx change tx_status to support Block Ack data This patch adds fields to ieee80211_tx_status in order to allow block ack information exchange between low-level driver,mac80211 and rate scaling module. Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- include/net/mac80211.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 0ce2e94dc84..277488176a4 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -445,12 +445,14 @@ struct ieee80211_rx_status { * * @IEEE80211_TX_STATUS_TX_FILTERED: The frame was not transmitted * because the destination STA was in powersave mode. - * * @IEEE80211_TX_STATUS_ACK: Frame was acknowledged + * @IEEE80211_TX_STATUS_AMPDU: The frame was aggregated, so status + * is for the whole aggregation. */ enum ieee80211_tx_status_flags { IEEE80211_TX_STATUS_TX_FILTERED = 1<<0, IEEE80211_TX_STATUS_ACK = 1<<1, + IEEE80211_TX_STATUS_AMPDU = 1<<2, }; /** @@ -461,24 +463,25 @@ enum ieee80211_tx_status_flags { * * @control: a copy of the &struct ieee80211_tx_control passed to the driver * in the tx() callback. - * * @flags: transmit status flags, defined above - * - * @ack_signal: signal strength of the ACK frame - * + * @retry_count: number of retries * @excessive_retries: set to 1 if the frame was retried many times * but not acknowledged - * - * @retry_count: number of retries - * + * @ampdu_ack_len: number of aggregated frames. + * relevant only if IEEE80211_TX_STATUS_AMPDU was set. + * @ampdu_ack_map: block ack bit map for the aggregation. + * relevant only if IEEE80211_TX_STATUS_AMPDU was set. + * @ack_signal: signal strength of the ACK frame * @queue_length: ?? REMOVE * @queue_number: ?? REMOVE */ struct ieee80211_tx_status { struct ieee80211_tx_control control; u8 flags; - bool excessive_retries; u8 retry_count; + bool excessive_retries; + u8 ampdu_ack_len; + u64 ampdu_ack_map; int ack_signal; int queue_length; int queue_number; -- cgit v1.2.3 From 8318d78a44d49ac1edf2bdec7299de3617c4232e Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 24 Jan 2008 19:38:38 +0100 Subject: cfg80211 API for channels/bitrates, mac80211 and driver conversion This patch creates new cfg80211 wiphy API for channel and bitrate registration and converts mac80211 and drivers to the new API. The old mac80211 API is completely ripped out. All drivers (except ath5k) are updated to the new API, in many cases I expect that optimisations can be done. Along with the regulatory code I've also ripped out the IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED flag, I believe it to be unnecessary if the hardware simply gives us whatever channels it wants to support and we then enable/disable them as required, which is pretty much required for travelling. Additionally, the patch adds proper "basic" rate handling for STA mode interface, AP mode interface will have to have new API added to allow userspace to set the basic rate set, currently it'll be empty... However, the basic rate handling will need to be moved to the BSS conf stuff. I do expect there to be bugs in this, especially wrt. transmit power handling where I'm basically clueless about how it should work. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 197 +++++++++---------------------------------------- include/net/wireless.h | 168 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 202 insertions(+), 163 deletions(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 277488176a4..460da54a001 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -69,95 +69,6 @@ * not do so then mac80211 may add this under certain circumstances. */ -#define IEEE80211_CHAN_W_SCAN 0x00000001 -#define IEEE80211_CHAN_W_ACTIVE_SCAN 0x00000002 -#define IEEE80211_CHAN_W_IBSS 0x00000004 - -/* Channel information structure. Low-level driver is expected to fill in chan, - * freq, and val fields. Other fields will be filled in by 80211.o based on - * hostapd information and low-level driver does not need to use them. The - * limits for each channel will be provided in 'struct ieee80211_conf' when - * configuring the low-level driver with hw->config callback. If a device has - * a default regulatory domain, IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED - * can be set to let the driver configure all fields */ -struct ieee80211_channel { - short chan; /* channel number (IEEE 802.11) */ - short freq; /* frequency in MHz */ - int val; /* hw specific value for the channel */ - int flag; /* flag for hostapd use (IEEE80211_CHAN_*) */ - unsigned char power_level; - unsigned char antenna_max; -}; - -#define IEEE80211_RATE_ERP 0x00000001 -#define IEEE80211_RATE_BASIC 0x00000002 -#define IEEE80211_RATE_PREAMBLE2 0x00000004 -#define IEEE80211_RATE_SUPPORTED 0x00000010 -#define IEEE80211_RATE_OFDM 0x00000020 -#define IEEE80211_RATE_CCK 0x00000040 -#define IEEE80211_RATE_MANDATORY 0x00000100 - -#define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2) -#define IEEE80211_RATE_MODULATION(f) \ - (f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM)) - -/* Low-level driver should set PREAMBLE2, OFDM and CCK flags. - * BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the - * configuration. */ -struct ieee80211_rate { - int rate; /* rate in 100 kbps */ - int val; /* hw specific value for the rate */ - int flags; /* IEEE80211_RATE_ flags */ - int val2; /* hw specific value for the rate when using short preamble - * (only when IEEE80211_RATE_PREAMBLE2 flag is set, i.e., for - * 2, 5.5, and 11 Mbps) */ - signed char min_rssi_ack; - unsigned char min_rssi_ack_delta; - - /* following fields are set by 80211.o and need not be filled by the - * low-level driver */ - int rate_inv; /* inverse of the rate (LCM(all rates) / rate) for - * optimizing channel utilization estimates */ -}; - -/** - * enum ieee80211_phymode - PHY modes - * - * @MODE_IEEE80211A: 5GHz as defined by 802.11a/802.11h - * @MODE_IEEE80211B: 2.4 GHz as defined by 802.11b - * @MODE_IEEE80211G: 2.4 GHz as defined by 802.11g (with OFDM), - * backwards compatible with 11b mode - * @NUM_IEEE80211_MODES: internal - */ -enum ieee80211_phymode { - MODE_IEEE80211A, - MODE_IEEE80211B, - MODE_IEEE80211G, - - /* keep last */ - NUM_IEEE80211_MODES -}; - -/** - * struct ieee80211_ht_info - describing STA's HT capabilities - * - * This structure describes most essential parameters needed - * to describe 802.11n HT capabilities for an STA. - * - * @ht_supported: is HT supported by STA, 0: no, 1: yes - * @cap: HT capabilities map as described in 802.11n spec - * @ampdu_factor: Maximum A-MPDU length factor - * @ampdu_density: Minimum A-MPDU spacing - * @supp_mcs_set: Supported MCS set as described in 802.11n spec - */ -struct ieee80211_ht_info { - u8 ht_supported; - u16 cap; /* use IEEE80211_HT_CAP_ */ - u8 ampdu_factor; - u8 ampdu_density; - u8 supp_mcs_set[16]; -}; - /** * struct ieee80211_ht_bss_info - describing BSS's HT characteristics * @@ -174,30 +85,6 @@ struct ieee80211_ht_bss_info { u8 bss_op_mode; /* use IEEE80211_HT_IE_ */ }; -/** - * struct ieee80211_hw_mode - PHY mode definition - * - * This structure describes the capabilities supported by the device - * in a single PHY mode. - * - * @list: internal - * @channels: pointer to array of supported channels - * @rates: pointer to array of supported bitrates - * @mode: the PHY mode for this definition - * @num_channels: number of supported channels - * @num_rates: number of supported bitrates - * @ht_info: PHY's 802.11n HT abilities for this mode - */ -struct ieee80211_hw_mode { - struct list_head list; - struct ieee80211_channel *channels; - struct ieee80211_rate *rates; - enum ieee80211_phymode mode; - int num_channels; - int num_rates; - struct ieee80211_ht_info ht_info; -}; - /** * struct ieee80211_tx_queue_params - transmit queue configuration * @@ -320,11 +207,13 @@ struct ieee80211_bss_conf { struct ieee80211_tx_control { struct ieee80211_vif *vif; - int tx_rate; /* Transmit rate, given as the hw specific value for the - * rate (from struct ieee80211_rate) */ - int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw - * specific value for the rate (from - * struct ieee80211_rate) */ + struct ieee80211_rate *tx_rate; + + /* Transmit rate for RTS/CTS frame */ + struct ieee80211_rate *rts_cts_rate; + + /* retry rate for the last retries */ + struct ieee80211_rate *alt_retry_rate; #define IEEE80211_TXCTL_REQ_TX_STATUS (1<<0)/* request TX status callback for * this frame */ @@ -343,6 +232,7 @@ struct ieee80211_tx_control { #define IEEE80211_TXCTL_REQUEUE (1<<7) #define IEEE80211_TXCTL_FIRST_FRAGMENT (1<<8) /* this is a first fragment of * the frame */ +#define IEEE80211_TXCTL_SHORT_PREAMBLE (1<<9) #define IEEE80211_TXCTL_LONG_RETRY_LIMIT (1<<10) /* this frame should be send * using the through * set_retry_limit configured @@ -359,20 +249,11 @@ struct ieee80211_tx_control { u8 retry_limit; /* 1 = only first attempt, 2 = one retry, .. * This could be used when set_retry_limit * is not implemented by the driver */ - u8 power_level; /* per-packet transmit power level, in dBm */ u8 antenna_sel_tx; /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */ u8 icv_len; /* length of the ICV/MIC field in octets */ u8 iv_len; /* length of the IV field in octets */ u8 queue; /* hardware queue to use for this frame; * 0 = highest, hw->queues-1 = lowest */ - struct ieee80211_rate *rate; /* internal 80211.o rate */ - struct ieee80211_rate *rts_rate; /* internal 80211.o rate - * for RTS/CTS */ - int alt_retry_rate; /* retry rate for the last retries, given as the - * hw specific value for the rate (from - * struct ieee80211_rate). To be used to limit - * packet dropping when probing higher rates, if hw - * supports multiple retry rates. -1 = not used */ int type; /* internal */ }; @@ -415,26 +296,24 @@ enum mac80211_rx_flags { * supported by hardware) to the 802.11 code with each received * frame. * @mactime: MAC timestamp as defined by 802.11 + * @band: the active band when this frame was received * @freq: frequency the radio was tuned to when receiving this frame, in MHz - * @channel: channel the radio was tuned to - * @phymode: active PHY mode * @ssi: signal strength when receiving this frame * @signal: used as 'qual' in statistics reporting * @noise: PHY noise when receiving this frame * @antenna: antenna used - * @rate: data rate + * @rate_idx: index of data rate into band's supported rates * @flag: %RX_FLAG_* */ struct ieee80211_rx_status { u64 mactime; + enum ieee80211_band band; int freq; - int channel; - enum ieee80211_phymode phymode; int ssi; int signal; int noise; int antenna; - int rate; + int rate_idx; int flag; }; @@ -509,41 +388,30 @@ enum ieee80211_conf_flags { * * @radio_enabled: when zero, driver is required to switch off the radio. * TODO make a flag - * @channel: IEEE 802.11 channel number - * @freq: frequency in MHz - * @channel_val: hardware specific channel value for the channel - * @phymode: PHY mode to activate (REMOVE) - * @chan: channel to switch to, pointer to the channel information - * @mode: pointer to mode definition - * @regulatory_domain: ?? * @beacon_int: beacon interval (TODO make interface config) * @flags: configuration flags defined above - * @power_level: transmit power limit for current regulatory domain in dBm - * @antenna_max: maximum antenna gain + * @power_level: requested transmit power (in dBm) + * @max_antenna_gain: maximum antenna gain (in dBi) * @antenna_sel_tx: transmit antenna selection, 0: default/diversity, * 1/2: antenna 0/1 * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx * @ht_conf: describes current self configuration of 802.11n HT capabilies * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters + * @channel: the channel to tune to */ struct ieee80211_conf { - int channel; /* IEEE 802.11 channel number */ - int freq; /* MHz */ - int channel_val; /* hw specific value for the channel */ - - enum ieee80211_phymode phymode; - struct ieee80211_channel *chan; - struct ieee80211_hw_mode *mode; unsigned int regulatory_domain; int radio_enabled; int beacon_int; u32 flags; - u8 power_level; - u8 antenna_max; + int power_level; + int max_antenna_gain; u8 antenna_sel_tx; u8 antenna_sel_rx; + struct ieee80211_channel *channel; + struct ieee80211_ht_info ht_conf; struct ieee80211_ht_bss_info ht_bss_conf; }; @@ -764,15 +632,19 @@ enum sta_notify_cmd { * %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is also not set because * otherwise the stack will not know when the DTIM beacon was sent. * - * @IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED: - * Channels are already configured to the default regulatory domain - * specified in the device's EEPROM + * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE: + * Hardware is not capable of short slot operation on the 2.4 GHz band. + * + * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE: + * Hardware is not capable of receiving frames with short preamble on + * the 2.4 GHz band. */ enum ieee80211_hw_flags { IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE = 1<<0, IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, - IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED = 1<<3, + IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, + IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, }; /** @@ -784,7 +656,8 @@ enum ieee80211_hw_flags { * @wiphy: This points to the &struct wiphy allocated for this * 802.11 PHY. You must fill in the @perm_addr and @dev * members of this structure using SET_IEEE80211_DEV() - * and SET_IEEE80211_PERM_ADDR(). + * and SET_IEEE80211_PERM_ADDR(). Additionally, all supported + * bands (with channels, bitrates) are registered here. * * @conf: &struct ieee80211_conf, device configuration, don't use. * @@ -1062,7 +935,9 @@ enum ieee80211_ampdu_mlme_action { * given local_address is enabled. * * @hw_scan: Ask the hardware to service the scan request, no need to start - * the scan state machine in stack. + * the scan state machine in stack. The scan must honour the channel + * configuration done by the regulatory agent in the wiphy's registered + * bands. * * @get_stats: return low-level statistics * @@ -1284,10 +1159,6 @@ static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw) #endif } -/* Register a new hardware PHYMODE capability to the stack. */ -int ieee80211_register_hwmode(struct ieee80211_hw *hw, - struct ieee80211_hw_mode *mode); - /** * ieee80211_unregister_hw - Unregister a hardware device * @@ -1461,7 +1332,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, * @hw: pointer obtained from ieee80211_alloc_hw(). * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @frame_len: the length of the frame. - * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. + * @rate: the rate at which the frame is going to be transmitted. * * Calculate the duration field of some generic frame, given its * length and transmission rate (in 100kbps). @@ -1469,7 +1340,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, struct ieee80211_vif *vif, size_t frame_len, - int rate); + struct ieee80211_rate *rate); /** * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames diff --git a/include/net/wireless.h b/include/net/wireless.h index d30c4ba8fd9..c7f805ee554 100644 --- a/include/net/wireless.h +++ b/include/net/wireless.h @@ -12,6 +12,162 @@ #include #include +/** + * enum ieee80211_band - supported frequency bands + * + * The bands are assigned this way because the supported + * bitrates differ in these bands. + * + * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band + * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) + */ +enum ieee80211_band { + IEEE80211_BAND_2GHZ, + IEEE80211_BAND_5GHZ, + + /* keep last */ + IEEE80211_NUM_BANDS +}; + +/** + * enum ieee80211_channel_flags - channel flags + * + * Channel flags set by the regulatory control code. + * + * @IEEE80211_CHAN_DISABLED: This channel is disabled. + * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted + * on this channel. + * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. + * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. + */ +enum ieee80211_channel_flags { + IEEE80211_CHAN_DISABLED = 1<<0, + IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, + IEEE80211_CHAN_NO_IBSS = 1<<2, + IEEE80211_CHAN_RADAR = 1<<3, +}; + +/** + * struct ieee80211_channel - channel definition + * + * This structure describes a single channel for use + * with cfg80211. + * + * @center_freq: center frequency in MHz + * @hw_value: hardware-specific value for the channel + * @flags: channel flags from &enum ieee80211_channel_flags. + * @orig_flags: channel flags at registration time, used by regulatory + * code to support devices with additional restrictions + * @band: band this channel belongs to. + * @max_antenna_gain: maximum antenna gain in dBi + * @max_power: maximum transmission power (in dBm) + * @orig_mag: internal use + * @orig_mpwr: internal use + */ +struct ieee80211_channel { + enum ieee80211_band band; + u16 center_freq; + u16 hw_value; + u32 flags; + int max_antenna_gain; + int max_power; + u32 orig_flags; + int orig_mag, orig_mpwr; +}; + +/** + * enum ieee80211_rate_flags - rate flags + * + * Hardware/specification flags for rates. These are structured + * in a way that allows using the same bitrate structure for + * different bands/PHY modes. + * + * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short + * preamble on this bitrate; only relevant in 2.4GHz band and + * with CCK rates. + * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate + * when used with 802.11a (on the 5 GHz band); filled by the + * core code when registering the wiphy. + * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate + * when used with 802.11b (on the 2.4 GHz band); filled by the + * core code when registering the wiphy. + * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate + * when used with 802.11g (on the 2.4 GHz band); filled by the + * core code when registering the wiphy. + * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. + */ +enum ieee80211_rate_flags { + IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, + IEEE80211_RATE_MANDATORY_A = 1<<1, + IEEE80211_RATE_MANDATORY_B = 1<<2, + IEEE80211_RATE_MANDATORY_G = 1<<3, + IEEE80211_RATE_ERP_G = 1<<4, +}; + +/** + * struct ieee80211_rate - bitrate definition + * + * This structure describes a bitrate that an 802.11 PHY can + * operate with. The two values @hw_value and @hw_value_short + * are only for driver use when pointers to this structure are + * passed around. + * + * @flags: rate-specific flags + * @bitrate: bitrate in units of 100 Kbps + * @hw_value: driver/hardware value for this rate + * @hw_value_short: driver/hardware value for this rate when + * short preamble is used + */ +struct ieee80211_rate { + u32 flags; + u16 bitrate; + u16 hw_value, hw_value_short; +}; + +/** + * struct ieee80211_ht_info - describing STA's HT capabilities + * + * This structure describes most essential parameters needed + * to describe 802.11n HT capabilities for an STA. + * + * @ht_supported: is HT supported by STA, 0: no, 1: yes + * @cap: HT capabilities map as described in 802.11n spec + * @ampdu_factor: Maximum A-MPDU length factor + * @ampdu_density: Minimum A-MPDU spacing + * @supp_mcs_set: Supported MCS set as described in 802.11n spec + */ +struct ieee80211_ht_info { + u16 cap; /* use IEEE80211_HT_CAP_ */ + u8 ht_supported; + u8 ampdu_factor; + u8 ampdu_density; + u8 supp_mcs_set[16]; +}; + +/** + * struct ieee80211_supported_band - frequency band definition + * + * This structure describes a frequency band a wiphy + * is able to operate in. + * + * @channels: Array of channels the hardware can operate in + * in this band. + * @band: the band this structure represents + * @n_channels: Number of channels in @channels + * @bitrates: Array of bitrates the hardware can operate with + * in this band. Must be sorted to give a valid "supported + * rates" IE, i.e. CCK rates first, then OFDM. + * @n_bitrates: Number of bitrates in @bitrates + */ +struct ieee80211_supported_band { + struct ieee80211_channel *channels; + struct ieee80211_rate *bitrates; + enum ieee80211_band band; + int n_channels; + int n_bitrates; + struct ieee80211_ht_info ht_info; +}; + /** * struct wiphy - wireless hardware description * @idx: the wiphy index assigned to this item @@ -30,6 +186,8 @@ struct wiphy { * help determine whether you own this wiphy or not. */ void *privid; + struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; + /* fields below are read-only, assigned by cfg80211 */ /* the item in /sys/class/ieee80211/ points to this, @@ -136,4 +294,14 @@ extern void wiphy_unregister(struct wiphy *wiphy); */ extern void wiphy_free(struct wiphy *wiphy); +/** + * ieee80211_channel_to_frequency - convert channel number to frequency + */ +extern int ieee80211_channel_to_frequency(int chan); + +/** + * ieee80211_frequency_to_channel - convert frequency to channel number + */ +extern int ieee80211_frequency_to_channel(int freq); + #endif /* __NET_WIRELESS_H */ -- cgit v1.2.3 From ee688b000d35f413f33561ec9c7d3355be561e2f Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Thu, 24 Jan 2008 19:38:39 +0100 Subject: nl80211: export hardware bitrate/channel capabilities This makes nl80211 export the hardware bitrate/channel capabilities as registered in a wiphy. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/linux/nl80211.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'include') diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 9fecf902419..63695060db9 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h @@ -161,6 +161,9 @@ enum nl80211_commands { * given for %NL80211_CMD_GET_STATION, nested attribute containing * info as possible, see &enum nl80211_sta_stats. * + * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands, + * consisting of a nested array. + * * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */ @@ -195,6 +198,8 @@ enum nl80211_attrs { NL80211_ATTR_STA_VLAN, NL80211_ATTR_STA_STATS, + NL80211_ATTR_WIPHY_BANDS, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -280,4 +285,63 @@ enum nl80211_sta_stats { NL80211_STA_STAT_MAX = __NL80211_STA_STAT_AFTER_LAST - 1 }; +/** + * enum nl80211_band_attr - band attributes + * @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved + * @NL80211_BAND_ATTR_FREQS: supported frequencies in this band, + * an array of nested frequency attributes + * @NL80211_BAND_ATTR_RATES: supported bitrates in this band, + * an array of nested bitrate attributes + */ +enum nl80211_band_attr { + __NL80211_BAND_ATTR_INVALID, + NL80211_BAND_ATTR_FREQS, + NL80211_BAND_ATTR_RATES, + + /* keep last */ + __NL80211_BAND_ATTR_AFTER_LAST, + NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1 +}; + +/** + * enum nl80211_frequency_attr - frequency attributes + * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz + * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current + * regulatory domain. + * @NL80211_FREQUENCY_ATTR_PASSIVE_SCAN: Only passive scanning is + * permitted on this channel in current regulatory domain. + * @NL80211_FREQUENCY_ATTR_NO_IBSS: IBSS networks are not permitted + * on this channel in current regulatory domain. + * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory + * on this channel in current regulatory domain. + */ +enum nl80211_frequency_attr { + __NL80211_FREQUENCY_ATTR_INVALID, + NL80211_FREQUENCY_ATTR_FREQ, + NL80211_FREQUENCY_ATTR_DISABLED, + NL80211_FREQUENCY_ATTR_PASSIVE_SCAN, + NL80211_FREQUENCY_ATTR_NO_IBSS, + NL80211_FREQUENCY_ATTR_RADAR, + + /* keep last */ + __NL80211_FREQUENCY_ATTR_AFTER_LAST, + NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1 +}; + +/** + * enum nl80211_bitrate_attr - bitrate attributes + * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps + * @NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE: Short preamble supported + * in 2.4 GHz band. + */ +enum nl80211_bitrate_attr { + __NL80211_BITRATE_ATTR_INVALID, + NL80211_BITRATE_ATTR_RATE, + NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE, + + /* keep last */ + __NL80211_BITRATE_ATTR_AFTER_LAST, + NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1 +}; + #endif /* __LINUX_NL80211_H */ -- cgit v1.2.3 From 66f7ac50ed7cc5c19a62bc97e8f6e7891004a03a Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Thu, 31 Jan 2008 19:48:22 +0100 Subject: nl80211: Add monitor interface configuration flags This allows precise control over what a monitor interface shows. Signed-off-by: Michael Wu Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/linux/nl80211.h | 35 +++++++++++++++++++++++++++++++++++ include/net/cfg80211.h | 24 ++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 63695060db9..a9f0b93324a 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h @@ -164,6 +164,9 @@ enum nl80211_commands { * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands, * consisting of a nested array. * + * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of + * &enum nl80211_mntr_flags. + * * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */ @@ -200,6 +203,8 @@ enum nl80211_attrs { NL80211_ATTR_WIPHY_BANDS, + NL80211_ATTR_MNTR_FLAGS, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -344,4 +349,34 @@ enum nl80211_bitrate_attr { NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1 }; +/** + * enum nl80211_mntr_flags - monitor configuration flags + * + * Monitor configuration flags. + * + * @__NL80211_MNTR_FLAG_INVALID: reserved + * + * @NL80211_MNTR_FLAG_FCSFAIL: pass frames with bad FCS + * @NL80211_MNTR_FLAG_PLCPFAIL: pass frames with bad PLCP + * @NL80211_MNTR_FLAG_CONTROL: pass control frames + * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering + * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing. + * overrides all other flags. + * + * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use + * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag + */ +enum nl80211_mntr_flags { + __NL80211_MNTR_FLAG_INVALID, + NL80211_MNTR_FLAG_FCSFAIL, + NL80211_MNTR_FLAG_PLCPFAIL, + NL80211_MNTR_FLAG_CONTROL, + NL80211_MNTR_FLAG_OTHER_BSS, + NL80211_MNTR_FLAG_COOK_FRAMES, + + /* keep last */ + __NL80211_MNTR_FLAG_AFTER_LAST, + NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1 +}; + #endif /* __LINUX_NL80211_H */ diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index bcc480b8892..ab4caf63954 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -163,6 +163,26 @@ struct station_stats { u32 tx_bytes; }; +/** + * enum monitor_flags - monitor flags + * + * Monitor interface configuration flags. Note that these must be the bits + * according to the nl80211 flags. + * + * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS + * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP + * @MONITOR_FLAG_CONTROL: pass control frames + * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering + * @MONITOR_FLAG_COOK_FRAMES: report frames after processing + */ +enum monitor_flags { + MONITOR_FLAG_FCSFAIL = 1< Date: Sun, 10 Feb 2008 16:49:38 +0100 Subject: mac80211: give burst time in txop rather than 0.1msec units This changes mac80211 to pass the burst time to conf_tx in txop units rather than 0.1msec units. 0.1msec units are only required by atheros hardware (according to current driver support), all other drivers do other calculations or require the txop value. Therefore, it results in fewer calculations and more precision if we just pass the txop value through to the driver. Signed-off-by: Johannes Berg Acked-by: Michael Buesch Signed-off-by: John W. Linville --- include/net/mac80211.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 460da54a001..5ecf3cc8d97 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -89,19 +89,19 @@ struct ieee80211_ht_bss_info { * struct ieee80211_tx_queue_params - transmit queue configuration * * The information provided in this structure is required for QoS - * transmit queue configuration. + * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29. * * @aifs: arbitration interface space [0..255, -1: use default] * @cw_min: minimum contention window [will be a value of the form * 2^n-1 in the range 1..1023; 0: use default] * @cw_max: maximum contention window [like @cw_min] - * @burst_time: maximum burst time in units of 0.1ms, 0 meaning disabled + * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled */ struct ieee80211_tx_queue_params { - int aifs; - int cw_min; - int cw_max; - int burst_time; + s16 aifs; + u16 cw_min; + u16 cw_max; + u16 txop; }; /** -- cgit v1.2.3 From d0f5afbe6de6b8c06f94a8a0b370252e3863afe7 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Tue, 12 Feb 2008 20:12:45 +0100 Subject: mac80211: Extend filter flag documentation about unsupported flags This extends the filter flags documentation to make it clear what clearing a flag really means. Signed-off-by: Michael Buesch Acked-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 5ecf3cc8d97..027d51f876e 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -793,8 +793,18 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) * parameter to see whether multicast frames should be accepted * or dropped. * - * All unsupported flags in @total_flags must be cleared, i.e. you - * should clear all bits except those you honoured. + * All unsupported flags in @total_flags must be cleared. + * Hardware does not support a flag if it is incapable of _passing_ + * the frame to the stack. Otherwise the driver must ignore + * the flag, but not clear it. + * You must _only_ clear the flag (announce no support for the + * flag to mac80211) if you are not able to pass the packet type + * to the stack (so the hardware always filters it). + * So for example, you should clear @FIF_CONTROL, if your hardware + * always filters control frames. If your hardware always passes + * control frames to the kernel and is incapable of filtering them, + * you do _not_ clear the @FIF_CONTROL flag. + * This rule applies to all other FIF flags as well. */ /** -- cgit v1.2.3 From c132bec33c2eb5e46d8e4b80cfa5a9656d8e57e7 Mon Sep 17 00:00:00 2001 From: Bruno Randolf Date: Mon, 18 Feb 2008 11:20:51 +0900 Subject: mac80211: better definition of mactime define mactime as the time when the first data symbol arrived at the HW. the old definition was questionable because 802.11 defines timestamp only for beacon and probe response frames, and there it means the timestamp field. a stricter definition of mactime is necessary for correct merging of IBSS. note that it is up to the driver to convert whatever its hardware returns to this definition. unfortunately we don't know for example when atheros hardware takes its rx timestamp exactly :( Signed-off-by: Bruno Randolf Acked-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 027d51f876e..1a1d0d8203a 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -295,7 +295,8 @@ enum mac80211_rx_flags { * The low-level driver should provide this information (the subset * supported by hardware) to the 802.11 code with each received * frame. - * @mactime: MAC timestamp as defined by 802.11 + * @mactime: value in microseconds of the 64-bit Time Synchronization Function + * (TSF) timer when the first data symbol (MPDU) arrived at the hardware. * @band: the active band when this frame was received * @freq: frequency the radio was tuned to when receiving this frame, in MHz * @ssi: signal strength when receiving this frame -- cgit v1.2.3 From 9d9bf77d16ba527f6f63846ca18cf20ae6e8d697 Mon Sep 17 00:00:00 2001 From: Bruno Randolf Date: Mon, 18 Feb 2008 11:21:36 +0900 Subject: mac80211: enable IBSS merging enable IBSS cell merging. if an IBSS beacon with the same channel, same ESSID and a TSF higher than the local TSF (mactime) is received, we have to join its BSSID. while this might not be immediately apparent from reading the 802.11 standard it is compliant and necessary to make IBSS mode functional in many cases. most drivers have a similar behaviour. * move the relevant code section (previously only containing debug code) down to the end of the function, so we can reuse the bss structure. * we have to compare the mactime (TSF at the time of packet receive) rather than the current TSF. since mactime is defined as the time the first data symbol arrived we add the time until byte 24 where the timestamp resides, since this is how the beacon timestamp is defined. as some some drivers are not able to give a reliable mactime we fall back to use the current TSF, which will be enough to catch most (but not all) cases where an IBSS merge is necessary. * in IBSS mode we want to allow beacons to override probe response info so we can correctly do merges. * we don't only configure beacons based on scan results, so change that message. * to enable this we have to let all beacons thru in IBSS mode, even if they have a different BSSID. Signed-off-by: Bruno Randolf Acked-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 1a1d0d8203a..784ab769b00 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -276,7 +276,8 @@ struct ieee80211_tx_control { * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on * the frame. * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field) - * is valid. + * is valid. This is useful in monitor mode and necessary for beacon frames + * to enable IBSS merging. */ enum mac80211_rx_flags { RX_FLAG_MMIC_ERROR = 1<<0, -- cgit v1.2.3 From ffc7689ddae5cbe12bde437ae0f2b386d568b5cd Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Wed, 20 Feb 2008 19:08:10 +0100 Subject: ssb: Add support for 8bit register access This adds support for 8bit wide register reads/writes. This is needed in order to support the gigabit ethernet core. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- include/linux/ssb/ssb.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 20add65215a..860d28c6d14 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -72,8 +72,10 @@ struct ssb_device; /* Lowlevel read/write operations on the device MMIO. * Internal, don't use that outside of ssb. */ struct ssb_bus_ops { + u8 (*read8)(struct ssb_device *dev, u16 offset); u16 (*read16)(struct ssb_device *dev, u16 offset); u32 (*read32)(struct ssb_device *dev, u16 offset); + void (*write8)(struct ssb_device *dev, u16 offset, u8 value); void (*write16)(struct ssb_device *dev, u16 offset, u16 value); void (*write32)(struct ssb_device *dev, u16 offset, u32 value); }; @@ -344,6 +346,10 @@ void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags); /* Device MMIO register read/write functions. */ +static inline u8 ssb_read8(struct ssb_device *dev, u16 offset) +{ + return dev->ops->read8(dev, offset); +} static inline u16 ssb_read16(struct ssb_device *dev, u16 offset) { return dev->ops->read16(dev, offset); @@ -352,6 +358,10 @@ static inline u32 ssb_read32(struct ssb_device *dev, u16 offset) { return dev->ops->read32(dev, offset); } +static inline void ssb_write8(struct ssb_device *dev, u16 offset, u8 value) +{ + dev->ops->write8(dev, offset, value); +} static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value) { dev->ops->write16(dev, offset, value); -- cgit v1.2.3 From d46e144b65bf053b25d134ec9f52a38e63e04bb4 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 20 Feb 2008 23:59:33 +0100 Subject: mac80211: rework TX filtered frame code This reworks the code for TX filtered frames, splitting it out to a new function to handle those cases, making the clear instruction a flag and renaming a few things to be easier to understand and less Atheros hardware specific. Finally, it also makes the comments explain more. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 784ab769b00..cd4b1c1a0d4 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -228,7 +228,8 @@ struct ieee80211_tx_control { #define IEEE80211_TXCTL_NO_ACK (1<<4) /* tell the low level not to * wait for an ack */ #define IEEE80211_TXCTL_RATE_CTRL_PROBE (1<<5) -#define IEEE80211_TXCTL_CLEAR_DST_MASK (1<<6) +#define IEEE80211_TXCTL_CLEAR_PS_FILT (1<<6) /* clear powersave filter + * for destination station */ #define IEEE80211_TXCTL_REQUEUE (1<<7) #define IEEE80211_TXCTL_FIRST_FRAGMENT (1<<8) /* this is a first fragment of * the frame */ -- cgit v1.2.3 From 28de57d1a9eb7e67badb731297197fcbef0cc19e Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Fri, 22 Feb 2008 16:14:58 +0100 Subject: ssb: Add CHIPCO IRQ access functions This patch adds functions to setup and read the CHIPCO IRQ. Signed-off-by: Aurelien Jarno Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- include/linux/ssb/ssb_driver_chipcommon.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h index 536851b946f..b548a54ff1f 100644 --- a/include/linux/ssb/ssb_driver_chipcommon.h +++ b/include/linux/ssb/ssb_driver_chipcommon.h @@ -390,6 +390,10 @@ extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc, extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, u32 ticks); +void ssb_chipco_irq_mask(struct ssb_chipcommon *cc, u32 mask, u32 value); + +u32 ssb_chipco_irq_status(struct ssb_chipcommon *cc, u32 mask); + /* Chipcommon GPIO pin access. */ u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask); u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value); -- cgit v1.2.3 From 2485f7105f20f85c2dbebc67be6b2cb97175fa7e Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Mon, 25 Feb 2008 16:27:41 +0100 Subject: mac80211: clarify use of TX status/RX callbacks This patch clarifies the use of the irqsafe vs. non-irq-safe functions and their respective locking requirements. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index cd4b1c1a0d4..7a80c398123 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -38,7 +38,11 @@ * called in hardware interrupt context. The low-level driver must not call any * other functions in hardware interrupt context. If there is a need for such * call, the low-level driver should first ACK the interrupt and perform the - * IEEE 802.11 code call after this, e.g. from a scheduled workqueue function. + * IEEE 802.11 code call after this, e.g. from a scheduled workqueue or even + * tasklet function. + * + * NOTE: If the driver opts to use the _irqsafe() functions, it may not also + * use the non-irqsafe functions! */ /** @@ -1204,7 +1208,10 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, * buffer in @skb must start with an IEEE 802.11 header or a radiotap * header if %RX_FLAG_RADIOTAP is set in the @status flags. * - * This function may not be called in IRQ context. + * This function may not be called in IRQ context. Calls to this function + * for a single hardware must be synchronized against each other. Calls + * to this function and ieee80211_rx_irqsafe() may not be mixed for a + * single hardware. * * @hw: the hardware this frame came in on * @skb: the buffer to receive, owned by mac80211 after this call @@ -1221,7 +1228,10 @@ static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, * ieee80211_rx_irqsafe - receive frame * * Like ieee80211_rx() but can be called in IRQ context - * (internally defers to a workqueue.) + * (internally defers to a tasklet.) + * + * Calls to this function and ieee80211_rx() may not be mixed for a + * single hardware. * * @hw: the hardware this frame came in on * @skb: the buffer to receive, owned by mac80211 after this call @@ -1240,6 +1250,11 @@ void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, * transmitted. It is permissible to not call this function for * multicast frames but this can affect statistics. * + * This function may not be called in IRQ context. Calls to this function + * for a single hardware must be synchronized against each other. Calls + * to this function and ieee80211_tx_status_irqsafe() may not be mixed + * for a single hardware. + * * @hw: the hardware the frame was transmitted by * @skb: the frame that was transmitted, owned by mac80211 after this call * @status: status information for this frame; the status pointer need not @@ -1249,6 +1264,22 @@ void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, struct ieee80211_tx_status *status); + +/** + * ieee80211_tx_status_irqsafe - irq-safe transmit status callback + * + * Like ieee80211_tx_status() but can be called in IRQ context + * (internally defers to a tasklet.) + * + * Calls to this function and ieee80211_tx_status() may not be mixed for a + * single hardware. + * + * @hw: the hardware the frame was transmitted by + * @skb: the frame that was transmitted, owned by mac80211 after this call + * @status: status information for this frame; the status pointer need not + * be valid after this function returns and is not freed by mac80211, + * it is recommended that it points to a stack area + */ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb, struct ieee80211_tx_status *status); -- cgit v1.2.3 From 988b705077d8f922408913f4f521ae073256d4a1 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 3 Mar 2008 12:20:57 -0800 Subject: [ARP]: Introduce the arp_hdr_len helper. There are some place, that calculate the ARP header length. These calculations are correct, but a) some operate with "magic" constants, b) enlarge the code length (sometimes at the cost of coding style), c) are not informative from the first glance. The proposal is to introduce a helper, that includes all the good sides of these calculations. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/linux/if_arp.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 296e8e86e91..4d3401812e6 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h @@ -156,6 +156,12 @@ static inline struct arphdr *arp_hdr(const struct sk_buff *skb) { return (struct arphdr *)skb_network_header(skb); } + +static inline int arp_hdr_len(struct net_device *dev) +{ + /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ + return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2; +} #endif #endif /* _LINUX_IF_ARP_H */ -- cgit v1.2.3 From c6aefafb7ec620911d46174eed514f9df639e5a4 Mon Sep 17 00:00:00 2001 From: Glenn Griffin Date: Thu, 7 Feb 2008 21:49:26 -0800 Subject: [TCP]: Add IPv6 support to TCP SYN cookies Updated to incorporate Eric's suggestion of using a per cpu buffer rather than allocating on the stack. Just a two line change, but will resend in it's entirety. Signed-off-by: Glenn Griffin Signed-off-by: YOSHIFUJI Hideaki --- include/net/tcp.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/net/tcp.h b/include/net/tcp.h index ae9774b478f..11119e33acf 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -434,11 +435,17 @@ extern int tcp_disconnect(struct sock *sk, int flags); extern void tcp_unhash(struct sock *sk); /* From syncookies.c */ +extern __u32 syncookie_secret[2][16-3+SHA_DIGEST_WORDS]; extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, struct ip_options *opt); extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mss); +/* From net/ipv6/syncookies.c */ +extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); +extern __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, + __u16 *mss); + /* tcp_output.c */ extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, @@ -1332,6 +1339,7 @@ extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo); extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo); extern struct request_sock_ops tcp_request_sock_ops; +extern struct request_sock_ops tcp6_request_sock_ops; extern int tcp_v4_destroy_sock(struct sock *sk); -- cgit v1.2.3 From e898d4db2749c6052072e9bc4448e396cbdeb06a Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Sat, 1 Mar 2008 01:06:47 +0900 Subject: [UDP]: Allow users to configure UDP-Lite. Let's give users an option for disabling UDP-Lite (~4K). old: | text data bss dec hex filename | 286498 12432 6072 305002 4a76a net/ipv4/built-in.o | 193830 8192 3204 205226 321aa net/ipv6/ipv6.o new (without UDP-Lite): | text data bss dec hex filename | 284086 12136 5432 301654 49a56 net/ipv4/built-in.o | 191835 7832 3076 202743 317f7 net/ipv6/ipv6.o Signed-off-by: YOSHIFUJI Hideaki --- include/linux/udp.h | 11 +++++++++++ include/net/ipv6.h | 5 +++++ include/net/transp_v6.h | 5 +++++ include/net/udplite.h | 9 +++++++-- 4 files changed, 28 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/udp.h b/include/linux/udp.h index 8ec703f462d..4144664d69d 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h @@ -70,8 +70,10 @@ struct udp_sock { #define UDPLITE_BIT 0x1 /* set by udplite proto init function */ #define UDPLITE_SEND_CC 0x2 /* set via udplite setsockopt */ #define UDPLITE_RECV_CC 0x4 /* set via udplite setsocktopt */ +#ifdef CONFIG_IP_UDPLITE __u8 pcflag; /* marks socket as UDP-Lite if > 0 */ __u8 unused[3]; +#endif /* * For encapsulation sockets. */ @@ -82,7 +84,16 @@ static inline struct udp_sock *udp_sk(const struct sock *sk) { return (struct udp_sock *)sk; } + +#ifdef CONFIG_IP_UDPLITE #define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag) +#define IS_PROTO_UDPLITE(__proto) ((__proto) == IPPROTO_UDPLITE) +#define IS_SOL_UDPFAMILY(level) ((level) == SOL_UDP || (level) == SOL_UDPLITE) +#else +#define IS_UDPLITE(__sk) 0 +#define IS_PROTO_UDPLITE(__proto) 0 +#define IS_SOL_UDPFAMILY(level) ((level) == SOL_UDP) +#endif #endif diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 8b05c65415c..96b1763bfca 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -603,8 +603,13 @@ extern int tcp6_proc_init(void); extern void tcp6_proc_exit(void); extern int udp6_proc_init(void); extern void udp6_proc_exit(void); +#ifdef CONFIG_IP_UDPLITE extern int udplite6_proc_init(void); extern void udplite6_proc_exit(void); +#else +static inline int udplite6_proc_init(void) { return 0; } +static inline void udplite6_proc_exit(void) { } +#endif extern int ipv6_misc_proc_init(void); extern void ipv6_misc_proc_exit(void); extern int snmp6_register_dev(struct inet6_dev *idev); diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 27394e0447d..902e6c6bc79 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h @@ -27,8 +27,13 @@ extern int rawv6_init(void); extern void rawv6_exit(void); extern int udpv6_init(void); extern void udpv6_exit(void); +#ifdef CONFIG_IP_UDPLITE extern int udplitev6_init(void); extern void udplitev6_exit(void); +#else +static inline int udplitev6_init(void) { return 0; } +static inline void udplitev6_exit(void) { } +#endif extern int tcpv6_init(void); extern void tcpv6_exit(void); diff --git a/include/net/udplite.h b/include/net/udplite.h index b76b2e377af..01ddb2c2026 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h @@ -25,7 +25,9 @@ static __inline__ int udplite_getfrag(void *from, char *to, int offset, /* Designate sk as UDP-Lite socket */ static inline int udplite_sk_init(struct sock *sk) { +#ifdef CONFIG_IP_UDPLITE udp_sk(sk)->pcflag = UDPLITE_BIT; +#endif return 0; } @@ -69,7 +71,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) { int cscov = up->len; - +#ifdef CONFIG_IP_UDPLITE /* * Sender has set `partial coverage' option on UDP-Lite socket */ @@ -93,13 +95,15 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) * illegal, we fall back to the defaults here. */ } +#endif return cscov; } static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) { - int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb)); __wsum csum = 0; +#ifdef CONFIG_IP_UDPLITE + int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb)); skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ @@ -112,6 +116,7 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) if ((cscov -= len) <= 0) break; } +#endif return csum; } -- cgit v1.2.3 From 662397fd7aaa10afdbdc55a0bfdb7e9701454c27 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Wed, 27 Feb 2008 23:14:03 +0900 Subject: [IPV6]: Move packet_type{} related bits to af_inet6.c. Signed-off-by: YOSHIFUJI Hideaki --- include/net/ipv6.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 96b1763bfca..5dc8164e5d3 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -555,10 +555,6 @@ extern int compat_ipv6_getsockopt(struct sock *sk, char __user *optval, int __user *optlen); -extern int ipv6_packet_init(void); - -extern void ipv6_packet_cleanup(void); - extern int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len); -- cgit v1.2.3 From 0e7b8dcd16eb91b9cd8ecc07c4094512f20d7e3c Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 28 Feb 2008 17:03:12 +0900 Subject: [IPV6]: Use htonl() instead of __constant_htonl() where appricable. Signed-off-by: YOSHIFUJI Hideaki --- include/net/addrconf.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 496503c0384..a9ff97c120c 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -214,29 +214,25 @@ static inline void addrconf_addr_solict_mult(const struct in6_addr *addr, struct in6_addr *solicited) { ipv6_addr_set(solicited, - __constant_htonl(0xFF020000), 0, - __constant_htonl(0x1), - __constant_htonl(0xFF000000) | addr->s6_addr32[3]); + htonl(0xFF020000), 0, + htonl(0x1), + htonl(0xFF000000) | addr->s6_addr32[3]); } static inline void ipv6_addr_all_nodes(struct in6_addr *addr) { - ipv6_addr_set(addr, - __constant_htonl(0xFF020000), 0, 0, - __constant_htonl(0x1)); + ipv6_addr_set(addr, htonl(0xFF020000), 0, 0, htonl(0x1)); } static inline void ipv6_addr_all_routers(struct in6_addr *addr) { - ipv6_addr_set(addr, - __constant_htonl(0xFF020000), 0, 0, - __constant_htonl(0x2)); + ipv6_addr_set(addr, htonl(0xFF020000), 0, 0, htonl(0x2)); } static inline int ipv6_addr_is_multicast(const struct in6_addr *addr) { - return (addr->s6_addr32[0] & __constant_htonl(0xFF000000)) == __constant_htonl(0xFF000000); + return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000); } static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) -- cgit v1.2.3 From 8082c37cdc31fb0ed178d9d706bf7568ada0edd9 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Tue, 4 Mar 2008 14:55:03 +0900 Subject: [NET] NEIGHBOUR: Remove unpopular neigh_is_connected(). neigh_is_connected() is not popular at all, and the only user drivers/net/cxgb3/l2t.c:t3_l2t_update() also have raw (expanded) expression. Let's expand it and remove the inline function. Signed-off-by: YOSHIFUJI Hideaki --- include/net/neighbour.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'include') diff --git a/include/net/neighbour.h b/include/net/neighbour.h index ebbfb509822..06228187206 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -284,12 +284,6 @@ static inline void neigh_confirm(struct neighbour *neigh) neigh->confirmed = jiffies; } -static inline int neigh_is_connected(struct neighbour *neigh) -{ - return neigh->nud_state&NUD_CONNECTED; -} - - static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) { neigh->used = jiffies; -- cgit v1.2.3 From 5e5f3f0f801321078c897a5de0b4b4304f234da0 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Mon, 3 Mar 2008 21:44:34 +0900 Subject: [IPV6] ADDRCONF: Convert ipv6_get_saddr() to ipv6_dev_get_saddr(). Since most users of ipv6_get_saddr() pass non-NULL as dst argument, use ipv6_dev_get_saddr() directly. Signed-off-by: YOSHIFUJI Hideaki --- include/net/addrconf.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/net/addrconf.h b/include/net/addrconf.h index a9ff97c120c..89e3c53c888 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -73,9 +73,6 @@ extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, struct net_device *dev, int strict); -extern int ipv6_get_saddr(struct dst_entry *dst, - struct in6_addr *daddr, - struct in6_addr *saddr); extern int ipv6_dev_get_saddr(struct net_device *dev, struct in6_addr *daddr, struct in6_addr *saddr); -- cgit v1.2.3 From 95e41e93e18d8e1e272ce23d96bae4f17ce11d42 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 6 Dec 2007 15:43:30 -0800 Subject: [IPV6]: Make ndisc_flow_init() common for later use. For later use, this patch is renaming ndisc_flow_init() to icmpv6_flow_init() and putting it in common place. Signed-off-by: YOSHIFUJI Hideaki --- include/linux/icmpv6.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index 8f86d6b621c..e4d4300d768 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h @@ -182,6 +182,14 @@ extern int icmpv6_err_convert(int type, int code, extern void icmpv6_cleanup(void); extern void icmpv6_param_prob(struct sk_buff *skb, int code, int pos); + +struct flowi; +extern void icmpv6_flow_init(struct sock *sk, + struct flowi *fl, + u8 type, + const struct in6_addr *saddr, + const struct in6_addr *daddr, + int oif); #endif #endif -- cgit v1.2.3 From 3b00944c5c73c49ef52bf17b66557c43c1d945fe Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 6 Dec 2007 16:11:48 -0800 Subject: [IPV6]: Make ndisc_dst_alloc() common for later use. For later use, this patch is renaming ndisc_dst_alloc() (and related function/structures) to icmp6_dst_alloc() (and so on). This patch also removing unused function- pointer argument for it. Signed-off-by: YOSHIFUJI Hideaki --- include/net/ip6_route.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index f99e4f0f568..8d155a645ab 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -73,11 +73,11 @@ extern struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr, int oif, int flags); -extern struct dst_entry *ndisc_dst_alloc(struct net_device *dev, +extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct neighbour *neigh, - struct in6_addr *addr, - int (*output)(struct sk_buff *)); -extern int ndisc_dst_gc(int *more); + struct in6_addr *addr); +extern int icmp6_dst_gc(int *more); + extern void fib6_force_start_gc(void); extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, -- cgit v1.2.3 From 58f09b78b730cf0d936597272bf35b3d615e967c Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Mon, 3 Mar 2008 23:25:27 -0800 Subject: [NETNS][IPV6] ip6_fib - make it per network namespace The fib table for ipv6 are moved to the network namespace structure. All references to them are made relatively to the network namespace. All external calls to the ip6_fib functions taking the network namespace parameter are made using the init_net variable, so the ip6_fib engine is ready for the namespaces but the callers not yet. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/ip6_fib.h | 9 +++++---- include/net/netns/ipv6.h | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 953d6040ff5..4d4c8aca8fb 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -181,10 +181,11 @@ typedef struct rt6_info *(*pol_lookup_t)(struct fib6_table *, * exported functions */ -extern struct fib6_table * fib6_get_table(u32 id); -extern struct fib6_table * fib6_new_table(u32 id); -extern struct dst_entry * fib6_rule_lookup(struct flowi *fl, int flags, - pol_lookup_t lookup); +extern struct fib6_table *fib6_get_table(struct net *net, u32 id); +extern struct fib6_table *fib6_new_table(struct net *net, u32 id); +extern struct dst_entry *fib6_rule_lookup(struct net *net, + struct flowi *fl, int flags, + pol_lookup_t lookup); extern struct fib6_node *fib6_lookup(struct fib6_node *root, struct in6_addr *daddr, diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 82623d3a8e3..b0653261c5a 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -35,6 +35,11 @@ struct netns_ipv6 { struct xt_table *ip6table_filter; struct xt_table *ip6table_mangle; struct xt_table *ip6table_raw; +#endif + struct hlist_head *fib_table_hash; + struct fib6_table *fib6_main_tbl; +#ifdef CONFIG_IPV6_MULTIPLE_TABLES + struct fib6_table *fib6_local_tbl; #endif struct sock **icmp_sk; }; -- cgit v1.2.3 From f3db48517f59133610f558f29de8834d7b007691 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Mon, 3 Mar 2008 23:27:06 -0800 Subject: [NETNS][IPV6] ip6_fib - fib6_clean_all handle several network namespaces The function fib6_clean_all takes the network namespace as parameter. That allows to flush the routes related to a specific network namespace. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/ip6_fib.h | 3 ++- include/net/ip6_route.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 4d4c8aca8fb..e54075d902d 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -195,7 +195,8 @@ struct fib6_node *fib6_locate(struct fib6_node *root, struct in6_addr *daddr, int dst_len, struct in6_addr *saddr, int src_len); -extern void fib6_clean_all(int (*func)(struct rt6_info *, void *arg), +extern void fib6_clean_all(struct net *net, + int (*func)(struct rt6_info *, void *arg), int prune, void *arg); extern int fib6_add(struct fib6_node *root, diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 8d155a645ab..a158abe7193 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -121,7 +121,7 @@ struct rt6_rtnl_dump_arg }; extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); -extern void rt6_ifdown(struct net_device *dev); +extern void rt6_ifdown(struct net *net, struct net_device *dev); extern void rt6_mtu_change(struct net_device *dev, unsigned mtu); extern rwlock_t rt6_lock; -- cgit v1.2.3 From 5b7c931dff03621ae7ac524c4fa280d4e5f187a4 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Mon, 3 Mar 2008 23:28:58 -0800 Subject: [NETNS][IPV6] ip6_fib - add net to gc timer parameter The fib tables are now relative to the network namespace. When the garbage collector timer expires, we must have a network namespace parameter in order to retrieve the tables. For now this is the init_net, but we should be able to have a timer per namespace and use the timer callback parameter to pass the network namespace from the expired timer. The timer callback, fib6_run_gc, is actually used to be called synchronously by some functions and asynchronously when the timer expires. When the timer expires, the delay specified for fib6_run_gc parameter is always zero. So, I changed fib6_run_gc to not be a timer callback but a function called by the timer callback and I added a timer callback where its work is just to retrieve from the data arg of the timer the network namespace and call fib6_run_gc with zero expiring time and the network namespace parameters. That makes the code cleaner for the fib6_run_gc callers. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/ip6_fib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index e54075d902d..fae267f6534 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -209,7 +209,8 @@ extern int fib6_del(struct rt6_info *rt, extern void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info); -extern void fib6_run_gc(unsigned long dummy); +extern void fib6_run_gc(unsigned long expires, + struct net *net); extern void fib6_gc_cleanup(void); -- cgit v1.2.3 From 63152fc0de4dfe83da543bf133cef73d885a50fc Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Mon, 3 Mar 2008 23:31:11 -0800 Subject: [NETNS][IPV6] ip6_fib - gc timer per namespace Move the timer initialization at the network namespace creation and store the network namespace in the timer argument. That enables multiple timers (one per network namespace) to do garbage collecting. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/ip6_route.h | 2 +- include/net/netns/ipv6.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index a158abe7193..79dce496f4d 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -78,7 +78,7 @@ extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct in6_addr *addr); extern int icmp6_dst_gc(int *more); -extern void fib6_force_start_gc(void); +extern void fib6_force_start_gc(struct net *net); extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, const struct in6_addr *addr, diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index b0653261c5a..5279cd6a00b 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -36,6 +36,7 @@ struct netns_ipv6 { struct xt_table *ip6table_mangle; struct xt_table *ip6table_raw; #endif + struct timer_list *ip6_fib_timer; struct hlist_head *fib_table_hash; struct fib6_table *fib6_main_tbl; #ifdef CONFIG_IPV6_MULTIPLE_TABLES -- cgit v1.2.3 From dcabb819a6eced95ef531b001e663d0d592c8d9f Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Mon, 3 Mar 2008 23:33:08 -0800 Subject: [NETNS][IPV6] fib6_rules - handle several network namespaces The fib6_rules_ops is moved to the network namespace structure. All references are changed to have it relatively to it. Each time a network namespace is created a new fib6_rules_ops is allocated, initialized and stored into the network namespace structure. The common part of the fib rules is namespace aware, so it is quite easy to retrieve the network namespace from the rules and use it in the different callbacks. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/netns/ipv6.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 5279cd6a00b..66bf9c0f745 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -41,6 +41,7 @@ struct netns_ipv6 { struct fib6_table *fib6_main_tbl; #ifdef CONFIG_IPV6_MULTIPLE_TABLES struct fib6_table *fib6_local_tbl; + struct fib_rules_ops *fib6_rules_ops; #endif struct sock **icmp_sk; }; -- cgit v1.2.3 From 6cc118bd506ae8c6436f507b838a0e1f6185fec2 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Mon, 3 Mar 2008 23:33:43 -0800 Subject: [NETNS][IPV6] rt6_stats - dynamically allocate the routes statistics This patch allocates the rt6_stats struct dynamically when the fib6 is initialized. That provides the ability to create several instances of this structure for the network namespaces. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/ipv6.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 5dc8164e5d3..9a00f35ae77 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -611,7 +611,7 @@ extern void ipv6_misc_proc_exit(void); extern int snmp6_register_dev(struct inet6_dev *idev); extern int snmp6_unregister_dev(struct inet6_dev *idev); -extern struct rt6_statistics rt6_stats; +extern struct rt6_statistics *rt6_stats; #else static inline int snmp6_register_dev(struct inet6_dev *idev) { -- cgit v1.2.3 From c572872f89e46e38cdb35a43b81122bfb7ff43fc Mon Sep 17 00:00:00 2001 From: Benjamin Thery Date: Mon, 3 Mar 2008 23:34:17 -0800 Subject: [NETNS][IPV6] rt6_stats - make the stats per network namespace The rt6_stats is now per namespace with this patch. It is allocated when a network namespace is created and freed when the network namespace exits and references are relative to the network namespace. Signed-off-by: Benjamin Thery Signed-off-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/ipv6.h | 1 - include/net/netns/ipv6.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 9a00f35ae77..5f6df50a33a 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -611,7 +611,6 @@ extern void ipv6_misc_proc_exit(void); extern int snmp6_register_dev(struct inet6_dev *idev); extern int snmp6_unregister_dev(struct inet6_dev *idev); -extern struct rt6_statistics *rt6_stats; #else static inline int snmp6_register_dev(struct inet6_dev *idev) { diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 66bf9c0f745..c6c9afff13e 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -36,6 +36,7 @@ struct netns_ipv6 { struct xt_table *ip6table_mangle; struct xt_table *ip6table_raw; #endif + struct rt6_statistics *rt6_stats; struct timer_list *ip6_fib_timer; struct hlist_head *fib_table_hash; struct fib6_table *fib6_main_tbl; -- cgit v1.2.3 From 606a2b4862d4be31fa55cad89871fe52a422d511 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 4 Mar 2008 13:45:59 -0800 Subject: [NETNS][IPV6] route6 - Pass the network namespace parameter to rt6_lookup Add a network namespace parameter to rt6_lookup(). Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/ip6_route.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 79dce496f4d..92004c5160c 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -69,7 +69,8 @@ extern void rt6_sndmsg(int type, struct in6_addr *dst, int dstlen, int srclen, int metric, __u32 flags); -extern struct rt6_info *rt6_lookup(struct in6_addr *daddr, +extern struct rt6_info *rt6_lookup(struct net *net, + struct in6_addr *daddr, struct in6_addr *saddr, int oif, int flags); -- cgit v1.2.3 From 7b4da53229bb61469bdab321384b9a13406e3485 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 4 Mar 2008 13:47:14 -0800 Subject: [NETNS][IPV6] route6 - Pass the network namespace parameter to rt6_purge_dflt_routers Add a network namespace parameter to rt6_purge_dflt_routers. This is needed to call fib6_get_table with the appropriate network namespace. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/ip6_route.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 92004c5160c..1444d358836 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -95,7 +95,7 @@ extern struct rt6_info * rt6_add_dflt_router(struct in6_addr *gwaddr, struct net_device *dev, unsigned int pref); -extern void rt6_purge_dflt_routers(void); +extern void rt6_purge_dflt_routers(struct net *net); extern int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, -- cgit v1.2.3 From 5578689a4e3c04f2d43ea39736fd3fa396d80c6e Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 4 Mar 2008 13:47:47 -0800 Subject: [NETNS][IPV6] route6 - make route6 per namespace This patch makes the routing engine use the network namespaces to access routing informations: Add a network namespace parameter to ipv6_route_ioctl and propagate the network namespace value to all the routing code that have not yet been changed. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/ip6_route.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 1444d358836..2bcbfb82653 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -49,7 +49,9 @@ extern struct dst_entry * ip6_route_output(struct sock *sk, extern int ip6_route_init(void); extern void ip6_route_cleanup(void); -extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); +extern int ipv6_route_ioctl(struct net *net, + unsigned int cmd, + void __user *arg); extern int ip6_route_add(struct fib6_config *cfg); extern int ip6_ins_rt(struct rt6_info *); -- cgit v1.2.3 From bdb3289f739e94bcae8b51972ae844ec66c2f4df Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 4 Mar 2008 13:48:10 -0800 Subject: [NETNS][IPV6] rt6_info - make rt6_info accessed as a pointer This patch make mindless changes and prepares the code to use dynamic allocation for rt6_info structure. The code accesses the rt6_info structure as a pointer instead of a global static variable. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/ip6_route.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 2bcbfb82653..e0caed25bfb 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -34,11 +34,11 @@ struct route_info { #define RT6_LOOKUP_F_REACHABLE 0x2 #define RT6_LOOKUP_F_HAS_SADDR 0x4 -extern struct rt6_info ip6_null_entry; +extern struct rt6_info *ip6_null_entry; #ifdef CONFIG_IPV6_MULTIPLE_TABLES -extern struct rt6_info ip6_prohibit_entry; -extern struct rt6_info ip6_blk_hole_entry; +extern struct rt6_info *ip6_prohibit_entry; +extern struct rt6_info *ip6_blk_hole_entry; #endif extern void ip6_route_input(struct sk_buff *skb); -- cgit v1.2.3 From 8ed677896752fff056f6cf3d7ce462adc6c464f0 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Tue, 4 Mar 2008 13:48:30 -0800 Subject: [NETNS][IPV6] rt6_info - move rt6_info structure inside the namespace The rt6_info structures are moved inside the network namespace structure. All references to these structures are now relative to the initial network namespace. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/ip6_fib.h | 3 ++- include/net/netns/ipv6.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index fae267f6534..7c5c0f79168 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -174,7 +174,8 @@ struct fib6_table { #define RT6_TABLE_LOCAL RT6_TABLE_MAIN #endif -typedef struct rt6_info *(*pol_lookup_t)(struct fib6_table *, +typedef struct rt6_info *(*pol_lookup_t)(struct net *, + struct fib6_table *, struct flowi *, int); /* diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index c6c9afff13e..311a942f36e 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -36,11 +36,14 @@ struct netns_ipv6 { struct xt_table *ip6table_mangle; struct xt_table *ip6table_raw; #endif + struct rt6_info *ip6_null_entry; struct rt6_statistics *rt6_stats; struct timer_list *ip6_fib_timer; struct hlist_head *fib_table_hash; struct fib6_table *fib6_main_tbl; #ifdef CONFIG_IPV6_MULTIPLE_TABLES + struct rt6_info *ip6_prohibit_entry; + struct rt6_info *ip6_blk_hole_entry; struct fib6_table *fib6_local_tbl; struct fib_rules_ops *fib6_rules_ops; #endif -- cgit v1.2.3 From f2fc6a54585a1be6669613a31fbaba2ecbadcd36 Mon Sep 17 00:00:00 2001 From: Benjamin Thery Date: Tue, 4 Mar 2008 13:49:23 -0800 Subject: [NETNS][IPV6] route6 - move ip6_dst_ops inside the network namespace The ip6_dst_ops is moved inside the network namespace structure. All references to this structure are now relative to the initial network namespace. Signed-off-by: Benjamin Thery Signed-off-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/netns/ipv6.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 311a942f36e..53b5a283a4b 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -41,6 +41,7 @@ struct netns_ipv6 { struct timer_list *ip6_fib_timer; struct hlist_head *fib_table_hash; struct fib6_table *fib6_main_tbl; + struct dst_ops *ip6_dst_ops; #ifdef CONFIG_IPV6_MULTIPLE_TABLES struct rt6_info *ip6_prohibit_entry; struct rt6_info *ip6_blk_hole_entry; -- cgit v1.2.3 From 6891a346c387bd0a64afa50f4522f5fe8ba879d8 Mon Sep 17 00:00:00 2001 From: Benjamin Thery Date: Tue, 4 Mar 2008 13:49:47 -0800 Subject: [NETNS][IPV6] route6 - make garbage collection work with multiple network namespaces This patch makes the necessary changes to make IPv6 dst_entry garbage collection work with multiple network namespaces. In ip6_dst_gc(), static local variables are now declared per-namespace. Signed-off-by: Benjamin Thery Signed-off-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/netns/ipv6.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 53b5a283a4b..90e6e24df85 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -42,6 +42,8 @@ struct netns_ipv6 { struct hlist_head *fib_table_hash; struct fib6_table *fib6_main_tbl; struct dst_ops *ip6_dst_ops; + unsigned int ip6_rt_gc_expire; + unsigned long ip6_rt_last_gc; #ifdef CONFIG_IPV6_MULTIPLE_TABLES struct rt6_info *ip6_prohibit_entry; struct rt6_info *ip6_blk_hole_entry; -- cgit v1.2.3 From af2849377e7b70afa1274e475be50286cd0ef6eb Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Wed, 5 Mar 2008 10:46:57 -0800 Subject: [NETNS][IPV6] addrconf - Pass the proper network namespace parameters to addrconf This patch propagates the network namespace pointer to the address configuration routines which need it, which means adding a new parameter to these functions, and make them use it instead of using the initial network namespace. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/addrconf.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 89e3c53c888..232da20e717 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -55,9 +55,12 @@ struct prefix_info { extern int addrconf_init(void); extern void addrconf_cleanup(void); -extern int addrconf_add_ifaddr(void __user *arg); -extern int addrconf_del_ifaddr(void __user *arg); -extern int addrconf_set_dstaddr(void __user *arg); +extern int addrconf_add_ifaddr(struct net *net, + void __user *arg); +extern int addrconf_del_ifaddr(struct net *net, + void __user *arg); +extern int addrconf_set_dstaddr(struct net *net, + void __user *arg); extern int ipv6_chk_addr(struct net *net, struct in6_addr *addr, -- cgit v1.2.3 From 4591db4f37618f37a9f1f25d291c3c7a43a15a21 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Wed, 5 Mar 2008 10:48:10 -0800 Subject: [NETNS][IPV6] route6 - add netns parameter to ip6_route_output Add an netns parameter to ip6_route_output. That will allow to access to the right routing table for outgoing traffic. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/ip6_route.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index e0caed25bfb..0e2895c8b27 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -43,7 +43,8 @@ extern struct rt6_info *ip6_blk_hole_entry; extern void ip6_route_input(struct sk_buff *skb); -extern struct dst_entry * ip6_route_output(struct sock *sk, +extern struct dst_entry * ip6_route_output(struct net *net, + struct sock *sk, struct flowi *fl); extern int ip6_route_init(void); -- cgit v1.2.3 From ee6b967301b4aa5d4a4b61e2f682f086266db9fb Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 5 Mar 2008 18:30:47 -0800 Subject: [IPV4]: Add 'rtable' field in struct sk_buff to alias 'dst' and avoid casts (Anonymous) unions can help us to avoid ugly casts. A common cast it the (struct rtable *)skb->dst one. Defining an union like : union { struct dst_entry *dst; struct rtable *rtable; }; permits to use skb->rtable in place. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller --- include/linux/skbuff.h | 5 ++++- include/net/inet_sock.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bbd8d0027e2..7beb239d2ee 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -256,7 +256,10 @@ struct sk_buff { ktime_t tstamp; struct net_device *dev; - struct dst_entry *dst; + union { + struct dst_entry *dst; + struct rtable *rtable; + }; struct sec_path *sp; /* diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 89cd011edb9..8660cb0fa0d 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -195,7 +195,7 @@ static inline int inet_sk_ehashfn(const struct sock *sk) static inline int inet_iif(const struct sk_buff *skb) { - return ((struct rtable *)skb->dst)->rt_iif; + return skb->rtable->rt_iif; } #endif /* _INET_SOCK_H */ -- cgit v1.2.3 From f59d43899e279c77924a7ada4bec8c70e5aeca06 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Wed, 5 Mar 2008 20:58:10 -0800 Subject: [IPV6]: Fix powerpc allmodconfig build warnings. Introduced by changeset 95e41e93e18d8e1e272ce23d96bae4f17ce11d42 ("[IPV6]: Make ndisc_flow_init() common for later use.") Reported by Stephen Rothwell. In file included from net/ipv6/netfilter/ip6_tables.c:21: include/linux/icmpv6.h:192: warning: 'struct in6_addr' declared inside parameter list include/linux/icmpv6.h:192: warning: its scope is only this definition or declaration, which is probably not what you want Signed-off-by: David S. Miller --- include/linux/icmpv6.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index e4d4300d768..03067443198 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h @@ -184,6 +184,7 @@ extern void icmpv6_param_prob(struct sk_buff *skb, int code, int pos); struct flowi; +struct in6_addr; extern void icmpv6_flow_init(struct sock *sk, struct flowi *fl, u8 type, -- cgit v1.2.3 From 37c5798968d0ce4d479f114f1d5785551b57bfa5 Mon Sep 17 00:00:00 2001 From: Luis Carlos Cobo Date: Sat, 23 Feb 2008 15:17:04 +0100 Subject: wireless: various definitions for mesh networking Signed-off-by: Luis Carlos Cobo Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/linux/ieee80211.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'include') diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index f577c8f1c66..f27d11ab418 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -97,6 +97,7 @@ #define IEEE80211_MAX_FRAME_LEN 2352 #define IEEE80211_MAX_SSID_LEN 32 +#define IEEE80211_MAX_MESH_ID_LEN 32 struct ieee80211_hdr { __le16 frame_control; @@ -109,6 +110,16 @@ struct ieee80211_hdr { } __attribute__ ((packed)); +struct ieee80211s_hdr { + u8 flags; + u8 ttl; + u8 seqnum[3]; + u8 eaddr1[6]; + u8 eaddr2[6]; + u8 eaddr3[6]; +} __attribute__ ((packed)); + + struct ieee80211_mgmt { __le16 frame_control; __le16 duration; @@ -206,6 +217,23 @@ struct ieee80211_mgmt { __le16 params; __le16 reason_code; } __attribute__((packed)) delba; + struct{ + u8 action_code; + /* capab_info for open and confirm, + * reason for close + */ + __le16 aux; + /* Followed in plink_confirm by status + * code, AID and supported rates, + * and directly by supported rates in + * plink_open and plink_close + */ + u8 variable[0]; + } __attribute__((packed)) plink_action; + struct{ + u8 action_code; + u8 variable[0]; + } __attribute__((packed)) mesh_action; } u; } __attribute__ ((packed)) action; } u; @@ -437,6 +465,13 @@ enum ieee80211_eid { WLAN_EID_TS_DELAY = 43, WLAN_EID_TCLAS_PROCESSING = 44, WLAN_EID_QOS_CAPA = 46, + /* 802.11s */ + WLAN_EID_MESH_CONFIG = 36, /* Pending IEEE 802.11 ANA approval */ + WLAN_EID_MESH_ID = 37, /* Pending IEEE 802.11 ANA approval */ + WLAN_EID_PEER_LINK = 40, /* Pending IEEE 802.11 ANA approval */ + WLAN_EID_PREQ = 53, /* Pending IEEE 802.11 ANA approval */ + WLAN_EID_PREP = 54, /* Pending IEEE 802.11 ANA approval */ + WLAN_EID_PERR = 55, /* Pending IEEE 802.11 ANA approval */ /* 802.11h */ WLAN_EID_PWR_CONSTRAINT = 32, WLAN_EID_PWR_CAPABILITY = 33, -- cgit v1.2.3 From cc0672a1066829be7e1b0128a13e36a2d0a15479 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Sat, 23 Feb 2008 15:17:05 +0100 Subject: WEXT: add mesh interface type This introduces a new WEXT type IW_MODE_MESH for mesh networks, used for scan results. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/linux/wireless.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 3160dfed73c..2864b1699ec 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h @@ -455,6 +455,7 @@ #define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ #define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ #define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ +#define IW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */ /* Statistics flags (bitmask in updated) */ #define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */ -- cgit v1.2.3 From 2ec600d672e74488f8d1acf67a0a2baed222564c Mon Sep 17 00:00:00 2001 From: Luis Carlos Cobo Date: Sat, 23 Feb 2008 15:17:06 +0100 Subject: nl80211/cfg80211: support for mesh, sta dumping Added support for mesh id and mesh path operation as well as station structure dumping. Signed-off-by: Luis Carlos Cobo Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/linux/nl80211.h | 119 ++++++++++++++++++++++++++++++++++------- include/net/cfg80211.h | 139 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 223 insertions(+), 35 deletions(-) (limited to 'include') diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index a9f0b93324a..ea6517e58b0 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h @@ -78,6 +78,18 @@ * or, if no MAC address given, all stations, on the interface identified * by %NL80211_ATTR_IFINDEX. * + * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to + * destination %NL80211_ATTR_MAC on the interface identified by + * %NL80211_ATTR_IFINDEX. + * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to + * destination %NL80211_ATTR_MAC on the interface identified by + * %NL80211_ATTR_IFINDEX. + * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the + * the interface identified by %NL80211_ATTR_IFINDEX. + * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC + * or, if no MAC address given, all mesh paths, on the interface identified + * by %NL80211_ATTR_IFINDEX. + * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ @@ -112,6 +124,11 @@ enum nl80211_commands { /* add commands here */ + NL80211_CMD_GET_MPATH, + NL80211_CMD_SET_MPATH, + NL80211_CMD_NEW_MPATH, + NL80211_CMD_DEL_MPATH, + /* used to define NL80211_CMD_MAX below */ __NL80211_CMD_AFTER_LAST, NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 @@ -157,13 +174,21 @@ enum nl80211_commands { * restriction (at most %NL80211_MAX_SUPP_RATES). * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station * to, or the AP interface the station was originally added to to. - * @NL80211_ATTR_STA_STATS: statistics for a station, part of station info + * @NL80211_ATTR_STA_INFO: information about a station, part of station info * given for %NL80211_CMD_GET_STATION, nested attribute containing - * info as possible, see &enum nl80211_sta_stats. + * info as possible, see &enum nl80211_sta_info. * * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands, * consisting of a nested array. * + * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). + * @NL80211_ATTR_PLINK_ACTION: action to perform on the mesh peer link. + * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. + * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path + * info given for %NL80211_CMD_GET_MPATH, nested attribute described at + * &enum nl80211_mpath_info. + * + * * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of * &enum nl80211_mntr_flags. * @@ -199,7 +224,7 @@ enum nl80211_attrs { NL80211_ATTR_STA_LISTEN_INTERVAL, NL80211_ATTR_STA_SUPPORTED_RATES, NL80211_ATTR_STA_VLAN, - NL80211_ATTR_STA_STATS, + NL80211_ATTR_STA_INFO, NL80211_ATTR_WIPHY_BANDS, @@ -207,6 +232,11 @@ enum nl80211_attrs { /* add attributes here, update the policy in nl80211.c */ + NL80211_ATTR_MESH_ID, + NL80211_ATTR_STA_PLINK_ACTION, + NL80211_ATTR_MPATH_NEXT_HOP, + NL80211_ATTR_MPATH_INFO, + __NL80211_ATTR_AFTER_LAST, NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 }; @@ -223,6 +253,7 @@ enum nl80211_attrs { * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points * @NL80211_IFTYPE_WDS: wireless distribution interface * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames + * @NL80211_IFTYPE_MESH_POINT: mesh point * @NL80211_IFTYPE_MAX: highest interface type number currently defined * @__NL80211_IFTYPE_AFTER_LAST: internal use * @@ -238,6 +269,7 @@ enum nl80211_iftype { NL80211_IFTYPE_AP_VLAN, NL80211_IFTYPE_WDS, NL80211_IFTYPE_MONITOR, + NL80211_IFTYPE_MESH_POINT, /* keep last */ __NL80211_IFTYPE_AFTER_LAST, @@ -267,27 +299,78 @@ enum nl80211_sta_flags { }; /** - * enum nl80211_sta_stats - station statistics + * enum nl80211_sta_info - station information * - * These attribute types are used with %NL80211_ATTR_STA_STATS + * These attribute types are used with %NL80211_ATTR_STA_INFO * when getting information about a station. * - * @__NL80211_STA_STAT_INVALID: attribute number 0 is reserved - * @NL80211_STA_STAT_INACTIVE_TIME: time since last activity (u32, msecs) - * @NL80211_STA_STAT_RX_BYTES: total received bytes (u32, from this station) - * @NL80211_STA_STAT_TX_BYTES: total transmitted bytes (u32, to this station) - * @__NL80211_STA_STAT_AFTER_LAST: internal - * @NL80211_STA_STAT_MAX: highest possible station stats attribute + * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved + * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) + * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station) + * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) + * @__NL80211_STA_INFO_AFTER_LAST: internal + * @NL80211_STA_INFO_MAX: highest possible station info attribute + */ +enum nl80211_sta_info { + __NL80211_STA_INFO_INVALID, + NL80211_STA_INFO_INACTIVE_TIME, + NL80211_STA_INFO_RX_BYTES, + NL80211_STA_INFO_TX_BYTES, + NL80211_STA_INFO_LLID, + NL80211_STA_INFO_PLID, + NL80211_STA_INFO_PLINK_STATE, + + /* keep last */ + __NL80211_STA_INFO_AFTER_LAST, + NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1 +}; + +/** + * enum nl80211_mpath_flags - nl80211 mesh path flags + * + * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active + * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running + * @NL80211_MPATH_FLAG_DSN_VALID: the mesh path contains a valid DSN + * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set + * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded + */ +enum nl80211_mpath_flags { + NL80211_MPATH_FLAG_ACTIVE = 1<<0, + NL80211_MPATH_FLAG_RESOLVING = 1<<1, + NL80211_MPATH_FLAG_DSN_VALID = 1<<2, + NL80211_MPATH_FLAG_FIXED = 1<<3, + NL80211_MPATH_FLAG_RESOLVED = 1<<4, +}; + +/** + * enum nl80211_mpath_info - mesh path information + * + * These attribute types are used with %NL80211_ATTR_MPATH_INFO when getting + * information about a mesh path. + * + * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved + * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination + * @NL80211_ATTR_MPATH_DSN: destination sequence number + * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path + * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now + * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in + * &enum nl80211_mpath_flags; + * @NL80211_ATTR_MPATH_DISCOVERY_TIMEOUT: total path discovery timeout, in msec + * @NL80211_ATTR_MPATH_DISCOVERY_RETRIES: mesh path discovery retries */ -enum nl80211_sta_stats { - __NL80211_STA_STAT_INVALID, - NL80211_STA_STAT_INACTIVE_TIME, - NL80211_STA_STAT_RX_BYTES, - NL80211_STA_STAT_TX_BYTES, +enum nl80211_mpath_info { + __NL80211_MPATH_INFO_INVALID, + NL80211_MPATH_INFO_FRAME_QLEN, + NL80211_MPATH_INFO_DSN, + NL80211_MPATH_INFO_METRIC, + NL80211_MPATH_INFO_EXPTIME, + NL80211_MPATH_INFO_FLAGS, + NL80211_MPATH_INFO_DISCOVERY_TIMEOUT, + NL80211_MPATH_INFO_DISCOVERY_RETRIES, /* keep last */ - __NL80211_STA_STAT_AFTER_LAST, - NL80211_STA_STAT_MAX = __NL80211_STA_STAT_AFTER_LAST - 1 + __NL80211_MPATH_INFO_AFTER_LAST, + NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1 }; /** diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index ab4caf63954..e00750836ba 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -12,6 +12,16 @@ * Copyright 2006, 2007 Johannes Berg */ +/** + * struct vif_params - describes virtual interface parameters + * @mesh_id: mesh ID to use + * @mesh_id_len: length of the mesh ID + */ +struct vif_params { + u8 *mesh_id; + int mesh_id_len; +}; + /* Radiotap header iteration * implemented in net/wireless/radiotap.c * docs in Documentation/networking/radiotap-headers.txt @@ -108,6 +118,19 @@ enum station_flags { STATION_FLAG_WME = 1< Date: Sat, 23 Feb 2008 15:17:07 +0100 Subject: mac80211: add mesh interface type This adds the mesh interface type. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 7a80c398123..934cc25f757 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -443,6 +443,7 @@ enum ieee80211_if_types { IEEE80211_IF_TYPE_AP, IEEE80211_IF_TYPE_STA, IEEE80211_IF_TYPE_IBSS, + IEEE80211_IF_TYPE_MESH_POINT, IEEE80211_IF_TYPE_MNTR, IEEE80211_IF_TYPE_WDS, IEEE80211_IF_TYPE_VLAN, -- cgit v1.2.3 From 902acc7896d7649fb30e4b22bd4e643c7f34b02c Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Sat, 23 Feb 2008 15:17:19 +0100 Subject: mac80211: clean up mesh code Various cleanups, reducing the #ifdef mess and other things. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 934cc25f757..6aca472d7a0 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -465,6 +465,14 @@ struct ieee80211_vif { u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); }; +static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) +{ +#ifdef CONFIG_MAC80211_MESH + return vif->type == IEEE80211_IF_TYPE_MESH_POINT; +#endif + return false; +} + /** * struct ieee80211_if_init_conf - initial configuration of an interface * -- cgit v1.2.3 From dbbea6713d6096cd1c411cb453a6b71292c78b33 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 26 Feb 2008 14:34:06 +0100 Subject: mac80211: add documentation book Quite a while ago I started this book. The required kernel-doc patches have since gone into the tree so it is now possible to build the book in mainline. The actual documentation is still rather incomplete and not all things are linked into the book, but this enables us to edit the documentation collaboratively, hopefully driver authors can add documentation based on their experience with mac80211. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 6aca472d7a0..d002b1c6e78 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -407,7 +407,6 @@ enum ieee80211_conf_flags { * @channel: the channel to tune to */ struct ieee80211_conf { - unsigned int regulatory_domain; int radio_enabled; int beacon_int; @@ -437,6 +436,7 @@ struct ieee80211_conf { * @IEEE80211_IF_TYPE_WDS: interface in WDS mode. * @IEEE80211_IF_TYPE_VLAN: VLAN interface bound to an AP, drivers * will never see this type. + * @IEEE80211_IF_TYPE_MESH_POINT: 802.11s mesh point */ enum ieee80211_if_types { IEEE80211_IF_TYPE_INVALID, @@ -1096,8 +1096,9 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, /** * ieee80211_register_hw - Register hardware device * - * You must call this function before any other functions - * except ieee80211_register_hwmode. + * You must call this function before any other functions in + * mac80211. Note that before a hardware can be registered, you + * need to fill the contained wiphy's information. * * @hw: the device to register as returned by ieee80211_alloc_hw() */ -- cgit v1.2.3 From aab547ce0d1493d400b6468c521a0137cd8c1edf Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Fri, 29 Feb 2008 11:36:12 +0100 Subject: ssb: Add Gigabit Ethernet driver This adds the Gigabit Ethernet driver for the SSB Gigabit Ethernet core. This driver actually is a frontend to the Tigon3 driver. So the real work is done by tg3. This device is used in the Linksys WRT350N. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- include/linux/ssb/ssb.h | 7 ++ include/linux/ssb/ssb_driver_gige.h | 174 ++++++++++++++++++++++++++++++++++++ include/linux/ssb/ssb_driver_pci.h | 19 ++++ 3 files changed, 200 insertions(+) create mode 100644 include/linux/ssb/ssb_driver_gige.h (limited to 'include') diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 860d28c6d14..b7c388972fc 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -422,5 +422,12 @@ extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl); extern u32 ssb_admatch_base(u32 adm); extern u32 ssb_admatch_size(u32 adm); +/* PCI device mapping and fixup routines. + * Called from the architecture pcibios init code. + * These are only available on SSB_EMBEDDED configurations. */ +#ifdef CONFIG_SSB_EMBEDDED +int ssb_pcibios_plat_dev_init(struct pci_dev *dev); +int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); +#endif /* CONFIG_SSB_EMBEDDED */ #endif /* LINUX_SSB_H_ */ diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h new file mode 100644 index 00000000000..01fbdf5fef2 --- /dev/null +++ b/include/linux/ssb/ssb_driver_gige.h @@ -0,0 +1,174 @@ +#ifndef LINUX_SSB_DRIVER_GIGE_H_ +#define LINUX_SSB_DRIVER_GIGE_H_ + +#include +#include +#include + + +#ifdef CONFIG_SSB_DRIVER_GIGE + + +#define SSB_GIGE_PCIIO 0x0000 /* PCI I/O Registers (1024 bytes) */ +#define SSB_GIGE_RESERVED 0x0400 /* Reserved (1024 bytes) */ +#define SSB_GIGE_PCICFG 0x0800 /* PCI config space (256 bytes) */ +#define SSB_GIGE_SHIM_FLUSHSTAT 0x0C00 /* PCI to OCP: Flush status control (32bit) */ +#define SSB_GIGE_SHIM_FLUSHRDA 0x0C04 /* PCI to OCP: Flush read address (32bit) */ +#define SSB_GIGE_SHIM_FLUSHTO 0x0C08 /* PCI to OCP: Flush timeout counter (32bit) */ +#define SSB_GIGE_SHIM_BARRIER 0x0C0C /* PCI to OCP: Barrier register (32bit) */ +#define SSB_GIGE_SHIM_MAOCPSI 0x0C10 /* PCI to OCP: MaocpSI Control (32bit) */ +#define SSB_GIGE_SHIM_SIOCPMA 0x0C14 /* PCI to OCP: SiocpMa Control (32bit) */ + +/* TM Status High flags */ +#define SSB_GIGE_TMSHIGH_RGMII 0x00010000 /* Have an RGMII PHY-bus */ +/* TM Status Low flags */ +#define SSB_GIGE_TMSLOW_TXBYPASS 0x00080000 /* TX bypass (no delay) */ +#define SSB_GIGE_TMSLOW_RXBYPASS 0x00100000 /* RX bypass (no delay) */ +#define SSB_GIGE_TMSLOW_DLLEN 0x01000000 /* Enable DLL controls */ + +/* Boardflags (low) */ +#define SSB_GIGE_BFL_ROBOSWITCH 0x0010 + + +#define SSB_GIGE_MEM_RES_NAME "SSB Broadcom 47xx GigE memory" +#define SSB_GIGE_IO_RES_NAME "SSB Broadcom 47xx GigE I/O" + +struct ssb_gige { + struct ssb_device *dev; + + spinlock_t lock; + + /* True, if the device has an RGMII bus. + * False, if the device has a GMII bus. */ + bool has_rgmii; + + /* The PCI controller device. */ + struct pci_controller pci_controller; + struct pci_ops pci_ops; + struct resource mem_resource; + struct resource io_resource; +}; + +/* Check whether a PCI device is a SSB Gigabit Ethernet core. */ +extern bool pdev_is_ssb_gige_core(struct pci_dev *pdev); + +/* Convert a pci_dev pointer to a ssb_gige pointer. */ +static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev) +{ + if (!pdev_is_ssb_gige_core(pdev)) + return NULL; + return container_of(pdev->bus->ops, struct ssb_gige, pci_ops); +} + +/* Returns whether the PHY is connected by an RGMII bus. */ +static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev) +{ + struct ssb_gige *dev = pdev_to_ssb_gige(pdev); + return (dev ? dev->has_rgmii : 0); +} + +/* Returns whether we have a Roboswitch. */ +static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev) +{ + struct ssb_gige *dev = pdev_to_ssb_gige(pdev); + if (dev) + return !!(dev->dev->bus->sprom.boardflags_lo & + SSB_GIGE_BFL_ROBOSWITCH); + return 0; +} + +/* Returns whether we can only do one DMA at once. */ +static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev) +{ + struct ssb_gige *dev = pdev_to_ssb_gige(pdev); + if (dev) + return ((dev->dev->bus->chip_id == 0x4785) && + (dev->dev->bus->chip_rev < 2)); + return 0; +} + +/* Returns whether we must flush posted writes. */ +static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev) +{ + struct ssb_gige *dev = pdev_to_ssb_gige(pdev); + if (dev) + return (dev->dev->bus->chip_id == 0x4785); + return 0; +} + +extern char * nvram_get(const char *name); +/* Get the device MAC address */ +static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) +{ +#ifdef CONFIG_BCM947XX + char *res = nvram_get("et0macaddr"); + if (res) + memcpy(macaddr, res, 6); +#endif +} + +extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, + struct pci_dev *pdev); +extern int ssb_gige_map_irq(struct ssb_device *sdev, + const struct pci_dev *pdev); + +/* The GigE driver is not a standalone module, because we don't have support + * for unregistering the driver. So we could not unload the module anyway. */ +extern int ssb_gige_init(void); +static inline void ssb_gige_exit(void) +{ + /* Currently we can not unregister the GigE driver, + * because we can not unregister the PCI bridge. */ + BUG(); +} + + +#else /* CONFIG_SSB_DRIVER_GIGE */ +/* Gigabit Ethernet driver disabled */ + + +static inline int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, + struct pci_dev *pdev) +{ + return -ENOSYS; +} +static inline int ssb_gige_map_irq(struct ssb_device *sdev, + const struct pci_dev *pdev) +{ + return -ENOSYS; +} +static inline int ssb_gige_init(void) +{ + return 0; +} +static inline void ssb_gige_exit(void) +{ +} + +static inline bool pdev_is_ssb_gige_core(struct pci_dev *pdev) +{ + return 0; +} +static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev) +{ + return NULL; +} +static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev) +{ + return 0; +} +static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev) +{ + return 0; +} +static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev) +{ + return 0; +} +static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev) +{ + return 0; +} + +#endif /* CONFIG_SSB_DRIVER_GIGE */ +#endif /* LINUX_SSB_DRIVER_GIGE_H_ */ diff --git a/include/linux/ssb/ssb_driver_pci.h b/include/linux/ssb/ssb_driver_pci.h index 5e25bac4ed3..41e330e51c2 100644 --- a/include/linux/ssb/ssb_driver_pci.h +++ b/include/linux/ssb/ssb_driver_pci.h @@ -1,6 +1,11 @@ #ifndef LINUX_SSB_PCICORE_H_ #define LINUX_SSB_PCICORE_H_ +#include + +struct pci_dev; + + #ifdef CONFIG_SSB_DRIVER_PCICORE /* PCI core registers. */ @@ -88,6 +93,9 @@ extern void ssb_pcicore_init(struct ssb_pcicore *pc); extern int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc, struct ssb_device *dev); +int ssb_pcicore_plat_dev_init(struct pci_dev *d); +int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); + #else /* CONFIG_SSB_DRIVER_PCICORE */ @@ -107,5 +115,16 @@ int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc, return 0; } +static inline +int ssb_pcicore_plat_dev_init(struct pci_dev *d) +{ + return -ENODEV; +} +static inline +int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) +{ + return -ENODEV; +} + #endif /* CONFIG_SSB_DRIVER_PCICORE */ #endif /* LINUX_SSB_PCICORE_H_ */ -- cgit v1.2.3 From 8c8696553aa3895c2ad4289537e4af45a8877b62 Mon Sep 17 00:00:00 2001 From: Allan Stephens Date: Thu, 6 Mar 2008 15:05:07 -0800 Subject: [TIPC]: Removal of message header option code This patch removes code associated with optional, user-specified fields of the TIPC message header. Such fields were never utilized by TIPC, and have now been removed from the protocol specification. Signed-off-by: Allan Stephens Signed-off-by: David S. Miller --- include/net/tipc/tipc_port.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'include') diff --git a/include/net/tipc/tipc_port.h b/include/net/tipc/tipc_port.h index cfc4ba46de8..c9b36b77a0b 100644 --- a/include/net/tipc/tipc_port.h +++ b/include/net/tipc/tipc_port.h @@ -86,13 +86,6 @@ u32 tipc_createport_raw(void *usr_handle, void (*wakeup)(struct tipc_port *), const u32 importance); -/* - * tipc_set_msg_option(): port must be locked. - */ -int tipc_set_msg_option(struct tipc_port *tp_ptr, - const char *opt, - const u32 len); - int tipc_reject_msg(struct sk_buff *buf, u32 err); int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode); -- cgit v1.2.3 From 0e0609bbd2ab39a5964a70b409a5567ebbaf3700 Mon Sep 17 00:00:00 2001 From: Allan Stephens Date: Thu, 6 Mar 2008 15:06:06 -0800 Subject: [TIPC]: Eliminate "sparse" symbol warnings This patch eliminates warnings about undeclared symbols. Signed-off-by: Allan Stephens Signed-off-by: David S. Miller --- include/net/tipc/tipc_bearer.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/net/tipc/tipc_bearer.h b/include/net/tipc/tipc_bearer.h index 2151a80cdf3..ee2f304e491 100644 --- a/include/net/tipc/tipc_bearer.h +++ b/include/net/tipc/tipc_bearer.h @@ -99,6 +99,9 @@ struct tipc_bearer { char name[TIPC_MAX_BEARER_NAME]; }; +/* + * TIPC routines available to supported media types + */ int tipc_register_media(u32 media_type, char *media_name, @@ -123,6 +126,12 @@ void tipc_continue(struct tipc_bearer *tb_ptr); int tipc_enable_bearer(const char *bearer_name, u32 bcast_scope, u32 priority); int tipc_disable_bearer(const char *name); +/* + * Routines made available to TIPC by supported media types + */ + +int tipc_eth_media_start(void); +void tipc_eth_media_stop(void); #endif -- cgit v1.2.3 From db8dac20d5199307dcfcf4e01dac4bda5edf9e89 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 6 Mar 2008 16:22:02 -0800 Subject: [UDP]: Revert udplite and code split. This reverts commit db1ed684f6c430c4cdad67d058688b8a1b5e607c ("[IPV6] UDP: Rename IPv6 UDP files."), commit 8be8af8fa4405652e6c0797db5465a4be8afb998 ("[IPV4] UDP: Move IPv4-specific bits to other file.") and commit e898d4db2749c6052072e9bc4448e396cbdeb06a ("[UDP]: Allow users to configure UDP-Lite."). First, udplite is of such small cost, and it is a core protocol just like TCP and normal UDP are. We spent enormous amounts of effort to make udplite share as much code with core UDP as possible. All of that work is less valuable if we're just going to slap a config option on udplite support. It is also causing build failures, as reported on linux-next, showing that the changeset was not tested very well. In fact, this is the second build failure resulting from the udplite change. Finally, the config options provided was a bool, instead of a modular option. Meaning the udplite code does not even get build tested by allmodconfig builds, and furthermore the user is not presented with a reasonable modular build option which is particularly needed by distribution vendors. Signed-off-by: David S. Miller --- include/linux/udp.h | 10 ---------- include/net/ipv6.h | 5 ----- include/net/transp_v6.h | 5 ----- include/net/udplite.h | 9 ++------- 4 files changed, 2 insertions(+), 27 deletions(-) (limited to 'include') diff --git a/include/linux/udp.h b/include/linux/udp.h index 4144664d69d..1e7b7cb5703 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h @@ -70,10 +70,8 @@ struct udp_sock { #define UDPLITE_BIT 0x1 /* set by udplite proto init function */ #define UDPLITE_SEND_CC 0x2 /* set via udplite setsockopt */ #define UDPLITE_RECV_CC 0x4 /* set via udplite setsocktopt */ -#ifdef CONFIG_IP_UDPLITE __u8 pcflag; /* marks socket as UDP-Lite if > 0 */ __u8 unused[3]; -#endif /* * For encapsulation sockets. */ @@ -85,15 +83,7 @@ static inline struct udp_sock *udp_sk(const struct sock *sk) return (struct udp_sock *)sk; } -#ifdef CONFIG_IP_UDPLITE #define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag) -#define IS_PROTO_UDPLITE(__proto) ((__proto) == IPPROTO_UDPLITE) -#define IS_SOL_UDPFAMILY(level) ((level) == SOL_UDP || (level) == SOL_UDPLITE) -#else -#define IS_UDPLITE(__sk) 0 -#define IS_PROTO_UDPLITE(__proto) 0 -#define IS_SOL_UDPFAMILY(level) ((level) == SOL_UDP) -#endif #endif diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 5f6df50a33a..8db06af1efb 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -599,13 +599,8 @@ extern int tcp6_proc_init(void); extern void tcp6_proc_exit(void); extern int udp6_proc_init(void); extern void udp6_proc_exit(void); -#ifdef CONFIG_IP_UDPLITE extern int udplite6_proc_init(void); extern void udplite6_proc_exit(void); -#else -static inline int udplite6_proc_init(void) { return 0; } -static inline void udplite6_proc_exit(void) { } -#endif extern int ipv6_misc_proc_init(void); extern void ipv6_misc_proc_exit(void); extern int snmp6_register_dev(struct inet6_dev *idev); diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 902e6c6bc79..27394e0447d 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h @@ -27,13 +27,8 @@ extern int rawv6_init(void); extern void rawv6_exit(void); extern int udpv6_init(void); extern void udpv6_exit(void); -#ifdef CONFIG_IP_UDPLITE extern int udplitev6_init(void); extern void udplitev6_exit(void); -#else -static inline int udplitev6_init(void) { return 0; } -static inline void udplitev6_exit(void) { } -#endif extern int tcpv6_init(void); extern void tcpv6_exit(void); diff --git a/include/net/udplite.h b/include/net/udplite.h index 01ddb2c2026..b76b2e377af 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h @@ -25,9 +25,7 @@ static __inline__ int udplite_getfrag(void *from, char *to, int offset, /* Designate sk as UDP-Lite socket */ static inline int udplite_sk_init(struct sock *sk) { -#ifdef CONFIG_IP_UDPLITE udp_sk(sk)->pcflag = UDPLITE_BIT; -#endif return 0; } @@ -71,7 +69,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh) static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) { int cscov = up->len; -#ifdef CONFIG_IP_UDPLITE + /* * Sender has set `partial coverage' option on UDP-Lite socket */ @@ -95,15 +93,13 @@ static inline int udplite_sender_cscov(struct udp_sock *up, struct udphdr *uh) * illegal, we fall back to the defaults here. */ } -#endif return cscov; } static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) { - __wsum csum = 0; -#ifdef CONFIG_IP_UDPLITE int cscov = udplite_sender_cscov(udp_sk(sk), udp_hdr(skb)); + __wsum csum = 0; skb->ip_summed = CHECKSUM_NONE; /* no HW support for checksumming */ @@ -116,7 +112,6 @@ static inline __wsum udplite_csum_outgoing(struct sock *sk, struct sk_buff *skb) if ((cscov -= len) <= 0) break; } -#endif return csum; } -- cgit v1.2.3 From 1762f7e88eb34f653b4a915be99a102e347dd45e Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 7 Mar 2008 11:15:34 -0800 Subject: [NETNS][IPV6] ndisc - make socket control per namespace Make ndisc socket control per namespace. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/netns/ipv6.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 90e6e24df85..b773256d0d1 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -51,5 +51,6 @@ struct netns_ipv6 { struct fib_rules_ops *fib6_rules_ops; #endif struct sock **icmp_sk; + struct sock *ndisc_sk; }; #endif -- cgit v1.2.3 From 93ec926b075d14bb7edcbc054e92199e9ad4ad1d Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 7 Mar 2008 11:16:02 -0800 Subject: [NETNS][IPV6] tcp6 - make socket control per namespace Instead of having a tcp6_socket global to all the namespace, there is tcp6 socket control per namespace. That is consistent with which namespace sent a RST and allows to pass the socket to the underlying function to retrieve the network namespace. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/netns/ipv6.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index b773256d0d1..ddb9ccddcc4 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -52,5 +52,6 @@ struct netns_ipv6 { #endif struct sock **icmp_sk; struct sock *ndisc_sk; + struct sock *tcp_sk; }; #endif -- cgit v1.2.3 From b8ad0cbc58f703972e9e37c4e2a8081dd7e6a551 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 7 Mar 2008 11:16:55 -0800 Subject: [NETNS][IPV6] mcast - handle several network namespace This patch make use of the network namespace information at the right places to handle the multicast for several network namespaces. It makes the socket control to be per namespace too. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/netns/ipv6.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index ddb9ccddcc4..ac053be6c25 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -53,5 +53,6 @@ struct netns_ipv6 { struct sock **icmp_sk; struct sock *ndisc_sk; struct sock *tcp_sk; + struct sock *igmp_sk; }; #endif -- cgit v1.2.3 From 11f4b1cec98ad95abda80dc20bdc3cecac145d77 Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Tue, 4 Mar 2008 18:09:26 -0800 Subject: mac80211: adding mac80211_tx_control_flags and HT flags This patch makes enum from the defines previously dwelled inside ieee80211_tx_control for better readability. The patch also addes HT flags, for 802.11n drivers: - IEEE80211_TXCTL_OFDM_HT: request low-level driver to use HT OFDM rates - IEEE80211_TXCTL_GREEN_FIELD: use green field protection - IEEE80211_TXCTL_DUP_DATA: duplicate data on both 20 Mhz channels - IEEE80211_TXCTL_40_MHZ_WIDTH: send this frame in 40Mhz width - IEEE80211_TXCTL_SHORT_GI: send this frame with short guard interval Tx command can be a combination of any of these flags, along with bitrate represented by ieee80211_rate. this will allow legacy drivers to switch easily to any 11n rate representation. Signed-off-by: Ron Rindjunsky Signed-off-by: Tomas Winkler CC: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 86 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 31 deletions(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index d002b1c6e78..cde1b495353 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -205,6 +205,58 @@ struct ieee80211_bss_conf { bool use_short_preamble; }; +/** + * enum mac80211_tx_control_flags - flags to describe Tx configuration for + * the Tx frame + * + * These flags are used with the @flags member of &ieee80211_tx_control + * + * @IEEE80211_TXCTL_REQ_TX_STATUS: request TX status callback for this frame. + * @IEEE80211_TXCTL_DO_NOT_ENCRYPT: send this frame without encryption; + * e.g., for EAPOL frame + * @IEEE80211_TXCTL_USE_RTS_CTS: use RTS-CTS before sending frame + * @IEEE80211_TXCTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g., + * for combined 802.11g / 802.11b networks) + * @IEEE80211_TXCTL_NO_ACK: tell the low level not to wait for an ack + * @IEEE80211_TXCTL_RATE_CTRL_PROBE + * @EEE80211_TXCTL_CLEAR_PS_FILT: clear powersave filter + * for destination station + * @IEEE80211_TXCTL_REQUEUE: + * @IEEE80211_TXCTL_FIRST_FRAGMENT: this is a first fragment of the frame + * @IEEE80211_TXCTL_LONG_RETRY_LIMIT: this frame should be send using the + * through set_retry_limit configured long + * retry value + * @IEEE80211_TXCTL_EAPOL_FRAME: internal to mac80211 + * @IEEE80211_TXCTL_SEND_AFTER_DTIM: send this frame after DTIM beacon + * @IEEE80211_TXCTL_AMPDU: this frame should be sent as part of an A-MPDU + * @IEEE80211_TXCTL_OFDM_HT: this frame can be sent in HT OFDM rates + * @IEEE80211_TXCTL_GREEN_FIELD: use green field protection for this frame + * @IEEE80211_TXCTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width + * @IEEE80211_TXCTL_DUP_DATA: duplicate data frame on both 20 Mhz channels + * @IEEE80211_TXCTL_SHORT_GI: send this frame using short guard interval + */ +enum mac80211_tx_control_flags { + IEEE80211_TXCTL_REQ_TX_STATUS = (1<<0), + IEEE80211_TXCTL_DO_NOT_ENCRYPT = (1<<1), + IEEE80211_TXCTL_USE_RTS_CTS = (1<<2), + IEEE80211_TXCTL_USE_CTS_PROTECT = (1<<3), + IEEE80211_TXCTL_NO_ACK = (1<<4), + IEEE80211_TXCTL_RATE_CTRL_PROBE = (1<<5), + IEEE80211_TXCTL_CLEAR_PS_FILT = (1<<6), + IEEE80211_TXCTL_REQUEUE = (1<<7), + IEEE80211_TXCTL_FIRST_FRAGMENT = (1<<8), + IEEE80211_TXCTL_SHORT_PREAMBLE = (1<<9), + IEEE80211_TXCTL_LONG_RETRY_LIMIT = (1<<10), + IEEE80211_TXCTL_EAPOL_FRAME = (1<<11), + IEEE80211_TXCTL_SEND_AFTER_DTIM = (1<<12), + IEEE80211_TXCTL_AMPDU = (1<<13), + IEEE80211_TXCTL_OFDM_HT = (1<<14), + IEEE80211_TXCTL_GREEN_FIELD = (1<<15), + IEEE80211_TXCTL_40_MHZ_WIDTH = (1<<16), + IEEE80211_TXCTL_DUP_DATA = (1<<17), + IEEE80211_TXCTL_SHORT_GI = (1<<18), +}; + /* Transmit control fields. This data structure is passed to low-level driver * with each TX frame. The low-level driver is responsible for configuring * the hardware to use given values (depending on what is supported). */ @@ -219,42 +271,14 @@ struct ieee80211_tx_control { /* retry rate for the last retries */ struct ieee80211_rate *alt_retry_rate; -#define IEEE80211_TXCTL_REQ_TX_STATUS (1<<0)/* request TX status callback for - * this frame */ -#define IEEE80211_TXCTL_DO_NOT_ENCRYPT (1<<1) /* send this frame without - * encryption; e.g., for EAPOL - * frames */ -#define IEEE80211_TXCTL_USE_RTS_CTS (1<<2) /* use RTS-CTS before sending - * frame */ -#define IEEE80211_TXCTL_USE_CTS_PROTECT (1<<3) /* use CTS protection for the - * frame (e.g., for combined - * 802.11g / 802.11b networks) */ -#define IEEE80211_TXCTL_NO_ACK (1<<4) /* tell the low level not to - * wait for an ack */ -#define IEEE80211_TXCTL_RATE_CTRL_PROBE (1<<5) -#define IEEE80211_TXCTL_CLEAR_PS_FILT (1<<6) /* clear powersave filter - * for destination station */ -#define IEEE80211_TXCTL_REQUEUE (1<<7) -#define IEEE80211_TXCTL_FIRST_FRAGMENT (1<<8) /* this is a first fragment of - * the frame */ -#define IEEE80211_TXCTL_SHORT_PREAMBLE (1<<9) -#define IEEE80211_TXCTL_LONG_RETRY_LIMIT (1<<10) /* this frame should be send - * using the through - * set_retry_limit configured - * long retry value */ -#define IEEE80211_TXCTL_EAPOL_FRAME (1<<11) /* internal to mac80211 */ -#define IEEE80211_TXCTL_SEND_AFTER_DTIM (1<<12) /* send this frame after DTIM - * beacon */ -#define IEEE80211_TXCTL_AMPDU (1<<13) /* this frame should be sent - * as part of an A-MPDU */ - u32 flags; /* tx control flags defined - * above */ + u32 flags; /* tx control flags defined above */ u8 key_idx; /* keyidx from hw->set_key(), undefined if * IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */ u8 retry_limit; /* 1 = only first attempt, 2 = one retry, .. * This could be used when set_retry_limit * is not implemented by the driver */ - u8 antenna_sel_tx; /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */ + u8 antenna_sel_tx; /* 0 = default/diversity, otherwise bit + * position represents antenna number used */ u8 icv_len; /* length of the ICV/MIC field in octets */ u8 iv_len; /* length of the IV field in octets */ u8 queue; /* hardware queue to use for this frame; -- cgit v1.2.3 From 6c5ef8a7059e4f7adc37b337face8b0a8cbd4f48 Mon Sep 17 00:00:00 2001 From: Ron Rindjunsky Date: Wed, 5 Mar 2008 17:38:59 +0200 Subject: mac80211: document IEEE80211_TXCTL_OFDM_HT This patch clarifies the use of IEEE80211_TXCTL_OFDM_HT flag. Can by united with patch "mac80211: adding mac80211_tx_control flags and HT flags" Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- include/net/mac80211.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index cde1b495353..5ab6a350ee6 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -229,7 +229,11 @@ struct ieee80211_bss_conf { * @IEEE80211_TXCTL_EAPOL_FRAME: internal to mac80211 * @IEEE80211_TXCTL_SEND_AFTER_DTIM: send this frame after DTIM beacon * @IEEE80211_TXCTL_AMPDU: this frame should be sent as part of an A-MPDU - * @IEEE80211_TXCTL_OFDM_HT: this frame can be sent in HT OFDM rates + * @IEEE80211_TXCTL_OFDM_HT: this frame can be sent in HT OFDM rates. number + * of streams when this flag is on can be extracted + * from antenna_sel_tx, so if 1 antenna is marked + * use SISO, 2 antennas marked use MIMO, n antennas + * marked use MIMO_n. * @IEEE80211_TXCTL_GREEN_FIELD: use green field protection for this frame * @IEEE80211_TXCTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width * @IEEE80211_TXCTL_DUP_DATA: duplicate data frame on both 20 Mhz channels -- cgit v1.2.3 From 7524d7d6de5d5d3f081de8cf5479819fad339661 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 4 Mar 2008 15:26:14 -0800 Subject: the scheduled ieee80211 softmac removal Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: John W. Linville --- include/net/ieee80211softmac.h | 373 -------------------------------------- include/net/ieee80211softmac_wx.h | 99 ---------- 2 files changed, 472 deletions(-) delete mode 100644 include/net/ieee80211softmac.h delete mode 100644 include/net/ieee80211softmac_wx.h (limited to 'include') diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h deleted file mode 100644 index 1ef6282fdde..00000000000 --- a/include/net/ieee80211softmac.h +++ /dev/null @@ -1,373 +0,0 @@ -/* - * ieee80211softmac.h - public interface to the softmac - * - * Copyright (c) 2005 Johannes Berg - * Joseph Jezak - * Larry Finger - * Danny van Dyk - * Michael Buesch - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The full GNU General Public License is included in this distribution in the - * file called COPYING. - */ - -#ifndef IEEE80211SOFTMAC_H_ -#define IEEE80211SOFTMAC_H_ - -#include -#include -#include -#include -#include - -/* Once the API is considered more or less stable, - * this should be incremented on API incompatible changes. - */ -#define IEEE80211SOFTMAC_API 0 - -#define IEEE80211SOFTMAC_MAX_RATES_LEN 8 -#define IEEE80211SOFTMAC_MAX_EX_RATES_LEN 255 - -struct ieee80211softmac_ratesinfo { - u8 count; - u8 rates[IEEE80211SOFTMAC_MAX_RATES_LEN + IEEE80211SOFTMAC_MAX_EX_RATES_LEN]; -}; - -/* internal structures */ -struct ieee80211softmac_network; -struct ieee80211softmac_scaninfo; - -struct ieee80211softmac_essid { - u8 len; - char data[IW_ESSID_MAX_SIZE+1]; -}; - -struct ieee80211softmac_wpa { - char *IE; - int IElen; - int IEbuflen; -}; - -/* - * Information about association - */ -struct ieee80211softmac_assoc_info { - - struct mutex mutex; - - /* - * This is the requested ESSID. It is written - * only by the WX handlers. - * - */ - struct ieee80211softmac_essid req_essid; - /* - * the ESSID of the network we're currently - * associated (or trying) to. This is - * updated to the network's actual ESSID - * even if the requested ESSID was 'ANY' - */ - struct ieee80211softmac_essid associate_essid; - - /* BSSID we're trying to associate to */ - char bssid[ETH_ALEN]; - - /* some flags. - * static_essid is valid if the essid is constant, - * this is for use by the wx handlers only. - * - * associating is true, if the network has been - * auth'ed on and we are in the process of associating. - * - * bssvalid is true if we found a matching network - * and saved it's BSSID into the bssid above. - * - * bssfixed is used for SIOCSIWAP. - */ - u8 static_essid; - u8 short_preamble_available; - u8 associating; - u8 associated; - u8 assoc_wait; - u8 bssvalid; - u8 bssfixed; - - /* Scan retries remaining */ - int scan_retry; - - struct delayed_work work; - struct delayed_work timeout; -}; - -struct ieee80211softmac_bss_info { - /* Rates supported by the network */ - struct ieee80211softmac_ratesinfo supported_rates; - - /* This indicates whether frames can currently be transmitted with - * short preamble (only use this variable during TX at CCK rates) */ - u8 short_preamble:1; - - /* This indicates whether protection (e.g. self-CTS) should be used - * when transmitting with OFDM modulation */ - u8 use_protection:1; -}; - -enum { - IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1, - IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2, -}; - -enum { - IEEE80211SOFTMAC_AUTH_SHARED_REQUEST = 1, - IEEE80211SOFTMAC_AUTH_SHARED_CHALLENGE = 2, - IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE = 3, - IEEE80211SOFTMAC_AUTH_SHARED_PASS = 4, -}; - -/* We should make these tunable - * AUTH_TIMEOUT seems really long, but that's what it is in BSD */ -#define IEEE80211SOFTMAC_AUTH_TIMEOUT (12 * HZ) -#define IEEE80211SOFTMAC_AUTH_RETRY_LIMIT 5 -#define IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT 3 - -struct ieee80211softmac_txrates { - /* The Bit-Rate to be used for multicast frames. */ - u8 mcast_rate; - - /* The Bit-Rate to be used for multicast management frames. */ - u8 mgt_mcast_rate; - - /* The Bit-Rate to be used for any other (normal) data packet. */ - u8 default_rate; - /* The Bit-Rate to be used for default fallback - * (If the device supports fallback and hardware-retry) - */ - u8 default_fallback; - - /* This is the rate that the user asked for */ - u8 user_rate; -}; - -/* Bits for txrates_change callback. */ -#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT (1 << 0) /* default_rate */ -#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK (1 << 1) /* default_fallback */ -#define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */ -#define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */ - -#define IEEE80211SOFTMAC_BSSINFOCHG_RATES (1 << 0) /* supported_rates */ -#define IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE (1 << 1) /* short_preamble */ -#define IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION (1 << 2) /* use_protection */ - -struct ieee80211softmac_device { - /* 802.11 structure for data stuff */ - struct ieee80211_device *ieee; - struct net_device *dev; - - /* only valid if associated, then holds the Association ID */ - u16 association_id; - - /* the following methods are callbacks that the driver - * using this framework has to assign - */ - - /* always assign these */ - void (*set_bssid_filter)(struct net_device *dev, const u8 *bssid); - void (*set_channel)(struct net_device *dev, u8 channel); - - /* assign if you need it, informational only */ - void (*link_change)(struct net_device *dev); - - /* If the hardware can do scanning, assign _all_ three of these callbacks. - * When the scan finishes, call ieee80211softmac_scan_finished(). - */ - - /* when called, start_scan is guaranteed to not be called again - * until you call ieee80211softmac_scan_finished. - * Return 0 if scanning could start, error otherwise. - * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_start_scan */ - int (*start_scan)(struct net_device *dev); - /* this should block until after ieee80211softmac_scan_finished was called - * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_wait_for_scan */ - void (*wait_for_scan)(struct net_device *dev); - /* stop_scan aborts a scan, but is asynchronous. - * if you want to wait for it too, use wait_for_scan - * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_stop_scan */ - void (*stop_scan)(struct net_device *dev); - - /* we'll need something about beacons here too, for AP or ad-hoc modes */ - - /* Transmission rates to be used by the driver. - * The SoftMAC figures out the best possible rates. - * The driver just needs to read them. - */ - struct ieee80211softmac_txrates txrates; - - /* If the driver needs to do stuff on TX rate changes, assign this - * callback. See IEEE80211SOFTMAC_TXRATECHG for change flags. */ - void (*txrates_change)(struct net_device *dev, - u32 changes); - - /* If the driver needs to do stuff when BSS properties change, assign - * this callback. see IEEE80211SOFTMAC_BSSINFOCHG for change flags. */ - void (*bssinfo_change)(struct net_device *dev, - u32 changes); - - /* private stuff follows */ - /* this lock protects this structure */ - spinlock_t lock; - - struct workqueue_struct *wq; - - u8 running; /* SoftMAC started? */ - u8 scanning; - - struct ieee80211softmac_scaninfo *scaninfo; - struct ieee80211softmac_assoc_info associnfo; - struct ieee80211softmac_bss_info bssinfo; - - struct list_head auth_queue; - struct list_head events; - - struct ieee80211softmac_ratesinfo ratesinfo; - int txrate_badness; - - /* WPA stuff */ - struct ieee80211softmac_wpa wpa; - - /* we need to keep a list of network structs we copied */ - struct list_head network_list; - - /* This must be the last item so that it points to the data - * allocated beyond this structure by alloc_ieee80211 */ - u8 priv[0]; -}; - -extern void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm); - -static inline void * ieee80211softmac_priv(struct net_device *dev) -{ - return ((struct ieee80211softmac_device *)ieee80211_priv(dev))->priv; -} - -extern struct net_device * alloc_ieee80211softmac(int sizeof_priv); -extern void free_ieee80211softmac(struct net_device *dev); - -/* Call this function if you detect a lost TX fragment. - * (If the device indicates failure of ACK RX, for example.) - * It is wise to call this function if you are able to detect lost packets, - * because it contributes to the TX Rates auto adjustment. - */ -extern void ieee80211softmac_fragment_lost(struct net_device *dev, - u16 wireless_sequence_number); -/* Call this function before _start to tell the softmac what rates - * the hw supports. The rates parameter is copied, so you can - * free it right after calling this function. - * Note that the rates need to be sorted. */ -extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates); - -/* Finds the highest rate which is: - * 1. Present in ri (optionally a basic rate) - * 2. Supported by the device - * 3. Less than or equal to the user-defined rate - */ -extern u8 ieee80211softmac_highest_supported_rate(struct ieee80211softmac_device *mac, - struct ieee80211softmac_ratesinfo *ri, int basic_only); - -/* Helper function which advises you the rate at which a frame should be - * transmitted at. */ -static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac, - int is_multicast, - int is_mgt) -{ - struct ieee80211softmac_txrates *txrates = &mac->txrates; - - if (!mac->associnfo.associated) - return txrates->mgt_mcast_rate; - - /* We are associated, sending unicast frame */ - if (!is_multicast) - return txrates->default_rate; - - /* We are associated, sending multicast frame */ - if (is_mgt) - return txrates->mgt_mcast_rate; - else - return txrates->mcast_rate; -} - -/* Helper function which advises you when it is safe to transmit with short - * preamble. - * You should only call this function when transmitting at CCK rates. */ -static inline int ieee80211softmac_short_preamble_ok(struct ieee80211softmac_device *mac, - int is_multicast, - int is_mgt) -{ - return (is_multicast && is_mgt) ? 0 : mac->bssinfo.short_preamble; -} - -/* Helper function which advises you whether protection (e.g. self-CTS) is - * needed. 1 = protection needed, 0 = no protection needed - * Only use this function when transmitting with OFDM modulation. */ -static inline int ieee80211softmac_protection_needed(struct ieee80211softmac_device *mac) -{ - return mac->bssinfo.use_protection; -} - -/* Start the SoftMAC. Call this after you initialized the device - * and it is ready to run. - */ -extern void ieee80211softmac_start(struct net_device *dev); -/* Stop the SoftMAC. Call this before you shutdown the device. */ -extern void ieee80211softmac_stop(struct net_device *dev); - -/* - * Event system - */ - -/* valid event types */ -#define IEEE80211SOFTMAC_EVENT_ANY -1 /*private use only*/ -#define IEEE80211SOFTMAC_EVENT_SCAN_FINISHED 0 -#define IEEE80211SOFTMAC_EVENT_ASSOCIATED 1 -#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED 2 -#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_TIMEOUT 3 -#define IEEE80211SOFTMAC_EVENT_AUTHENTICATED 4 -#define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5 -#define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6 -#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7 -#define IEEE80211SOFTMAC_EVENT_DISASSOCIATED 8 -/* keep this updated! */ -#define IEEE80211SOFTMAC_EVENT_LAST 8 -/* - * If you want to be notified of certain events, you can call - * ieee80211softmac_notify[_atomic] with - * - event set to one of the constants below - * - fun set to a function pointer of the appropriate type - * - context set to the context data you want passed - * The return value is 0, or an error. - */ -typedef void (*notify_function_ptr)(struct net_device *dev, int event_type, void *context); - -#define ieee80211softmac_notify(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_KERNEL); -#define ieee80211softmac_notify_atomic(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_ATOMIC); - -extern int ieee80211softmac_notify_gfp(struct net_device *dev, - int event, notify_function_ptr fun, void *context, gfp_t gfp_mask); - -/* To clear pending work (for ifconfig down, etc.) */ -extern void -ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm); - -#endif /* IEEE80211SOFTMAC_H_ */ diff --git a/include/net/ieee80211softmac_wx.h b/include/net/ieee80211softmac_wx.h deleted file mode 100644 index 4ee3ad57283..00000000000 --- a/include/net/ieee80211softmac_wx.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file contains the prototypes for the wireless extension - * handlers that the softmac API provides. Include this file to - * use the wx handlers, you can assign these directly. - * - * Copyright (c) 2005 Johannes Berg - * Joseph Jezak - * Larry Finger - * Danny van Dyk - * Michael Buesch - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The full GNU General Public License is included in this distribution in the - * file called COPYING. - */ - -#ifndef _IEEE80211SOFTMAC_WX_H -#define _IEEE80211SOFTMAC_WX_H - -#include -#include - -extern int -ieee80211softmac_wx_trigger_scan(struct net_device *net_dev, - struct iw_request_info *info, - union iwreq_data *data, - char *extra); - -extern int -ieee80211softmac_wx_get_scan_results(struct net_device *net_dev, - struct iw_request_info *info, - union iwreq_data *data, - char *extra); - -extern int -ieee80211softmac_wx_set_essid(struct net_device *net_dev, - struct iw_request_info *info, - union iwreq_data *data, - char *extra); - -extern int -ieee80211softmac_wx_get_essid(struct net_device *net_dev, - struct iw_request_info *info, - union iwreq_data *data, - char *extra); - -extern int -ieee80211softmac_wx_set_rate(struct net_device *net_dev, - struct iw_request_info *info, - union iwreq_data *data, - char *extra); - -extern int -ieee80211softmac_wx_get_rate(struct net_device *net_dev, - struct iw_request_info *info, - union iwreq_data *data, - char *extra); - -extern int -ieee80211softmac_wx_get_wap(struct net_device *net_dev, - struct iw_request_info *info, - union iwreq_data *data, - char *extra); - -extern int -ieee80211softmac_wx_set_wap(struct net_device *net_dev, - struct iw_request_info *info, - union iwreq_data *data, - char *extra); - -extern int -ieee80211softmac_wx_set_genie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra); - -extern int -ieee80211softmac_wx_get_genie(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra); -extern int -ieee80211softmac_wx_set_mlme(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, - char *extra); -#endif /* _IEEE80211SOFTMAC_WX */ -- cgit v1.2.3 From 068edceb7e73c05f77e204442ea8f86e238575da Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sun, 9 Mar 2008 16:55:10 -0700 Subject: include/net/ieee80211.h - remove duplicate include Signed-off-by: Joe Perches Signed-off-by: John W. Linville --- include/net/ieee80211.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index 285b2adfa64..529816bfbc5 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h @@ -183,7 +183,6 @@ const char *escape_essid(const char *essid, u8 essid_len); #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) #define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a) #include -#include #include /* ARPHRD_ETHER */ #ifndef WIRELESS_SPY -- cgit v1.2.3 From e7ec2e3230633a858af1b0b359f6c4670dbeb997 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Mon, 10 Mar 2008 17:26:32 +0100 Subject: ssb: Add SPROM/invariants support for PCMCIA devices This adds support for reading/writing the SPROM invariants for PCMCIA based devices. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- include/linux/ssb/ssb.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index b7c388972fc..8644e03cf58 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -245,9 +245,9 @@ struct ssb_bus { /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ struct pcmcia_device *host_pcmcia; -#ifdef CONFIG_SSB_PCIHOST +#ifdef CONFIG_SSB_SPROM /* Mutex to protect the SPROM writing. */ - struct mutex pci_sprom_mutex; + struct mutex sprom_mutex; #endif /* ID information about the Chip. */ -- cgit v1.2.3 From 3e94794355724f77dc6cbb5ad956f7c72d8313a4 Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Fri, 22 Feb 2008 19:55:15 +0900 Subject: smc91x: introduce platform data flags V2 This patch introduces struct smc91x_platdata and modifies the driver so bus width is checked during run time using SMC_nBIT() instead of SMC_CAN_USE_nBIT. V2 keeps static configuration lean using SMC_DYNAMIC_BUS_CONFIG. Signed-off-by: Magnus Damm Acked-by: Nicolas Pitre Signed-off-by: Jeff Garzik --- include/linux/smc91x.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 include/linux/smc91x.h (limited to 'include') diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h new file mode 100644 index 00000000000..8e0556b8781 --- /dev/null +++ b/include/linux/smc91x.h @@ -0,0 +1,13 @@ +#ifndef __SMC91X_H__ +#define __SMC91X_H__ + +#define SMC91X_USE_8BIT (1 << 0) +#define SMC91X_USE_16BIT (1 << 1) +#define SMC91X_USE_32BIT (1 << 2) + +struct smc91x_platdata { + unsigned long flags; + unsigned long irq_flags; /* IRQF_... */ +}; + +#endif /* __SMC91X_H__ */ -- cgit v1.2.3 From 82cc1a7a56872056af0ead6c7d695aa223f36695 Mon Sep 17 00:00:00 2001 From: Peter P Waskiewicz Jr Date: Fri, 21 Mar 2008 03:43:19 -0700 Subject: [NET]: Add per-connection option to set max TSO frame size Update: My mailer ate one of Jarek's feedback mails... Fixed the parameter in netif_set_gso_max_size() to be u32, not u16. Fixed the whitespace issue due to a patch import botch. Changed the types from u32 to unsigned int to be more consistent with other variables in the area. Also brought the patch up to the latest net-2.6.26 tree. Update: Made gso_max_size container 32 bits, not 16. Moved the location of gso_max_size within netdev to be less hotpath. Made more consistent names between the sock and netdev layers, and added a define for the max GSO size. Update: Respun for net-2.6.26 tree. Update: changed max_gso_frame_size and sk_gso_max_size from signed to unsigned - thanks Stephen! This patch adds the ability for device drivers to control the size of the TSO frames being sent to them, per TCP connection. By setting the netdevice's gso_max_size value, the socket layer will set the GSO frame size based on that value. This will propogate into the TCP layer, and send TSO's of that size to the hardware. This can be desirable to help tune the bursty nature of TSO on a per-adapter basis, where one may have 1 GbE and 10 GbE devices coexisting in a system, one running multiqueue and the other not, etc. This can also be desirable for devices that cannot support full 64 KB TSO's, but still want to benefit from some level of segmentation offloading. Signed-off-by: Peter P Waskiewicz Jr Signed-off-by: David S. Miller --- include/linux/netdevice.h | 10 ++++++++++ include/net/sock.h | 2 ++ 2 files changed, 12 insertions(+) (limited to 'include') diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index a2f003239c8..ced61f87660 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -724,6 +724,10 @@ struct net_device /* rtnetlink link ops */ const struct rtnl_link_ops *rtnl_link_ops; + /* for setting kernel sock attribute on TCP connection setup */ +#define GSO_MAX_SIZE 65536 + unsigned int gso_max_size; + /* The TX queue control structures */ unsigned int egress_subqueue_count; struct net_device_subqueue egress_subqueue[1]; @@ -1475,6 +1479,12 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); } +static inline void netif_set_gso_max_size(struct net_device *dev, + unsigned int size) +{ + dev->gso_max_size = size; +} + /* On bonding slaves other than the currently active slave, suppress * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and * ARP on active-backup slaves with arp_validate enabled. diff --git a/include/net/sock.h b/include/net/sock.h index 39112e75411..8358fff002e 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -151,6 +151,7 @@ struct sock_common { * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) + * @sk_gso_max_size: Maximum GSO segment size to build * @sk_lingertime: %SO_LINGER l_linger setting * @sk_backlog: always used with the per-socket spinlock held * @sk_callback_lock: used with the callbacks in the end of this struct @@ -237,6 +238,7 @@ struct sock { gfp_t sk_allocation; int sk_route_caps; int sk_gso_type; + unsigned int sk_gso_max_size; int sk_rcvlowat; unsigned long sk_flags; unsigned long sk_lingertime; -- cgit v1.2.3 From a91275eff43a527e1a25d6d034cbcd19ee323e64 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 21 Mar 2008 04:11:58 -0700 Subject: [NETNS][IPV6] udp - make proc handle the network namespace This patch makes the common udp proc functions to take care of which socket they should show taking into account the namespace it belongs. Signed-off-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/udp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/udp.h b/include/net/udp.h index c6669c0a74c..a1b33d66719 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -192,6 +192,7 @@ struct udp_seq_afinfo { }; struct udp_iter_state { + struct net *net; sa_family_t family; struct hlist_head *hashtable; int bucket; -- cgit v1.2.3 From f40c8174d3c21bf178283f3ef3aa8c7bf238fdec Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 21 Mar 2008 04:13:54 -0700 Subject: [NETNS][IPV4] tcp - make proc handle the network namespaces This patch, like udp proc, makes the proc functions to take care of which namespace the socket belongs. Signed-off-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/tcp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/tcp.h b/include/net/tcp.h index 11119e33acf..6b08dab1b1f 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1328,6 +1328,7 @@ struct tcp_seq_afinfo { }; struct tcp_iter_state { + struct net *net; sa_family_t family; enum tcp_seq_states state; struct sock *syn_wait_sk; -- cgit v1.2.3 From 0c96d8c50bffb7f02690dd8a8cf1adb8e07e100f Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 21 Mar 2008 04:14:17 -0700 Subject: [NETNS][IPV6] udp6 - make proc per namespace The proc init/exit functions take a new network namespace parameter in order to register/unregister /proc/net/udp6 for a namespace. Signed-off-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/ipv6.h | 4 ++-- include/net/udp.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 8db06af1efb..e01a563132e 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -597,8 +597,8 @@ extern int raw6_proc_init(void); extern void raw6_proc_exit(void); extern int tcp6_proc_init(void); extern void tcp6_proc_exit(void); -extern int udp6_proc_init(void); -extern void udp6_proc_exit(void); +extern int udp6_proc_init(struct net *net); +extern void udp6_proc_exit(struct net *net); extern int udplite6_proc_init(void); extern void udplite6_proc_exit(void); extern int ipv6_misc_proc_init(void); diff --git a/include/net/udp.h b/include/net/udp.h index a1b33d66719..b4cbdce883d 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -200,8 +200,8 @@ struct udp_iter_state { }; #ifdef CONFIG_PROC_FS -extern int udp_proc_register(struct udp_seq_afinfo *afinfo); -extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo); +extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo); +extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo); extern int udp4_proc_init(void); extern void udp4_proc_exit(void); -- cgit v1.2.3 From 6f8b13bcb3369a5df2e63acc422bed6098f5b8c4 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 21 Mar 2008 04:14:45 -0700 Subject: [NETNS][IPV6] tcp6 - make proc per namespace Make the proc for tcp6 to be per namespace. Signed-off-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/ipv6.h | 4 ++-- include/net/tcp.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/net/ipv6.h b/include/net/ipv6.h index e01a563132e..e82f1814d96 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -595,8 +595,8 @@ extern int ac6_proc_init(void); extern void ac6_proc_exit(void); extern int raw6_proc_init(void); extern void raw6_proc_exit(void); -extern int tcp6_proc_init(void); -extern void tcp6_proc_exit(void); +extern int tcp6_proc_init(struct net *net); +extern void tcp6_proc_exit(struct net *net); extern int udp6_proc_init(struct net *net); extern void udp6_proc_exit(struct net *net); extern int udplite6_proc_init(void); diff --git a/include/net/tcp.h b/include/net/tcp.h index 6b08dab1b1f..847e1634e1f 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1336,8 +1336,8 @@ struct tcp_iter_state { struct seq_operations seq_ops; }; -extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo); -extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo); +extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); +extern void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo); extern struct request_sock_ops tcp_request_sock_ops; extern struct request_sock_ops tcp6_request_sock_ops; -- cgit v1.2.3 From 4cd9029d25f6612302f82634620f107c65f790b1 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 21 Mar 2008 15:54:53 -0700 Subject: socket: SOCK_DEBUG type checking Use the inline trick (same as pr_debug) to get checking of debug statements even if no code is generated. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- include/net/sock.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index 8358fff002e..b89680d2693 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -70,7 +70,11 @@ #define SOCK_DEBUG(sk, msg...) do { if ((sk) && sock_flag((sk), SOCK_DBG)) \ printk(KERN_DEBUG msg); } while (0) #else -#define SOCK_DEBUG(sk, msg...) do { } while (0) +/* Validate arguments and do nothing */ +static void inline int __attribute__ ((format (printf, 2, 3))) +SOCK_DEBUG(struct sock *sk, const char *msg, ...) +{ +} #endif /* This is the per-socket lock. The spinlock provides a synchronization -- cgit v1.2.3 From ec3c0982a2dd1e671bad8e9d26c28dcba0039d87 Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Fri, 21 Mar 2008 16:33:01 -0700 Subject: [TCP]: TCP_DEFER_ACCEPT updates - process as established Change TCP_DEFER_ACCEPT implementation so that it transitions a connection to ESTABLISHED after handshake is complete instead of leaving it in SYN-RECV until some data arrvies. Place connection in accept queue when first data packet arrives from slow path. Benefits: - established connection is now reset if it never makes it to the accept queue - diagnostic state of established matches with the packet traces showing completed handshake - TCP_DEFER_ACCEPT timeouts are expressed in seconds and can now be enforced with reasonable accuracy instead of rounding up to next exponential back-off of syn-ack retry. Signed-off-by: Patrick McManus Signed-off-by: David S. Miller --- include/linux/tcp.h | 7 +++++++ include/net/request_sock.h | 4 ++-- include/net/tcp.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 08027f1d7f3..d96d9b12230 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -239,6 +239,11 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req) return (struct tcp_request_sock *)req; } +struct tcp_deferred_accept_info { + struct sock *listen_sk; + struct request_sock *request; +}; + struct tcp_sock { /* inet_connection_sock has to be the first member of tcp_sock */ struct inet_connection_sock inet_conn; @@ -374,6 +379,8 @@ struct tcp_sock { unsigned int keepalive_intvl; /* time interval between keep alive probes */ int linger2; + struct tcp_deferred_accept_info defer_tcp_accept; + unsigned long last_synq_overflow; u32 tso_deferred; diff --git a/include/net/request_sock.h b/include/net/request_sock.h index 040780add35..0369f98e9f3 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h @@ -115,8 +115,8 @@ struct request_sock_queue { struct request_sock *rskq_accept_head; struct request_sock *rskq_accept_tail; rwlock_t syn_wait_lock; - u8 rskq_defer_accept; - /* 3 bytes hole, try to pack */ + u16 rskq_defer_accept; + /* 2 bytes hole, try to pack */ struct listen_sock *listen_opt; }; diff --git a/include/net/tcp.h b/include/net/tcp.h index 847e1634e1f..67cc3956d29 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -139,6 +139,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); #define MAX_TCP_KEEPINTVL 32767 #define MAX_TCP_KEEPCNT 127 #define MAX_TCP_SYNCNT 127 +#define MAX_TCP_ACCEPT_DEFERRED 65535 #define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */ -- cgit v1.2.3 From ef722495c8867aacc1db0675a6737e5cf1e72e07 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Sat, 22 Mar 2008 16:35:29 -0700 Subject: [IPV4]: Remove unused ip_options->is_data. ip_options->is_data is assigned only and never checked. The structure is not a part of kernel interface to the userspace. So, it is safe to remove this field. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/inet_sock.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 8660cb0fa0d..b6db16d2766 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -43,8 +43,7 @@ struct ip_options { unsigned char srr; unsigned char rr; unsigned char ts; - unsigned char is_data:1, - is_strictroute:1, + unsigned char is_strictroute:1, srr_is_hit:1, is_changed:1, rr_needaddr:1, -- cgit v1.2.3 From 39d8cda76cfb1178455f9d196b39e773878e6c05 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Sat, 22 Mar 2008 16:50:58 -0700 Subject: [SOCK]: Add udp_hash member to struct proto. Inspired by the commit ab1e0a13 ([SOCK] proto: Add hashinfo member to struct proto) from Arnaldo, I made similar thing for UDP/-Lite IPv4 and -v6 protocols. The result is not that exciting, but it removes some levels of indirection in udpxxx_get_port and saves some space in code and text. The first step is to union existing hashinfo and new udp_hash on the struct proto and give a name to this union, since future initialization of tcpxxx_prot, dccp_vx_protinfo and udpxxx_protinfo will cause gcc warning about inability to initialize anonymous member this way. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/inet_hashtables.h | 2 +- include/net/sock.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 97dc35ad09b..d99c1ba2ece 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -223,7 +223,7 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk) /* Caller must disable local BH processing. */ static inline void __inet_inherit_port(struct sock *sk, struct sock *child) { - struct inet_hashinfo *table = sk->sk_prot->hashinfo; + struct inet_hashinfo *table = sk->sk_prot->h.hashinfo; const int bhash = inet_bhashfn(inet_sk(child)->num, table->bhash_size); struct inet_bind_hashbucket *head = &table->bhash[bhash]; struct inet_bind_bucket *tb; diff --git a/include/net/sock.h b/include/net/sock.h index b89680d2693..c3175c400b7 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -586,7 +586,10 @@ struct proto { struct request_sock_ops *rsk_prot; struct timewait_sock_ops *twsk_prot; - struct inet_hashinfo *hashinfo; + union { + struct inet_hashinfo *hashinfo; + struct hlist_head *udp_hash; + } h; struct module *owner; -- cgit v1.2.3 From 6ba5a3c52da00015e739469e3b00cd6d0d4c5c67 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Sat, 22 Mar 2008 16:51:21 -0700 Subject: [UDP]: Make full use of proto.h.udp_hash innovation. After this we have only udp_lib_get_port to get the port and two stubs for ipv4 and ipv6. No difference in udp and udplite except for initialized h.udp_hash member. I tried to find a graceful way to drop the only difference between udp_v4_get_port and udp_v6_get_port (i.e. the rcv_saddr comparison routine), but adding one more callback on the struct proto didn't appear such :( Maybe later. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/udp.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/net/udp.h b/include/net/udp.h index b4cbdce883d..635940d374a 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -125,6 +125,8 @@ static inline void udp_lib_close(struct sock *sk, long timeout) sk_common_release(sk); } +extern int udp_lib_get_port(struct sock *sk, unsigned short snum, + int (*)(const struct sock*,const struct sock*)); /* net/ipv4/udp.c */ extern int udp_get_port(struct sock *sk, unsigned short snum, -- cgit v1.2.3 From fc8717baa8f52dd8d1b90df9008300ef3ec794ed Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Sat, 22 Mar 2008 16:56:51 -0700 Subject: [RAW]: Add raw_hashinfo member on struct proto. Sorry for the patch sequence confusion :| but I found that the similar thing can be done for raw sockets easily too late. Expand the proto.h union with the raw_hashinfo member and use it in raw_prot and rawv6_prot. This allows to drop the protocol specific versions of hash and unhash callbacks. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/raw.h | 4 ++-- include/net/sock.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/raw.h b/include/net/raw.h index 1828f81fe37..6c14a656357 100644 --- a/include/net/raw.h +++ b/include/net/raw.h @@ -53,7 +53,7 @@ int raw_seq_open(struct inode *ino, struct file *file, #endif -void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h); -void raw_unhash_sk(struct sock *sk, struct raw_hashinfo *h); +void raw_hash_sk(struct sock *sk); +void raw_unhash_sk(struct sock *sk); #endif /* _RAW_H */ diff --git a/include/net/sock.h b/include/net/sock.h index c3175c400b7..b433b1ed203 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -504,6 +504,7 @@ extern int sk_wait_data(struct sock *sk, long *timeo); struct request_sock_ops; struct timewait_sock_ops; struct inet_hashinfo; +struct raw_hashinfo; /* Networking protocol blocks we attach to sockets. * socket layer -> transport layer interface @@ -589,6 +590,7 @@ struct proto { union { struct inet_hashinfo *hashinfo; struct hlist_head *udp_hash; + struct raw_hashinfo *raw_hash; } h; struct module *owner; -- cgit v1.2.3 From 0098b7273e968fb9989a6e1e4e4c024cd081fe0d Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 22 Mar 2008 17:18:47 -0700 Subject: [NET]: NPROTO is redundant; it's equal to AF_MAX/PF_MAX. DaveM pointed out NPROTO exposed to userspace, so keep it around, just make sure it stays in sync. Signed-off-by: Rusty Russell Signed-off-by: David S. Miller --- include/linux/net.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/net.h b/include/linux/net.h index c414d90e647..71f7dd55928 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -19,6 +19,7 @@ #define _LINUX_NET_H #include +#include #include struct poll_table_struct; @@ -26,7 +27,7 @@ struct pipe_inode_info; struct inode; struct net; -#define NPROTO 34 /* should be enough for now.. */ +#define NPROTO AF_MAX #define SYS_SOCKET 1 /* sys_socket(2) */ #define SYS_BIND 2 /* sys_bind(2) */ -- cgit v1.2.3 From 7d164be8aa4392fe55474f4608547f2097e07c41 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sun, 23 Mar 2008 22:03:56 -0700 Subject: [NET]: include/net/route.h - remove duplicate include Signed-off-by: Joe Perches Signed-off-by: David S. Miller --- include/net/route.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/net/route.h b/include/net/route.h index eadad590142..28dba925663 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -34,7 +34,6 @@ #include #include #include -#include #ifndef __KERNEL__ #warning This file is not supposed to be used outside of kernel. -- cgit v1.2.3 From 414f69d8a6ff0b30e7ea5ce10534b19f851e172e Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sun, 23 Mar 2008 22:04:31 -0700 Subject: [NET]: include/linux/atalk.h - remove duplicate include Signed-off-by: Joe Perches Signed-off-by: David S. Miller --- include/linux/atalk.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/linux/atalk.h b/include/linux/atalk.h index ced8a1ed080..e9ebac2e2ec 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h @@ -85,8 +85,6 @@ static inline struct atalk_sock *at_sk(struct sock *sk) return (struct atalk_sock *)sk; } -#include - struct ddpehdr { __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */ __be16 deh_sum; -- cgit v1.2.3 From cc32e05416b4023a5466a2f66e3c02236a771c5b Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sun, 23 Mar 2008 22:05:44 -0700 Subject: [NET]: include/linux/igmp.h - remove duplicate include Removed duplicate #include Combined #ifdef __KERNEL__ blocks Signed-off-by: Joe Perches Signed-off-by: David S. Miller --- include/linux/igmp.h | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/linux/igmp.h b/include/linux/igmp.h index f510e7e382a..f5a1a0db2e8 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h @@ -80,27 +80,6 @@ struct igmpv3_query { __be32 srcs[0]; }; -#ifdef __KERNEL__ -#include - -static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb) -{ - return (struct igmphdr *)skb_transport_header(skb); -} - -static inline struct igmpv3_report * - igmpv3_report_hdr(const struct sk_buff *skb) -{ - return (struct igmpv3_report *)skb_transport_header(skb); -} - -static inline struct igmpv3_query * - igmpv3_query_hdr(const struct sk_buff *skb) -{ - return (struct igmpv3_query *)skb_transport_header(skb); -} -#endif - #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ #define IGMP_DVMRP 0x13 /* DVMRP routing */ @@ -151,6 +130,23 @@ static inline struct igmpv3_query * #include #include +static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb) +{ + return (struct igmphdr *)skb_transport_header(skb); +} + +static inline struct igmpv3_report * + igmpv3_report_hdr(const struct sk_buff *skb) +{ + return (struct igmpv3_report *)skb_transport_header(skb); +} + +static inline struct igmpv3_query * + igmpv3_query_hdr(const struct sk_buff *skb) +{ + return (struct igmpv3_query *)skb_transport_header(skb); +} + extern int sysctl_igmp_max_memberships; extern int sysctl_igmp_max_msf; -- cgit v1.2.3 From 310afe86af8ddd96a06b75aa61ef1af233f80e89 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sun, 23 Mar 2008 22:06:51 -0700 Subject: [NET]: include/linux/udp.h - remove duplicate include Remove duplicate #include Combine #ifdef __KERNEL__ blocks Signed-off-by: Joe Perches Signed-off-by: David S. Miller --- include/linux/udp.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/linux/udp.h b/include/linux/udp.h index 1e7b7cb5703..581ca2c14c5 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h @@ -26,15 +26,6 @@ struct udphdr { __sum16 check; }; -#ifdef __KERNEL__ -#include - -static inline struct udphdr *udp_hdr(const struct sk_buff *skb) -{ - return (struct udphdr *)skb_transport_header(skb); -} -#endif - /* UDP socket options */ #define UDP_CORK 1 /* Never send partially complete segments */ #define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ @@ -45,9 +36,14 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb) #define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ #ifdef __KERNEL__ -#include - #include +#include + +static inline struct udphdr *udp_hdr(const struct sk_buff *skb) +{ + return (struct udphdr *)skb_transport_header(skb); +} + #define UDP_HTABLE_SIZE 128 struct udp_sock { -- cgit v1.2.3 From 2051f11fb86b0056fec440fe7e9fa8370d60a5c6 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Sun, 23 Mar 2008 22:21:28 -0700 Subject: [TCP]: Shrink syncookie_secret by 8 byte. the first u32 copied from syncookie_secret is overwritten by the minute-counter four lines below. After adjusting the destination address, the size of syncookie_secret can be reduced accordingly. AFAICS, the only other user of syncookie_secret[] is the ipv6 syncookie support. Because ipv6 syncookies only grab 44 bytes from syncookie_secret[], this shouldn't affect them in any way. With fixes from Glenn Griffin. Signed-off-by: Florian Westphal Acked-by: Glenn Griffin Signed-off-by: David S. Miller --- include/net/tcp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/tcp.h b/include/net/tcp.h index 67cc3956d29..723b36851dd 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -436,7 +436,7 @@ extern int tcp_disconnect(struct sock *sk, int flags); extern void tcp_unhash(struct sock *sk); /* From syncookies.c */ -extern __u32 syncookie_secret[2][16-3+SHA_DIGEST_WORDS]; +extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, struct ip_options *opt); extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, -- cgit v1.2.3 From 80445cfb28a6b093540582b68d9ae928bf34cfe7 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Sun, 23 Mar 2008 22:47:08 -0700 Subject: [SCTP]: Remove redundant wrapper functions. sctp_datamsg_free and sctp_datamsg_track are just aliases for sctp_datamsg_put and sctp_chunk_hold, respectively. Saves 32 Bytes on x86. Signed-off-by: Florian Westphal Signed-off-by: David S. Miller --- include/net/sctp/structs.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 8966599ddb9..0ce0443c5b7 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -637,8 +637,6 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *, struct sctp_sndrcvinfo *, struct msghdr *, int len); void sctp_datamsg_put(struct sctp_datamsg *); -void sctp_datamsg_free(struct sctp_datamsg *); -void sctp_datamsg_track(struct sctp_chunk *); void sctp_chunk_fail(struct sctp_chunk *, int error); int sctp_chunk_abandoned(struct sctp_chunk *); -- cgit v1.2.3 From 0e6bd4a1c6c3881c9ed82985ecb9824d4450c4ba Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Mon, 24 Mar 2008 15:29:23 -0700 Subject: [NETNS]: Add namespace parameter to ip_options_compile. ip_options_compile uses inet_addr_type which requires a namespace. The packet argument is optional, so parameter is the only way to obtain it. Pass the init_net there for now. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/ip.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ip.h b/include/net/ip.h index 9f50d4f1f15..bcc3afa3df3 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -347,7 +347,8 @@ extern int ip_forward(struct sk_buff *skb); extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag); extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); extern void ip_options_fragment(struct sk_buff *skb); -extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb); +extern int ip_options_compile(struct net *net, + struct ip_options *opt, struct sk_buff *skb); extern int ip_options_get(struct ip_options **optp, unsigned char *data, int optlen); extern int ip_options_get_from_user(struct ip_options **optp, -- cgit v1.2.3 From f2c4802b3fdfb0d9596d932ca2af0ef6f8d60491 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Mon, 24 Mar 2008 15:29:55 -0700 Subject: [NETNS]: Add namespace parameter to ip_options_get(...). Pass the init_net there for now. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/ip.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/ip.h b/include/net/ip.h index bcc3afa3df3..531270dc48a 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -349,9 +349,9 @@ extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); extern void ip_options_fragment(struct sk_buff *skb); extern int ip_options_compile(struct net *net, struct ip_options *opt, struct sk_buff *skb); -extern int ip_options_get(struct ip_options **optp, +extern int ip_options_get(struct net *net, struct ip_options **optp, unsigned char *data, int optlen); -extern int ip_options_get_from_user(struct ip_options **optp, +extern int ip_options_get_from_user(struct net *net, struct ip_options **optp, unsigned char __user *data, int optlen); extern void ip_options_undo(struct ip_options * opt); extern void ip_forward_options(struct sk_buff *skb); -- cgit v1.2.3 From 7a6adb92fe301c10ca4dbd0d9f2422f5880595e7 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Mon, 24 Mar 2008 15:30:27 -0700 Subject: [NETNS]: Add namespace parameter to ip_cmsg_send. Pass the init_net there for now. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/ip.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/ip.h b/include/net/ip.h index 531270dc48a..6d7bcd5e62d 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -362,7 +362,8 @@ extern int ip_options_rcv_srr(struct sk_buff *skb); */ extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); -extern int ip_cmsg_send(struct msghdr *msg, struct ipcm_cookie *ipc); +extern int ip_cmsg_send(struct net *net, + struct msghdr *msg, struct ipcm_cookie *ipc); extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen); extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); extern int compat_ip_setsockopt(struct sock *sk, int level, -- cgit v1.2.3 From f145049a06f470d0489f47cb83ff3ccb2a0de622 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Mon, 24 Mar 2008 15:33:00 -0700 Subject: [NETNS]: Drop packets in the non-initial namespace on the per/protocol basis. IP layer now can handle multiple namespaces normally. So, process such packets normally and drop them only if the transport layer is not aware about namespaces. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/protocol.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/protocol.h b/include/net/protocol.h index ad8c584233a..8d024d7cb74 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h @@ -39,7 +39,8 @@ struct net_protocol { int (*gso_send_check)(struct sk_buff *skb); struct sk_buff *(*gso_segment)(struct sk_buff *skb, int features); - int no_policy; + unsigned int no_policy:1, + netns_ok:1; }; #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) -- cgit v1.2.3 From 9bb182a7007515239091b237fe7169b1328a61d3 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Fri, 22 Feb 2008 14:48:22 +0900 Subject: [XFRM] MIP6: Fix address keys for routing search. Each MIPv6 XFRM state (DSTOPT/RH2) holds either destination or source address to be mangled in the IPv6 header (that is "CoA"). On Inter-MN communication after both nodes binds each other, they use route optimized traffic two MIPv6 states applied, and both source and destination address in the IPv6 header are replaced by the states respectively. The packet format is correct, however, next-hop routing search are not. This patch fixes it by remembering address pairs for later states. Based on patch from Masahide NAKAMURA . Signed-off-by: Masahide NAKAMURA Signed-off-by: YOSHIFUJI Hideaki --- include/net/xfrm.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include') diff --git a/include/net/xfrm.h b/include/net/xfrm.h index c435620dbb3..bed7d43932f 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -1045,6 +1045,23 @@ xfrm_address_t *xfrm_flowi_saddr(struct flowi *fl, unsigned short family) return NULL; } +static __inline__ +void xfrm_flowi_addr_get(struct flowi *fl, + xfrm_address_t *saddr, xfrm_address_t *daddr, + unsigned short family) +{ + switch(family) { + case AF_INET: + memcpy(&saddr->a4, &fl->fl4_src, sizeof(saddr->a4)); + memcpy(&daddr->a4, &fl->fl4_dst, sizeof(daddr->a4)); + break; + case AF_INET6: + ipv6_addr_copy((struct in6_addr *)&saddr->a6, &fl->fl6_src); + ipv6_addr_copy((struct in6_addr *)&daddr->a6, &fl->fl6_dst); + break; + } +} + static __inline__ int __xfrm4_state_addr_check(struct xfrm_state *x, xfrm_address_t *daddr, xfrm_address_t *saddr) -- cgit v1.2.3 From c8cdaf998df221b01134a051aba38c570105061b Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Mon, 10 Mar 2008 04:30:37 -0400 Subject: [IPV4,IPV6]: Share cork.rt between IPv4 and IPv6. Signed-off-by: YOSHIFUJI Hideaki --- include/linux/ipv6.h | 1 - include/net/inet_sock.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 4aaefc349a4..2102d8b67c0 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -315,7 +315,6 @@ struct ipv6_pinfo { struct sk_buff *pktoptions; struct { struct ipv6_txoptions *opt; - struct rt6_info *rt; int hop_limit; int tclass; } cork; diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index b6db16d2766..a42cd63d241 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -136,7 +136,7 @@ struct inet_sock { unsigned int flags; unsigned int fragsize; struct ip_options *opt; - struct rtable *rt; + struct dst_entry *dst; int length; /* Total length of all frames */ __be32 addr; struct flowi fl; -- cgit v1.2.3 From 4725474584d6aa2f07b3d47442dfbc4f6544f65e Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Mon, 10 Mar 2008 04:41:33 -0400 Subject: [IPV6]: Convert cork.hop_limit and cork.tclass into u8 instead of int. Values of those fields are always between 0 and 255 (inclusive), so use u8 and save some memory on 32bit systems. Signed-off-by: YOSHIFUJI Hideaki --- include/linux/ipv6.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 2102d8b67c0..9b59e37afad 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -315,8 +315,8 @@ struct ipv6_pinfo { struct sk_buff *pktoptions; struct { struct ipv6_txoptions *opt; - int hop_limit; - int tclass; + u8 hop_limit; + u8 tclass; } cork; }; -- cgit v1.2.3 From 6b75d0908185bf853b188afa6f269426f6554c5b Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Mon, 10 Mar 2008 06:00:30 -0400 Subject: [IPV6]: Optimize hop-limit determination. Last part of hop-limit determination is always: hoplimit = dst_metric(dst, RTAX_HOPLIMIT); if (hoplimit < 0) hoplimit = ipv6_get_hoplimit(dst->dev). Let's consolidate it as ip6_dst_hoplimit(dst). Signed-off-by: YOSHIFUJI Hideaki --- include/net/addrconf.h | 2 -- include/net/ip6_route.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 232da20e717..edcb4bbaab7 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -123,8 +123,6 @@ extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr); extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len); -extern int ipv6_get_hoplimit(struct net_device *dev); - /* * anycast prototypes (anycast.c) */ diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 0e2895c8b27..5c3b67c86ae 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -88,6 +88,8 @@ extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, const struct in6_addr *addr, int anycast); +extern int ip6_dst_hoplimit(struct dst_entry *dst); + /* * support functions for ND * -- cgit v1.2.3 From 1d5d236d309ab90fa6aedf712f586b3595721373 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Mon, 10 Mar 2008 10:56:55 -0400 Subject: [IPV6]: Use bitfields for hop_limit and mcast_hops. Save some bits for future extensions. Signed-off-by: YOSHIFUJI Hideaki --- include/linux/ipv6.h | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 9b59e37afad..87ae4e389ce 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -274,8 +274,29 @@ struct ipv6_pinfo { __be32 flow_label; __u32 frag_size; - __s16 hop_limit; - __s16 mcast_hops; + + /* + * Packed in 16bits. + * Omit one shift by by putting the signed field at MSB. + */ +#if defined(__BIG_ENDIAN_BITFIELD) + __s16 hop_limit:9; + __u16 __unused_1:7; +#else + __u16 __unused_1:7; + __s16 hop_limit:9; +#endif + +#if defined(__BIG_ENDIAN_BITFIELD) + /* Packed in 16bits. */ + __s16 mcast_hops:9; + __u16 __unused_2:6, + mc_loop:1; +#else + __u16 mc_loop:1, + __unused_2:6; + __s16 mcast_hops:9; +#endif int mcast_oif; /* pktoption flags */ @@ -298,8 +319,7 @@ struct ipv6_pinfo { } rxopt; /* sockopt flags */ - __u8 mc_loop:1, - recverr:1, + __u8 recverr:1, sndflow:1, pmtudisc:2, ipv6only:1; -- cgit v1.2.3 From 7cbca67c073263c179f605bdbbdc565ab29d801d Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Tue, 25 Mar 2008 09:37:42 +0900 Subject: [IPV6]: Support Source Address Selection API (RFC5014). Signed-off-by: YOSHIFUJI Hideaki --- include/linux/in6.h | 11 +++++++++++ include/linux/ipv6.h | 6 +++++- include/net/addrconf.h | 1 + include/net/ip6_route.h | 9 ++++++--- 4 files changed, 23 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/linux/in6.h b/include/linux/in6.h index 2a61c82af11..f674000c6c9 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h @@ -249,4 +249,15 @@ struct in6_flowlabel_req * IP6T_SO_GET_REVISION_TARGET 69 */ +/* RFC5014: Source address selection */ +#define IPV6_ADDR_PREFERENCES 72 + +#define IPV6_PREFER_SRC_TMP 0x0001 +#define IPV6_PREFER_SRC_PUBLIC 0x0002 +#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100 +#define IPV6_PREFER_SRC_COA 0x0004 +#define IPV6_PREFER_SRC_HOME 0x0400 +#define IPV6_PREFER_SRC_CGA 0x0008 +#define IPV6_PREFER_SRC_NONCGA 0x0800 + #endif diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 87ae4e389ce..c9ba0da16ce 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -322,7 +322,11 @@ struct ipv6_pinfo { __u8 recverr:1, sndflow:1, pmtudisc:2, - ipv6only:1; + ipv6only:1, + srcprefs:3; /* 001: prefer temporary address + * 010: prefer public address + * 100: prefer care-of address + */ __u8 tclass; __u32 dst_cookie; diff --git a/include/net/addrconf.h b/include/net/addrconf.h index edcb4bbaab7..c9276c72764 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -78,6 +78,7 @@ extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, extern int ipv6_dev_get_saddr(struct net_device *dev, struct in6_addr *daddr, + unsigned int srcprefs, struct in6_addr *saddr); extern int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr, diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 5c3b67c86ae..3ae6799c2b1 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -30,9 +30,12 @@ struct route_info { #include #include -#define RT6_LOOKUP_F_IFACE 0x1 -#define RT6_LOOKUP_F_REACHABLE 0x2 -#define RT6_LOOKUP_F_HAS_SADDR 0x4 +#define RT6_LOOKUP_F_IFACE 0x00000001 +#define RT6_LOOKUP_F_REACHABLE 0x00000002 +#define RT6_LOOKUP_F_HAS_SADDR 0x00000004 +#define RT6_LOOKUP_F_SRCPREF_TMP 0x00000008 +#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 +#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 extern struct rt6_info *ip6_null_entry; -- cgit v1.2.3 From c346dca10840a874240c78efe3f39acf4312a1f2 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Tue, 25 Mar 2008 21:47:49 +0900 Subject: [NET] NETNS: Omit net_device->nd_net without CONFIG_NET_NS. Introduce per-net_device inlines: dev_net(), dev_net_set(). Without CONFIG_NET_NS, no namespace other than &init_net exists. Let's explicitly define them to help compiler optimizations. Signed-off-by: YOSHIFUJI Hideaki --- include/linux/inetdevice.h | 6 +++--- include/linux/netdevice.h | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index da05ab47ff2..7009b0cdd06 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h @@ -70,13 +70,13 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) #define IN_DEV_ANDCONF(in_dev, attr) \ - (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \ + (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ IN_DEV_CONF_GET((in_dev), attr)) #define IN_DEV_ORCONF(in_dev, attr) \ - (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \ + (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) || \ IN_DEV_CONF_GET((in_dev), attr)) #define IN_DEV_MAXCONF(in_dev, attr) \ - (max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \ + (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \ IN_DEV_CONF_GET((in_dev), attr))) #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ced61f87660..d146be40f46 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -708,8 +708,10 @@ struct net_device void (*poll_controller)(struct net_device *dev); #endif +#ifdef CONFIG_NET_NS /* Network namespace this network device is inside */ struct net *nd_net; +#endif /* bridge stuff */ struct net_bridge_port *br_port; @@ -737,6 +739,27 @@ struct net_device #define NETDEV_ALIGN 32 #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) +/* + * Net namespace inlines + */ +static inline +struct net *dev_net(const struct net_device *dev) +{ +#ifdef CONFIG_NET_NS + return dev->nd_net; +#else + return &init_net; +#endif +} + +static inline +void dev_net_set(struct net_device *dev, const struct net *net) +{ +#ifdef CONFIG_NET_NS + dev->nd_dev = net; +#endif +} + /** * netdev_priv - access network device private data * @dev: network device @@ -813,7 +836,7 @@ static inline struct net_device *next_net_device(struct net_device *dev) struct list_head *lh; struct net *net; - net = dev->nd_net; + net = dev_net(dev); lh = dev->dev_list.next; return lh == &net->dev_base_head ? NULL : net_device_entry(lh); } -- cgit v1.2.3 From 3b1e0a655f8eba44ab1ee2a1068d169ccfb853b9 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Wed, 26 Mar 2008 02:26:21 +0900 Subject: [NET] NETNS: Omit sock->sk_net without CONFIG_NET_NS. Introduce per-sock inlines: sock_net(), sock_net_set() and per-inet_timewait_sock inlines: twsk_net(), twsk_net_set(). Without CONFIG_NET_NS, no namespace other than &init_net exists. Let's explicitly define them to help compiler optimizations. Signed-off-by: YOSHIFUJI Hideaki --- include/linux/ipv6.h | 4 ++-- include/net/inet_hashtables.h | 8 ++++---- include/net/inet_timewait_sock.h | 18 ++++++++++++++++++ include/net/route.h | 4 ++-- include/net/sock.h | 24 ++++++++++++++++++++++-- 5 files changed, 48 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index c9ba0da16ce..b90d3d461d4 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -481,7 +481,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk) #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ #define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ - (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ + (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ ((__sk)->sk_family == AF_INET6) && \ ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ @@ -489,7 +489,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk) (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) #define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \ - (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ + (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \ ((__sk)->sk_family == PF_INET6) && \ (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \ diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index d99c1ba2ece..5525227c5e9 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -314,25 +314,25 @@ typedef __u64 __bitwise __addrpair; ((__force __u64)(__be32)(__saddr))); #endif /* __BIG_ENDIAN */ #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ - (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ + (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) #define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ - (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ + (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) #else /* 32-bit arch */ #define INET_ADDR_COOKIE(__name, __saddr, __daddr) #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ - (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ + (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ (inet_sk(__sk)->daddr == (__saddr)) && \ (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) #define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ - (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ + (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 296547bfb0b..07fe0d1a4f0 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h @@ -207,4 +207,22 @@ extern void inet_twsk_schedule(struct inet_timewait_sock *tw, const int timeo, const int timewait_len); extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, struct inet_timewait_death_row *twdr); + +static inline +struct net *twsk_net(const struct inet_timewait_sock *twsk) +{ +#ifdef CONFIG_NET_NS + return twsk->tw_net; +#else + return &init_net; +#endif +} + +static inline +void twsk_net_set(struct inet_timewait_sock *twsk, const struct net *net) +{ +#ifdef CONFIG_NET_NS + twsk->tw_net = net; +#endif +} #endif /* _INET_TIMEWAIT_SOCK_ */ diff --git a/include/net/route.h b/include/net/route.h index 28dba925663..c6338802e8f 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -160,7 +160,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, .dport = dport } } }; int err; - struct net *net = sk->sk_net; + struct net *net = sock_net(sk); if (!dst || !src) { err = __ip_route_output_key(net, rp, &fl); if (err) @@ -188,7 +188,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, ip_rt_put(*rp); *rp = NULL; security_sk_classify_flow(sk, &fl); - return ip_route_output_flow(sk->sk_net, rp, &fl, sk, 0); + return ip_route_output_flow(sock_net(sk), rp, &fl, sk, 0); } return 0; } diff --git a/include/net/sock.h b/include/net/sock.h index b433b1ed203..7e0d4a0c4d1 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -126,7 +126,9 @@ struct sock_common { atomic_t skc_refcnt; unsigned int skc_hash; struct proto *skc_prot; +#ifdef CONFIG_NET_NS struct net *skc_net; +#endif }; /** @@ -1345,6 +1347,24 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e } #endif +static inline +struct net *sock_net(const struct sock *sk) +{ +#ifdef CONFIG_NET_NS + return sk->sk_net; +#else + return &init_net; +#endif +} + +static inline +void sock_net_set(struct sock *sk, const struct net *net) +{ +#ifdef CONFIG_NET_NS + sk->sk_net = net; +#endif +} + /* * Kernel sockets, f.e. rtnl or icmp_socket, are a part of a namespace. * They should not hold a referrence to a namespace in order to allow @@ -1353,8 +1373,8 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e */ static inline void sk_change_net(struct sock *sk, struct net *net) { - put_net(sk->sk_net); - sk->sk_net = net; + put_net(sock_net(sk)); + sock_net_set(sk, net); } extern void sock_enable_timestamp(struct sock *sk); -- cgit v1.2.3 From 1218854afa6f659be90b748cf1bc7badee954a35 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Wed, 26 Mar 2008 02:36:06 +0900 Subject: [NET] NETNS: Omit seq_net_private->net without CONFIG_NET_NS. Without CONFIG_NET_NS, no namespace other than &init_net exists, no need to store net in seq_net_private. Signed-off-by: YOSHIFUJI Hideaki --- include/linux/seq_file.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 67c2563961f..d870a825376 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -5,6 +5,7 @@ #include #include #include +#include struct seq_operations; struct file; @@ -64,7 +65,9 @@ extern struct list_head *seq_list_next(void *v, struct list_head *head, struct net; struct seq_net_private { +#ifdef CONFIG_NET_NS struct net *net; +#endif }; int seq_open_net(struct inode *, struct file *, @@ -72,7 +75,11 @@ int seq_open_net(struct inode *, struct file *, int seq_release_net(struct inode *, struct file *); static inline struct net *seq_file_net(struct seq_file *seq) { +#ifdef CONFIG_NET_NS return ((struct seq_net_private *)seq->private)->net; +#else + return &init_net; +#endif } #endif -- cgit v1.2.3 From 57da52c1e62c6c13875e97de6c69d3156f8416da Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Wed, 26 Mar 2008 03:49:59 +0900 Subject: [NET] NETNS: Omit neigh_parms->net and pneigh_entry->net without CONFIG_NET_NS. Introduce neigh_parms/pneigh_entry inlines: neigh_parms_net(), pneigh_net(). Without CONFIG_NET_NS, no namespace other than &init_net exists. Let's explicitly define them to help compiler optimizations. Signed-off-by: YOSHIFUJI Hideaki --- include/net/neighbour.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'include') diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 06228187206..8bec0d69b27 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -38,7 +38,9 @@ struct neighbour; struct neigh_parms { +#ifdef CONFIG_NET_NS struct net *net; +#endif struct net_device *dev; struct neigh_parms *next; int (*neigh_setup)(struct neighbour *); @@ -131,7 +133,9 @@ struct neigh_ops struct pneigh_entry { struct pneigh_entry *next; +#ifdef CONFIG_NET_NS struct net *net; +#endif struct net_device *dev; u8 flags; u8 key[0]; @@ -213,6 +217,17 @@ extern struct neighbour *neigh_event_ns(struct neigh_table *tbl, extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); + +static inline +struct net *neigh_parms_net(const struct neigh_parms *parms) +{ +#ifdef CONFIG_NET_NS + return parms->net; +#else + return &init_net; +#endif +} + extern unsigned long neigh_rand_reach_time(unsigned long base); extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, @@ -220,6 +235,16 @@ extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev, int creat); extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev); +static inline +struct net *pneigh_net(const struct pneigh_entry *pneigh) +{ +#ifdef CONFIG_NET_NS + return pneigh->net; +#else + return &init_net; +#endif +} + extern void neigh_app_ns(struct neighbour *n); extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); -- cgit v1.2.3 From 878628fbf2589eb24357e42027d5f54b1dafd3c8 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Wed, 26 Mar 2008 03:57:35 +0900 Subject: [NET] NETNS: Omit namespace comparision without CONFIG_NET_NS. Introduce an inline net_eq() to compare two namespaces. Without CONFIG_NET_NS, since no namespace other than &init_net exists, it is always 1. We do not need to convert 1) inline vs inline and 2) inline vs &init_net comparisons. Signed-off-by: YOSHIFUJI Hideaki --- include/net/net_namespace.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 923f2b8b909..f8f3d1a5fc3 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -118,6 +118,12 @@ static inline void release_net(struct net *net) { atomic_dec(&net->use_count); } + +static inline +int net_eq(const struct net *net1, const struct net *net2) +{ + return net1 == net2; +} #else static inline struct net *get_net(struct net *net) { @@ -141,6 +147,12 @@ static inline struct net *maybe_get_net(struct net *net) { return net; } + +static inline +int net_eq(const struct net *net1, const struct net *net2) +{ + return 1; +} #endif #define for_each_net(VAR) \ -- cgit v1.2.3 From 5d2cdcd4e85c5187db30a6b29f79fbbe59f39f78 Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach Date: Thu, 20 Mar 2008 15:06:41 +0200 Subject: mac80211: get a TKIP phase key from skb This patch makes mac80211 able to compute a TKIP key from an skb. The requested key can be a phase 1 or a phase 2 key. This is useful for drivers who need to provide tkip key to their HW to enable HW encryption. Signed-off-by: Emmanuel Grumbach Signed-off-by: Tomas Winkler Signed-off-by: John W. Linville --- include/net/mac80211.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 5ab6a350ee6..2a134582fc1 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -643,6 +643,21 @@ enum sta_notify_cmd { STA_NOTIFY_ADD, STA_NOTIFY_REMOVE }; +/** + * enum ieee80211_tkip_key_type - get tkip key + * + * Used by drivers which need to get a tkip key for skb. Some drivers need a + * phase 1 key, others need a phase 2 key. A single function allows the driver + * to get the key, this enum indicates what type of key is required. + * + * @IEEE80211_TKIP_P1_KEY: the driver needs a phase 1 key + * @IEEE80211_TKIP_P2_KEY: the driver needs a phase 2 key + */ +enum ieee80211_tkip_key_type { + IEEE80211_TKIP_P1_KEY, + IEEE80211_TKIP_P2_KEY, +}; + /** * enum ieee80211_hw_flags - hardware flags * @@ -1471,6 +1486,21 @@ int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); */ int ieee80211_get_hdrlen(u16 fc); +/** + * ieee80211_get_tkip_key - get a TKIP rc4 for skb + * + * This function computes a TKIP rc4 key for an skb. It computes + * a phase 1 key if needed (iv16 wraps around). This function is to + * be used by drivers which can do HW encryption but need to compute + * to phase 1/2 key in SW. + * + * @keyconf: the parameter passed with the set key + * @skb: the skb for which the key is needed + * @rc4key: a buffer to which the key will be written + */ +void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf, + struct sk_buff *skb, + enum ieee80211_tkip_key_type type, u8 *key); /** * ieee80211_wake_queue - wake specific queue * @hw: pointer as obtained from ieee80211_alloc_hw(). -- cgit v1.2.3 From 9ae4fda332df616ef47d5bb710c39681641d4303 Mon Sep 17 00:00:00 2001 From: Emmanuel Grumbach Date: Thu, 20 Mar 2008 15:06:42 +0200 Subject: mac80211: allows driver to request a Phase 1 RX key This patch makes mac80211 able to send a phase1 key for TKIP decryption. This is needed for drivers that don't do the rekeying by themselves (i.e. iwlwifi). Upon IV16 wrap around, the packet is decrypted in SW, if decryption is ok, mac80211 calls to update_tkip_key with a new phase 1 RX key. Signed-off-by: Emmanuel Grumbach Signed-off-by: Tomas Winkler Signed-off-by: John W. Linville --- include/net/mac80211.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 2a134582fc1..48428a6b910 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -827,6 +827,16 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) * parameter is guaranteed to be valid until another call to set_key() * removes it, but it can only be used as a cookie to differentiate * keys. + * + * In TKIP some HW need to be provided a phase 1 key, for RX decryption + * acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key + * handler. + * The update_tkip_key() call updates the driver with the new phase 1 key. + * This happens everytime the iv16 wraps around (every 65536 packets). The + * set_key() call will happen only once for each key (unless the AP did + * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is + * provided by udpate_tkip_key only. The trigger that makes mac80211 call this + * handler is software decryption with wrap around of iv16. */ /** @@ -1003,6 +1013,10 @@ enum ieee80211_ampdu_mlme_action { * and remove_interface calls, i.e. while the interface with the * given local_address is enabled. * + * @update_tkip_key: See the section "Hardware crypto acceleration" + * This callback will be called in the context of Rx. Called for drivers + * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. + * * @hw_scan: Ask the hardware to service the scan request, no need to start * the scan state machine in stack. The scan must honour the channel * configuration done by the regulatory agent in the wiphy's registered @@ -1094,6 +1108,9 @@ struct ieee80211_ops { int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, const u8 *local_address, const u8 *address, struct ieee80211_key_conf *key); + void (*update_tkip_key)(struct ieee80211_hw *hw, + struct ieee80211_key_conf *conf, const u8 *address, + u32 iv32, u16 *phase1key); int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); int (*get_stats)(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats); -- cgit v1.2.3 From 906c730a2db950b7bce4ef17d65399acd791c360 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Sun, 16 Mar 2008 18:34:33 +0100 Subject: wireless: add wiphy channel freq to channel struct lookup helper Add ieee80211_get_channel() which gets you a channel struct for a specific wiphy if that channel is present in that wiphy. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/wireless.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/net/wireless.h b/include/net/wireless.h index c7f805ee554..f4b77ab66ba 100644 --- a/include/net/wireless.h +++ b/include/net/wireless.h @@ -304,4 +304,10 @@ extern int ieee80211_channel_to_frequency(int chan); */ extern int ieee80211_frequency_to_channel(int freq); +/** + * ieee80211_get_channel - get channel struct from wiphy for specified frequency + */ +extern struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, + int freq); + #endif /* __NET_WIRELESS_H */ -- cgit v1.2.3 From ef27559b70bd5312dfcbeab3b9ab0296206413c4 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:07:38 -0700 Subject: [NETFILTER]: nf_conntrack: fix NF_CT_TUPLE_DUMP for IPv4 NF_CT_TUPLE_DUMP prints IPv4 addresses as IPv6, fix this and use printk (guarded by #ifdef DEBUG) directly instead of pr_debug since the tuple is usually printed at the end of line and we don't want to include a log-level. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/net/netfilter/nf_conntrack_tuple.h | 38 ++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index e69ab2e8759..d9b53dd601a 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h @@ -113,11 +113,39 @@ struct nf_conntrack_tuple_mask #ifdef __KERNEL__ -#define NF_CT_DUMP_TUPLE(tp) \ -pr_debug("tuple %p: %u %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", \ - (tp), (tp)->src.l3num, (tp)->dst.protonum, \ - NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \ - NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all)) +static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t) +{ +#ifdef DEBUG + printk("tuple %p: %u " NIPQUAD_FMT ":%hu -> " NIPQUAD_FMT ":%hu\n", + t, t->dst.protonum, + NIPQUAD(t->src.u3.ip), ntohs(t->src.u.all), + NIPQUAD(t->dst.u3.ip), ntohs(t->dst.u.all)); +#endif +} + +static inline void nf_ct_dump_tuple_ipv6(const struct nf_conntrack_tuple *t) +{ +#ifdef DEBUG + printk("tuple %p: %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", + t, t->dst.protonum, + NIP6(*(struct in6_addr *)t->src.u3.all), ntohs(t->src.u.all), + NIP6(*(struct in6_addr *)t->dst.u3.all), ntohs(t->dst.u.all)); +#endif +} + +static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t) +{ + switch (t->src.l3num) { + case AF_INET: + nf_ct_dump_tuple_ip(t); + break; + case AF_INET6: + nf_ct_dump_tuple_ipv6(t); + break; + } +} + +#define NF_CT_DUMP_TUPLE(tp) nf_ct_dump_tuple(tp) /* If we're the first tuple, it's the original dir. */ #define NF_CT_DIRECTION(h) \ -- cgit v1.2.3 From 1d9d752259ab2e16b99f84b7e7bd4a30c884c289 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:07:58 -0700 Subject: [NETFILTER]: nf_conntrack_expect: constify nf_ct_expect_init arguments Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/net/netfilter/nf_conntrack_expect.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index cb608a1b44e..f1bdcb4f3f2 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h @@ -75,9 +75,9 @@ void nf_ct_unexpect_related(struct nf_conntrack_expect *exp); nf_ct_expect_related. You will have to call put afterwards. */ struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); void nf_ct_expect_init(struct nf_conntrack_expect *, int, - union nf_inet_addr *, - union nf_inet_addr *, - u_int8_t, __be16 *, __be16 *); + const union nf_inet_addr *, + const union nf_inet_addr *, + u_int8_t, const __be16 *, const __be16 *); void nf_ct_expect_put(struct nf_conntrack_expect *exp); int nf_ct_expect_related(struct nf_conntrack_expect *expect); -- cgit v1.2.3 From 359b9ab614aba71c2c3bc047efbd6d12dd4a2b9e Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:08:37 -0700 Subject: [NETFILTER]: nf_conntrack_expect: support inactive expectations This is useful for the SIP helper and signalling expectations. We don't want to create a full-blown expectation with a wildcard as source based on a single UDP packet, but need to know the final port anyways. With inactive expectations we can register the expectation and reserve the tuple, but wait for confirmation from the registrar before activating it. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/net/netfilter/nf_conntrack_expect.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index f1bdcb4f3f2..47c28dd0789 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h @@ -53,7 +53,8 @@ struct nf_conntrack_expect struct rcu_head rcu; }; -#define NF_CT_EXPECT_PERMANENT 0x1 +#define NF_CT_EXPECT_PERMANENT 0x1 +#define NF_CT_EXPECT_INACTIVE 0x2 int nf_conntrack_expect_init(void); void nf_conntrack_expect_fini(void); -- cgit v1.2.3 From 6002f266b3e7f0acc2d5158cddbed41730b02e82 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:09:15 -0700 Subject: [NETFILTER]: nf_conntrack: introduce expectation classes and policies Introduce expectation classes and policies. An expectation class is used to distinguish different types of expectations by the same helper (for example audio/video/t.120). The expectation policy is used to hold the maximum number of expectations and the initial timeout for each class. The individual classes are isolated from each other, which means that for example an audio expectation will only evict other audio expectations. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/net/netfilter/nf_conntrack.h | 5 ++++- include/net/netfilter/nf_conntrack_expect.h | 13 ++++++++++++- include/net/netfilter/nf_conntrack_helper.h | 5 ++--- 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 90b3e7f5df5..92287713359 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -75,6 +75,9 @@ do { \ struct nf_conntrack_helper; +/* Must be kept in sync with the classes defined by helpers */ +#define NF_CT_MAX_EXPECT_CLASSES 1 + /* nf_conn feature for connections that have a helper */ struct nf_conn_help { /* Helper. if any */ @@ -85,7 +88,7 @@ struct nf_conn_help { struct hlist_head expectations; /* Current number of expected connections */ - unsigned int expecting; + u8 expecting[NF_CT_MAX_EXPECT_CLASSES]; }; diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index 47c28dd0789..dfdf4b45947 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h @@ -41,6 +41,9 @@ struct nf_conntrack_expect /* Flags */ unsigned int flags; + /* Expectation class */ + unsigned int class; + #ifdef CONFIG_NF_NAT_NEEDED __be32 saved_ip; /* This is the original per-proto part, used to map the @@ -53,6 +56,14 @@ struct nf_conntrack_expect struct rcu_head rcu; }; +struct nf_conntrack_expect_policy +{ + unsigned int max_expected; + unsigned int timeout; +}; + +#define NF_CT_EXPECT_CLASS_DEFAULT 0 + #define NF_CT_EXPECT_PERMANENT 0x1 #define NF_CT_EXPECT_INACTIVE 0x2 @@ -75,7 +86,7 @@ void nf_ct_unexpect_related(struct nf_conntrack_expect *exp); /* Allocate space for an expectation: this is mandatory before calling nf_ct_expect_related. You will have to call put afterwards. */ struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); -void nf_ct_expect_init(struct nf_conntrack_expect *, int, +void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, int, const union nf_inet_addr *, const union nf_inet_addr *, u_int8_t, const __be16 *, const __be16 *); diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index 4ca125e9b3c..f8060ab5a08 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h @@ -20,9 +20,7 @@ struct nf_conntrack_helper const char *name; /* name of the module */ struct module *me; /* pointer to self */ - unsigned int max_expected; /* Maximum number of concurrent - * expected connections */ - unsigned int timeout; /* timeout for expecteds */ + const struct nf_conntrack_expect_policy *expect_policy; /* Tuple of things we will help (compared against server response) */ struct nf_conntrack_tuple tuple; @@ -37,6 +35,7 @@ struct nf_conntrack_helper void (*destroy)(struct nf_conn *ct); int (*to_nlattr)(struct sk_buff *skb, const struct nf_conn *ct); + unsigned int expect_class_max; }; extern struct nf_conntrack_helper * -- cgit v1.2.3 From b8beedd25d3913d45b8330a08ab88fdf90eb54b8 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:09:33 -0700 Subject: [NETFILTER]: Add nf_inet_addr_cmp() Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter.h | 9 +++++++++ include/net/netfilter/nf_conntrack_tuple.h | 15 +++------------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index f0680c2bee7..89e6c72ad29 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -61,6 +61,15 @@ union nf_inet_addr { #ifdef __KERNEL__ #ifdef CONFIG_NETFILTER +static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1, + const union nf_inet_addr *a2) +{ + return a1->all[0] == a2->all[0] && + a1->all[1] == a2->all[1] && + a1->all[2] == a2->all[2] && + a1->all[3] == a2->all[3]; +} + extern void netfilter_init(void); /* Largest hook number + 1 */ diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index d9b53dd601a..168c91754d8 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h @@ -163,10 +163,7 @@ struct nf_conntrack_tuple_hash static inline int __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, const struct nf_conntrack_tuple *t2) { - return (t1->src.u3.all[0] == t2->src.u3.all[0] && - t1->src.u3.all[1] == t2->src.u3.all[1] && - t1->src.u3.all[2] == t2->src.u3.all[2] && - t1->src.u3.all[3] == t2->src.u3.all[3] && + return (nf_inet_addr_cmp(&t1->src.u3, &t2->src.u3) && t1->src.u.all == t2->src.u.all && t1->src.l3num == t2->src.l3num); } @@ -174,10 +171,7 @@ static inline int __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, static inline int __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, const struct nf_conntrack_tuple *t2) { - return (t1->dst.u3.all[0] == t2->dst.u3.all[0] && - t1->dst.u3.all[1] == t2->dst.u3.all[1] && - t1->dst.u3.all[2] == t2->dst.u3.all[2] && - t1->dst.u3.all[3] == t2->dst.u3.all[3] && + return (nf_inet_addr_cmp(&t1->dst.u3, &t2->dst.u3) && t1->dst.u.all == t2->dst.u.all && t1->dst.protonum == t2->dst.protonum); } @@ -192,10 +186,7 @@ static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1, static inline int nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1, const struct nf_conntrack_tuple_mask *m2) { - return (m1->src.u3.all[0] == m2->src.u3.all[0] && - m1->src.u3.all[1] == m2->src.u3.all[1] && - m1->src.u3.all[2] == m2->src.u3.all[2] && - m1->src.u3.all[3] == m2->src.u3.all[3] && + return (nf_inet_addr_cmp(&m1->src.u3, &m2->src.u3) && m1->src.u.all == m2->src.u.all); } -- cgit v1.2.3 From 2a6cfb22ae002330d445f734668d9158db9e90de Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:16:54 -0700 Subject: [NETFILTER]: nf_conntrack_sip: adjust dptr and datalen after packet mangling After mangling the packet, the pointer to the data and the length of the data portion may change and need to be adjusted. Use double data pointers and a pointer to the length everywhere and add a helper function to the NAT helper for performing the adjustments. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 8e5ce1ca7bf..9d0dbfb2630 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -24,11 +24,13 @@ enum sip_header_pos { extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, enum ip_conntrack_info ctinfo, struct nf_conn *ct, - const char **dptr); + const char **dptr, + unsigned int *datalen); extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, enum ip_conntrack_info ctinfo, struct nf_conntrack_expect *exp, - const char *dptr); + const char **dptr, + unsigned int *datalen); extern int ct_sip_get_info(const struct nf_conn *ct, const char *dptr, size_t dlen, unsigned int *matchoff, -- cgit v1.2.3 From 212440a7d04a12ee13787afecc6c86c7fc4e6184 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:17:13 -0700 Subject: [NETFILTER]: nf_conntrack_sip: remove redundant function arguments The conntrack reference and ctinfo can be derived from the packet. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 9d0dbfb2630..b94de3d6030 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -22,15 +22,12 @@ enum sip_header_pos { }; extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, - enum ip_conntrack_info ctinfo, - struct nf_conn *ct, const char **dptr, unsigned int *datalen); extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, - enum ip_conntrack_info ctinfo, - struct nf_conntrack_expect *exp, const char **dptr, - unsigned int *datalen); + unsigned int *datalen, + struct nf_conntrack_expect *exp); extern int ct_sip_get_info(const struct nf_conn *ct, const char *dptr, size_t dlen, unsigned int *matchoff, -- cgit v1.2.3 From 3e9b4600b4e71beaa9d943251bfe9c25f6a97b8c Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:17:55 -0700 Subject: [NETFILTER]: nf_conntrack_sip: add seperate SDP header parsing function SDP and SIP headers are quite different, SIP can have continuation lines, leading and trailing whitespace after the colon and is mostly case-insensitive while SDP headers always begin on a new line and are followed by an equal sign and the value, without any whitespace. Introduce new SDP header parsing function and convert all users that used the SIP header parsing function. This will allow to properly deal with the special SIP cases in the SIP header parsing function later. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 49 ++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index b94de3d6030..9131cbc9b9d 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -13,12 +13,42 @@ enum sip_header_pos { POS_VIA, POS_CONTACT, POS_CONTENT, - POS_MEDIA, - POS_OWNER_IP4, - POS_CONNECTION_IP4, - POS_OWNER_IP6, - POS_CONNECTION_IP6, - POS_SDP_HEADER, +}; + +struct sip_header { + const char *name; + const char *cname; + const char *search; + unsigned int len; + unsigned int clen; + unsigned int slen; + int (*match_len)(const struct nf_conn *ct, + const char *dptr, const char *limit, + int *shift); +}; + +#define __SIP_HDR(__name, __cname, __search, __match) \ +{ \ + .name = (__name), \ + .len = sizeof(__name) - 1, \ + .cname = (__cname), \ + .clen = (__cname) ? sizeof(__cname) - 1 : 0, \ + .search = (__search), \ + .slen = (__search) ? sizeof(__search) - 1 : 0, \ + .match_len = (__match), \ +} + +#define SDP_HDR(__name, __search, __match) \ + __SIP_HDR(__name, NULL, __search, __match) + +enum sdp_header_types { + SDP_HDR_UNSPEC, + SDP_HDR_VERSION, + SDP_HDR_OWNER_IP4, + SDP_HDR_CONNECTION_IP4, + SDP_HDR_OWNER_IP6, + SDP_HDR_CONNECTION_IP6, + SDP_HDR_MEDIA, }; extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, @@ -36,5 +66,12 @@ extern int ct_sip_lnlen(const char *line, const char *limit); extern const char *ct_sip_search(const char *needle, const char *haystack, size_t needle_len, size_t haystack_len, int case_sensitive); + +extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr, + unsigned int dataoff, unsigned int datalen, + enum sdp_header_types type, + enum sdp_header_types term, + unsigned int *matchoff, unsigned int *matchlen); + #endif /* __KERNEL__ */ #endif /* __NF_CONNTRACK_SIP_H__ */ -- cgit v1.2.3 From ac3677406d4e36e86b1eb5a453997a3b3e0c089a Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:18:40 -0700 Subject: [NETFILTER]: nf_conntrack_sip: kill request URI "header" definitions The request URI is not a header and needs to be treated differently than real SIP headers. Add a seperate function for parsing it and get rid of the POS_REQ_URI/POS_REG_REQ_URI definitions. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 9131cbc9b9d..480b26f40ce 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -6,8 +6,6 @@ #define SIP_TIMEOUT 3600 enum sip_header_pos { - POS_REG_REQ_URI, - POS_REQ_URI, POS_FROM, POS_TO, POS_VIA, @@ -59,6 +57,9 @@ extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, unsigned int *datalen, struct nf_conntrack_expect *exp); +extern int ct_sip_parse_request(const struct nf_conn *ct, + const char *dptr, unsigned int datalen, + unsigned int *matchoff, unsigned int *matchlen); extern int ct_sip_get_info(const struct nf_conn *ct, const char *dptr, size_t dlen, unsigned int *matchoff, unsigned int *matchlen, enum sip_header_pos pos); -- cgit v1.2.3 From ea45f12a2766dae54e5426a23e8f4bafdbe2782e Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:18:57 -0700 Subject: [NETFILTER]: nf_conntrack_sip: parse SIP headers properly Introduce new function for SIP header parsing that properly deals with continuation lines and whitespace in headers and use it. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 480b26f40ce..ccc70142296 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -5,14 +5,6 @@ #define SIP_PORT 5060 #define SIP_TIMEOUT 3600 -enum sip_header_pos { - POS_FROM, - POS_TO, - POS_VIA, - POS_CONTACT, - POS_CONTENT, -}; - struct sip_header { const char *name; const char *cname; @@ -36,9 +28,20 @@ struct sip_header { .match_len = (__match), \ } +#define SIP_HDR(__name, __cname, __search, __match) \ + __SIP_HDR(__name, __cname, __search, __match) + #define SDP_HDR(__name, __search, __match) \ __SIP_HDR(__name, NULL, __search, __match) +enum sip_header_types { + SIP_HDR_FROM, + SIP_HDR_TO, + SIP_HDR_CONTACT, + SIP_HDR_VIA, + SIP_HDR_CONTENT_LENGTH, +}; + enum sdp_header_types { SDP_HDR_UNSPEC, SDP_HDR_VERSION, @@ -60,13 +63,10 @@ extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, extern int ct_sip_parse_request(const struct nf_conn *ct, const char *dptr, unsigned int datalen, unsigned int *matchoff, unsigned int *matchlen); -extern int ct_sip_get_info(const struct nf_conn *ct, const char *dptr, - size_t dlen, unsigned int *matchoff, - unsigned int *matchlen, enum sip_header_pos pos); -extern int ct_sip_lnlen(const char *line, const char *limit); -extern const char *ct_sip_search(const char *needle, const char *haystack, - size_t needle_len, size_t haystack_len, - int case_sensitive); +extern int ct_sip_get_header(const struct nf_conn *ct, const char *dptr, + unsigned int dataoff, unsigned int datalen, + enum sip_header_types type, + unsigned int *matchoff, unsigned int *matchlen); extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr, unsigned int dataoff, unsigned int datalen, -- cgit v1.2.3 From 05e3ced297fe755093140e7487e292fb7603316e Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:19:13 -0700 Subject: [NETFILTER]: nf_conntrack_sip: introduce SIP-URI parsing helper Introduce a helper function to parse a SIP-URI in a header value, optionally iterating through all headers of this kind. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index ccc70142296..87bc6f79efc 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -67,6 +67,11 @@ extern int ct_sip_get_header(const struct nf_conn *ct, const char *dptr, unsigned int dataoff, unsigned int datalen, enum sip_header_types type, unsigned int *matchoff, unsigned int *matchlen); +extern int ct_sip_parse_header_uri(const struct nf_conn *ct, const char *dptr, + unsigned int *dataoff, unsigned int datalen, + enum sip_header_types type, int *in_header, + unsigned int *matchoff, unsigned int *matchlen, + union nf_inet_addr *addr, __be16 *port); extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr, unsigned int dataoff, unsigned int datalen, -- cgit v1.2.3 From 624f8b7bba98c27a1464f5f858c4a861d5d3e8d7 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:19:30 -0700 Subject: [NETFILTER]: nf_nat_sip: get rid of text based header translation Use the URI parsing helper to get the numerical addresses and get rid of the text based header translation. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 87bc6f79efc..68a0d6a4173 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -62,7 +62,8 @@ extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, extern int ct_sip_parse_request(const struct nf_conn *ct, const char *dptr, unsigned int datalen, - unsigned int *matchoff, unsigned int *matchlen); + unsigned int *matchoff, unsigned int *matchlen, + union nf_inet_addr *addr, __be16 *port); extern int ct_sip_get_header(const struct nf_conn *ct, const char *dptr, unsigned int dataoff, unsigned int datalen, enum sip_header_types type, -- cgit v1.2.3 From 30f33e6dee80c6ded917f978e4f377d1069d519d Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:22:20 -0700 Subject: [NETFILTER]: nf_conntrack_sip: support method specific request/response handling Add support for per-method request/response handlers and perform SDP parsing for INVITE/UPDATE requests and for all informational and successful responses. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 68a0d6a4173..da93e80804c 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -5,6 +5,25 @@ #define SIP_PORT 5060 #define SIP_TIMEOUT 3600 +struct sip_handler { + const char *method; + unsigned int len; + int (*request)(struct sk_buff *skb, + const char **dptr, unsigned int *datalen, + unsigned int cseq); + int (*response)(struct sk_buff *skb, + const char **dptr, unsigned int *datalen, + unsigned int cseq, unsigned int code); +}; + +#define SIP_HANDLER(__method, __request, __response) \ +{ \ + .method = (__method), \ + .len = sizeof(__method) - 1, \ + .request = (__request), \ + .response = (__response), \ +} + struct sip_header { const char *name; const char *cname; @@ -35,6 +54,7 @@ struct sip_header { __SIP_HDR(__name, NULL, __search, __match) enum sip_header_types { + SIP_HDR_CSEQ, SIP_HDR_FROM, SIP_HDR_TO, SIP_HDR_CONTACT, -- cgit v1.2.3 From 2bbb21168a90c788e12fe722eb66f27e611e7df7 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:24:24 -0700 Subject: [NETFILTER]: nf_conntrack_sip: introduce URI and header parameter parsing helpers Introduce URI and header parameter parsing helpers. These are needed by the conntrack helper to parse expiration values in Contact: header parameters and by the NAT helper to properly update the Via-header rport=, received= and maddr= parameters. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index da93e80804c..87e402825db 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -93,6 +93,16 @@ extern int ct_sip_parse_header_uri(const struct nf_conn *ct, const char *dptr, enum sip_header_types type, int *in_header, unsigned int *matchoff, unsigned int *matchlen, union nf_inet_addr *addr, __be16 *port); +extern int ct_sip_parse_address_param(const struct nf_conn *ct, const char *dptr, + unsigned int dataoff, unsigned int datalen, + const char *name, + unsigned int *matchoff, unsigned int *matchlen, + union nf_inet_addr *addr); +extern int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr, + unsigned int off, unsigned int datalen, + const char *name, + unsigned int *matchoff, unsigned int *matchen, + unsigned int *val); extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr, unsigned int dataoff, unsigned int datalen, -- cgit v1.2.3 From 0f32a40fc91a9ebbbf66e826ac2a829ab37d9cf8 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:25:13 -0700 Subject: [NETFILTER]: nf_conntrack_sip: create signalling expectations Create expectations for incoming signalling connections when seeing a REGISTER request. This is needed when the registrar uses a different source port number for signalling messages and for receiving incoming calls from other endpoints than the registrar. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 18 ++++++++++++++++++ include/net/netfilter/nf_conntrack.h | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 87e402825db..7cc84ed0c5d 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -5,6 +5,17 @@ #define SIP_PORT 5060 #define SIP_TIMEOUT 3600 +struct nf_ct_sip_master { + unsigned int register_cseq; +}; + +enum sip_expectation_classes { + SIP_EXPECT_SIGNALLING, + SIP_EXPECT_AUDIO, + __SIP_EXPECT_MAX +}; +#define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1) + struct sip_handler { const char *method; unsigned int len; @@ -59,6 +70,7 @@ enum sip_header_types { SIP_HDR_TO, SIP_HDR_CONTACT, SIP_HDR_VIA, + SIP_HDR_EXPIRES, SIP_HDR_CONTENT_LENGTH, }; @@ -75,6 +87,12 @@ enum sdp_header_types { extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, const char **dptr, unsigned int *datalen); +extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, + const char **dptr, + unsigned int *datalen, + struct nf_conntrack_expect *exp, + unsigned int matchoff, + unsigned int matchlen); extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, const char **dptr, unsigned int *datalen, diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 92287713359..4a4f870d2a5 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -46,6 +46,7 @@ union nf_conntrack_expect_proto { #include #include #include +#include /* per conntrack: application helper private data */ union nf_conntrack_help { @@ -54,6 +55,7 @@ union nf_conntrack_help { struct nf_ct_pptp_master ct_pptp_info; struct nf_ct_h323_master ct_h323_info; struct nf_ct_sane_master ct_sane_info; + struct nf_ct_sip_master ct_sip_info; }; #include @@ -76,7 +78,7 @@ do { \ struct nf_conntrack_helper; /* Must be kept in sync with the classes defined by helpers */ -#define NF_CT_MAX_EXPECT_CLASSES 1 +#define NF_CT_MAX_EXPECT_CLASSES 2 /* nf_conn feature for connections that have a helper */ struct nf_conn_help { -- cgit v1.2.3 From a9c1d35917c0c95c8f95a8e497fb91e301419693 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:25:49 -0700 Subject: [NETFILTER]: nf_conntrack_sip: create RTCP expectations Create expectations for the RTCP connections in addition to RTP connections. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 7cc84ed0c5d..6ddf95f51fb 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -96,7 +96,8 @@ extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, const char **dptr, unsigned int *datalen, - struct nf_conntrack_expect *exp); + struct nf_conntrack_expect *rtp_exp, + struct nf_conntrack_expect *rtcp_exp); extern int ct_sip_parse_request(const struct nf_conn *ct, const char *dptr, unsigned int datalen, -- cgit v1.2.3 From 4ab9e64e5e3c0516577818804aaf13a630d67bc9 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:26:08 -0700 Subject: [NETFILTER]: nf_nat_sip: split up SDP mangling The SDP connection addresses may be contained in the payload multiple times (in the session description and/or once per media description), currently only the session description is properly updated. Split up SDP mangling so the function setting up expectations only updates the media port, update connection addresses from media descriptions while parsing them and at the end update the session description when the final addresses are known. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 6ddf95f51fb..eca3ad3f28d 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -93,11 +93,26 @@ extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb, struct nf_conntrack_expect *exp, unsigned int matchoff, unsigned int matchlen); -extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, - const char **dptr, - unsigned int *datalen, - struct nf_conntrack_expect *rtp_exp, - struct nf_conntrack_expect *rtcp_exp); +extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, + const char **dptr, + unsigned int dataoff, + unsigned int *datalen, + enum sdp_header_types type, + enum sdp_header_types term, + const union nf_inet_addr *addr); +extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb, + const char **dptr, + unsigned int dataoff, + unsigned int *datalen, + const union nf_inet_addr *addr); +extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb, + const char **dptr, + unsigned int *datalen, + struct nf_conntrack_expect *rtp_exp, + struct nf_conntrack_expect *rtcp_exp, + unsigned int mediaoff, + unsigned int medialen, + union nf_inet_addr *rtp_addr); extern int ct_sip_parse_request(const struct nf_conn *ct, const char *dptr, unsigned int datalen, -- cgit v1.2.3 From 0d0ab0378d67517a4f4ae3497706c13d9dd24af1 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:26:24 -0700 Subject: [NETFILTER]: nf_conntrack_sip: support multiple media channels Add support for multiple media channels and use it to create expectations for video streams when present. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 14 ++++++++++++++ include/net/netfilter/nf_conntrack.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index eca3ad3f28d..71fa3eb5f48 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -12,10 +12,24 @@ struct nf_ct_sip_master { enum sip_expectation_classes { SIP_EXPECT_SIGNALLING, SIP_EXPECT_AUDIO, + SIP_EXPECT_VIDEO, __SIP_EXPECT_MAX }; #define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1) +struct sdp_media_type { + const char *name; + unsigned int len; + enum sip_expectation_classes class; +}; + +#define SDP_MEDIA_TYPE(__name, __class) \ +{ \ + .name = (__name), \ + .len = sizeof(__name) - 1, \ + .class = (__class), \ +} + struct sip_handler { const char *method; unsigned int len; diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 4a4f870d2a5..a3567a7a6d6 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -78,7 +78,7 @@ do { \ struct nf_conntrack_helper; /* Must be kept in sync with the classes defined by helpers */ -#define NF_CT_MAX_EXPECT_CLASSES 2 +#define NF_CT_MAX_EXPECT_CLASSES 3 /* nf_conn feature for connections that have a helper */ struct nf_conn_help { -- cgit v1.2.3 From c7f485abd618e0d249bdd1abdc586bd10fee1954 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 25 Mar 2008 20:26:43 -0700 Subject: [NETFILTER]: nf_conntrack_sip: RTP routing optimization Optimize call routing between NATed endpoints: when an external registrar sends a media description that contains an existing RTP expectation from a different SNATed connection, the gatekeeper is trying to route the call directly between the two endpoints. We assume both endpoints can reach each other directly and "un-NAT" the addresses, which makes the media stream go between the two endpoints directly. Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/netfilter/nf_conntrack_sip.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h index 71fa3eb5f48..5da04e586a3 100644 --- a/include/linux/netfilter/nf_conntrack_sip.h +++ b/include/linux/netfilter/nf_conntrack_sip.h @@ -114,6 +114,12 @@ extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb, enum sdp_header_types type, enum sdp_header_types term, const union nf_inet_addr *addr); +extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb, + const char **dptr, + unsigned int *datalen, + unsigned int matchoff, + unsigned int matchlen, + u_int16_t port); extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb, const char **dptr, unsigned int dataoff, -- cgit v1.2.3 From 9c2f5746b9cd536f0007709196d85a7e7d0070fa Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Wed, 26 Mar 2008 00:47:14 -0700 Subject: [NETNS]: Compilation fix for include/linux/netdevice.h. Commit commit c346dca10840a874240c78efe3f39acf4312a1f2 ([NET] NETNS: Omit net_device->nd_net without CONFIG_NET_NS) breaks compilation with CONFIG_NET_NS set. Fix the typo. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/linux/netdevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index d146be40f46..06ca84d71db 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -756,7 +756,7 @@ static inline void dev_net_set(struct net_device *dev, const struct net *net) { #ifdef CONFIG_NET_NS - dev->nd_dev = net; + dev->nd_net = net; #endif } -- cgit v1.2.3 From f5aa23fd49063745f85644dd7a9330acd706add6 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Wed, 26 Mar 2008 00:48:17 -0700 Subject: [NETNS]: Compilation warnings under CONFIG_NET_NS. Recent commits from YOSHIFUJI Hideaki have been introduced a several compilation warnings 'assignment discards qualifiers from pointer target type' due to extra const modifier in the inline call parameters of {dev|sock|twsk}_net_set. Drop it. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/linux/netdevice.h | 2 +- include/net/inet_timewait_sock.h | 2 +- include/net/sock.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 06ca84d71db..15fa84a15c2 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -753,7 +753,7 @@ struct net *dev_net(const struct net_device *dev) } static inline -void dev_net_set(struct net_device *dev, const struct net *net) +void dev_net_set(struct net_device *dev, struct net *net) { #ifdef CONFIG_NET_NS dev->nd_net = net; diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 07fe0d1a4f0..95c660c9719 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h @@ -219,7 +219,7 @@ struct net *twsk_net(const struct inet_timewait_sock *twsk) } static inline -void twsk_net_set(struct inet_timewait_sock *twsk, const struct net *net) +void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net) { #ifdef CONFIG_NET_NS twsk->tw_net = net; diff --git a/include/net/sock.h b/include/net/sock.h index 7e0d4a0c4d1..1c9d059223e 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1358,7 +1358,7 @@ struct net *sock_net(const struct sock *sk) } static inline -void sock_net_set(struct sock *sk, const struct net *net) +void sock_net_set(struct sock *sk, struct net *net) { #ifdef CONFIG_NET_NS sk->sk_net = net; -- cgit v1.2.3 From a24022e1887978decaa28fb11d1ddff63e31497f Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Wed, 26 Mar 2008 01:55:37 -0700 Subject: [NETNS][ICMP]: Move ICMP sysctls on struct net. Initialization is moved to icmp_sk_init, all the places, that refer to them use init_net for now. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/icmp.h | 7 ------- include/net/netns/ipv4.h | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/net/icmp.h b/include/net/icmp.h index faba64db8ff..dddb839ff4b 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h @@ -65,11 +65,4 @@ static inline struct raw_sock *raw_sk(const struct sock *sk) return (struct raw_sock *)sk; } -extern int sysctl_icmp_echo_ignore_all; -extern int sysctl_icmp_echo_ignore_broadcasts; -extern int sysctl_icmp_ignore_bogus_error_responses; -extern int sysctl_icmp_errors_use_inbound_ifaddr; -extern int sysctl_icmp_ratelimit; -extern int sysctl_icmp_ratemask; - #endif /* _ICMP_H */ diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 504fde17452..e3de0ff8ea4 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -35,5 +35,12 @@ struct netns_ipv4 { struct xt_table *iptable_raw; struct xt_table *arptable_filter; #endif + + int sysctl_icmp_echo_ignore_all; + int sysctl_icmp_echo_ignore_broadcasts; + int sysctl_icmp_ignore_bogus_error_responses; + int sysctl_icmp_ratelimit; + int sysctl_icmp_ratemask; + int sysctl_icmp_errors_use_inbound_ifaddr; }; #endif -- cgit v1.2.3 From 68528f09980a60c8df046d16336333cac4fc0c32 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Wed, 26 Mar 2008 01:56:24 -0700 Subject: [NETNS][ICMP]: Make ctl tables for ICMP sysctls per-net. Add some flesh to ipv4_sysctl_init_net and ipv4_sysctl_exit_net, i.e. copy the table, alter .data pointers and register it per-net. Other ipv4_table's sysctls are now global, but this is going to change once sysctl permissions patches migrate from -mm tree to mainline in 2.6.26 merge window :) Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/netns/ipv4.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index e3de0ff8ea4..af685f71f4b 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -17,6 +17,7 @@ struct netns_ipv4 { #ifdef CONFIG_SYSCTL struct ctl_table_header *forw_hdr; struct ctl_table_header *frags_hdr; + struct ctl_table_header *ipv4_hdr; #endif struct ipv4_devconf *devconf_all; struct ipv4_devconf *devconf_dflt; -- cgit v1.2.3 From 67727184f28c38d06013c6659560bb046c1d9f9c Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Wed, 26 Mar 2008 16:27:22 -0700 Subject: [VLAN]: Reduce memory consumed by vlan_groups Currently each vlan_groupd contains 8 pointers on arrays with 512 pointers on struct net_device each :) Such a construction "in many cases ... wastes memory". My proposal is to allow for some of these arrays pointers be NULL, meaning that there are no devices in it. When a new device is added to the vlan_group, the appropriate array is allocated. The check in vlan_group_get_device's is safe, since the pointer vg->vlan_devices_arrays[x] can only switch from NULL to not-NULL. The vlan_group_prealloc_vid() is guarded with rtnl lock and is also safe. I've checked (I hope that) all the places, that use these arrays and found, that the register_vlan_dev is the only place, that can put a vlan device on an empty vlan_group. Rough calculations shows, that after the patch a setup with a single vlan dev (or up to 512 vlans with sequential vids) will occupy approximately 8 times less memory. The question I have is - does this patch makes sense, or a totally new structures are required to store the vlan_devs? Signed-off-by: Pavel Emelyanov Signed-off-by: Patrick McHardy --- include/linux/if_vlan.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 79504b22a93..edd55af7ebd 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -93,7 +93,7 @@ static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, { struct net_device **array; array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; - return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN]; + return array ? array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] : NULL; } static inline void vlan_group_set_device(struct vlan_group *vg, -- cgit v1.2.3 From 6ab57e7e7fa316552d0f94eaebf1def1d49f18da Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Wed, 26 Mar 2008 16:52:32 -0700 Subject: [NETNS][IPV6] anycast - handle several network namespace Make use of the network namespace information to have this protocol to handle several network namespace. Signed-off-by: Daniel Lezcano Signed-off-by: Benjamin Thery Signed-off-by: David S. Miller --- include/net/addrconf.h | 3 ++- include/net/ipv6.h | 17 ++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/net/addrconf.h b/include/net/addrconf.h index c9276c72764..d0c47c30604 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -134,7 +134,8 @@ extern int inet6_ac_check(struct sock *sk, struct in6_addr *addr, int ifindex); extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr); extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr); -extern int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr); +extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, + struct in6_addr *addr); /* Device notifier */ diff --git a/include/net/ipv6.h b/include/net/ipv6.h index e82f1814d96..1c98e737dbd 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -591,8 +591,8 @@ extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, int __user *optlen); #ifdef CONFIG_PROC_FS -extern int ac6_proc_init(void); -extern void ac6_proc_exit(void); +extern int ac6_proc_init(struct net *net); +extern void ac6_proc_exit(struct net *net); extern int raw6_proc_init(void); extern void raw6_proc_exit(void); extern int tcp6_proc_init(struct net *net); @@ -607,15 +607,10 @@ extern int snmp6_register_dev(struct inet6_dev *idev); extern int snmp6_unregister_dev(struct inet6_dev *idev); #else -static inline int snmp6_register_dev(struct inet6_dev *idev) -{ - return 0; -} - -static inline int snmp6_unregister_dev(struct inet6_dev *idev) -{ - return 0; -} +static inline int ac6_proc_init(struct net *net) { return 0; } +static inline void ac6_proc_exit(struct net *net) { } +static inline int snmp6_register_dev(struct inet6_dev *idev) { return 0; } +static inline int snmp6_unregister_dev(struct inet6_dev *idev) { return 0; } #endif #ifdef CONFIG_SYSCTL -- cgit v1.2.3 From 60e8fbc4c53d3ef0cbffa393a9e7b77e2a1bae58 Mon Sep 17 00:00:00 2001 From: Benjamin Thery Date: Wed, 26 Mar 2008 16:53:08 -0700 Subject: [NETNS][IPV6] flowlabels - make flowlabels per namespace This patch introduces a new member, fl_net, in struct ip6_flowlabel. This allows to create labels with the same value in different namespaces. Signed-off-by: Benjamin Thery Signed-off-by: Daniel Lezcano Signed-off-by: David S. Miller --- include/net/ipv6.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 1c98e737dbd..296f61d8470 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -202,6 +202,7 @@ struct ip6_flowlabel u32 owner; unsigned long lastuse; unsigned long expires; + struct net *fl_net; }; #define IPV6_FLOWINFO_MASK __constant_htonl(0x0FFFFFFF) -- cgit v1.2.3 From 6c507cd0400cb51dd2ee251c1b8756b9375a1128 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 26 Mar 2008 14:14:55 +0100 Subject: cfg80211: don't export ieee80211_get_channel This patch makes ieee80211_get_channel a static inline defined in cfg80211's header file which simply calls __ieee80211_get_channel to avoid symbol clashes with the ieee80211 code. The problem was pointed out by David Miller, thanks! Signed-off-by: Johannes Berg Cc: David Miller Signed-off-by: John W. Linville --- include/net/wireless.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/net/wireless.h b/include/net/wireless.h index f4b77ab66ba..667b4080d30 100644 --- a/include/net/wireless.h +++ b/include/net/wireless.h @@ -304,10 +304,22 @@ extern int ieee80211_channel_to_frequency(int chan); */ extern int ieee80211_frequency_to_channel(int freq); +/* + * Name indirection necessary because the ieee80211 code also has + * a function named "ieee80211_get_channel", so if you include + * cfg80211's header file you get cfg80211's version, if you try + * to include both header files you'll (rightfully!) get a symbol + * clash. + */ +extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, + int freq); + /** * ieee80211_get_channel - get channel struct from wiphy for specified frequency */ -extern struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, - int freq); - +static inline struct ieee80211_channel * +ieee80211_get_channel(struct wiphy *wiphy, int freq) +{ + return __ieee80211_get_channel(wiphy, freq); +} #endif /* __NET_WIRELESS_H */ -- cgit v1.2.3 From 0e5f8be1388093edc324a78ebf241170b258eba3 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 27 Mar 2008 14:25:53 -0700 Subject: [NETNS]: Compile NET /proc support only if CONFIG_NET is set. This fix broken compilation for 'allnoconfig'. This was introduced by Introduced by commit 1218854afa6f659be90b748cf1bc7badee954a35 ("[NET] NETNS: Omit seq_net_private->net without CONFIG_NET_NS.") Signed-off-by: Denis V. Lunev Acked-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- include/linux/seq_file.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index d870a825376..5da70c3f441 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -63,6 +63,7 @@ extern struct list_head *seq_list_start_head(struct list_head *head, extern struct list_head *seq_list_next(void *v, struct list_head *head, loff_t *ppos); +#ifdef CONFIG_NET struct net; struct seq_net_private { #ifdef CONFIG_NET_NS @@ -81,6 +82,7 @@ static inline struct net *seq_file_net(struct seq_file *seq) return &init_net; #endif } +#endif /* CONFIG_NET */ #endif #endif -- cgit v1.2.3 From 09382bac667821017144de6b733a26f29a1c185b Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 27 Mar 2008 16:53:37 -0700 Subject: [PKT_SCHED]: Pass real namespace in net scheduler classifiers. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/pkt_cls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index d349c66ef82..aa9e282db48 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -353,7 +353,7 @@ tcf_match_indev(struct sk_buff *skb, char *indev) if (indev[0]) { if (!skb->iif) return 0; - dev = __dev_get_by_index(&init_net, skb->iif); + dev = __dev_get_by_index(dev_net(skb->dev), skb->iif); if (!dev || strcmp(indev, dev->name)) return 0; } -- cgit v1.2.3 From 4f95165d4bf6369d57052d60cc0266c569c6b077 Mon Sep 17 00:00:00 2001 From: Rami Rosen Date: Thu, 27 Mar 2008 17:39:19 -0700 Subject: [IPV6]: Remove three unused method declarations in include/net/ipv6.h This patch removes three unused method declarations in include/net/ipv6.h: inet_getfrag_t(), ipv6_build_nfrag_opts() and ipv6_build_frag_opts(). Signed-off-by: Rami Rosen Signed-off-by: David S. Miller --- include/net/ipv6.h | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'include') diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 296f61d8470..5738c1c73ac 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -250,15 +250,6 @@ int ip6_frag_mem(struct net *net); #define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ -/* - * Function prototype for build_xmit - */ - -typedef int (*inet_getfrag_t) (const void *data, - struct in6_addr *addr, - char *, - unsigned int, unsigned int); - extern int __ipv6_addr_type(const struct in6_addr *addr); static inline int ipv6_addr_type(const struct in6_addr *addr) { @@ -510,14 +501,6 @@ extern int ip6_local_out(struct sk_buff *skb); * Extension header (options) processing */ -extern u8 * ipv6_build_nfrag_opts(struct sk_buff *skb, - u8 *prev_hdr, - struct ipv6_txoptions *opt, - struct in6_addr *daddr, - u32 jumbolen); -extern u8 * ipv6_build_frag_opts(struct sk_buff *skb, - u8 *prev_hdr, - struct ipv6_txoptions *opt); extern void ipv6_push_nfrag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt, u8 *proto, -- cgit v1.2.3 From 0dde3e16485dca16eb682dd59da1a598bf62e284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Thu, 27 Mar 2008 17:43:41 -0700 Subject: [NET]: uninline skb_put, de-bloats a lot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allyesconfig (v2.6.24-mm1): ~500 files changed ... 869 funcs, 198 +, 111003 -, diff: -110805 --- skb_put skb_put | +104 Without number of debug related CONFIGs (v2.6.25-rc2-mm1): -60744 855 funcs, 861 +, 61605 -, diff: -60744 --- skb_put skb_put | +57 Signed-off-by: Ilpo Järvinen Signed-off-by: David S. Miller --- include/linux/skbuff.h | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 7beb239d2ee..f085955cb5a 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -892,6 +892,7 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset) /* * Add data to an sk_buff */ +extern unsigned char *skb_put(struct sk_buff *skb, unsigned int len); static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) { unsigned char *tmp = skb_tail_pointer(skb); @@ -901,26 +902,6 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) return tmp; } -/** - * skb_put - add data to a buffer - * @skb: buffer to use - * @len: amount of data to add - * - * This function extends the used data area of the buffer. If this would - * exceed the total buffer size the kernel will panic. A pointer to the - * first byte of the extra data is returned. - */ -static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len) -{ - unsigned char *tmp = skb_tail_pointer(skb); - SKB_LINEAR_ASSERT(skb); - skb->tail += len; - skb->len += len; - if (unlikely(skb->tail > skb->end)) - skb_over_panic(skb, len, current_text_addr()); - return tmp; -} - static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) { skb->data -= len; -- cgit v1.2.3 From 6be8ac2fdc5e69dec53913a42312a92dbfbd4907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Thu, 27 Mar 2008 17:47:24 -0700 Subject: [NET]: uninline skb_pull, de-bloats a lot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allyesconfig (v2.6.24-mm1): -28162 354 funcs, 3005 +, 31167 -, diff: -28162 --- skb_pull Without number of debug related CONFIGs (v2.6.25-rc2-mm1): -9697 338 funcs, 221 +, 9918 -, diff: -9697 --- skb_pull skb_pull | +44 Signed-off-by: Ilpo Järvinen Signed-off-by: David S. Miller --- include/linux/skbuff.h | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index f085955cb5a..6d6cde7b243 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -927,6 +927,7 @@ static inline unsigned char *skb_push(struct sk_buff *skb, unsigned int len) return skb->data; } +extern unsigned char *skb_pull(struct sk_buff *skb, unsigned int len); static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) { skb->len -= len; @@ -934,21 +935,6 @@ static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) return skb->data += len; } -/** - * skb_pull - remove data from the start of a buffer - * @skb: buffer to use - * @len: amount of data to remove - * - * This function removes data from the start of a buffer, returning - * the memory to the headroom. A pointer to the next data in the buffer - * is returned. Once the data has been pulled future pushes will overwrite - * the old data. - */ -static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len) -{ - return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len); -} - extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) -- cgit v1.2.3 From f58518e678e5eef430c8d5cdcc7cd28d285f1980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Thu, 27 Mar 2008 17:51:31 -0700 Subject: [NET]: uninline dev_alloc_skb, de-bloats a lot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allyesconfig (v2.6.24-mm1): -23668 392 funcs, 104 +, 23772 -, diff: -23668 --- dev_alloc_skb Without many debug CONFIGs (v2.6.25-rc2-mm1): -12178 382 funcs, 157 +, 12335 -, diff: -12178 --- dev_alloc_skb dev_alloc_skb | +37 Signed-off-by: Ilpo Järvinen Signed-off-by: David S. Miller --- include/linux/skbuff.h | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 6d6cde7b243..01a11b0c029 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1272,22 +1272,7 @@ static inline struct sk_buff *__dev_alloc_skb(unsigned int length, return skb; } -/** - * dev_alloc_skb - allocate an skbuff for receiving - * @length: length to allocate - * - * Allocate a new &sk_buff and assign it a usage count of one. The - * buffer has unspecified headroom built in. Users should allocate - * the headroom they think they need without accounting for the - * built in space. The built in space is used for optimisations. - * - * %NULL is returned if there is no free memory. Although this function - * allocates memory it can be called from an interrupt. - */ -static inline struct sk_buff *dev_alloc_skb(unsigned int length) -{ - return __dev_alloc_skb(length, GFP_ATOMIC); -} +extern struct sk_buff *dev_alloc_skb(unsigned int length); extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int length, gfp_t gfp_mask); -- cgit v1.2.3 From c2aa270ad73d385bd6cdebf5d741bdf18a3e17ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Thu, 27 Mar 2008 17:52:40 -0700 Subject: [NET]: uninline skb_push, de-bloats a lot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allyesconfig (v2.6.24-mm1): -21593 356 funcs, 2418 +, 24011 -, diff: -21593 --- skb_push Without many debug related CONFIGs (v2.6.25-rc2-mm1): -13890 341 funcs, 189 +, 14079 -, diff: -13890 --- skb_push skb_push | +46 Signed-off-by: Ilpo Järvinen Signed-off-by: David S. Miller --- include/linux/skbuff.h | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 01a11b0c029..1baf4d43bb2 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -902,6 +902,7 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) return tmp; } +extern unsigned char *skb_push(struct sk_buff *skb, unsigned int len); static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) { skb->data -= len; @@ -909,24 +910,6 @@ static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) return skb->data; } -/** - * skb_push - add data to the start of a buffer - * @skb: buffer to use - * @len: amount of data to add - * - * This function extends the used data area of the buffer at the buffer - * start. If this would exceed the total buffer headroom the kernel will - * panic. A pointer to the first byte of the extra data is returned. - */ -static inline unsigned char *skb_push(struct sk_buff *skb, unsigned int len) -{ - skb->data -= len; - skb->len += len; - if (unlikely(skb->datahead)) - skb_under_panic(skb, len, current_text_addr()); - return skb->data; -} - extern unsigned char *skb_pull(struct sk_buff *skb, unsigned int len); static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) { -- cgit v1.2.3 From 8d3308687f7f1eaa1bb5d202d14752d5f90068eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Thu, 27 Mar 2008 17:53:31 -0700 Subject: [NET]: uninline dst_release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codiff stats (allyesconfig, v2.6.24-mm1): -16420 187 funcs, 103 +, 16523 -, diff: -16420 --- dst_release Without number of debug related CONFIGs (v2.6.25-rc2-mm1): -7257 186 funcs, 70 +, 7327 -, diff: -7257 --- dst_release dst_release | +40 Signed-off-by: Ilpo Järvinen Signed-off-by: David S. Miller --- include/net/dst.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'include') diff --git a/include/net/dst.h b/include/net/dst.h index ae13370e848..002500e631f 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -163,15 +163,7 @@ struct dst_entry * dst_clone(struct dst_entry * dst) return dst; } -static inline -void dst_release(struct dst_entry * dst) -{ - if (dst) { - WARN_ON(atomic_read(&dst->__refcnt) < 1); - smp_mb__before_atomic_dec(); - atomic_dec(&dst->__refcnt); - } -} +extern void dst_release(struct dst_entry *dst); /* Children define the path of the packet through the * Linux networking. Thus, destinations are stackable. -- cgit v1.2.3 From 419ae74ecc9494e58928a5c6652f4c072f3ca744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Thu, 27 Mar 2008 17:54:01 -0700 Subject: [NET]: uninline skb_trim, de-bloats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allyesconfig (v2.6.24-mm1): -10976 209 funcs, 123 +, 11099 -, diff: -10976 --- skb_trim Without number of debug related CONFIGs (v2.6.25-rc2-mm1): -7360 192 funcs, 131 +, 7491 -, diff: -7360 --- skb_trim skb_trim | +42 Signed-off-by: Ilpo Järvinen Signed-off-by: David S. Miller --- include/linux/skbuff.h | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 1baf4d43bb2..ff72145d5d9 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1158,21 +1158,7 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len) skb_set_tail_pointer(skb, len); } -/** - * skb_trim - remove end from a buffer - * @skb: buffer to alter - * @len: new length - * - * Cut the length of a buffer down by removing data from the tail. If - * the buffer is already under the length specified it is not modified. - * The skb must be linear. - */ -static inline void skb_trim(struct sk_buff *skb, unsigned int len) -{ - if (skb->len > len) - __skb_trim(skb, len); -} - +extern void skb_trim(struct sk_buff *skb, unsigned int len); static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) { -- cgit v1.2.3 From bc09dff198e67a98a82c42000006b39f6d502031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Thu, 27 Mar 2008 17:54:29 -0700 Subject: [SCTP]: Remove sctp_add_cmd_sf wrapper bloat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With a was number of callsites sctp_add_cmd_sf wrapper bloats kernel by some amount. Due to unlikely tracking allyesconfig, with the initial result were around ~7kB (thus caught my attention) while a non-debug config produced only ~2.3kB effect. I (ij) proposed first a patch to uninline it but Vlad responded with a patch that removed the only sctp_add_cmd call which is wrapped by sctp_add_cmd_sf (I wasn't sure if I could do that). I did minor cleanup to Vlad's patch. Signed-off-by: Ilpo Järvinen Signed-off-by: Vlad Yasevich Signed-off-by: David S. Miller --- include/net/sctp/command.h | 3 +-- include/net/sctp/sm.h | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) (limited to 'include') diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index 10ae2da6f93..4263af85779 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h @@ -205,12 +205,11 @@ typedef struct { int sctp_init_cmd_seq(sctp_cmd_seq_t *seq); /* Add a command to an sctp_cmd_seq_t. - * Return 0 if the command sequence is full. * * Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above * to wrap data which goes in the obj argument. */ -int sctp_add_cmd(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj); +void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj); /* Return the next command structure in an sctp_cmd_seq. * Return NULL at the end of the sequence. diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index ef9e7ed2c82..24811732bdb 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h @@ -385,14 +385,6 @@ static inline int ADDIP_SERIAL_gte(__u16 s, __u16 t) return (((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT)); } - -/* Run sctp_add_cmd() generating a BUG() if there is a failure. */ -static inline void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj) -{ - if (unlikely(!sctp_add_cmd(seq, verb, obj))) - BUG(); -} - /* Check VTAG of the packet matches the sender's own tag. */ static inline int sctp_vtag_verify(const struct sctp_chunk *chunk, -- cgit v1.2.3 From 1567ca7eec7664b8be3b07755ac59dc1b1ec76cb Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Fri, 28 Mar 2008 15:53:11 -0700 Subject: [NET]: Protect device namespace inlines with CONFIG_NET Include sites should not be bothered by whether CONFIG_NET is set or not when trying to include benign files like linux/etherdevice.h et al. From a report by Stephen Rothwell. Signed-off-by: David S. Miller --- include/linux/netdevice.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 3b54f8a2c05..8576ca928da 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -741,6 +741,7 @@ struct net_device #define NETDEV_ALIGN 32 #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) +#ifdef CONFIG_NET /* * Net namespace inlines */ @@ -761,6 +762,7 @@ void dev_net_set(struct net_device *dev, struct net *net) dev->nd_net = net; #endif } +#endif /** * netdev_priv - access network device private data -- cgit v1.2.3 From be2ce06b4962658d807410e58f7c6b739dc6a0c3 Mon Sep 17 00:00:00 2001 From: Rami Rosen Date: Fri, 28 Mar 2008 16:26:45 -0700 Subject: [IPV6]: Remove unused method declaration in include/net/addrconf.h. This patches removes unused declaration of addrconf_forwarding_on() method in include/net/addrconf.h. Signed-off-by: Rami Rosen Signed-off-by: David S. Miller --- include/net/addrconf.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/net/addrconf.h b/include/net/addrconf.h index d0c47c30604..d89b0bc7ab7 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -185,7 +185,6 @@ static inline void in6_ifa_put(struct inet6_ifaddr *ifp) #define in6_ifa_hold(ifp) atomic_inc(&(ifp)->refcnt) -extern void addrconf_forwarding_on(void); /* * Hash function taken from net_alias.c */ -- cgit v1.2.3 From bc578a54f0fd489d0722303f9a52508495ccaf9a Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Fri, 28 Mar 2008 16:35:27 -0700 Subject: [NET]: Rename inet_frag.h identifiers COMPLETE, FIRST_IN, LAST_IN to INET_FRAG_* On Fri, 2008-03-28 at 03:24 -0700, Andrew Morton wrote: > they should all be renamed. Done for include/net and net Signed-off-by: Joe Perches Signed-off-by: David S. Miller --- include/net/inet_frag.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 7374251b978..e081eefd6f4 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h @@ -25,9 +25,9 @@ struct inet_frag_queue { int meat; __u8 last_in; /* first/last segment arrived? */ -#define COMPLETE 4 -#define FIRST_IN 2 -#define LAST_IN 1 +#define INET_FRAG_COMPLETE 4 +#define INET_FRAG_FIRST_IN 2 +#define INET_FRAG_LAST_IN 1 }; #define INETFRAGS_HASHSZ 64 -- cgit v1.2.3 From 13ff3d6fa4e6d8b6ee7c64245a0078e6a0e6f977 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 28 Mar 2008 16:38:17 -0700 Subject: [SOCK]: Enumerate struct proto-s to facilitate percpu inuse accounting (v2). The inuse counters are going to become a per-cpu array. Introduce an index for this array on the struct proto. To handle the case of proto register-unregister-register loop the bitmap is used. All its bits manipulations are protected with proto_list_lock and a sanity check for the bitmap being exhausted is also added. Signed-off-by: Pavel Emelyanov Acked-by: Eric Dumazet Signed-off-by: David S. Miller --- include/net/sock.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index 1c9d059223e..abc6341f536 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -562,6 +562,7 @@ struct proto { /* Keeping track of sockets in use */ #ifdef CONFIG_PROC_FS + unsigned int inuse_idx; struct pcounter inuse; #endif -- cgit v1.2.3 From 1338d466d9c3f8a65cc6d83c629cd906f2a989f8 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 28 Mar 2008 16:38:43 -0700 Subject: [SOCK]: Introduce a percpu inuse counters array (v2). And redirect sock_prot_inuse_add and _get to use one. As far as the dereferences are concerned. Before the patch we made 1 dereference to proto->inuse.add call, the call itself and then called the __get_cpu_var() on a static variable. After the patch we make a direct call, then one dereference to proto->inuse_idx and then the same __get_cpu_var() on a still static variable. So this patch doesn't seem to produce performance penalty on SMP. This is not per-net yet, but I will deliberately make NET_NS=y case separated from NET_NS=n one, since it'll cost us one-or-two more dereferences to get the struct net and the inuse counter. Signed-off-by: Pavel Emelyanov Acked-by: Eric Dumazet Signed-off-by: David S. Miller --- include/net/sock.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index abc6341f536..ebf9552664b 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -639,18 +639,15 @@ static inline void sk_refcnt_debug_release(const struct sock *sk) # define DEFINE_PROTO_INUSE(NAME) DEFINE_PCOUNTER(NAME) # define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse) /* Called with local bh disabled */ -static inline void sock_prot_inuse_add(struct proto *prot, int inc) -{ - pcounter_add(&prot->inuse, inc); -} +extern void sock_prot_inuse_add(struct proto *prot, int inc); + static inline int sock_prot_inuse_init(struct proto *proto) { return pcounter_alloc(&proto->inuse); } -static inline int sock_prot_inuse_get(struct proto *proto) -{ - return pcounter_getval(&proto->inuse); -} + +extern int sock_prot_inuse_get(struct proto *proto); + static inline void sock_prot_inuse_free(struct proto *proto) { pcounter_free(&proto->inuse); -- cgit v1.2.3 From 60e7663d462af3994f292cb3691ea4f7371a9220 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 28 Mar 2008 16:39:10 -0700 Subject: [SOCK]: Drop per-proto inuse init and fre functions (v2). Constructive part of the set is finished here. We have to remove the pcounter, so start with its init and free functions. Signed-off-by: Pavel Emelyanov Acked-by: Eric Dumazet Signed-off-by: David S. Miller --- include/net/sock.h | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index ebf9552664b..1f4294252dd 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -640,31 +640,13 @@ static inline void sk_refcnt_debug_release(const struct sock *sk) # define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse) /* Called with local bh disabled */ extern void sock_prot_inuse_add(struct proto *prot, int inc); - -static inline int sock_prot_inuse_init(struct proto *proto) -{ - return pcounter_alloc(&proto->inuse); -} - extern int sock_prot_inuse_get(struct proto *proto); - -static inline void sock_prot_inuse_free(struct proto *proto) -{ - pcounter_free(&proto->inuse); -} #else # define DEFINE_PROTO_INUSE(NAME) # define REF_PROTO_INUSE(NAME) static void inline sock_prot_inuse_add(struct proto *prot, int inc) { } -static int inline sock_prot_inuse_init(struct proto *proto) -{ - return 0; -} -static void inline sock_prot_inuse_free(struct proto *proto) -{ -} #endif -- cgit v1.2.3 From bdcde3d71a67e97f25e851f3ca97c9bb5ef03e7f Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 28 Mar 2008 16:39:33 -0700 Subject: [SOCK]: Drop inuse pcounter from struct proto (v2). An uppercut - do not use the pcounter on struct proto. Signed-off-by: Pavel Emelyanov Acked-by: Eric Dumazet Signed-off-by: David S. Miller --- include/net/sock.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index 1f4294252dd..2a3344f666a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -47,7 +47,6 @@ #include #include #include -#include #include /* struct sk_buff */ #include #include @@ -563,7 +562,6 @@ struct proto { /* Keeping track of sockets in use */ #ifdef CONFIG_PROC_FS unsigned int inuse_idx; - struct pcounter inuse; #endif /* Memory pressure */ @@ -636,14 +634,10 @@ static inline void sk_refcnt_debug_release(const struct sock *sk) #ifdef CONFIG_PROC_FS -# define DEFINE_PROTO_INUSE(NAME) DEFINE_PCOUNTER(NAME) -# define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse) /* Called with local bh disabled */ extern void sock_prot_inuse_add(struct proto *prot, int inc); extern int sock_prot_inuse_get(struct proto *proto); #else -# define DEFINE_PROTO_INUSE(NAME) -# define REF_PROTO_INUSE(NAME) static void inline sock_prot_inuse_add(struct proto *prot, int inc) { } -- cgit v1.2.3 From 095d911201b0741e7f326d269a005dba55985acf Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 28 Mar 2008 16:39:58 -0700 Subject: [LIB]: Drop the pcounter itself. The knock-out. The pcounter abstraction is not used any longer in the kernel. Not sure whether this should go via netdev tree, but as far as I remember it was added via this one, and besides Eric thinks that Andrew shouldn't mind this. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/linux/pcounter.h | 74 ------------------------------------------------ 1 file changed, 74 deletions(-) delete mode 100644 include/linux/pcounter.h (limited to 'include') diff --git a/include/linux/pcounter.h b/include/linux/pcounter.h deleted file mode 100644 index a82d9f2628c..00000000000 --- a/include/linux/pcounter.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __LINUX_PCOUNTER_H -#define __LINUX_PCOUNTER_H -/* - * Using a dynamic percpu 'int' variable has a cost : - * 1) Extra dereference - * Current per_cpu_ptr() implementation uses an array per 'percpu variable'. - * 2) memory cost of NR_CPUS*(32+sizeof(void *)) instead of num_possible_cpus()*4 - * - * This pcounter implementation is an abstraction to be able to use - * either a static or a dynamic per cpu variable. - * One dynamic per cpu variable gets a fast & cheap implementation, we can - * change pcounter implementation too. - */ -struct pcounter { -#ifdef CONFIG_SMP - void (*add)(struct pcounter *self, int inc); - int (*getval)(const struct pcounter *self, int cpu); - int *per_cpu_values; -#else - int val; -#endif -}; - -#ifdef CONFIG_SMP -#include - -#define DEFINE_PCOUNTER(NAME) \ -static DEFINE_PER_CPU(int, NAME##_pcounter_values); \ -static void NAME##_pcounter_add(struct pcounter *self, int val) \ -{ \ - __get_cpu_var(NAME##_pcounter_values) += val; \ -} \ -static int NAME##_pcounter_getval(const struct pcounter *self, int cpu) \ -{ \ - return per_cpu(NAME##_pcounter_values, cpu); \ -} \ - -#define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER) \ - MEMBER = { \ - .add = NAME##_pcounter_add, \ - .getval = NAME##_pcounter_getval, \ - } - - -static inline void pcounter_add(struct pcounter *self, int inc) -{ - self->add(self, inc); -} - -extern int pcounter_getval(const struct pcounter *self); -extern int pcounter_alloc(struct pcounter *self); -extern void pcounter_free(struct pcounter *self); - - -#else /* CONFIG_SMP */ - -static inline void pcounter_add(struct pcounter *self, int inc) -{ - self->val += inc; -} - -static inline int pcounter_getval(const struct pcounter *self) -{ - return self->val; -} - -#define DEFINE_PCOUNTER(NAME) -#define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER) -#define pcounter_alloc(self) 0 -#define pcounter_free(self) - -#endif /* CONFIG_SMP */ - -#endif /* __LINUX_PCOUNTER_H */ -- cgit v1.2.3 From 6f191efe48af62dd5f8917dd21d187f896cd6c81 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Fri, 28 Mar 2008 18:23:33 -0700 Subject: [UDP]: Replace struct net on udp_iter_state with seq_net_private. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/udp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/udp.h b/include/net/udp.h index 635940d374a..77af7d46d86 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -194,7 +194,7 @@ struct udp_seq_afinfo { }; struct udp_iter_state { - struct net *net; + struct seq_net_private p; sa_family_t family; struct hlist_head *hashtable; int bucket; -- cgit v1.2.3 From dda61925f84d89e2f2a4597d6298a05a2bc05c20 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Fri, 28 Mar 2008 18:24:26 -0700 Subject: [UDP]: Move seq_ops from udp_iter_state to udp_seq_afinfo. No need to create seq_operations for each instance of 'netstat'. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/udp.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/udp.h b/include/net/udp.h index 77af7d46d86..0079d17fd3a 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -189,8 +189,8 @@ struct udp_seq_afinfo { char *name; sa_family_t family; struct hlist_head *hashtable; - int (*seq_show) (struct seq_file *m, void *v); struct file_operations *seq_fops; + struct seq_operations seq_ops; }; struct udp_iter_state { @@ -198,7 +198,6 @@ struct udp_iter_state { sa_family_t family; struct hlist_head *hashtable; int bucket; - struct seq_operations seq_ops; }; #ifdef CONFIG_PROC_FS -- cgit v1.2.3 From 3ba9441bdf07370670a684e6d95dfc523476677f Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Fri, 28 Mar 2008 18:25:32 -0700 Subject: [UDP]: Place file operations directly into udp_seq_afinfo. No need to have separate never-used variable. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/udp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/udp.h b/include/net/udp.h index 0079d17fd3a..5cf0e593dda 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -189,7 +189,7 @@ struct udp_seq_afinfo { char *name; sa_family_t family; struct hlist_head *hashtable; - struct file_operations *seq_fops; + struct file_operations seq_fops; struct seq_operations seq_ops; }; -- cgit v1.2.3 From 4ad96d39a2d74c1b2e400b602da2594f5098fc26 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Fri, 28 Mar 2008 18:25:53 -0700 Subject: [UDP]: Remove owner from udp_seq_afinfo. Move it to udp_seq_afinfo->seq_fops as should be. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/udp.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/net/udp.h b/include/net/udp.h index 5cf0e593dda..24a41fa3164 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -185,7 +185,6 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); /* /proc */ struct udp_seq_afinfo { - struct module *owner; char *name; sa_family_t family; struct hlist_head *hashtable; -- cgit v1.2.3 From 9307b570a745da4f2d83195f5337927e98221bb2 Mon Sep 17 00:00:00 2001 From: "S.Caglar Onur" Date: Fri, 28 Mar 2008 14:41:24 -0700 Subject: drivers/net/arcnet/arcnet.c: use time_* macros The functions time_before, time_before_eq, time_after, and time_after_eq are more robust for comparing jiffies against other values. So use the time_after() macro, defined in linux/jiffies.h, which deals with wrapping correctly. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: S.Caglar Onur Signed-off-by: Andrew Morton Signed-off-by: Jeff Garzik --- include/linux/arcdevice.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h index fde675872c5..a1916078fd0 100644 --- a/include/linux/arcdevice.h +++ b/include/linux/arcdevice.h @@ -283,8 +283,8 @@ struct arcnet_local { int next_buf, first_free_buf; /* network "reconfiguration" handling */ - time_t first_recon, /* time of "first" RECON message to count */ - last_recon; /* time of most recent RECON */ + unsigned long first_recon; /* time of "first" RECON message to count */ + unsigned long last_recon; /* time of most recent RECON */ int num_recons; /* number of RECONs between first and last. */ bool network_down; /* do we think the network is down? */ -- cgit v1.2.3 From 3edf8fa5ccf10688a9280b5cbca8ed3947c42866 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 31 Mar 2008 00:28:14 -0700 Subject: [NET]: Fix allnoconfig build on powerpc and avr32 As reported by Haavard Skinnemoen and Stephen Rothwell: > allnoconfig fails with > > include/linux/netdevice.h:843: error: implicit declaration of function 'dev_net' > > which seems to be because the definition of dev_net is inside #ifdef > CONFIG_NET, while next_net_device, which calls it, is not. Signed-off-by: David S. Miller --- include/linux/netdevice.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 8576ca928da..993758f924b 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -827,6 +827,7 @@ struct packet_type { extern rwlock_t dev_base_lock; /* Device list lock */ +#ifdef CONFIG_NET #define for_each_netdev(net, d) \ list_for_each_entry(d, &(net)->dev_base_head, dev_list) #define for_each_netdev_safe(net, d, n) \ @@ -850,6 +851,7 @@ static inline struct net_device *first_net_device(struct net *net) return list_empty(&net->dev_base_head) ? NULL : net_device_entry(net->dev_base_head.next); } +#endif extern int netdev_boot_setup_check(struct net_device *dev); extern unsigned long netdev_boot_base(const char *prefix, int unit); -- cgit v1.2.3 From 8efa6e93cb2666dceafc4844057fdcb9aa324fb7 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 31 Mar 2008 19:41:14 -0700 Subject: [NETNS]: Introduce a netns_core structure. There's already some stuff on the struct net, that should better be folded into netns_core structure. I'm making the per-proto inuse counter be per-net also, which is also a candidate for this, so introduce this structure and populate it a bit. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/net_namespace.h | 6 ++---- include/net/netns/core.h | 13 +++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 include/net/netns/core.h (limited to 'include') diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index f8f3d1a5fc3..c01d45fe08c 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -46,10 +47,7 @@ struct net { struct sock *rtnl; /* rtnetlink socket */ - /* core sysctls */ - struct ctl_table_header *sysctl_core_hdr; - int sysctl_somaxconn; - + struct netns_core core; struct netns_packet packet; struct netns_unix unx; struct netns_ipv4 ipv4; diff --git a/include/net/netns/core.h b/include/net/netns/core.h new file mode 100644 index 00000000000..0e8c0f8435d --- /dev/null +++ b/include/net/netns/core.h @@ -0,0 +1,13 @@ +#ifndef __NETNS_CORE_H__ +#define __NETNS_CORE_H__ + +struct ctl_table_header; + +struct netns_core { + /* core sysctls */ + struct ctl_table_header *sysctl_hdr; + + int sysctl_somaxconn; +}; + +#endif -- cgit v1.2.3 From c29a0bc4dfc4d833eb702b1929cec96a3eeb9f7a Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 31 Mar 2008 19:41:46 -0700 Subject: [SOCK][NETNS]: Add a struct net argument to sock_prot_inuse_add and _get. This counter is about to become per-proto-and-per-net, so we'll need two arguments to determine which cell in this "table" to work with. All the places, but proc already pass proper net to it - proc will be tuned a bit later. Some indentation with spaces in proc files is done to keep the file coding style consistent. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/sock.h | 7 ++++--- include/net/udp.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index 2a3344f666a..f4fdd101c9a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -635,10 +635,11 @@ static inline void sk_refcnt_debug_release(const struct sock *sk) #ifdef CONFIG_PROC_FS /* Called with local bh disabled */ -extern void sock_prot_inuse_add(struct proto *prot, int inc); -extern int sock_prot_inuse_get(struct proto *proto); +extern void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc); +extern int sock_prot_inuse_get(struct net *net, struct proto *proto); #else -static void inline sock_prot_inuse_add(struct proto *prot, int inc) +static void inline sock_prot_inuse_add(struct net *net, struct proto *prot, + int inc) { } #endif diff --git a/include/net/udp.h b/include/net/udp.h index 24a41fa3164..3e55a99b0ba 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -115,7 +115,7 @@ static inline void udp_lib_unhash(struct sock *sk) write_lock_bh(&udp_hash_lock); if (sk_del_node_init(sk)) { inet_sk(sk)->num = 0; - sock_prot_inuse_add(sk->sk_prot, -1); + sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); } write_unlock_bh(&udp_hash_lock); } -- cgit v1.2.3 From 70ee115942be6ce52ff10e5e813fb4da82cdb25a Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 31 Mar 2008 19:42:16 -0700 Subject: [SOCK][NETNS]: Add the percpu prot_inuse counter in the struct net. Such an accounting would cost us two more dereferences to get the percpu variable from the struct net, so I make sock_prot_inuse_get and _add calls work differently depending on CONFIG_NET_NS - without it old optimized routines are used. The per-cpu counter for init_net is prepared in core_initcall, so that even af_inet, that starts as fs_initcall, will already have the init_net prepared. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/netns/core.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/net/netns/core.h b/include/net/netns/core.h index 0e8c0f8435d..24d4be76bbd 100644 --- a/include/net/netns/core.h +++ b/include/net/netns/core.h @@ -2,12 +2,15 @@ #define __NETNS_CORE_H__ struct ctl_table_header; +struct prot_inuse; struct netns_core { /* core sysctls */ struct ctl_table_header *sysctl_hdr; int sysctl_somaxconn; + + struct prot_inuse *inuse; }; #endif -- cgit v1.2.3 From 225c0a0107735597100dc4133cd88c5ed10d9e63 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Wed, 2 Apr 2008 00:09:29 -0700 Subject: [NETNS]: Merge ifdef CONFIG_NET in include/net/net_namespace.h. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/net_namespace.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index c01d45fe08c..4a37037b1d1 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -59,25 +59,27 @@ struct net { #endif }; + #ifdef CONFIG_NET /* Init's network namespace */ extern struct net init_net; #define INIT_NET_NS(net_ns) .net_ns = &init_net, -#else -#define INIT_NET_NS(net_ns) -#endif -extern struct list_head net_namespace_list; - -#ifdef CONFIG_NET extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); -#else + +#else /* CONFIG_NET */ + +#define INIT_NET_NS(net_ns) + static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) { /* There is nothing to copy so this is a noop */ return net_ns; } -#endif +#endif /* CONFIG_NET */ + + +extern struct list_head net_namespace_list; #ifdef CONFIG_NET_NS extern void __put_net(struct net *net); -- cgit v1.2.3 From c0f39322c335412339dec16ebfd2a05ceba5ebcf Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Wed, 2 Apr 2008 00:10:28 -0700 Subject: [NETNS]: Do not include net/net_namespace.h from seq_file.h Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/linux/seq_file.h | 22 ---------------------- include/linux/seq_file_net.h | 27 +++++++++++++++++++++++++++ include/net/net_namespace.h | 2 ++ 3 files changed, 29 insertions(+), 22 deletions(-) create mode 100644 include/linux/seq_file_net.h (limited to 'include') diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 5da70c3f441..1da1e6208a0 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -5,7 +5,6 @@ #include #include #include -#include struct seq_operations; struct file; @@ -63,26 +62,5 @@ extern struct list_head *seq_list_start_head(struct list_head *head, extern struct list_head *seq_list_next(void *v, struct list_head *head, loff_t *ppos); -#ifdef CONFIG_NET -struct net; -struct seq_net_private { -#ifdef CONFIG_NET_NS - struct net *net; -#endif -}; - -int seq_open_net(struct inode *, struct file *, - const struct seq_operations *, int); -int seq_release_net(struct inode *, struct file *); -static inline struct net *seq_file_net(struct seq_file *seq) -{ -#ifdef CONFIG_NET_NS - return ((struct seq_net_private *)seq->private)->net; -#else - return &init_net; -#endif -} -#endif /* CONFIG_NET */ - #endif #endif diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h new file mode 100644 index 00000000000..4ac52542a56 --- /dev/null +++ b/include/linux/seq_file_net.h @@ -0,0 +1,27 @@ +#ifndef __SEQ_FILE_NET_H__ +#define __SEQ_FILE_NET_H__ + +#include + +struct net; +extern struct net init_net; + +struct seq_net_private { +#ifdef CONFIG_NET_NS + struct net *net; +#endif +}; + +int seq_open_net(struct inode *, struct file *, + const struct seq_operations *, int); +int seq_release_net(struct inode *, struct file *); +static inline struct net *seq_file_net(struct seq_file *seq) +{ +#ifdef CONFIG_NET_NS + return ((struct seq_net_private *)seq->private)->net; +#else + return &init_net; +#endif +} + +#endif diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 4a37037b1d1..6c9a48a4668 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -61,6 +61,8 @@ struct net { #ifdef CONFIG_NET +#include + /* Init's network namespace */ extern struct net init_net; #define INIT_NET_NS(net_ns) .net_ns = &init_net, -- cgit v1.2.3 From fadf6bf06069138f8e97c9a963be38348ba2708b Mon Sep 17 00:00:00 2001 From: "Templin, Fred L" Date: Tue, 11 Mar 2008 18:35:59 -0400 Subject: [IPV6] SIT: Add PRL management for ISATAP. This patch updates the Linux the Intra-Site Automatic Tunnel Addressing Protocol (ISATAP) implementation. It places the ISATAP potential router list (PRL) in the kernel and adds three new private ioctls for PRL management. [Add several changes of structure name, constant names etc. - yoshfuji] Signed-off-by: Fred L. Templin Signed-off-by: YOSHIFUJI Hideaki --- include/linux/if_tunnel.h | 18 +++++++++++++++--- include/linux/skbuff.h | 3 ++- include/net/ipip.h | 7 +++++++ include/net/ndisc.h | 9 +++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h index 228eb4eb312..f20c224d544 100644 --- a/include/linux/if_tunnel.h +++ b/include/linux/if_tunnel.h @@ -7,6 +7,9 @@ #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) #define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) #define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) +#define SIOCADDPRL (SIOCDEVPRIVATE + 5) +#define SIOCDELPRL (SIOCDEVPRIVATE + 6) +#define SIOCCHGPRL (SIOCDEVPRIVATE + 7) #define GRE_CSUM __constant_htons(0x8000) #define GRE_ROUTING __constant_htons(0x4000) @@ -17,9 +20,6 @@ #define GRE_FLAGS __constant_htons(0x00F8) #define GRE_VERSION __constant_htons(0x0007) -/* i_flags values for SIT mode */ -#define SIT_ISATAP 0x0001 - struct ip_tunnel_parm { char name[IFNAMSIZ]; @@ -31,4 +31,16 @@ struct ip_tunnel_parm struct iphdr iph; }; +/* SIT-mode i_flags */ +#define SIT_ISATAP 0x0001 + +struct ip_tunnel_prl { + __be32 addr; + __u16 flags; + __u16 __reserved; +}; + +/* PRL flags */ +#define PRL_DEFAULT 0x0001 + #endif /* _IF_TUNNEL_H_ */ diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index ff72145d5d9..e10e55c9b08 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -313,7 +313,8 @@ struct sk_buff { __u16 tc_verd; /* traffic control verdict */ #endif #endif - /* 2 byte hole */ + __u8 ndisc_nodetype:2; + /* 14 bit hole */ #ifdef CONFIG_NET_DMA dma_cookie_t dma_cookie; diff --git a/include/net/ipip.h b/include/net/ipip.h index 549e132bca9..205536a014e 100644 --- a/include/net/ipip.h +++ b/include/net/ipip.h @@ -24,6 +24,13 @@ struct ip_tunnel int mlink; struct ip_tunnel_parm parms; + struct ip_tunnel_prl_entry *prl; /* potential router list */ +}; + +struct ip_tunnel_prl_entry +{ + struct ip_tunnel_prl_entry *next; + struct ip_tunnel_prl entry; }; #define IPTUNNEL_XMIT() do { \ diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 5aedf324de6..9f2bae68d28 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -11,6 +11,15 @@ #define NDISC_NEIGHBOUR_ADVERTISEMENT 136 #define NDISC_REDIRECT 137 +/* + * Router type: cross-layer information from link-layer to + * IPv6 layer reported by certain link types (e.g., RFC4214). + */ +#define NDISC_NODETYPE_UNSPEC 0 /* unspecified (default) */ +#define NDISC_NODETYPE_HOST 1 /* host or unauthorized router */ +#define NDISC_NODETYPE_NODEFAULT 2 /* non-default router */ +#define NDISC_NODETYPE_DEFAULT 3 /* default router */ + /* * ndisc options */ -- cgit v1.2.3 From 300aaeeaab5f447fcf40e911afe96df3de28f0db Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Mon, 24 Mar 2008 18:28:39 +0900 Subject: [IPV6] SIT: Add SIOCGETPRL ioctl to get/dump PRL. Signed-off-by: YOSHIFUJI Hideaki --- include/linux/if_tunnel.h | 4 ++++ include/net/ipip.h | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h index f20c224d544..f1fbe9c930d 100644 --- a/include/linux/if_tunnel.h +++ b/include/linux/if_tunnel.h @@ -7,6 +7,7 @@ #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) #define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) #define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) +#define SIOCGETPRL (SIOCDEVPRIVATE + 4) #define SIOCADDPRL (SIOCDEVPRIVATE + 5) #define SIOCDELPRL (SIOCDEVPRIVATE + 6) #define SIOCCHGPRL (SIOCDEVPRIVATE + 7) @@ -38,6 +39,9 @@ struct ip_tunnel_prl { __be32 addr; __u16 flags; __u16 __reserved; + __u32 datalen; + __u32 __reserved2; + void __user *data; }; /* PRL flags */ diff --git a/include/net/ipip.h b/include/net/ipip.h index 205536a014e..633ed4def8e 100644 --- a/include/net/ipip.h +++ b/include/net/ipip.h @@ -24,13 +24,16 @@ struct ip_tunnel int mlink; struct ip_tunnel_parm parms; + struct ip_tunnel_prl_entry *prl; /* potential router list */ + unsigned int prl_count; /* # of entries in PRL */ }; struct ip_tunnel_prl_entry { struct ip_tunnel_prl_entry *next; - struct ip_tunnel_prl entry; + __be32 addr; + u16 flags; }; #define IPTUNNEL_XMIT() do { \ -- cgit v1.2.3 From 52eeeb8481d705e61e2e9aae974e7799a93783e9 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Sat, 15 Mar 2008 22:54:23 -0400 Subject: [IPV6]: Unify ip6_onlink() and ipip6_onlink(). Both are identical, let's create ipv6_chk_prefix() and use it in both places. --- include/net/addrconf.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/net/addrconf.h b/include/net/addrconf.h index d89b0bc7ab7..bdcc863a60a 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -71,6 +71,10 @@ extern int ipv6_chk_addr(struct net *net, extern int ipv6_chk_home_addr(struct net *net, struct in6_addr *addr); #endif + +extern int ipv6_chk_prefix(struct in6_addr *addr, + struct net_device *dev); + extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, struct in6_addr *addr, struct net_device *dev, -- cgit v1.2.3 From de357cc01334a468e4d5b7ba66a17b0d3ca9d63e Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Sat, 15 Mar 2008 23:59:18 -0400 Subject: [IPV6] NDISC: Don't rely on node-type hint from L2 unless required. Signed-off-by: YOSHIFUJI Hideaki --- include/linux/skbuff.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index e10e55c9b08..e517701c25b 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -313,7 +313,9 @@ struct sk_buff { __u16 tc_verd; /* traffic control verdict */ #endif #endif +#ifdef CONFIG_IPV6_NDISC_NODETYPE __u8 ndisc_nodetype:2; +#endif /* 14 bit hole */ #ifdef CONFIG_NET_DMA -- cgit v1.2.3 From a4aa834a9165150252c5cd953faab4de29d51b87 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 3 Apr 2008 13:04:33 -0700 Subject: [NETNS]: Declare init_net even without CONFIG_NET defined. This does not look good, but there is no other choice. The compilation without CONFIG_NET is broken and can not be fixed with ease. After that there is no need for the following commits: 1567ca7eec7664b8be3b07755ac59dc1b1ec76cb 3edf8fa5ccf10688a9280b5cbca8ed3947c42866 2d38f9a4f8d2ebdc799f03eecf82345825495711 Revert them. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/linux/netdevice.h | 4 ---- include/net/net_namespace.h | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index c36c76caf20..8b17ed40dea 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -741,7 +741,6 @@ struct net_device #define NETDEV_ALIGN 32 #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) -#ifdef CONFIG_NET /* * Net namespace inlines */ @@ -762,7 +761,6 @@ void dev_net_set(struct net_device *dev, struct net *net) dev->nd_net = net; #endif } -#endif /** * netdev_priv - access network device private data @@ -827,7 +825,6 @@ struct packet_type { extern rwlock_t dev_base_lock; /* Device list lock */ -#ifdef CONFIG_NET #define for_each_netdev(net, d) \ list_for_each_entry(d, &(net)->dev_base_head, dev_list) #define for_each_netdev_safe(net, d, n) \ @@ -851,7 +848,6 @@ static inline struct net_device *first_net_device(struct net *net) return list_empty(&net->dev_base_head) ? NULL : net_device_entry(net->dev_base_head.next); } -#endif extern int netdev_boot_setup_check(struct net_device *dev); extern unsigned long netdev_boot_base(const char *prefix, int unit); diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 6c9a48a4668..0ab62ed2fde 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -60,11 +60,12 @@ struct net { }; -#ifdef CONFIG_NET #include /* Init's network namespace */ extern struct net init_net; + +#ifdef CONFIG_NET #define INIT_NET_NS(net_ns) .net_ns = &init_net, extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); -- cgit v1.2.3 From 3d58b5fa8e4c461ab09afdacd3d1754fccca06ad Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 3 Apr 2008 14:22:32 -0700 Subject: [INET]: Rename inet_csk_ctl_sock_create to inet_ctl_sock_create. This call is nothing common with INET connection sockets code. It simply creates an unhashes kernel sockets for protocol messages. Move the new call into af_inet.c after the rename. Signed-off-by: Denis V. Lunev Acked-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- include/net/inet_common.h | 5 +++++ include/net/inet_connection_sock.h | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/net/inet_common.h b/include/net/inet_common.h index 38d5a1e9980..d6238bdefba 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h @@ -39,6 +39,11 @@ extern int inet_getname(struct socket *sock, extern int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); +extern int inet_ctl_sock_create(struct socket **sock, + unsigned short family, + unsigned short type, + unsigned char protocol); + #endif diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index f00f0573627..2ff545a56fb 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h @@ -327,11 +327,6 @@ extern void inet_csk_listen_stop(struct sock *sk); extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); -extern int inet_csk_ctl_sock_create(struct socket **sock, - unsigned short family, - unsigned short type, - unsigned char protocol); - extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, -- cgit v1.2.3 From eee4fe4ded6e9c196168aee8f9787771f4df9c90 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 3 Apr 2008 14:27:58 -0700 Subject: [INET]: Let inet_ctl_sock_create return sock rather than socket. All upper protocol layers are already use sock internally. Signed-off-by: Denis V. Lunev Acked-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- include/net/inet_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/inet_common.h b/include/net/inet_common.h index d6238bdefba..4bfcf3f3555 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h @@ -39,7 +39,7 @@ extern int inet_getname(struct socket *sock, extern int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); -extern int inet_ctl_sock_create(struct socket **sock, +extern int inet_ctl_sock_create(struct sock **sk, unsigned short family, unsigned short type, unsigned char protocol); -- cgit v1.2.3 From 5677242f432102dea9e6eceec1dc089e2f709ca4 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 3 Apr 2008 14:28:30 -0700 Subject: [NETNS]: Inet control socket should not hold a namespace. This is a generic requirement, so make inet_ctl_sock_create namespace aware and create a inet_ctl_sock_destroy wrapper around sk_release_kernel. Signed-off-by: Denis V. Lunev Acked-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- include/net/inet_common.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/inet_common.h b/include/net/inet_common.h index 4bfcf3f3555..18c773286b9 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h @@ -42,7 +42,13 @@ extern int inet_ioctl(struct socket *sock, extern int inet_ctl_sock_create(struct sock **sk, unsigned short family, unsigned short type, - unsigned char protocol); + unsigned char protocol, + struct net *net); + +static inline void inet_ctl_sock_destroy(struct sock *sk) +{ + sk_release_kernel(sk); +} #endif -- cgit v1.2.3 From 046ee902357adc046d041441956ec7eeb30c77c4 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Thu, 3 Apr 2008 14:31:33 -0700 Subject: [NETNS]: Create tcp control socket in the each namespace. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/netns/ipv4.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index af685f71f4b..34ee348a2cf 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -28,6 +28,7 @@ struct netns_ipv4 { struct sock *fibnl; struct sock **icmp_sk; + struct sock *tcp_sock; struct netns_frags frags; #ifdef CONFIG_NETFILTER -- cgit v1.2.3 From 2e8046271f68198dd37451017c1a4a2432e4ec68 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 3 Apr 2008 09:22:09 +0900 Subject: [IPV4] MROUTE: Move PIM definitions to . Signed-off-by: YOSHIFUJI Hideaki --- include/linux/Kbuild | 1 + include/linux/mroute.h | 22 +--------------------- include/linux/pim.h | 29 +++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 include/linux/pim.h (limited to 'include') diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 9cdd12a9e84..84736acb4b9 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild @@ -289,6 +289,7 @@ unifdef-y += parport.h unifdef-y += patchkey.h unifdef-y += pci.h unifdef-y += personality.h +unifdef-y += pim.h unifdef-y += pktcdvd.h unifdef-y += pmu.h unifdef-y += poll.h diff --git a/include/linux/mroute.h b/include/linux/mroute.h index 35a8277ec1b..c41b4217ae3 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h @@ -3,6 +3,7 @@ #include #include +#include /* * Based on the MROUTING 3.5 defines primarily to keep @@ -210,27 +211,6 @@ struct mfc_cache #define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ #ifdef __KERNEL__ - -#define PIM_V1_VERSION __constant_htonl(0x10000000) -#define PIM_V1_REGISTER 1 - -#define PIM_VERSION 2 -#define PIM_REGISTER 1 - -#define PIM_NULL_REGISTER __constant_htonl(0x40000000) - -/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ - -struct pimreghdr -{ - __u8 type; - __u8 reserved; - __be16 csum; - __be32 flags; -}; - -extern int pim_rcv_v1(struct sk_buff *); - struct rtmsg; extern int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait); #endif diff --git a/include/linux/pim.h b/include/linux/pim.h new file mode 100644 index 00000000000..6f689dc8550 --- /dev/null +++ b/include/linux/pim.h @@ -0,0 +1,29 @@ +#ifndef __LINUX_PIM_H +#define __LINUX_PIM_H + +#include + +/* Message types - V1 */ +#define PIM_V1_VERSION __constant_htonl(0x10000000) +#define PIM_V1_REGISTER 1 + +/* Message types - V2 */ +#define PIM_VERSION 2 +#define PIM_REGISTER 1 + +#if defined(__KERNEL__) +#define PIM_NULL_REGISTER __constant_htonl(0x40000000) + +/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ +struct pimreghdr +{ + __u8 type; + __u8 reserved; + __be16 csum; + __be32 flags; +}; + +struct sk_buff; +extern int pim_rcv_v1(struct sk_buff *); +#endif +#endif -- cgit v1.2.3 From 80a9492a33dd7d852465625022d56ff76d62174d Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 3 Apr 2008 09:22:52 +0900 Subject: [IPV4] MROUTE: Adjust include files for user-space. needs . Avoid including in user-space, which conflicts with standard . Add basic struct and constant in . Signed-off-by: YOSHIFUJI Hideaki --- include/linux/mroute.h | 3 +++ include/linux/pim.h | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) (limited to 'include') diff --git a/include/linux/mroute.h b/include/linux/mroute.h index c41b4217ae3..de4decfa1bf 100644 --- a/include/linux/mroute.h +++ b/include/linux/mroute.h @@ -2,7 +2,10 @@ #define __LINUX_MROUTE_H #include +#include +#ifdef __KERNEL__ #include +#endif #include /* diff --git a/include/linux/pim.h b/include/linux/pim.h index 6f689dc8550..236ffd31739 100644 --- a/include/linux/pim.h +++ b/include/linux/pim.h @@ -3,6 +3,22 @@ #include +#ifndef __KERNEL__ +struct pim { +#if defined(__LITTLE_ENDIAN_BITFIELD) + __u8 pim_type:4, /* PIM message type */ + pim_ver:4; /* PIM version */ +#elif defined(__BIG_ENDIAN_BITFIELD) + __u8 pim_ver:4; /* PIM version */ + pim_type:4; /* PIM message type */ +#endif + __u8 pim_rsv; /* Reserved */ + __be16 pim_cksum; /* Checksum */ +}; + +#define PIM_MINLEN 8 +#endif + /* Message types - V1 */ #define PIM_V1_VERSION __constant_htonl(0x10000000) #define PIM_V1_REGISTER 1 -- cgit v1.2.3 From 7bc570c8b4f75ddb3fd5dbeb38127cdc4acbcc9c Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 3 Apr 2008 09:22:53 +0900 Subject: [IPV6] MROUTE: Support multicast forwarding. Based on ancient patch by Mickael Hoerdt , which is available at . Signed-off-by: YOSHIFUJI Hideaki --- include/linux/Kbuild | 1 + include/linux/ipv6.h | 5 ++ include/linux/mroute6.h | 227 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 233 insertions(+) create mode 100644 include/linux/mroute6.h (limited to 'include') diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 84736acb4b9..29ab9b95d37 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild @@ -261,6 +261,7 @@ unifdef-y += mempolicy.h unifdef-y += mii.h unifdef-y += mman.h unifdef-y += mroute.h +unifdef-y += mroute6.h unifdef-y += msdos_fs.h unifdef-y += msg.h unifdef-y += nbd.h diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index b90d3d461d4..f53e4764fc0 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -159,6 +159,9 @@ struct ipv6_devconf { __s32 accept_source_route; #ifdef CONFIG_IPV6_OPTIMISTIC_DAD __s32 optimistic_dad; +#endif +#ifdef CONFIG_IPV6_MROUTE + __s32 mc_forwarding; #endif void *sysctl; }; @@ -190,6 +193,7 @@ enum { DEVCONF_PROXY_NDP, DEVCONF_OPTIMISTIC_DAD, DEVCONF_ACCEPT_SOURCE_ROUTE, + DEVCONF_MC_FORWARDING, DEVCONF_MAX }; @@ -230,6 +234,7 @@ struct inet6_skb_parm { #endif #define IP6SKB_XFRM_TRANSFORMED 1 +#define IP6SKB_FORWARDED 2 }; #define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h new file mode 100644 index 00000000000..b92190304e0 --- /dev/null +++ b/include/linux/mroute6.h @@ -0,0 +1,227 @@ +#ifndef __LINUX_MROUTE6_H +#define __LINUX_MROUTE6_H + +#include +#include + +/* + * Based on the MROUTING 3.5 defines primarily to keep + * source compatibility with BSD. + * + * See the pim6sd code for the original history. + * + * Protocol Independent Multicast (PIM) data structures included + * Carlos Picoto (cap@di.fc.ul.pt) + * + */ + +#define MRT6_BASE 200 +#define MRT6_INIT (MRT6_BASE) /* Activate the kernel mroute code */ +#define MRT6_DONE (MRT6_BASE+1) /* Shutdown the kernel mroute */ +#define MRT6_ADD_MIF (MRT6_BASE+2) /* Add a virtual interface */ +#define MRT6_DEL_MIF (MRT6_BASE+3) /* Delete a virtual interface */ +#define MRT6_ADD_MFC (MRT6_BASE+4) /* Add a multicast forwarding entry */ +#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */ +#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */ + +#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */ +#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1) +#define SIOCGETRPF (SIOCPROTOPRIVATE+2) + +#define MAXMIFS 32 +typedef unsigned long mifbitmap_t; /* User mode code depends on this lot */ +typedef unsigned short mifi_t; +#define ALL_MIFS ((mifi_t)(-1)) + +#ifndef IF_SETSIZE +#define IF_SETSIZE 256 +#endif + +typedef __u32 if_mask; +#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */ + +#if !defined(__KERNEL__) && !defined(DIV_ROUND_UP) +#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y)) +#endif + +typedef struct if_set { + if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)]; +} if_set; + +#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS))) +#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS))) +#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS))) +#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f))) +#define IF_ZERO(p) bzero(p, sizeof(*(p))) + +/* + * Passed by mrouted for an MRT_ADD_MIF - again we use the + * mrouted 3.6 structures for compatibility + */ + +struct mif6ctl { + mifi_t mif6c_mifi; /* Index of MIF */ + unsigned char mif6c_flags; /* MIFF_ flags */ + unsigned char vifc_threshold; /* ttl limit */ + u_short mif6c_pifi; /* the index of the physical IF */ + unsigned int vifc_rate_limit; /* Rate limiter values (NI) */ +}; + +#define MIFF_REGISTER 0x1 /* register vif */ + +/* + * Cache manipulation structures for mrouted and PIMd + */ + +struct mf6cctl +{ + struct sockaddr_in6 mf6cc_origin; /* Origin of mcast */ + struct sockaddr_in6 mf6cc_mcastgrp; /* Group in question */ + mifi_t mf6cc_parent; /* Where it arrived */ + struct if_set mf6cc_ifset; /* Where it is going */ +}; + +/* + * Group count retrieval for pim6sd + */ + +struct sioc_sg_req6 +{ + struct sockaddr_in6 src; + struct sockaddr_in6 grp; + unsigned long pktcnt; + unsigned long bytecnt; + unsigned long wrong_if; +}; + +/* + * To get vif packet counts + */ + +struct sioc_mif_req6 +{ + mifi_t mifi; /* Which iface */ + unsigned long icount; /* In packets */ + unsigned long ocount; /* Out packets */ + unsigned long ibytes; /* In bytes */ + unsigned long obytes; /* Out bytes */ +}; + +/* + * That's all usermode folks + */ + +#ifdef __KERNEL__ + +#include /* for struct sk_buff_head */ + +struct net_device; +struct inet6_dev *ipv6_find_idev(struct net_device *dev); + +#ifdef CONFIG_IPV6_MROUTE +static inline int ip6_mroute_opt(int opt) +{ + return (opt >= MRT6_BASE) && (opt <= MRT6_BASE + 10); +} +#else +static inline int ip6_mroute_opt(int opt) +{ + return 0; +} +#endif + +struct sock; + +extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int); +extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *); +extern int ip6_mr_input(struct sk_buff *skb); +extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg); +extern void ip6_mr_init(void); + +struct mif_device +{ + struct net_device *dev; /* Device we are using */ + unsigned long bytes_in,bytes_out; + unsigned long pkt_in,pkt_out; /* Statistics */ + unsigned long rate_limit; /* Traffic shaping (NI) */ + unsigned char threshold; /* TTL threshold */ + unsigned short flags; /* Control flags */ + int link; /* Physical interface index */ +}; + +#define VIFF_STATIC 0x8000 + +struct mfc6_cache +{ + struct mfc6_cache *next; /* Next entry on cache line */ + struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */ + struct in6_addr mf6c_origin; /* Source of packet */ + mifi_t mf6c_parent; /* Source interface */ + int mfc_flags; /* Flags on line */ + + union { + struct { + unsigned long expires; + struct sk_buff_head unresolved; /* Unresolved buffers */ + } unres; + struct { + unsigned long last_assert; + int minvif; + int maxvif; + unsigned long bytes; + unsigned long pkt; + unsigned long wrong_if; + unsigned char ttls[MAXMIFS]; /* TTL thresholds */ + } res; + } mfc_un; +}; + +#define MFC_STATIC 1 +#define MFC_NOTIFY 2 + +#define MFC6_LINES 64 + +#define MFC6_HASH(a, g) (((__force u32)(a)->s6_addr32[0] ^ \ + (__force u32)(a)->s6_addr32[1] ^ \ + (__force u32)(a)->s6_addr32[2] ^ \ + (__force u32)(a)->s6_addr32[3] ^ \ + (__force u32)(g)->s6_addr32[0] ^ \ + (__force u32)(g)->s6_addr32[1] ^ \ + (__force u32)(g)->s6_addr32[2] ^ \ + (__force u32)(g)->s6_addr32[3]) % MFC6_LINES) + +#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */ + +#endif + +#ifdef __KERNEL__ +struct rtmsg; +extern int ip6mr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait); + +#ifdef CONFIG_IPV6_MROUTE +extern struct sock *mroute6_socket; +extern int ip6mr_sk_done(struct sock *sk); +#else +#define mroute6_socket NULL +static inline int ip6mr_sk_done(struct sock *sk) { return 0; } +#endif +#endif + +/* + * Structure used to communicate from kernel to multicast router. + * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{} + * used for IPv4 implementation). This is because this structure will be passed via an + * IPv6 raw socket, on wich an application will only receiver the payload i.e the data after + * the IPv6 header and all the extension headers. (See section 3 of RFC 3542) + */ + +struct mrt6msg { +#define MRT6MSG_NOCACHE 1 + __u8 im6_mbz; /* must be zero */ + __u8 im6_msgtype; /* what type of message */ + __u16 im6_mif; /* mif rec'd on */ + __u32 im6_pad; /* padding for 64 bit arch */ + struct in6_addr im6_src, im6_dst; +}; + +#endif -- cgit v1.2.3 From 14fb64e1f449ef6666f1c3a3fa4e13aec669b98d Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 3 Apr 2008 09:22:54 +0900 Subject: [IPV6] MROUTE: Support PIM-SM (SSM). Based on ancient patch by Mickael Hoerdt , which is available at . Signed-off-by: YOSHIFUJI Hideaki --- include/linux/mroute6.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h index b92190304e0..f6469fb9084 100644 --- a/include/linux/mroute6.h +++ b/include/linux/mroute6.h @@ -23,6 +23,8 @@ #define MRT6_ADD_MFC (MRT6_BASE+4) /* Add a multicast forwarding entry */ #define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */ #define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */ +#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */ +#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */ #define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */ #define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1) @@ -217,6 +219,8 @@ static inline int ip6mr_sk_done(struct sock *sk) { return 0; } struct mrt6msg { #define MRT6MSG_NOCACHE 1 +#define MRT6MSG_WRONGMIF 2 +#define MRT6MSG_WHOLEPKT 3 /* used for use level encap */ __u8 im6_mbz; /* must be zero */ __u8 im6_msgtype; /* what type of message */ __u16 im6_mif; /* mif rec'd on */ -- cgit v1.2.3 From 12802d058a003048104fe405a8d283b94ac50801 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 3 Apr 2008 09:22:56 +0900 Subject: [IPV6]: Comment MRT6_xxx sockopts in include/linux/in6.h. Signed-off-by: YOSHIFUJI Hideaki --- include/linux/in6.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') diff --git a/include/linux/in6.h b/include/linux/in6.h index f674000c6c9..e6aa8de2b93 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h @@ -260,4 +260,19 @@ struct in6_flowlabel_req #define IPV6_PREFER_SRC_CGA 0x0008 #define IPV6_PREFER_SRC_NONCGA 0x0800 +/* + * Multicast Routing: + * see include/linux/mroute6.h. + * + * MRT6_INIT 200 + * MRT6_DONE 201 + * MRT6_ADD_MIF 202 + * MRT6_DEL_MIF 203 + * MRT6_ADD_MFC 204 + * MRT6_DEL_MFC 205 + * MRT6_VERSION 206 + * MRT6_ASSERT 207 + * MRT6_PIM 208 + * (reserved) 209 + */ #endif -- cgit v1.2.3 From 38668c059f5202f5fd9612391f9aa1b38a97241b Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Fri, 28 Mar 2008 16:33:32 -0700 Subject: mac80211: eliminate conf_ht This patch eliminates the use of conf_ht, replacing it with bss_info_changed. Signed-off-by: Tomas Winkler Signed-off-by: Ron Rindjunsky Signed-off-by: John W. Linville --- include/net/mac80211.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 48428a6b910..5174eaa8950 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -178,11 +178,13 @@ struct ieee80211_low_level_stats { * also implies a change in the AID. * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed * @BSS_CHANGED_ERP_PREAMBLE: preamble changed + * @BSS_CHANGED_HT: 802.11n parameters changed */ enum ieee80211_bss_change { BSS_CHANGED_ASSOC = 1<<0, BSS_CHANGED_ERP_CTS_PROT = 1<<1, BSS_CHANGED_ERP_PREAMBLE = 1<<2, + BSS_CHANGED_HT = 1<<4, }; /** @@ -195,6 +197,9 @@ enum ieee80211_bss_change { * @aid: association ID number, valid only when @assoc is true * @use_cts_prot: use CTS protection * @use_short_preamble: use 802.11b short preamble + * @assoc_ht: association in HT mode + * @ht_conf: ht capabilities + * @ht_bss_conf: ht extended capabilities */ struct ieee80211_bss_conf { /* association related data */ @@ -203,6 +208,10 @@ struct ieee80211_bss_conf { /* erp related data */ bool use_cts_prot; bool use_short_preamble; + /* ht related data */ + bool assoc_ht; + struct ieee80211_ht_info *ht_conf; + struct ieee80211_ht_bss_info *ht_bss_conf; }; /** @@ -1132,7 +1141,6 @@ struct ieee80211_ops { struct sk_buff *skb, struct ieee80211_tx_control *control); int (*tx_last_beacon)(struct ieee80211_hw *hw); - int (*conf_ht)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); int (*ampdu_action)(struct ieee80211_hw *hw, enum ieee80211_ampdu_mlme_action action, const u8 *addr, u16 tid, u16 *ssn); -- cgit v1.2.3 From 21c0cbe760ca6b5d4c6927c3ec1352a843a8c11c Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Fri, 28 Mar 2008 16:33:34 -0700 Subject: mac80211: add association capabilty and timing info into bss_conf This patch adds assocation capability, timestamp (tsf) and beacon interval to bss_conf. This is required for successful assocation of iwlwifi drivers Signed-off-by: Tomas Winkler Signed-off-by: Gregory Greenman Signed-off-by: John W. Linville --- include/net/mac80211.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 5174eaa8950..01b32152b89 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -197,6 +197,9 @@ enum ieee80211_bss_change { * @aid: association ID number, valid only when @assoc is true * @use_cts_prot: use CTS protection * @use_short_preamble: use 802.11b short preamble + * @timestamp: beacon timestamp + * @beacon_int: beacon interval + * @assoc_capability: capabbilities taken from assoc resp * @assoc_ht: association in HT mode * @ht_conf: ht capabilities * @ht_bss_conf: ht extended capabilities @@ -208,6 +211,9 @@ struct ieee80211_bss_conf { /* erp related data */ bool use_cts_prot; bool use_short_preamble; + u16 beacon_int; + u16 assoc_capability; + u64 timestamp; /* ht related data */ bool assoc_ht; struct ieee80211_ht_info *ht_conf; -- cgit v1.2.3 From 8fe2b65a18e49bfde56a59ed4ab3fc7aa0c2f325 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Sun, 30 Mar 2008 00:10:50 +0100 Subject: ssb: Turn suspend/resume upside down Turn the SSB bus suspend mechanism upside down. Instead of deciding by an internal reference count when to suspend/resume, let the parent bus call us in their suspend/resume routine. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- include/linux/ssb/ssb.h | 10 +++++++--- include/linux/ssb/ssb_driver_chipcommon.h | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 8644e03cf58..a8ca396f810 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -260,9 +260,6 @@ struct ssb_bus { struct ssb_device devices[SSB_MAX_NR_CORES]; u8 nr_devices; - /* Reference count. Number of suspended devices. */ - u8 suspend_cnt; - /* Software ID number for this bus. */ unsigned int busnumber; @@ -334,6 +331,13 @@ extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus, extern void ssb_bus_unregister(struct ssb_bus *bus); +/* Suspend a SSB bus. + * Call this from the parent bus suspend routine. */ +extern int ssb_bus_suspend(struct ssb_bus *bus); +/* Resume a SSB bus. + * Call this from the parent bus resume routine. */ +extern int ssb_bus_resume(struct ssb_bus *bus); + extern u32 ssb_clockspeed(struct ssb_bus *bus); /* Is the device enabled in hardware? */ diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h index b548a54ff1f..7d7e03dcf77 100644 --- a/include/linux/ssb/ssb_driver_chipcommon.h +++ b/include/linux/ssb/ssb_driver_chipcommon.h @@ -367,8 +367,7 @@ static inline bool ssb_chipco_available(struct ssb_chipcommon *cc) extern void ssb_chipcommon_init(struct ssb_chipcommon *cc); -#include -extern void ssb_chipco_suspend(struct ssb_chipcommon *cc, pm_message_t state); +extern void ssb_chipco_suspend(struct ssb_chipcommon *cc); extern void ssb_chipco_resume(struct ssb_chipcommon *cc); extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc, -- cgit v1.2.3 From fff7710937f755099209357e5b5740d42a2c9f97 Mon Sep 17 00:00:00 2001 From: Chr Date: Tue, 1 Apr 2008 21:45:18 +0200 Subject: mac80211: add station aid into ieee80211_tx_control This patch is necessary for the upcoming Accesspoint patch for p54. Signed-off-by: Christian Lamparter Acked-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 01b32152b89..999f970da6b 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -302,6 +302,7 @@ struct ieee80211_tx_control { u8 iv_len; /* length of the IV field in octets */ u8 queue; /* hardware queue to use for this frame; * 0 = highest, hw->queues-1 = lowest */ + u16 aid; /* Station AID */ int type; /* internal */ }; -- cgit v1.2.3 From d625a29ba649a4df6027520ffc378f23c0e6883e Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Wed, 2 Apr 2008 19:46:56 +0200 Subject: ssb: Add support for block-I/O This adds support for block based I/O to SSB. This is needed in order to efficiently support PIO data transfers to the card. The block-I/O support is only compiled, if it's selected by the weird driver that needs it. So there's no overhead for sane devices. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- include/linux/ssb/ssb.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include') diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index a8ca396f810..9f95afd0e9e 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -78,6 +78,12 @@ struct ssb_bus_ops { void (*write8)(struct ssb_device *dev, u16 offset, u8 value); void (*write16)(struct ssb_device *dev, u16 offset, u16 value); void (*write32)(struct ssb_device *dev, u16 offset, u32 value); +#ifdef CONFIG_SSB_BLOCKIO + void (*block_read)(struct ssb_device *dev, void *buffer, + size_t count, u16 offset, u8 reg_width); + void (*block_write)(struct ssb_device *dev, const void *buffer, + size_t count, u16 offset, u8 reg_width); +#endif }; @@ -374,6 +380,19 @@ static inline void ssb_write32(struct ssb_device *dev, u16 offset, u32 value) { dev->ops->write32(dev, offset, value); } +#ifdef CONFIG_SSB_BLOCKIO +static inline void ssb_block_read(struct ssb_device *dev, void *buffer, + size_t count, u16 offset, u8 reg_width) +{ + dev->ops->block_read(dev, buffer, count, offset, reg_width); +} + +static inline void ssb_block_write(struct ssb_device *dev, const void *buffer, + size_t count, u16 offset, u8 reg_width) +{ + dev->ops->block_write(dev, buffer, count, offset, reg_width); +} +#endif /* CONFIG_SSB_BLOCKIO */ /* Translation (routing) bits that need to be ORed to DMA -- cgit v1.2.3 From 84363e6e07f17f8cc580065260907ee3f0520485 Mon Sep 17 00:00:00 2001 From: Mohamed Abbas Date: Fri, 4 Apr 2008 16:59:58 -0700 Subject: mac80211: notify mac from low level driver (iwlwifi) Add new API to MAC80211 to allow low level driver to notify MAC with driver status. Signed-off-by: Mohamed Abbas Signed-off-by: Reinette Chatre Acked-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 999f970da6b..079e7bd86c9 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -73,6 +73,14 @@ * not do so then mac80211 may add this under certain circumstances. */ +/** + * enum ieee80211_notification_type - Low level driver notification + * @IEEE80211_NOTIFY_RE_ASSOC: start the re-association sequence + */ +enum ieee80211_notification_types { + IEEE80211_NOTIFY_RE_ASSOC, +}; + /** * struct ieee80211_ht_bss_info - describing BSS's HT characteristics * @@ -1678,4 +1686,15 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid); void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra, u16 tid); +/** + * ieee80211_notify_mac - low level driver notification + * @hw: pointer as obtained from ieee80211_alloc_hw(). + * @notification_types: enum ieee80211_notification_types + * + * This function must be called by low level driver to inform mac80211 of + * low level driver status change or force mac80211 to re-assoc for low + * level driver internal error that require re-assoc. + */ +void ieee80211_notify_mac(struct ieee80211_hw *hw, + enum ieee80211_notification_types notif_type); #endif /* MAC80211_H */ -- cgit v1.2.3 From b715631fad3ed320b85d386a84a6fb0b3f86b0b9 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 10 Apr 2008 01:33:47 -0700 Subject: socket: sk_filter minor cleanups Some minor style cleanups: * Move __KERNEL__ definitions to one place in filter.h * Use const for sk_filter_len * Line wrapping * Put EXPORT_SYMBOL next to function definition Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- include/linux/filter.h | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/linux/filter.h b/include/linux/filter.h index ddfa0372a3b..bfc5d319b94 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -37,21 +37,6 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */ struct sock_filter __user *filter; }; -#ifdef __KERNEL__ -struct sk_filter -{ - atomic_t refcnt; - unsigned int len; /* Number of filter blocks */ - struct rcu_head rcu; - struct sock_filter insns[0]; -}; - -static inline unsigned int sk_filter_len(struct sk_filter *fp) -{ - return fp->len*sizeof(struct sock_filter) + sizeof(*fp); -} -#endif - /* * Instruction classes */ @@ -141,10 +126,24 @@ static inline unsigned int sk_filter_len(struct sk_filter *fp) #define SKF_LL_OFF (-0x200000) #ifdef __KERNEL__ +struct sk_filter +{ + atomic_t refcnt; + unsigned int len; /* Number of filter blocks */ + struct rcu_head rcu; + struct sock_filter insns[0]; +}; + +static inline unsigned int sk_filter_len(const struct sk_filter *fp) +{ + return fp->len * sizeof(struct sock_filter) + sizeof(*fp); +} + struct sk_buff; struct sock; -extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen); +extern unsigned int sk_run_filter(struct sk_buff *skb, + struct sock_filter *filter, int flen); extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); extern int sk_detach_filter(struct sock *sk); extern int sk_chk_filter(struct sock_filter *filter, int flen); -- cgit v1.2.3 From 43db6d65e0ef943a361cb91f8baa49132009227b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 10 Apr 2008 01:43:09 -0700 Subject: socket: sk_filter deinline The sk_filter function is too big to be inlined. This saves 2296 bytes of text on allyesconfig. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- include/linux/filter.h | 1 + include/net/sock.h | 35 ----------------------------------- 2 files changed, 1 insertion(+), 35 deletions(-) (limited to 'include') diff --git a/include/linux/filter.h b/include/linux/filter.h index bfc5d319b94..673e5677ebc 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -142,6 +142,7 @@ static inline unsigned int sk_filter_len(const struct sk_filter *fp) struct sk_buff; struct sock; +extern int sk_filter(struct sock *sk, struct sk_buff *skb); extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen); extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); diff --git a/include/net/sock.h b/include/net/sock.h index f4fdd101c9a..09255eae93e 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -927,41 +927,6 @@ extern void sk_common_release(struct sock *sk); /* Initialise core socket variables */ extern void sock_init_data(struct socket *sock, struct sock *sk); -/** - * sk_filter - run a packet through a socket filter - * @sk: sock associated with &sk_buff - * @skb: buffer to filter - * @needlock: set to 1 if the sock is not locked by caller. - * - * Run the filter code and then cut skb->data to correct size returned by - * sk_run_filter. If pkt_len is 0 we toss packet. If skb->len is smaller - * than pkt_len we keep whole skb->data. This is the socket level - * wrapper to sk_run_filter. It returns 0 if the packet should - * be accepted or -EPERM if the packet should be tossed. - * - */ - -static inline int sk_filter(struct sock *sk, struct sk_buff *skb) -{ - int err; - struct sk_filter *filter; - - err = security_sock_rcv_skb(sk, skb); - if (err) - return err; - - rcu_read_lock_bh(); - filter = rcu_dereference(sk->sk_filter); - if (filter) { - unsigned int pkt_len = sk_run_filter(skb, filter->insns, - filter->len); - err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM; - } - rcu_read_unlock_bh(); - - return err; -} - /** * sk_filter_release: Release a socket filter * @sk: socket -- cgit v1.2.3 From 3cccd6078413e9707f0ef3652b4e6e9cb84e9fa0 Mon Sep 17 00:00:00 2001 From: Rami Rosen Date: Thu, 10 Apr 2008 02:01:21 -0700 Subject: [IPV6] Remove three method declarations in include/net/ndisc.h. This patch removes two unused method declarations in include/net/ndisc.h: ndisc_forwarding_on(void) and ndisc_forwarding_off(void); Also igmp6_cleanup(void) appears twice in this header, so one igmp6_cleanup(void) declaration is removed. Signed-off-by: Rami Rosen Signed-off-by: David S. Miller --- include/net/ndisc.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 9f2bae68d28..16424236fe2 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -102,9 +102,6 @@ extern void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, struct in6_addr *daddr); -extern void ndisc_forwarding_on(void); -extern void ndisc_forwarding_off(void); - extern void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, struct in6_addr *target); @@ -124,7 +121,6 @@ extern int igmp6_event_query(struct sk_buff *skb); extern int igmp6_event_report(struct sk_buff *skb); -extern void igmp6_cleanup(void); #ifdef CONFIG_SYSCTL extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, -- cgit v1.2.3 From 4738c1db1593687713869fa69e733eebc7b0d6d8 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Thu, 10 Apr 2008 02:02:28 -0700 Subject: [SKFILTER]: Add SKF_ADF_NLATTR instruction SKF_ADF_NLATTR searches for a netlink attribute, which avoids manually parsing and walking attributes. It takes the offset at which to start searching in the 'A' register and the attribute type in the 'X' register and returns the offset in the 'A' register. When the attribute is not found it returns zero. A top-level attribute can be located using a filter like this (example for nfnetlink, using struct nfgenmsg): ... { /* A = offset of first attribute */ .code = BPF_LD | BPF_IMM, .k = sizeof(struct nlmsghdr) + sizeof(struct nfgenmsg) }, { /* X = CTA_PROTOINFO */ .code = BPF_LDX | BPF_IMM, .k = CTA_PROTOINFO, }, { /* A = netlink attribute offset */ .code = BPF_LD | BPF_B | BPF_ABS, .k = SKF_AD_OFF + SKF_AD_NLATTR }, { /* Exit if not found */ .code = BPF_JMP | BPF_JEQ | BPF_K, .k = 0, .jt = }, ... A nested attribute below the CTA_PROTOINFO attribute would then be parsed like this: ... { /* A += sizeof(struct nlattr) */ .code = BPF_ALU | BPF_ADD | BPF_K, .k = sizeof(struct nlattr), }, { /* X = CTA_PROTOINFO_TCP */ .code = BPF_LDX | BPF_IMM, .k = CTA_PROTOINFO_TCP, }, { /* A = netlink attribute offset */ .code = BPF_LD | BPF_B | BPF_ABS, .k = SKF_AD_OFF + SKF_AD_NLATTR }, ... The data of an attribute can be loaded into 'A' like this: ... { /* X = A (attribute offset) */ .code = BPF_MISC | BPF_TAX, }, { /* A = skb->data[X + k] */ .code = BPF_LD | BPF_B | BPF_IND, .k = sizeof(struct nlattr), }, ... Signed-off-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/filter.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/filter.h b/include/linux/filter.h index 673e5677ebc..b6ea9aa9e85 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -121,7 +121,8 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */ #define SKF_AD_PROTOCOL 0 #define SKF_AD_PKTTYPE 4 #define SKF_AD_IFINDEX 8 -#define SKF_AD_MAX 12 +#define SKF_AD_NLATTR 12 +#define SKF_AD_MAX 16 #define SKF_NET_OFF (-0x100000) #define SKF_LL_OFF (-0x200000) -- cgit v1.2.3 From 5c06f510a25153ff79e8c2dca312b732a367c5bb Mon Sep 17 00:00:00 2001 From: Rami Rosen Date: Thu, 10 Apr 2008 02:31:20 -0700 Subject: [IPV6]: Remove unused declarations in include/net/ip6_route.h. 1) Standlaone ip6_null_entry is no longer needed as it is replaced by the ip6_null_entry member of ipv6 (instance of struct netns_ipv6) in struct net (as a result of Network Namespaces patches). 2) These 3 methods from this same header are not defined anywhere: ip6_rt_addr_add(), ip6_rt_addr_del(), rt6_sndmsg() Signed-off-by: Rami Rosen Signed-off-by: David S. Miller --- include/net/ip6_route.h | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'include') diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 3ae6799c2b1..9080076ce0e 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -37,7 +37,6 @@ struct route_info { #define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010 #define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 -extern struct rt6_info *ip6_null_entry; #ifdef CONFIG_IPV6_MULTIPLE_TABLES extern struct rt6_info *ip6_prohibit_entry; @@ -61,20 +60,6 @@ extern int ip6_route_add(struct fib6_config *cfg); extern int ip6_ins_rt(struct rt6_info *); extern int ip6_del_rt(struct rt6_info *); -extern int ip6_rt_addr_add(struct in6_addr *addr, - struct net_device *dev, - int anycast); - -extern int ip6_rt_addr_del(struct in6_addr *addr, - struct net_device *dev); - -extern void rt6_sndmsg(int type, struct in6_addr *dst, - struct in6_addr *src, - struct in6_addr *gw, - struct net_device *dev, - int dstlen, int srclen, - int metric, __u32 flags); - extern struct rt6_info *rt6_lookup(struct net *net, struct in6_addr *daddr, struct in6_addr *saddr, -- cgit v1.2.3 From 4dfc2817025965a2fc78a18c50f540736a6b5c24 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Thu, 10 Apr 2008 03:12:40 -0700 Subject: [Syncookies]: Add support for TCP options via timestamps. Allow the use of SACK and window scaling when syncookies are used and the client supports tcp timestamps. Options are encoded into the timestamp sent in the syn-ack and restored from the timestamp echo when the ack is received. Based on earlier work by Glenn Griffin. This patch avoids increasing the size of structs by encoding TCP options into the least significant bits of the timestamp and by not using any 'timestamp offset'. The downside is that the timestamp sent in the packet after the synack will increase by several seconds. changes since v1: don't duplicate timestamp echo decoding function, put it into ipv4/syncookie.c and have ipv6/syncookies.c use it. Feedback from Glenn Griffin: fix line indented with spaces, kill redundant if () Reviewed-by: Hagen Paul Pfeifer Signed-off-by: Florian Westphal Signed-off-by: David S. Miller --- include/net/request_sock.h | 2 +- include/net/tcp.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/request_sock.h b/include/net/request_sock.h index 0369f98e9f3..b220b5f624d 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h @@ -45,7 +45,7 @@ struct request_sock { struct request_sock *dl_next; /* Must be first member! */ u16 mss; u8 retrans; - u8 __pad; + u8 cookie_ts; /* syncookie: encode tcpopts in timestamp */ /* The following two fields can be easily recomputed I think -AK */ u32 window_clamp; /* window clamp at creation time */ u32 rcv_wnd; /* rcv_wnd offered first time */ diff --git a/include/net/tcp.h b/include/net/tcp.h index 723b36851dd..7b41bb962b9 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -442,6 +442,9 @@ extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mss); +extern __u32 cookie_init_timestamp(struct request_sock *req); +extern void cookie_check_timestamp(struct tcp_options_received *tcp_opt); + /* From net/ipv6/syncookies.c */ extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); extern __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb, @@ -956,6 +959,7 @@ static inline void tcp_openreq_init(struct request_sock *req, struct inet_request_sock *ireq = inet_rsk(req); req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */ + req->cookie_ts = 0; tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq; req->mss = rx_opt->mss_clamp; req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0; -- cgit v1.2.3 From fed85383ac34d82e96f227ce49ce68117cec23a0 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Fri, 11 Apr 2008 20:17:55 +0900 Subject: [IPV6]: Use XOR and OR rather than mutiple ands for ipv6 address comparisons. ipv6_addr_equal(), ipv6_addr_v4mapped(), ipv6_addr_is_ll_all_{nodes,routers}(), ipv6_masked_addr_cmp() Signed-off-by: YOSHIFUJI Hideaki --- include/net/addrconf.h | 14 ++++++-------- include/net/ipv6.h | 22 ++++++++++------------ 2 files changed, 16 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/include/net/addrconf.h b/include/net/addrconf.h index bdcc863a60a..1dc9d03372d 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -240,18 +240,16 @@ static inline int ipv6_addr_is_multicast(const struct in6_addr *addr) static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) { - return (addr->s6_addr32[0] == htonl(0xff020000) && - addr->s6_addr32[1] == 0 && - addr->s6_addr32[2] == 0 && - addr->s6_addr32[3] == htonl(0x00000001)); + return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | + addr->s6_addr32[1] | addr->s6_addr32[2] | + (addr->s6_addr32[3] ^ htonl(0x00000001))) == 0); } static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) { - return (addr->s6_addr32[0] == htonl(0xff020000) && - addr->s6_addr32[1] == 0 && - addr->s6_addr32[2] == 0 && - addr->s6_addr32[3] == htonl(0x00000002)); + return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | + addr->s6_addr32[1] | addr->s6_addr32[2] | + (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0); } static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr) diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 5738c1c73ac..a0c285b6311 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -280,12 +280,10 @@ static inline int ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m, const struct in6_addr *a2) { - unsigned int i; - - for (i = 0; i < 4; i++) - if ((a1->s6_addr32[i] ^ a2->s6_addr32[i]) & m->s6_addr32[i]) - return 1; - return 0; + return (!!(((a1->s6_addr32[0] ^ a2->s6_addr32[0]) & m->s6_addr32[0]) | + ((a1->s6_addr32[1] ^ a2->s6_addr32[1]) & m->s6_addr32[1]) | + ((a1->s6_addr32[2] ^ a2->s6_addr32[2]) & m->s6_addr32[2]) | + ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3]))); } static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2) @@ -320,10 +318,10 @@ static inline void ipv6_addr_set(struct in6_addr *addr, static inline int ipv6_addr_equal(const struct in6_addr *a1, const struct in6_addr *a2) { - return (a1->s6_addr32[0] == a2->s6_addr32[0] && - a1->s6_addr32[1] == a2->s6_addr32[1] && - a1->s6_addr32[2] == a2->s6_addr32[2] && - a1->s6_addr32[3] == a2->s6_addr32[3]); + return (((a1->s6_addr32[0] ^ a2->s6_addr32[0]) | + (a1->s6_addr32[1] ^ a2->s6_addr32[1]) | + (a1->s6_addr32[2] ^ a2->s6_addr32[2]) | + (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0); } static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, @@ -371,8 +369,8 @@ static inline int ipv6_addr_any(const struct in6_addr *a) static inline int ipv6_addr_v4mapped(const struct in6_addr *a) { - return ((a->s6_addr32[0] | a->s6_addr32[1]) == 0 && - a->s6_addr32[2] == htonl(0x0000ffff)); + return ((a->s6_addr32[0] | a->s6_addr32[1] | + (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0); } /* -- cgit v1.2.3 From 3eb84f49290461e2b83d6e8ee1f3f0e504340c8b Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 10 Apr 2008 15:42:08 +0900 Subject: [IPV6] ADDRCONF: Uninline ipv6_addr_hash(). The function is only used in net/ipv6/addrconf.c. Signed-off-by: YOSHIFUJI Hideaki --- include/net/addrconf.h | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'include') diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 1dc9d03372d..1ba4e5bf580 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -189,25 +189,6 @@ static inline void in6_ifa_put(struct inet6_ifaddr *ifp) #define in6_ifa_hold(ifp) atomic_inc(&(ifp)->refcnt) -/* - * Hash function taken from net_alias.c - */ - -static __inline__ u8 ipv6_addr_hash(const struct in6_addr *addr) -{ - __u32 word; - - /* - * We perform the hash function over the last 64 bits of the address - * This will include the IEEE address token on links that support it. - */ - - word = (__force u32)(addr->s6_addr32[2] ^ addr->s6_addr32[3]); - word ^= (word >> 16); - word ^= (word >> 8); - - return ((word ^ (word >> 4)) & 0x0f); -} /* * compute link-local solicited-node multicast address -- cgit v1.2.3 From dfd982baff01c18e3e1717c97fdac79c28f105ce Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 10 Apr 2008 15:42:09 +0900 Subject: [IPV6] ADDRCONF: Uninline ipv6_isatap_eui64(). Signed-off-by: YOSHIFUJI Hideaki --- include/net/addrconf.h | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'include') diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 1ba4e5bf580..8317c1bcd86 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -233,20 +233,7 @@ static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0); } -static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr) -{ - eui[0] = (ipv4_is_zeronet(addr) || ipv4_is_private_10(addr) || - ipv4_is_loopback(addr) || ipv4_is_linklocal_169(addr) || - ipv4_is_private_172(addr) || ipv4_is_test_192(addr) || - ipv4_is_anycast_6to4(addr) || ipv4_is_private_192(addr) || - ipv4_is_test_198(addr) || ipv4_is_multicast(addr) || - ipv4_is_lbcast(addr)) ? 0x00 : 0x02; - eui[1] = 0; - eui[2] = 0x5E; - eui[3] = 0xFE; - memcpy (eui+4, &addr, 4); - return 0; -} +extern int __ipv6_isatap_ifid(u8 *eui, __be32 addr); static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) { -- cgit v1.2.3 From 9acd9f3ae92d0dc0ca7504fb48c1040e8bbc39fe Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 10 Apr 2008 15:42:10 +0900 Subject: [IPV6]: Make address arguments const. - net/ipv6/addrconf.c: ipv6_get_ifaddr(), ipv6_dev_get_saddr() - net/ipv6/mcast.c: ipv6_sock_mc_join(), ipv6_sock_mc_drop(), inet6_mc_check(), ipv6_dev_mc_inc(), __ipv6_dev_mc_dec(), ipv6_dev_mc_dec(), ipv6_chk_mcast_addr() - net/ipv6/route.c: rt6_lookup(), icmp6_dst_alloc() - net/ipv6/ip6_output.c: ip6_nd_hdr() - net/ipv6/ndisc.c: ndisc_send_ns(), ndisc_send_rs(), ndisc_send_redirect(), ndisc_get_neigh(), __ndisc_send() Signed-off-by: YOSHIFUJI Hideaki --- include/net/addrconf.h | 28 +++++++++++++++------------- include/net/ip6_route.h | 6 +++--- include/net/ipv6.h | 4 ++-- include/net/ndisc.h | 14 +++++++------- 4 files changed, 27 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 8317c1bcd86..92af23d66eb 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -76,12 +76,12 @@ extern int ipv6_chk_prefix(struct in6_addr *addr, struct net_device *dev); extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, - struct in6_addr *addr, + const struct in6_addr *addr, struct net_device *dev, int strict); extern int ipv6_dev_get_saddr(struct net_device *dev, - struct in6_addr *daddr, + const struct in6_addr *daddr, unsigned int srcprefs, struct in6_addr *saddr); extern int ipv6_get_lladdr(struct net_device *dev, @@ -105,25 +105,27 @@ extern u32 ipv6_addr_label(const struct in6_addr *addr, /* * multicast prototypes (mcast.c) */ -extern int ipv6_sock_mc_join(struct sock *sk, int ifindex, - struct in6_addr *addr); -extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex, - struct in6_addr *addr); +extern int ipv6_sock_mc_join(struct sock *sk, int ifindex, + const struct in6_addr *addr); +extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex, + const struct in6_addr *addr); extern void ipv6_sock_mc_close(struct sock *sk); -extern int inet6_mc_check(struct sock *sk, struct in6_addr *mc_addr, - struct in6_addr *src_addr); +extern int inet6_mc_check(struct sock *sk, + const struct in6_addr *mc_addr, + const struct in6_addr *src_addr); -extern int ipv6_dev_mc_inc(struct net_device *dev, struct in6_addr *addr); -extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, struct in6_addr *addr); -extern int ipv6_dev_mc_dec(struct net_device *dev, struct in6_addr *addr); +extern int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr); +extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr); +extern int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr); extern void ipv6_mc_up(struct inet6_dev *idev); extern void ipv6_mc_down(struct inet6_dev *idev); extern void ipv6_mc_init_dev(struct inet6_dev *idev); extern void ipv6_mc_destroy_dev(struct inet6_dev *idev); extern void addrconf_dad_failure(struct inet6_ifaddr *ifp); -extern int ipv6_chk_mcast_addr(struct net_device *dev, struct in6_addr *group, - struct in6_addr *src_addr); +extern int ipv6_chk_mcast_addr(struct net_device *dev, + const struct in6_addr *group, + const struct in6_addr *src_addr); extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr); extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len); diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 9080076ce0e..9313491e3da 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -61,13 +61,13 @@ extern int ip6_ins_rt(struct rt6_info *); extern int ip6_del_rt(struct rt6_info *); extern struct rt6_info *rt6_lookup(struct net *net, - struct in6_addr *daddr, - struct in6_addr *saddr, + const struct in6_addr *daddr, + const struct in6_addr *saddr, int oif, int flags); extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct neighbour *neigh, - struct in6_addr *addr); + const struct in6_addr *addr); extern int icmp6_dst_gc(int *more); extern void fib6_force_start_gc(struct net *net); diff --git a/include/net/ipv6.h b/include/net/ipv6.h index a0c285b6311..49c48983019 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -451,8 +451,8 @@ extern int ip6_xmit(struct sock *sk, extern int ip6_nd_hdr(struct sock *sk, struct sk_buff *skb, struct net_device *dev, - struct in6_addr *saddr, - struct in6_addr *daddr, + const struct in6_addr *saddr, + const struct in6_addr *daddr, int proto, int len); extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr); diff --git a/include/net/ndisc.h b/include/net/ndisc.h index 16424236fe2..9c451ff2f4f 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h @@ -94,17 +94,17 @@ extern int ndisc_rcv(struct sk_buff *skb); extern void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, - struct in6_addr *solicit, - struct in6_addr *daddr, - struct in6_addr *saddr); + const struct in6_addr *solicit, + const struct in6_addr *daddr, + const struct in6_addr *saddr); extern void ndisc_send_rs(struct net_device *dev, - struct in6_addr *saddr, - struct in6_addr *daddr); + const struct in6_addr *saddr, + const struct in6_addr *daddr); extern void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, - struct in6_addr *target); + const struct in6_addr *target); extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir); @@ -134,7 +134,7 @@ extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, extern void inet6_ifinfo_notify(int event, struct inet6_dev *idev); -static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, struct in6_addr *addr) +static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, const struct in6_addr *addr) { if (dev) -- cgit v1.2.3 From f3ee4010e84452aa133e5163e6cfabc52b194e94 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 10 Apr 2008 15:42:11 +0900 Subject: [IPV6]: Define constants for link-local multicast addresses. - Define link-local all-node / all-router multicast addresses. - Remove ipv6_addr_all_nodes() and ipv6_addr_all_routers(). Signed-off-by: YOSHIFUJI Hideaki --- include/linux/in6.h | 8 ++++++++ include/net/addrconf.h | 11 ----------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/linux/in6.h b/include/linux/in6.h index e6aa8de2b93..bc492048c34 100644 --- a/include/linux/in6.h +++ b/include/linux/in6.h @@ -48,6 +48,14 @@ extern const struct in6_addr in6addr_any; #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } extern const struct in6_addr in6addr_loopback; #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } +#ifdef __KERNEL__ +extern const struct in6_addr in6addr_linklocal_allnodes; +#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \ + { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } +extern const struct in6_addr in6addr_linklocal_allrouters; +#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \ + { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } } +#endif struct sockaddr_in6 { unsigned short int sin6_family; /* AF_INET6 */ diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 92af23d66eb..0a2f0372df3 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -205,17 +205,6 @@ static inline void addrconf_addr_solict_mult(const struct in6_addr *addr, htonl(0xFF000000) | addr->s6_addr32[3]); } - -static inline void ipv6_addr_all_nodes(struct in6_addr *addr) -{ - ipv6_addr_set(addr, htonl(0xFF020000), 0, 0, htonl(0x1)); -} - -static inline void ipv6_addr_all_routers(struct in6_addr *addr) -{ - ipv6_addr_set(addr, htonl(0xFF020000), 0, 0, htonl(0x2)); -} - static inline int ipv6_addr_is_multicast(const struct in6_addr *addr) { return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000); -- cgit v1.2.3 From 7f1eced8b0a001c4d5a8cfa5ac7b5cbc89fedab8 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Thu, 10 Apr 2008 15:42:12 +0900 Subject: [IPV6] MIP6: Use our standard definitions for paddings. MIP6_OPT_PAD_X are actually for paddings in destination option header. Replace them with our standard IPV6_TLV_PADX. Signed-off-by: YOSHIFUJI Hideaki --- include/net/mip6.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/net/mip6.h b/include/net/mip6.h index 63272610a24..a83ad1982a9 100644 --- a/include/net/mip6.h +++ b/include/net/mip6.h @@ -28,9 +28,6 @@ #include #include -#define MIP6_OPT_PAD_1 0 -#define MIP6_OPT_PAD_N 1 - /* * Mobility Header */ -- cgit v1.2.3 From 00447872a643787411c2c0cb1df6169dda8b0c47 Mon Sep 17 00:00:00 2001 From: Paul Moore Date: Sat, 12 Apr 2008 19:06:42 -0700 Subject: NetLabel: Allow passing the LSM domain as a shared pointer Smack doesn't have the need to create a private copy of the LSM "domain" when setting NetLabel security attributes like SELinux, however, the current NetLabel code requires a private copy of the LSM "domain". This patches fixes that by letting the LSM determine how it wants to pass the domain value. * NETLBL_SECATTR_DOMAIN_CPY The current behavior, NetLabel assumes that the domain value is a copy and frees it when done * NETLBL_SECATTR_DOMAIN New, Smack-friendly behavior, NetLabel assumes that the domain value is a reference to a string managed by the LSM and does not free it when done Signed-off-by: Paul Moore Acked-by: James Morris Signed-off-by: David S. Miller --- include/net/netlabel.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/net/netlabel.h b/include/net/netlabel.h index 0ca67d73c7a..5e53a85b5ca 100644 --- a/include/net/netlabel.h +++ b/include/net/netlabel.h @@ -162,7 +162,7 @@ struct netlbl_lsm_secattr_catmap { /** * struct netlbl_lsm_secattr - NetLabel LSM security attributes - * @flags: indicate which attributes are contained in this structure + * @flags: indicate structure attributes, see NETLBL_SECATTR_* * @type: indicate the NLTYPE of the attributes * @domain: the NetLabel LSM domain * @cache: NetLabel LSM specific cache @@ -180,17 +180,22 @@ struct netlbl_lsm_secattr_catmap { * NetLabel itself when returning security attributes to the LSM. * */ +struct netlbl_lsm_secattr { + u32 flags; + /* bitmap values for 'flags' */ #define NETLBL_SECATTR_NONE 0x00000000 #define NETLBL_SECATTR_DOMAIN 0x00000001 +#define NETLBL_SECATTR_DOMAIN_CPY (NETLBL_SECATTR_DOMAIN | \ + NETLBL_SECATTR_FREE_DOMAIN) #define NETLBL_SECATTR_CACHE 0x00000002 #define NETLBL_SECATTR_MLS_LVL 0x00000004 #define NETLBL_SECATTR_MLS_CAT 0x00000008 #define NETLBL_SECATTR_SECID 0x00000010 + /* bitmap meta-values for 'flags' */ +#define NETLBL_SECATTR_FREE_DOMAIN 0x01000000 #define NETLBL_SECATTR_CACHEABLE (NETLBL_SECATTR_MLS_LVL | \ NETLBL_SECATTR_MLS_CAT | \ NETLBL_SECATTR_SECID) -struct netlbl_lsm_secattr { - u32 flags; u32 type; char *domain; struct netlbl_lsm_cache *cache; @@ -303,7 +308,8 @@ static inline void netlbl_secattr_init(struct netlbl_lsm_secattr *secattr) */ static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr) { - kfree(secattr->domain); + if (secattr->flags & NETLBL_SECATTR_FREE_DOMAIN) + kfree(secattr->domain); if (secattr->flags & NETLBL_SECATTR_CACHE) netlbl_secattr_cache_free(secattr->cache); if (secattr->flags & NETLBL_SECATTR_MLS_CAT) -- cgit v1.2.3 From 03e1ad7b5d871d4189b1da3125c2f12d1b5f7d0b Mon Sep 17 00:00:00 2001 From: Paul Moore Date: Sat, 12 Apr 2008 19:07:52 -0700 Subject: LSM: Make the Labeled IPsec hooks more stack friendly The xfrm_get_policy() and xfrm_add_pol_expire() put some rather large structs on the stack to work around the LSM API. This patch attempts to fix that problem by changing the LSM API to require only the relevant "security" pointers instead of the entire SPD entry; we do this for all of the security_xfrm_policy*() functions to keep things consistent. Signed-off-by: Paul Moore Acked-by: James Morris Signed-off-by: David S. Miller --- include/linux/security.h | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'include') diff --git a/include/linux/security.h b/include/linux/security.h index c673dfd4dff..f5eb9ff47ac 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -910,24 +910,24 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) * Security hooks for XFRM operations. * * @xfrm_policy_alloc_security: - * @xp contains the xfrm_policy being added to Security Policy Database - * used by the XFRM system. + * @ctxp is a pointer to the xfrm_sec_ctx being added to Security Policy + * Database used by the XFRM system. * @sec_ctx contains the security context information being provided by * the user-level policy update program (e.g., setkey). * Allocate a security structure to the xp->security field; the security * field is initialized to NULL when the xfrm_policy is allocated. * Return 0 if operation was successful (memory to allocate, legal context) * @xfrm_policy_clone_security: - * @old contains an existing xfrm_policy in the SPD. - * @new contains a new xfrm_policy being cloned from old. - * Allocate a security structure to the new->security field - * that contains the information from the old->security field. + * @old_ctx contains an existing xfrm_sec_ctx. + * @new_ctxp contains a new xfrm_sec_ctx being cloned from old. + * Allocate a security structure in new_ctxp that contains the + * information from the old_ctx structure. * Return 0 if operation was successful (memory to allocate). * @xfrm_policy_free_security: - * @xp contains the xfrm_policy + * @ctx contains the xfrm_sec_ctx * Deallocate xp->security. * @xfrm_policy_delete_security: - * @xp contains the xfrm_policy. + * @ctx contains the xfrm_sec_ctx. * Authorize deletion of xp->security. * @xfrm_state_alloc_security: * @x contains the xfrm_state being added to the Security Association @@ -947,7 +947,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) * @x contains the xfrm_state. * Authorize deletion of x->security. * @xfrm_policy_lookup: - * @xp contains the xfrm_policy for which the access control is being + * @ctx contains the xfrm_sec_ctx for which the access control is being * checked. * @fl_secid contains the flow security label that is used to authorize * access to the policy xp. @@ -1454,17 +1454,17 @@ struct security_operations { #endif /* CONFIG_SECURITY_NETWORK */ #ifdef CONFIG_SECURITY_NETWORK_XFRM - int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, + int (*xfrm_policy_alloc_security) (struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx); - int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); - void (*xfrm_policy_free_security) (struct xfrm_policy *xp); - int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); + int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx); + void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx); + int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx); int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx, u32 secid); void (*xfrm_state_free_security) (struct xfrm_state *x); int (*xfrm_state_delete_security) (struct xfrm_state *x); - int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir); + int (*xfrm_policy_lookup)(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, struct xfrm_policy *xp, struct flowi *fl); int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); @@ -2562,16 +2562,16 @@ static inline void security_inet_conn_established(struct sock *sk, #ifdef CONFIG_SECURITY_NETWORK_XFRM -int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); -int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new); -void security_xfrm_policy_free(struct xfrm_policy *xp); -int security_xfrm_policy_delete(struct xfrm_policy *xp); +int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx); +int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp); +void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx); +int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx); int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); int security_xfrm_state_alloc_acquire(struct xfrm_state *x, struct xfrm_sec_ctx *polsec, u32 secid); int security_xfrm_state_delete(struct xfrm_state *x); void security_xfrm_state_free(struct xfrm_state *x); -int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir); +int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir); int security_xfrm_state_pol_flow_match(struct xfrm_state *x, struct xfrm_policy *xp, struct flowi *fl); int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); @@ -2579,21 +2579,21 @@ void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl); #else /* CONFIG_SECURITY_NETWORK_XFRM */ -static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) +static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx) { return 0; } -static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) +static inline int security_xfrm_policy_clone(struct xfrm_sec_ctx *old, struct xfrm_sec_ctx **new_ctxp) { return 0; } -static inline void security_xfrm_policy_free(struct xfrm_policy *xp) +static inline void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx) { } -static inline int security_xfrm_policy_delete(struct xfrm_policy *xp) +static inline int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx) { return 0; } @@ -2619,7 +2619,7 @@ static inline int security_xfrm_state_delete(struct xfrm_state *x) return 0; } -static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir) +static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir) { return 0; } -- cgit v1.2.3 From a4146b1b2c6ba995db08b1a2aef5af1b17b151e6 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Sun, 13 Apr 2008 22:11:14 -0700 Subject: [TCP]: Replace struct net on tcp_iter_state with seq_net_private. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/tcp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/tcp.h b/include/net/tcp.h index 7b41bb962b9..f5b61e0f01f 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1333,7 +1333,7 @@ struct tcp_seq_afinfo { }; struct tcp_iter_state { - struct net *net; + struct seq_net_private p; sa_family_t family; enum tcp_seq_states state; struct sock *syn_wait_sk; -- cgit v1.2.3 From 9427c4b36b8fe652df1d7c89eae678948e1f4b32 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Sun, 13 Apr 2008 22:12:13 -0700 Subject: [TCP]: Move seq_ops from tcp_iter_state to tcp_seq_afinfo. No need to create seq_operations for each instance of 'netstat'. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/tcp.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/tcp.h b/include/net/tcp.h index f5b61e0f01f..2c9a650412c 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1328,8 +1328,8 @@ struct tcp_seq_afinfo { struct module *owner; char *name; sa_family_t family; - int (*seq_show) (struct seq_file *m, void *v); struct file_operations *seq_fops; + struct seq_operations seq_ops; }; struct tcp_iter_state { @@ -1338,7 +1338,6 @@ struct tcp_iter_state { enum tcp_seq_states state; struct sock *syn_wait_sk; int bucket, sbucket, num, uid; - struct seq_operations seq_ops; }; extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); -- cgit v1.2.3 From 68fcadd16c371d5e0698ba366f33a4f990ce83ce Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Sun, 13 Apr 2008 22:13:30 -0700 Subject: [TCP]: Place file operations directly into tcp_seq_afinfo. No need to have separate never-used variable. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/tcp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/tcp.h b/include/net/tcp.h index 2c9a650412c..93479ebf3e3 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1328,7 +1328,7 @@ struct tcp_seq_afinfo { struct module *owner; char *name; sa_family_t family; - struct file_operations *seq_fops; + struct file_operations seq_fops; struct seq_operations seq_ops; }; -- cgit v1.2.3 From 5f4472c5a640c9671ca5becaebdfd6e651482176 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Sun, 13 Apr 2008 22:13:53 -0700 Subject: [TCP]: Remove owner from tcp_seq_afinfo. Move it to tcp_seq_afinfo->seq_fops as should be. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/tcp.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/net/tcp.h b/include/net/tcp.h index 93479ebf3e3..58d82822414 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1325,7 +1325,6 @@ enum tcp_seq_states { }; struct tcp_seq_afinfo { - struct module *owner; char *name; sa_family_t family; struct file_operations seq_fops; -- cgit v1.2.3 From 67019cc9ee3f4868c8e5e493b2873c4722306019 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Sun, 13 Apr 2008 22:28:42 -0700 Subject: [NETNS]: Add an empty netns_dccp structure on struct net. According to the overall struct net design, it will be filled with DCCP-related members. Signed-off-by: Pavel Emelyanov Acked-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- include/net/net_namespace.h | 4 ++++ include/net/netns/dccp.h | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 include/net/netns/dccp.h (limited to 'include') diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 0ab62ed2fde..e2aee2689ab 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -13,6 +13,7 @@ #include #include #include +#include #include struct proc_dir_entry; @@ -54,6 +55,9 @@ struct net { #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) struct netns_ipv6 ipv6; #endif +#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE) + struct netns_dccp dccp; +#endif #ifdef CONFIG_NETFILTER struct netns_xt xt; #endif diff --git a/include/net/netns/dccp.h b/include/net/netns/dccp.h new file mode 100644 index 00000000000..056e6adc70b --- /dev/null +++ b/include/net/netns/dccp.h @@ -0,0 +1,7 @@ +#ifndef __NETNS_DCCP_H__ +#define __NETNS_DCCP_H__ + +struct netns_dccp { +}; + +#endif -- cgit v1.2.3 From 7b1cffa8c90269dc3dc721d084d1e0d742d87c31 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Sun, 13 Apr 2008 22:29:37 -0700 Subject: [NETNS][DCCPV4]: Move the dccp_v4_ctl_sk on the struct net. And replace all its usage with init_net's socket. Signed-off-by: Pavel Emelyanov Acked-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- include/net/netns/dccp.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/net/netns/dccp.h b/include/net/netns/dccp.h index 056e6adc70b..e4f16faa898 100644 --- a/include/net/netns/dccp.h +++ b/include/net/netns/dccp.h @@ -1,7 +1,10 @@ #ifndef __NETNS_DCCP_H__ #define __NETNS_DCCP_H__ +struct sock; + struct netns_dccp { + struct sock *v4_ctl_sk; }; #endif -- cgit v1.2.3 From 0204774191d3e7bc69e3ae6bbf328b635607505a Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Sun, 13 Apr 2008 22:32:25 -0700 Subject: [NETNS][DCCPV6]: Move the dccp_v6_ctl_sk on the struct net. And replace all its usage with init_net's socket. Signed-off-by: Pavel Emelyanov Acked-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- include/net/netns/dccp.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/netns/dccp.h b/include/net/netns/dccp.h index e4f16faa898..98d2a7ce1f7 100644 --- a/include/net/netns/dccp.h +++ b/include/net/netns/dccp.h @@ -5,6 +5,7 @@ struct sock; struct netns_dccp { struct sock *v4_ctl_sk; + struct sock *v6_ctl_sk; }; #endif -- cgit v1.2.3 From cee8947338d46bccece54c752bf6cd4043035f05 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Sun, 13 Apr 2008 23:21:16 -0700 Subject: [IPV6] MROUTE: Do not call ipv6_find_idev() directly. Since NETDEV_REGISTER notifier chain is responsible for creating inet6_dev{}, we do not need to call ipv6_find_idev() directly here. Signed-off-by: YOSHIFUJI Hideaki Signed-off-by: David S. Miller --- include/linux/mroute6.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h index f6469fb9084..e7989593142 100644 --- a/include/linux/mroute6.h +++ b/include/linux/mroute6.h @@ -117,9 +117,6 @@ struct sioc_mif_req6 #include /* for struct sk_buff_head */ -struct net_device; -struct inet6_dev *ipv6_find_idev(struct net_device *dev); - #ifdef CONFIG_IPV6_MROUTE static inline int ip6_mroute_opt(int opt) { -- cgit v1.2.3 From f525c06d12b72cddb085df7f6f348c3c5a39b3ce Mon Sep 17 00:00:00 2001 From: Gerrit Renker Date: Mon, 14 Apr 2008 00:04:12 -0700 Subject: [SKB]: __skb_dequeue = skb_peek + __skb_unlink By rearranging the order of declarations, __skb_dequeue() is expressed in terms of * skb_peek() and * __skb_unlink(), thus in effect mirroring the analogue implementation of __skb_dequeue_tail(). Signed-off-by: Gerrit Renker Signed-off-by: David S. Miller --- include/linux/skbuff.h | 47 ++++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index e517701c25b..c2116200580 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -734,35 +734,6 @@ static inline void __skb_queue_tail(struct sk_buff_head *list, next->prev = prev->next = newsk; } - -/** - * __skb_dequeue - remove from the head of the queue - * @list: list to dequeue from - * - * Remove the head of the list. This function does not take any locks - * so must be used with appropriate locks held only. The head item is - * returned or %NULL if the list is empty. - */ -extern struct sk_buff *skb_dequeue(struct sk_buff_head *list); -static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list) -{ - struct sk_buff *next, *prev, *result; - - prev = (struct sk_buff *) list; - next = prev->next; - result = NULL; - if (next != prev) { - result = next; - next = next->next; - list->qlen--; - next->prev = prev; - prev->next = next; - result->next = result->prev = NULL; - } - return result; -} - - /* * Insert a packet on a list. */ @@ -803,8 +774,22 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) prev->next = next; } - -/* XXX: more streamlined implementation */ +/** + * __skb_dequeue - remove from the head of the queue + * @list: list to dequeue from + * + * Remove the head of the list. This function does not take any locks + * so must be used with appropriate locks held only. The head item is + * returned or %NULL if the list is empty. + */ +extern struct sk_buff *skb_dequeue(struct sk_buff_head *list); +static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list) +{ + struct sk_buff *skb = skb_peek(list); + if (skb) + __skb_unlink(skb, list); + return skb; +} /** * __skb_dequeue_tail - remove from the tail of the queue -- cgit v1.2.3 From bf299275882624b1908521ee8074df85160e9679 Mon Sep 17 00:00:00 2001 From: Gerrit Renker Date: Mon, 14 Apr 2008 00:04:51 -0700 Subject: [SKB]: __skb_queue_after(prev) = __skb_insert(prev, prev->next) By reordering, __skb_queue_after() is expressed in terms of __skb_insert(). Signed-off-by: Gerrit Renker Signed-off-by: David S. Miller --- include/linux/skbuff.h | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index c2116200580..bb107ab675f 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -663,11 +663,21 @@ static inline void skb_queue_head_init_class(struct sk_buff_head *list, } /* - * Insert an sk_buff at the start of a list. + * Insert an sk_buff on a list. * * The "__skb_xxxx()" functions are the non-atomic ones that * can only be called with interrupts disabled. */ +extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list); +static inline void __skb_insert(struct sk_buff *newsk, + struct sk_buff *prev, struct sk_buff *next, + struct sk_buff_head *list) +{ + newsk->next = next; + newsk->prev = prev; + next->prev = prev->next = newsk; + list->qlen++; +} /** * __skb_queue_after - queue a buffer at the list head @@ -684,13 +694,7 @@ static inline void __skb_queue_after(struct sk_buff_head *list, struct sk_buff *prev, struct sk_buff *newsk) { - struct sk_buff *next; - list->qlen++; - - next = prev->next; - newsk->next = next; - newsk->prev = prev; - next->prev = prev->next = newsk; + __skb_insert(newsk, prev, prev->next, list); } /** @@ -734,20 +738,6 @@ static inline void __skb_queue_tail(struct sk_buff_head *list, next->prev = prev->next = newsk; } -/* - * Insert a packet on a list. - */ -extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list); -static inline void __skb_insert(struct sk_buff *newsk, - struct sk_buff *prev, struct sk_buff *next, - struct sk_buff_head *list) -{ - newsk->next = next; - newsk->prev = prev; - next->prev = prev->next = newsk; - list->qlen++; -} - /* * Place a packet after a given packet in a list. */ -- cgit v1.2.3 From 7de6c033367ab86f39c7723392caf73325cbf286 Mon Sep 17 00:00:00 2001 From: Gerrit Renker Date: Mon, 14 Apr 2008 00:05:09 -0700 Subject: [SKB]: __skb_append = __skb_queue_after This expresses __skb_append in terms of __skb_queue_after, exploiting that __skb_append(old, new, list) = __skb_queue_after(list, old, new). Signed-off-by: Gerrit Renker Signed-off-by: David S. Miller --- include/linux/skbuff.h | 12 +++--------- include/net/tcp.h | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bb107ab675f..83c85184682 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -697,6 +697,9 @@ static inline void __skb_queue_after(struct sk_buff_head *list, __skb_insert(newsk, prev, prev->next, list); } +extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, + struct sk_buff_head *list); + /** * __skb_queue_head - queue a buffer at the list head * @list: list to use @@ -738,15 +741,6 @@ static inline void __skb_queue_tail(struct sk_buff_head *list, next->prev = prev->next = newsk; } -/* - * Place a packet after a given packet in a list. - */ -extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list); -static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list) -{ - __skb_insert(newsk, old, old->next, list); -} - /* * remove sk_buff from list. _Must_ be called atomically, and with * the list known.. diff --git a/include/net/tcp.h b/include/net/tcp.h index 58d82822414..2ab350eca02 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1247,7 +1247,7 @@ static inline void tcp_insert_write_queue_after(struct sk_buff *skb, struct sk_buff *buff, struct sock *sk) { - __skb_append(skb, buff, &sk->sk_write_queue); + __skb_queue_after(&sk->sk_write_queue, skb, buff); } /* Insert skb between prev and next on the write queue of sk. */ -- cgit v1.2.3 From f5572855ec492334d8c3ec0e0e86c31865d5cf07 Mon Sep 17 00:00:00 2001 From: Gerrit Renker Date: Mon, 14 Apr 2008 00:05:28 -0700 Subject: [SKB]: __skb_queue_tail = __skb_insert before This expresses __skb_queue_tail() in terms of __skb_insert(), using __skb_insert_before() as auxiliary function. Signed-off-by: Gerrit Renker Signed-off-by: David S. Miller --- include/linux/skbuff.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 83c85184682..11fd9f2c409 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -700,6 +700,13 @@ static inline void __skb_queue_after(struct sk_buff_head *list, extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list); +static inline void __skb_queue_before(struct sk_buff_head *list, + struct sk_buff *next, + struct sk_buff *newsk) +{ + __skb_insert(newsk, next->prev, next, list); +} + /** * __skb_queue_head - queue a buffer at the list head * @list: list to use @@ -731,14 +738,7 @@ extern void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk); static inline void __skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk) { - struct sk_buff *prev, *next; - - list->qlen++; - next = (struct sk_buff *)list; - prev = next->prev; - newsk->next = next; - newsk->prev = prev; - next->prev = prev->next = newsk; + __skb_queue_before(list, (struct sk_buff *)list, newsk); } /* -- cgit v1.2.3 From 666953df353194bef76086fa3f126241cbac3e3a Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Mon, 14 Apr 2008 09:56:02 +0200 Subject: [NETFILTER]: ip_tables: per-netns FILTER/MANGLE/RAW tables for real Commit 9335f047fe61587ec82ff12fbb1220bcfdd32006 aka "[NETFILTER]: ip_tables: per-netns FILTER, MANGLE, RAW" added per-netns _view_ of iptables rules. They were shown to user, but ignored by filtering code. Now that it's possible to at least ping loopback, per-netns tables can affect filtering decisions. netns is taken in case of PRE_ROUTING, LOCAL_IN -- from in device, POST_ROUTING, LOCAL_OUT -- from out device, FORWARD -- from in device which should be equal to out device's netns. This code is relatively new, so BUG_ON was plugged. Wrappers were added to a) keep code the same from CONFIG_NET_NS=n users (overwhelming majority), b) consolidate code in one place -- similar changes will be done in ipv6 and arp netfilter code. Signed-off-by: Alexey Dobriyan Signed-off-by: Patrick McHardy --- include/linux/netfilter.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 89e6c72ad29..66bc52060fd 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -6,11 +6,13 @@ #include #include #include +#include #include #include #include #include #include +#include #endif #include @@ -76,7 +78,6 @@ extern void netfilter_init(void); #define NF_MAX_HOOKS 8 struct sk_buff; -struct net_device; typedef unsigned int nf_hookfn(unsigned int hooknum, struct sk_buff *skb, @@ -320,5 +321,56 @@ extern void (*nf_ct_destroy)(struct nf_conntrack *); static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} #endif +static inline struct net *nf_pre_routing_net(const struct net_device *in, + const struct net_device *out) +{ +#ifdef CONFIG_NET_NS + return in->nd_net; +#else + return &init_net; +#endif +} + +static inline struct net *nf_local_in_net(const struct net_device *in, + const struct net_device *out) +{ +#ifdef CONFIG_NET_NS + return in->nd_net; +#else + return &init_net; +#endif +} + +static inline struct net *nf_forward_net(const struct net_device *in, + const struct net_device *out) +{ +#ifdef CONFIG_NET_NS + BUG_ON(in->nd_net != out->nd_net); + return in->nd_net; +#else + return &init_net; +#endif +} + +static inline struct net *nf_local_out_net(const struct net_device *in, + const struct net_device *out) +{ +#ifdef CONFIG_NET_NS + return out->nd_net; +#else + return &init_net; +#endif +} + +static inline struct net *nf_post_routing_net(const struct net_device *in, + const struct net_device *out) +{ +#ifdef CONFIG_NET_NS + return out->nd_net; +#else + return &init_net; +#endif +} + #endif /*__KERNEL__*/ #endif /*__LINUX_NETFILTER_H*/ -- cgit v1.2.3 From b9f61b160336da5eaaacb0cb41ebe32169e3bde5 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Apr 2008 09:56:04 +0200 Subject: [NETFILTER]: xt_sctp: simplify xt_sctp.h The use of xt_sctp.h flagged up -Wshadow warnings in userspace, which prompted me to look at it and clean it up. Basic operations have been directly replaced by library calls (memcpy, memset is both available in the kernel and userspace, and usually faster than a self-made loop). The is_set and is_clear functions now use a processing time shortcut, too. Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- include/linux/netfilter/xt_sctp.h | 84 ++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 49 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h index dd5a4fd4cfd..32000ba6ece 100644 --- a/include/linux/netfilter/xt_sctp.h +++ b/include/linux/netfilter/xt_sctp.h @@ -37,68 +37,54 @@ struct xt_sctp_info { #define SCTP_CHUNKMAP_SET(chunkmap, type) \ do { \ - chunkmap[type / bytes(u_int32_t)] |= \ + (chunkmap)[type / bytes(u_int32_t)] |= \ 1 << (type % bytes(u_int32_t)); \ } while (0) #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ do { \ - chunkmap[type / bytes(u_int32_t)] &= \ + (chunkmap)[type / bytes(u_int32_t)] &= \ ~(1 << (type % bytes(u_int32_t))); \ } while (0) #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ ({ \ - (chunkmap[type / bytes (u_int32_t)] & \ + ((chunkmap)[type / bytes (u_int32_t)] & \ (1 << (type % bytes (u_int32_t)))) ? 1: 0; \ }) -#define SCTP_CHUNKMAP_RESET(chunkmap) \ - do { \ - int i; \ - for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \ - chunkmap[i] = 0; \ - } while (0) - -#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ - do { \ - int i; \ - for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \ - chunkmap[i] = ~0; \ - } while (0) - -#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ - do { \ - int i; \ - for (i = 0; i < ARRAY_SIZE(srcmap); i++) \ - destmap[i] = srcmap[i]; \ - } while (0) - -#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ -({ \ - int i; \ - int flag = 1; \ - for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \ - if (chunkmap[i]) { \ - flag = 0; \ - break; \ - } \ - } \ - flag; \ -}) - -#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \ -({ \ - int i; \ - int flag = 1; \ - for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \ - if (chunkmap[i] != ~0) { \ - flag = 0; \ - break; \ - } \ - } \ - flag; \ -}) +#define SCTP_CHUNKMAP_RESET(chunkmap) \ + memset((chunkmap), 0, sizeof(chunkmap)) + +#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ + memset((chunkmap), ~0U, sizeof(chunkmap)) + +#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ + memcpy((destmap), (srcmap), sizeof(srcmap)) + +#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ + __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap)) +static inline bool +__sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned int n) +{ + unsigned int i; + for (i = 0; i < n; ++i) + if (chunkmap[i]) + return false; + return true; +} + +#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \ + __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap)) +static inline bool +__sctp_chunkmap_is_all_set(const u_int32_t *chunkmap, unsigned int n) +{ + unsigned int i; + for (i = 0; i < n; ++i) + if (chunkmap[i] != ~0U) + return false; + return true; +} #endif /* _XT_SCTP_H_ */ -- cgit v1.2.3 From 5452e425adfdfc4647b618e303f73d48f2405b0e Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Apr 2008 11:15:35 +0200 Subject: [NETFILTER]: annotate {arp,ip,ip6,x}tables with const Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- include/linux/netfilter/x_tables.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index b2c62cc618f..2326296b6f2 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h @@ -430,13 +430,13 @@ extern int xt_compat_add_offset(int af, unsigned int offset, short delta); extern void xt_compat_flush_offsets(int af); extern short xt_compat_calc_jump(int af, unsigned int offset); -extern int xt_compat_match_offset(struct xt_match *match); +extern int xt_compat_match_offset(const struct xt_match *match); extern int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr, unsigned int *size); extern int xt_compat_match_to_user(struct xt_entry_match *m, void __user **dstptr, unsigned int *size); -extern int xt_compat_target_offset(struct xt_target *target); +extern int xt_compat_target_offset(const struct xt_target *target); extern void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr, unsigned int *size); extern int xt_compat_target_to_user(struct xt_entry_target *t, -- cgit v1.2.3 From 4abff0775d5e4feb20b21371e1c63a1b30fc2140 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Apr 2008 11:15:43 +0200 Subject: [NETFILTER]: remove arpt_table indirection macro Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- include/linux/netfilter_arp/arp_tables.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h index db223ca92c8..102c4134a71 100644 --- a/include/linux/netfilter_arp/arp_tables.h +++ b/include/linux/netfilter_arp/arp_tables.h @@ -24,7 +24,6 @@ #define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN #define arpt_target xt_target -#define arpt_table xt_table #define ARPT_DEV_ADDR_LEN_MAX 16 @@ -271,15 +270,15 @@ struct arpt_error xt_register_target(tgt); }) #define arpt_unregister_target(tgt) xt_unregister_target(tgt) -extern struct arpt_table *arpt_register_table(struct net *net, - struct arpt_table *table, - const struct arpt_replace *repl); -extern void arpt_unregister_table(struct arpt_table *table); +extern struct xt_table *arpt_register_table(struct net *net, + struct xt_table *table, + const struct arpt_replace *repl); +extern void arpt_unregister_table(struct xt_table *table); extern unsigned int arpt_do_table(struct sk_buff *skb, unsigned int hook, const struct net_device *in, const struct net_device *out, - struct arpt_table *table); + struct xt_table *table); #define ARPT_ALIGN(s) XT_ALIGN(s) -- cgit v1.2.3 From 95eea855af69bfd54a7b73546190e76046ca2e07 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Apr 2008 11:15:43 +0200 Subject: [NETFILTER]: remove arpt_target indirection macro Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- include/linux/netfilter_arp/arp_tables.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h index 102c4134a71..782b83e5bdb 100644 --- a/include/linux/netfilter_arp/arp_tables.h +++ b/include/linux/netfilter_arp/arp_tables.h @@ -23,7 +23,6 @@ #define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN #define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN -#define arpt_target xt_target #define ARPT_DEV_ADDR_LEN_MAX 16 -- cgit v1.2.3 From 3bb0362d2f53fa54a17b88c96b43fc093e47699b Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Apr 2008 11:15:44 +0200 Subject: [NETFILTER]: remove arpt_(un)register_target indirection macros Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- include/linux/netfilter_arp/arp_tables.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h index 782b83e5bdb..dd9c97f2d43 100644 --- a/include/linux/netfilter_arp/arp_tables.h +++ b/include/linux/netfilter_arp/arp_tables.h @@ -264,11 +264,6 @@ struct arpt_error .target.errorname = "ERROR", \ } -#define arpt_register_target(tgt) \ -({ (tgt)->family = NF_ARP; \ - xt_register_target(tgt); }) -#define arpt_unregister_target(tgt) xt_unregister_target(tgt) - extern struct xt_table *arpt_register_table(struct net *net, struct xt_table *table, const struct arpt_replace *repl); -- cgit v1.2.3 From 937e0dfd87a8b7946a17161664500fba93eb13fd Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Thu, 20 Mar 2008 15:15:47 +0100 Subject: [NETFILTER]: nf_nat: add helpers for common NAT protocol operations Add generic ->in_range and ->unique_tuple ops to avoid duplicating them again and again for future NAT modules and save a few bytes of text: net/ipv4/netfilter/nf_nat_proto_tcp.c: tcp_in_range | -62 (removed) tcp_unique_tuple | -259 # 271 -> 12, # inlines: 1 -> 0, size inlines: 7 -> 0 2 functions changed, 321 bytes removed net/ipv4/netfilter/nf_nat_proto_udp.c: udp_in_range | -62 (removed) udp_unique_tuple | -259 # 271 -> 12, # inlines: 1 -> 0, size inlines: 7 -> 0 2 functions changed, 321 bytes removed net/ipv4/netfilter/nf_nat_proto_gre.c: gre_in_range | -62 (removed) 1 function changed, 62 bytes removed vmlinux: 5 functions changed, 704 bytes removed Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_nat_protocol.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h index 4aa0edbb5b9..fa06f6d0de5 100644 --- a/include/net/netfilter/nf_nat_protocol.h +++ b/include/net/netfilter/nf_nat_protocol.h @@ -62,6 +62,17 @@ extern int init_protocols(void) __init; extern void cleanup_protocols(void); extern const struct nf_nat_protocol *find_nat_proto(u_int16_t protonum); +extern int nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple, + enum nf_nat_manip_type maniptype, + const union nf_conntrack_man_proto *min, + const union nf_conntrack_man_proto *max); + +extern int nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, + const struct nf_nat_range *range, + enum nf_nat_manip_type maniptype, + const struct nf_conn *ct, + u_int16_t *rover); + extern int nf_nat_port_range_to_nlattr(struct sk_buff *skb, const struct nf_nat_range *range); extern int nf_nat_port_nlattr_to_range(struct nlattr *tb[], -- cgit v1.2.3 From 535b57c7c1524125444aa1b874332f6ff1608ef5 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 14 Apr 2008 11:15:47 +0200 Subject: [NETFILTER]: nf_nat: move NAT ctnetlink helpers to nf_nat_proto_common Move to nf_nat_proto_common and rename to nf_nat_proto_... since they're also used by protocols that don't have port numbers. Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_nat_protocol.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h index fa06f6d0de5..8ce227624ea 100644 --- a/include/net/netfilter/nf_nat_protocol.h +++ b/include/net/netfilter/nf_nat_protocol.h @@ -73,9 +73,9 @@ extern int nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, const struct nf_conn *ct, u_int16_t *rover); -extern int nf_nat_port_range_to_nlattr(struct sk_buff *skb, - const struct nf_nat_range *range); -extern int nf_nat_port_nlattr_to_range(struct nlattr *tb[], - struct nf_nat_range *range); +extern int nf_nat_proto_range_to_nlattr(struct sk_buff *skb, + const struct nf_nat_range *range); +extern int nf_nat_proto_nlattr_to_range(struct nlattr *tb[], + struct nf_nat_range *range); #endif /*_NF_NAT_PROTO_H*/ -- cgit v1.2.3 From 2d2d84c40e19a7fce51ba1f124ecde105104192d Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Thu, 20 Mar 2008 15:15:49 +0100 Subject: [NETFILTER]: nf_nat: remove unused name from struct nf_nat_protocol Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_nat_protocol.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h index 8ce227624ea..fba94a2028d 100644 --- a/include/net/netfilter/nf_nat_protocol.h +++ b/include/net/netfilter/nf_nat_protocol.h @@ -8,9 +8,6 @@ struct nf_nat_range; struct nf_nat_protocol { - /* Protocol name */ - const char *name; - /* Protocol number. */ unsigned int protonum; -- cgit v1.2.3 From d63a650736f566a1f9e9434725d2089597c0d2cc Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Thu, 20 Mar 2008 15:15:53 +0100 Subject: [NETFILTER]: Add partial checksum validation helper Move the UDP-Lite conntrack checksum validation to a generic helper similar to nf_checksum() and make it fall back to nf_checksum() in case the full packet is to be checksummed and hardware checksums are available. This is to be used by DCCP conntrack, which also needs to verify partial checksums. Signed-off-by: Patrick McHardy --- include/linux/netfilter.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include') diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 66bc52060fd..e4c66593b5c 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -234,6 +234,11 @@ struct nf_afinfo { unsigned short family; __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, u_int8_t protocol); + __sum16 (*checksum_partial)(struct sk_buff *skb, + unsigned int hook, + unsigned int dataoff, + unsigned int len, + u_int8_t protocol); int (*route)(struct dst_entry **dst, struct flowi *fl); void (*saveroute)(const struct sk_buff *skb, struct nf_queue_entry *entry); @@ -263,6 +268,23 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, return csum; } +static inline __sum16 +nf_checksum_partial(struct sk_buff *skb, unsigned int hook, + unsigned int dataoff, unsigned int len, + u_int8_t protocol, unsigned short family) +{ + const struct nf_afinfo *afinfo; + __sum16 csum = 0; + + rcu_read_lock(); + afinfo = nf_get_afinfo(family); + if (afinfo) + csum = afinfo->checksum_partial(skb, hook, dataoff, len, + protocol); + rcu_read_unlock(); + return csum; +} + extern int nf_register_afinfo(const struct nf_afinfo *afinfo); extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); -- cgit v1.2.3 From 2bc780499aa33311ec0f3e42624dfaa7be0ade5e Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Thu, 20 Mar 2008 15:15:55 +0100 Subject: [NETFILTER]: nf_conntrack: add DCCP protocol support Add DCCP conntrack helper. Thanks to Gerrit Renker for review and testing. Signed-off-by: Patrick McHardy --- include/linux/netfilter/nf_conntrack_dccp.h | 40 +++++++++++++++++++++++++++ include/linux/netfilter/nfnetlink_conntrack.h | 8 ++++++ include/net/netfilter/nf_conntrack.h | 2 ++ include/net/netfilter/nf_conntrack_tuple.h | 6 ++++ 4 files changed, 56 insertions(+) create mode 100644 include/linux/netfilter/nf_conntrack_dccp.h (limited to 'include') diff --git a/include/linux/netfilter/nf_conntrack_dccp.h b/include/linux/netfilter/nf_conntrack_dccp.h new file mode 100644 index 00000000000..40dcc82058d --- /dev/null +++ b/include/linux/netfilter/nf_conntrack_dccp.h @@ -0,0 +1,40 @@ +#ifndef _NF_CONNTRACK_DCCP_H +#define _NF_CONNTRACK_DCCP_H + +/* Exposed to userspace over nfnetlink */ +enum ct_dccp_states { + CT_DCCP_NONE, + CT_DCCP_REQUEST, + CT_DCCP_RESPOND, + CT_DCCP_PARTOPEN, + CT_DCCP_OPEN, + CT_DCCP_CLOSEREQ, + CT_DCCP_CLOSING, + CT_DCCP_TIMEWAIT, + CT_DCCP_IGNORE, + CT_DCCP_INVALID, + __CT_DCCP_MAX +}; +#define CT_DCCP_MAX (__CT_DCCP_MAX - 1) + +enum ct_dccp_roles { + CT_DCCP_ROLE_CLIENT, + CT_DCCP_ROLE_SERVER, + __CT_DCCP_ROLE_MAX +}; +#define CT_DCCP_ROLE_MAX (__CT_DCCP_ROLE_MAX - 1) + +#ifdef __KERNEL__ +#include + +struct nf_ct_dccp { + u_int8_t role[IP_CT_DIR_MAX]; + u_int8_t state; + u_int8_t last_pkt; + u_int8_t last_dir; + u_int64_t handshake_seq; +}; + +#endif /* __KERNEL__ */ + +#endif /* _NF_CONNTRACK_DCCP_H */ diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h index e3e1533aba2..0a383ac083c 100644 --- a/include/linux/netfilter/nfnetlink_conntrack.h +++ b/include/linux/netfilter/nfnetlink_conntrack.h @@ -80,6 +80,7 @@ enum ctattr_l4proto { enum ctattr_protoinfo { CTA_PROTOINFO_UNSPEC, CTA_PROTOINFO_TCP, + CTA_PROTOINFO_DCCP, __CTA_PROTOINFO_MAX }; #define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) @@ -95,6 +96,13 @@ enum ctattr_protoinfo_tcp { }; #define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) +enum ctattr_protoinfo_dccp { + CTA_PROTOINFO_DCCP_UNSPEC, + CTA_PROTOINFO_DCCP_STATE, + __CTA_PROTOINFO_DCCP_MAX, +}; +#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) + enum ctattr_counters { CTA_COUNTERS_UNSPEC, CTA_COUNTERS_PACKETS, /* old 64bit counters */ diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index a3567a7a6d6..bb9fc852e97 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -30,6 +31,7 @@ /* per conntrack: protocol private data */ union nf_conntrack_proto { /* insert conntrack proto private data here */ + struct nf_ct_dccp dccp; struct ip_ct_sctp sctp; struct ip_ct_tcp tcp; struct ip_ct_icmp icmp; diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index 168c91754d8..bdeec346138 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h @@ -39,6 +39,9 @@ union nf_conntrack_man_proto struct { __be16 id; } icmp; + struct { + __be16 port; + } dccp; struct { __be16 port; } sctp; @@ -77,6 +80,9 @@ struct nf_conntrack_tuple struct { u_int8_t type, code; } icmp; + struct { + __be16 port; + } dccp; struct { __be16 port; } sctp; -- cgit v1.2.3 From 8c87238b726e543f8af4bdb4296020a328df4744 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 14 Apr 2008 11:15:51 +0200 Subject: [NETFILTER]: nf_nat: don't add NAT extension for confirmed conntracks Adding extensions to confirmed conntracks is not allowed to avoid races on reallocation. Don't setup NAT for confirmed conntracks in case NAT module is loaded late. The has one side-effect, the connections existing before the NAT module was loaded won't enter the bysource hash. The only case where this actually makes a difference is in case of SNAT to a multirange where the IP before NAT is also part of the range. Since old connections don't enter the bysource hash the first new connection from the IP will have a new address selected. This shouldn't matter at all. Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_nat_rule.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h index 75d1825031d..e4a18ae361c 100644 --- a/include/net/netfilter/nf_nat_rule.h +++ b/include/net/netfilter/nf_nat_rule.h @@ -14,7 +14,4 @@ extern int nf_nat_rule_find(struct sk_buff *skb, extern unsigned int alloc_null_binding(struct nf_conn *ct, unsigned int hooknum); - -extern unsigned int -alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum); #endif /* _NF_NAT_RULE_H */ -- cgit v1.2.3 From 55871d04793d9c069ee277b1e98794b88d92ed80 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 14 Apr 2008 11:15:51 +0200 Subject: [NETFILTER]: nf_conntrack_extend: warn on confirmed conntracks New extensions may only be added to unconfirmed conntracks to avoid races when reallocating the storage. Also change NF_CT_ASSERT to use WARN_ON to get backtraces. Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_conntrack.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index bb9fc852e97..4a0496aa32d 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -65,14 +65,7 @@ union nf_conntrack_help { #include #ifdef CONFIG_NETFILTER_DEBUG -#define NF_CT_ASSERT(x) \ -do { \ - if (!(x)) \ - /* Wooah! I'm tripping my conntrack in a frenzy of \ - netplay... */ \ - printk("NF_CT_ASSERT: %s:%i(%s)\n", \ - __FILE__, __LINE__, __FUNCTION__); \ -} while(0) +#define NF_CT_ASSERT(x) WARN_ON(!(x)) #else #define NF_CT_ASSERT(x) #endif -- cgit v1.2.3 From dd13b010368f85dfa59364ba87bfe8ae930b2832 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 14 Apr 2008 11:15:52 +0200 Subject: [NETFILTER]: nf_nat: kill helper and seq_adjust hooks Connection tracking helpers (specifically FTP) need to be called before NAT sequence numbers adjustments are performed to be able to compare them against previously seen ones. We've introduced two new hooks around 2.6.11 to maintain this ordering when NAT modules were changed to get called from conntrack helpers directly. The cost of netfilter hooks is quite high and sequence number adjustments are only rarely needed however. Add a RCU-protected sequence number adjustment function pointer and call it from IPv4 conntrack after calling the helper. Signed-off-by: Patrick McHardy --- include/linux/netfilter_ipv4.h | 2 -- include/net/netfilter/nf_nat_helper.h | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h index 9a10092e358..650318b0c40 100644 --- a/include/linux/netfilter_ipv4.h +++ b/include/linux/netfilter_ipv4.h @@ -62,8 +62,6 @@ enum nf_ip_hook_priorities { NF_IP_PRI_FILTER = 0, NF_IP_PRI_NAT_SRC = 100, NF_IP_PRI_SELINUX_LAST = 225, - NF_IP_PRI_CONNTRACK_HELPER = INT_MAX - 2, - NF_IP_PRI_NAT_SEQ_ADJUST = INT_MAX - 1, NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, NF_IP_PRI_LAST = INT_MAX, }; diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h index 58dd2268794..237a961f40e 100644 --- a/include/net/netfilter/nf_nat_helper.h +++ b/include/net/netfilter/nf_nat_helper.h @@ -24,6 +24,9 @@ extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, extern int nf_nat_seq_adjust(struct sk_buff *skb, struct nf_conn *ct, enum ip_conntrack_info ctinfo); +extern int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb, + struct nf_conn *ct, + enum ip_conntrack_info ctinfo); /* Setup NAT on this expected conntrack so it follows master, but goes * to port ct->master->saved_proto. */ -- cgit v1.2.3 From 5e8fbe2ac8a3f1e34e7004c5750ef59bf9304f82 Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Mon, 14 Apr 2008 11:15:52 +0200 Subject: [NETFILTER]: nf_conntrack: add tuplehash l3num/protonum accessors Add accessors for l3num and protonum and get rid of some overly long expressions. Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_conntrack.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 4a0496aa32d..26e6a6e2b5a 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -140,6 +140,16 @@ nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash) tuplehash[hash->tuple.dst.dir]); } +static inline u_int16_t nf_ct_l3num(const struct nf_conn *ct) +{ + return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num; +} + +static inline u_int8_t nf_ct_protonum(const struct nf_conn *ct) +{ + return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum; +} + /* get master conntrack via master expectation */ #define master_ct(conntr) (conntr->master) -- cgit v1.2.3 From 9dbae7917899d78a094aceeb5062cd76efa89052 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Apr 2008 11:15:52 +0200 Subject: [NETFILTER]: Remove unused callbacks in nf_conntrack_l3proto These functions are never called. Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_conntrack_l3proto.h | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index b886e3ae6ca..db0825803b1 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h @@ -42,17 +42,6 @@ struct nf_conntrack_l3proto int (*print_tuple)(struct seq_file *s, const struct nf_conntrack_tuple *); - /* Returns verdict for packet, or -1 for invalid. */ - int (*packet)(struct nf_conn *ct, - const struct sk_buff *skb, - enum ip_conntrack_info ctinfo); - - /* - * Called when a new connection for this protocol found; - * returns TRUE if it's OK. If so, packet() called next. - */ - int (*new)(struct nf_conn *ct, const struct sk_buff *skb); - /* * Called before tracking. * *dataoff: offset of protocol header (TCP, UDP,...) in skb -- cgit v1.2.3 From 8ce8439a31f723f3aa28adf27fe8797a5678dde1 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Apr 2008 11:15:52 +0200 Subject: [NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_l3proto Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_conntrack_l3proto.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index db0825803b1..0378676c3dd 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h @@ -28,15 +28,15 @@ struct nf_conntrack_l3proto * Try to fill in the third arg: nhoff is offset of l3 proto * hdr. Return true if possible. */ - int (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff, - struct nf_conntrack_tuple *tuple); + bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff, + struct nf_conntrack_tuple *tuple); /* * Invert the per-proto part of the tuple: ie. turn xmit into reply. * Some packets can't be inverted: return 0 in that case. */ - int (*invert_tuple)(struct nf_conntrack_tuple *inverse, - const struct nf_conntrack_tuple *orig); + bool (*invert_tuple)(struct nf_conntrack_tuple *inverse, + const struct nf_conntrack_tuple *orig); /* Print out the per-protocol part of the tuple. */ int (*print_tuple)(struct seq_file *s, -- cgit v1.2.3 From 09f263cd39751cada63dec2dccc71e67c00bc38c Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Apr 2008 11:15:53 +0200 Subject: [NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_l4proto Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_conntrack_l4proto.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h index efc16eccddb..723df9d1cc3 100644 --- a/include/net/netfilter/nf_conntrack_l4proto.h +++ b/include/net/netfilter/nf_conntrack_l4proto.h @@ -25,15 +25,14 @@ struct nf_conntrack_l4proto /* Try to fill in the third arg: dataoff is offset past network protocol hdr. Return true if possible. */ - int (*pkt_to_tuple)(const struct sk_buff *skb, - unsigned int dataoff, - struct nf_conntrack_tuple *tuple); + bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int dataoff, + struct nf_conntrack_tuple *tuple); /* Invert the per-proto part of the tuple: ie. turn xmit into reply. * Some packets can't be inverted: return 0 in that case. */ - int (*invert_tuple)(struct nf_conntrack_tuple *inverse, - const struct nf_conntrack_tuple *orig); + bool (*invert_tuple)(struct nf_conntrack_tuple *inverse, + const struct nf_conntrack_tuple *orig); /* Returns verdict for packet, or -1 for invalid. */ int (*packet)(struct nf_conn *ct, @@ -45,8 +44,8 @@ struct nf_conntrack_l4proto /* Called when a new connection for this protocol found; * returns TRUE if it's OK. If so, packet() called next. */ - int (*new)(struct nf_conn *ct, const struct sk_buff *skb, - unsigned int dataoff); + bool (*new)(struct nf_conn *ct, const struct sk_buff *skb, + unsigned int dataoff); /* Called when a conntrack entry is destroyed */ void (*destroy)(struct nf_conn *ct); -- cgit v1.2.3 From 5f2b4c9006fc667c4614f0b079efab3721f68316 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Apr 2008 11:15:53 +0200 Subject: [NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_tuple.h Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_conntrack.h | 11 ++++----- include/net/netfilter/nf_conntrack_core.h | 4 +-- include/net/netfilter/nf_conntrack_tuple.h | 39 ++++++++++++++++-------------- 3 files changed, 28 insertions(+), 26 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 26e6a6e2b5a..2dbd6c015b9 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -194,12 +194,11 @@ extern void nf_conntrack_hash_insert(struct nf_conn *ct); extern void nf_conntrack_flush(void); -extern int nf_ct_get_tuplepr(const struct sk_buff *skb, - unsigned int nhoff, - u_int16_t l3num, - struct nf_conntrack_tuple *tuple); -extern int nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, - const struct nf_conntrack_tuple *orig); +extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, + unsigned int nhoff, u_int16_t l3num, + struct nf_conntrack_tuple *tuple); +extern bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, + const struct nf_conntrack_tuple *orig); extern void __nf_ct_refresh_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo, diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index 9ee26469c75..a8177121093 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h @@ -30,7 +30,7 @@ extern void nf_conntrack_cleanup(void); extern int nf_conntrack_proto_init(void); extern void nf_conntrack_proto_fini(void); -extern int +extern bool nf_ct_get_tuple(const struct sk_buff *skb, unsigned int nhoff, unsigned int dataoff, @@ -40,7 +40,7 @@ nf_ct_get_tuple(const struct sk_buff *skb, const struct nf_conntrack_l3proto *l3proto, const struct nf_conntrack_l4proto *l4proto); -extern int +extern bool nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, const struct nf_conntrack_tuple *orig, const struct nf_conntrack_l3proto *l3proto, diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index bdeec346138..2722b13ecd6 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h @@ -166,61 +166,64 @@ struct nf_conntrack_tuple_hash #endif /* __KERNEL__ */ -static inline int __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, - const struct nf_conntrack_tuple *t2) +static inline bool __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, + const struct nf_conntrack_tuple *t2) { return (nf_inet_addr_cmp(&t1->src.u3, &t2->src.u3) && t1->src.u.all == t2->src.u.all && t1->src.l3num == t2->src.l3num); } -static inline int __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, - const struct nf_conntrack_tuple *t2) +static inline bool __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, + const struct nf_conntrack_tuple *t2) { return (nf_inet_addr_cmp(&t1->dst.u3, &t2->dst.u3) && t1->dst.u.all == t2->dst.u.all && t1->dst.protonum == t2->dst.protonum); } -static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1, - const struct nf_conntrack_tuple *t2) +static inline bool nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1, + const struct nf_conntrack_tuple *t2) { return __nf_ct_tuple_src_equal(t1, t2) && __nf_ct_tuple_dst_equal(t1, t2); } -static inline int nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1, - const struct nf_conntrack_tuple_mask *m2) +static inline bool +nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1, + const struct nf_conntrack_tuple_mask *m2) { return (nf_inet_addr_cmp(&m1->src.u3, &m2->src.u3) && m1->src.u.all == m2->src.u.all); } -static inline int nf_ct_tuple_src_mask_cmp(const struct nf_conntrack_tuple *t1, - const struct nf_conntrack_tuple *t2, - const struct nf_conntrack_tuple_mask *mask) +static inline bool +nf_ct_tuple_src_mask_cmp(const struct nf_conntrack_tuple *t1, + const struct nf_conntrack_tuple *t2, + const struct nf_conntrack_tuple_mask *mask) { int count; for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++) { if ((t1->src.u3.all[count] ^ t2->src.u3.all[count]) & mask->src.u3.all[count]) - return 0; + return false; } if ((t1->src.u.all ^ t2->src.u.all) & mask->src.u.all) - return 0; + return false; if (t1->src.l3num != t2->src.l3num || t1->dst.protonum != t2->dst.protonum) - return 0; + return false; - return 1; + return true; } -static inline int nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t, - const struct nf_conntrack_tuple *tuple, - const struct nf_conntrack_tuple_mask *mask) +static inline bool +nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t, + const struct nf_conntrack_tuple *tuple, + const struct nf_conntrack_tuple_mask *mask) { return nf_ct_tuple_src_mask_cmp(t, tuple, mask) && __nf_ct_tuple_dst_equal(t, tuple); -- cgit v1.2.3 From f2ea825f483d5d78754ae813b6db63f8b74e9343 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Apr 2008 11:15:53 +0200 Subject: [NETFILTER]: nf_nat: use bool type in nf_nat_proto Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_nat_protocol.h | 42 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h index fba94a2028d..f3662c4394e 100644 --- a/include/net/netfilter/nf_nat_protocol.h +++ b/include/net/netfilter/nf_nat_protocol.h @@ -15,25 +15,25 @@ struct nf_nat_protocol /* Translate a packet to the target according to manip type. Return true if succeeded. */ - int (*manip_pkt)(struct sk_buff *skb, - unsigned int iphdroff, - const struct nf_conntrack_tuple *tuple, - enum nf_nat_manip_type maniptype); + bool (*manip_pkt)(struct sk_buff *skb, + unsigned int iphdroff, + const struct nf_conntrack_tuple *tuple, + enum nf_nat_manip_type maniptype); /* Is the manipable part of the tuple between min and max incl? */ - int (*in_range)(const struct nf_conntrack_tuple *tuple, - enum nf_nat_manip_type maniptype, - const union nf_conntrack_man_proto *min, - const union nf_conntrack_man_proto *max); + bool (*in_range)(const struct nf_conntrack_tuple *tuple, + enum nf_nat_manip_type maniptype, + const union nf_conntrack_man_proto *min, + const union nf_conntrack_man_proto *max); /* Alter the per-proto part of the tuple (depending on maniptype), to give a unique tuple in the given range if possible; return false if not. Per-protocol part of tuple is initialized to the incoming packet. */ - int (*unique_tuple)(struct nf_conntrack_tuple *tuple, - const struct nf_nat_range *range, - enum nf_nat_manip_type maniptype, - const struct nf_conn *ct); + bool (*unique_tuple)(struct nf_conntrack_tuple *tuple, + const struct nf_nat_range *range, + enum nf_nat_manip_type maniptype, + const struct nf_conn *ct); int (*range_to_nlattr)(struct sk_buff *skb, const struct nf_nat_range *range); @@ -59,16 +59,16 @@ extern int init_protocols(void) __init; extern void cleanup_protocols(void); extern const struct nf_nat_protocol *find_nat_proto(u_int16_t protonum); -extern int nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple, - enum nf_nat_manip_type maniptype, - const union nf_conntrack_man_proto *min, - const union nf_conntrack_man_proto *max); +extern bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple, + enum nf_nat_manip_type maniptype, + const union nf_conntrack_man_proto *min, + const union nf_conntrack_man_proto *max); -extern int nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, - const struct nf_nat_range *range, - enum nf_nat_manip_type maniptype, - const struct nf_conn *ct, - u_int16_t *rover); +extern bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, + const struct nf_nat_range *range, + enum nf_nat_manip_type maniptype, + const struct nf_conn *ct, + u_int16_t *rover); extern int nf_nat_proto_range_to_nlattr(struct sk_buff *skb, const struct nf_nat_range *range); -- cgit v1.2.3 From 3c9fba656a185cf56872a325e5594d9b4d4168ec Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 14 Apr 2008 11:15:54 +0200 Subject: [NETFILTER]: nf_conntrack: replace NF_CT_DUMP_TUPLE macro indrection by function call Directly call IPv4 and IPv6 variants where the address family is easily known. Signed-off-by: Jan Engelhardt Signed-off-by: Patrick McHardy --- include/net/netfilter/nf_conntrack_tuple.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index 2722b13ecd6..1bb7087833d 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h @@ -151,8 +151,6 @@ static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t) } } -#define NF_CT_DUMP_TUPLE(tp) nf_ct_dump_tuple(tp) - /* If we're the first tuple, it's the original dir. */ #define NF_CT_DIRECTION(h) \ ((enum ip_conntrack_dir)(h)->tuple.dst.dir) -- cgit v1.2.3 From e7bfd0a1a6c8f82977253dab19be9d9979c1ec1b Mon Sep 17 00:00:00 2001 From: Peter Warasin Date: Mon, 14 Apr 2008 11:15:54 +0200 Subject: [NETFILTER]: bridge: add ebt_nflog watcher This patch adds the ebtables nflog watcher to the kernel in order to allow ebtables log through the nfnetlink_log backend. Signed-off-by: Peter Warasin Signed-off-by: Patrick McHardy --- include/linux/netfilter_bridge/ebt_nflog.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/linux/netfilter_bridge/ebt_nflog.h (limited to 'include') diff --git a/include/linux/netfilter_bridge/ebt_nflog.h b/include/linux/netfilter_bridge/ebt_nflog.h new file mode 100644 index 00000000000..052817849b8 --- /dev/null +++ b/include/linux/netfilter_bridge/ebt_nflog.h @@ -0,0 +1,21 @@ +#ifndef __LINUX_BRIDGE_EBT_NFLOG_H +#define __LINUX_BRIDGE_EBT_NFLOG_H + +#define EBT_NFLOG_MASK 0x0 + +#define EBT_NFLOG_PREFIX_SIZE 64 +#define EBT_NFLOG_WATCHER "nflog" + +#define EBT_NFLOG_DEFAULT_GROUP 0x1 +#define EBT_NFLOG_DEFAULT_THRESHOLD 1 + +struct ebt_nflog_info { + u_int32_t len; + u_int16_t group; + u_int16_t threshold; + u_int16_t flags; + u_int16_t pad; + char prefix[EBT_NFLOG_PREFIX_SIZE]; +}; + +#endif /* __LINUX_BRIDGE_EBT_NFLOG_H */ -- cgit v1.2.3 From 0c3141e910eaaa0b617e2f26c69b266d1cd1f035 Mon Sep 17 00:00:00 2001 From: Allan Stephens Date: Tue, 15 Apr 2008 00:22:02 -0700 Subject: [TIPC]: Overhaul of socket locking logic This patch modifies TIPC's socket code to follow the same approach used by other protocols. This change eliminates the need for a mutex in the TIPC-specific portion of the socket protocol data structure -- in its place, the standard Linux socket backlog queue and associated locking routines are utilized. These changes fix a long-standing receive queue bug on SMP systems, and also enable individual read and write threads to utilize a socket without unnecessarily interfering with each other. Signed-off-by: Allan Stephens Signed-off-by: David S. Miller --- include/net/tipc/tipc_port.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/net/tipc/tipc_port.h b/include/net/tipc/tipc_port.h index c9b36b77a0b..11105bcc445 100644 --- a/include/net/tipc/tipc_port.h +++ b/include/net/tipc/tipc_port.h @@ -96,6 +96,12 @@ struct tipc_port *tipc_get_port(const u32 ref); void *tipc_get_handle(const u32 ref); +/* + * The following routines require that the port be locked on entry + */ + +int tipc_disconnect_port(struct tipc_port *tp_ptr); + #endif -- cgit v1.2.3 From 99971e70fdc1862e120f3319fc0a4dba8c728acf Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 15 Apr 2008 00:27:58 -0700 Subject: [WANPIPE]: Forgotten bits of Sangoma drivers removal. Robert P. J. Day spotted that my removal of the Sangoma drivers missed a few bits. Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- include/linux/Kbuild | 1 - include/linux/if_wanpipe.h | 124 --------------------------------------------- 2 files changed, 125 deletions(-) delete mode 100644 include/linux/if_wanpipe.h (limited to 'include') diff --git a/include/linux/Kbuild b/include/linux/Kbuild index e56b739d8e2..b3d9ccde0c2 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild @@ -231,7 +231,6 @@ unifdef-y += if_pppol2tp.h unifdef-y += if_pppox.h unifdef-y += if_tr.h unifdef-y += if_vlan.h -unifdef-y += if_wanpipe.h unifdef-y += igmp.h unifdef-y += inet_diag.h unifdef-y += in.h diff --git a/include/linux/if_wanpipe.h b/include/linux/if_wanpipe.h deleted file mode 100644 index e594ca6069e..00000000000 --- a/include/linux/if_wanpipe.h +++ /dev/null @@ -1,124 +0,0 @@ -/***************************************************************************** -* if_wanpipe.h Header file for the Sangoma AF_WANPIPE Socket -* -* Author: Nenad Corbic -* -* Copyright: (c) 2000 Sangoma Technologies Inc. -* -* 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. -* ============================================================================ -* -* Jan 28, 2000 Nenad Corbic Initial Version -* -*****************************************************************************/ - -#ifndef __LINUX_IF_WAN_PACKET_H -#define __LINUX_IF_WAN_PACKET_H - -struct wan_sockaddr_ll -{ - unsigned short sll_family; - unsigned short sll_protocol; - int sll_ifindex; - unsigned short sll_hatype; - unsigned char sll_pkttype; - unsigned char sll_halen; - unsigned char sll_addr[8]; - unsigned char sll_device[14]; - unsigned char sll_card[14]; -}; - -typedef struct -{ - unsigned char free; - unsigned char state_sk; - int rcvbuf; - int sndbuf; - int rmem; - int wmem; - int sk_count; - unsigned char bound; - char name[14]; - unsigned char d_state; - unsigned char svc; - unsigned short lcn; - unsigned char mbox; - unsigned char cmd_busy; - unsigned char command; - unsigned poll; - unsigned poll_cnt; - int rblock; -} wan_debug_hdr_t; - -#define MAX_NUM_DEBUG 10 -#define X25_PROT 0x16 -#define PVC_PROT 0x17 - -typedef struct -{ - wan_debug_hdr_t debug[MAX_NUM_DEBUG]; -}wan_debug_t; - -#define SIOC_WANPIPE_GET_CALL_DATA (SIOCPROTOPRIVATE + 0) -#define SIOC_WANPIPE_SET_CALL_DATA (SIOCPROTOPRIVATE + 1) -#define SIOC_WANPIPE_ACCEPT_CALL (SIOCPROTOPRIVATE + 2) -#define SIOC_WANPIPE_CLEAR_CALL (SIOCPROTOPRIVATE + 3) -#define SIOC_WANPIPE_RESET_CALL (SIOCPROTOPRIVATE + 4) -#define SIOC_WANPIPE_DEBUG (SIOCPROTOPRIVATE + 5) -#define SIOC_WANPIPE_SET_NONBLOCK (SIOCPROTOPRIVATE + 6) -#define SIOC_WANPIPE_CHECK_TX (SIOCPROTOPRIVATE + 7) -#define SIOC_WANPIPE_SOCK_STATE (SIOCPROTOPRIVATE + 8) - -/* Packet types */ - -#define WAN_PACKET_HOST 0 /* To us */ -#define WAN_PACKET_BROADCAST 1 /* To all */ -#define WAN_PACKET_MULTICAST 2 /* To group */ -#define WAN_PACKET_OTHERHOST 3 /* To someone else */ -#define WAN_PACKET_OUTGOING 4 /* Outgoing of any type */ -/* These ones are invisible by user level */ -#define WAN_PACKET_LOOPBACK 5 /* MC/BRD frame looped back */ -#define WAN_PACKET_FASTROUTE 6 /* Fastrouted frame */ - - -/* X25 specific */ -#define WAN_PACKET_DATA 7 -#define WAN_PACKET_CMD 8 -#define WAN_PACKET_ASYNC 9 -#define WAN_PACKET_ERR 10 - -/* Packet socket options */ - -#define WAN_PACKET_ADD_MEMBERSHIP 1 -#define WAN_PACKET_DROP_MEMBERSHIP 2 - -#define WAN_PACKET_MR_MULTICAST 0 -#define WAN_PACKET_MR_PROMISC 1 -#define WAN_PACKET_MR_ALLMULTI 2 - -#ifdef __KERNEL__ - -/* Private wanpipe socket structures. */ -struct wanpipe_opt -{ - void *mbox; /* Mail box */ - void *card; /* Card bouded to */ - struct net_device *dev; /* Bounded device */ - unsigned short lcn; /* Binded LCN */ - unsigned char svc; /* 0=pvc, 1=svc */ - unsigned char timer; /* flag for delayed transmit*/ - struct timer_list tx_timer; - unsigned poll_cnt; - unsigned char force; /* Used to force sock release */ - atomic_t packet_sent; - unsigned short num; -}; - -#define wp_sk(__sk) ((struct wanpipe_opt *)(__sk)->sk_protinfo) - -#endif - -#endif -- cgit v1.2.3 From 7ef3abd2104232a35f259dad6a213310edc7c9fe Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 15 Apr 2008 00:29:24 -0700 Subject: [IRDA]: Remove irlan_eth_send_gratuitous_arp() Even kernel 2.2.26 (sic) already contains the #undef CONFIG_IRLAN_SEND_GRATUITOUS_ARP with the comment "but for some reason the machine crashes if you use DHCP". Either someone finally looks into this or it's simply time to remove this dead code. Reported-by: Robert P. J. Day Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- include/net/irda/irlan_eth.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/net/irda/irlan_eth.h b/include/net/irda/irlan_eth.h index 0062347600b..de5c81691f3 100644 --- a/include/net/irda/irlan_eth.h +++ b/include/net/irda/irlan_eth.h @@ -29,5 +29,4 @@ struct net_device *alloc_irlandev(const char *name); int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb); void irlan_eth_flow_indication( void *instance, void *sap, LOCAL_FLOW flow); -void irlan_eth_send_gratuitous_arp(struct net_device *dev); #endif -- cgit v1.2.3 From 31efdf0530b6351b0658d35a602a0f2d6bc2ed6f Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 15 Apr 2008 00:30:16 -0700 Subject: [ISDN] include/linux/isdn.h: remove dead code This patch remove the usage of a nonexisting kconfig variable. Reported-by: Robert P. J. Day Signed-off-by: Adrian Bunk Signed-off-by: David S. Miller --- include/linux/isdn.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'include') diff --git a/include/linux/isdn.h b/include/linux/isdn.h index 9cb2855bb17..44cd663c53b 100644 --- a/include/linux/isdn.h +++ b/include/linux/isdn.h @@ -16,14 +16,8 @@ #include -#ifdef CONFIG_COBALT_MICRO_SERVER -/* Save memory */ -#define ISDN_MAX_DRIVERS 2 -#define ISDN_MAX_CHANNELS 8 -#else #define ISDN_MAX_DRIVERS 32 #define ISDN_MAX_CHANNELS 64 -#endif /* New ioctl-codes */ #define IIOCNETAIF _IO('I',1) -- cgit v1.2.3 From c93cf61fd1d5378134f9b06703f7078067542e00 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 15 Apr 2008 00:35:23 -0700 Subject: [NETNS]: The net-subsys IDs generator. To make some per-net generic pointers, we need some way to address them, i.e. - IDs. This is simple IDA-based IDs generator for pernet subsystems. Addressing questions about potential checkpoint/restart problems: these IDs are "lite-offsets" within the net structure and are by no means supposed to be exported to the userspace. Since it will be used in the nearest future by devices only (tun, vlan, tunnels, bridge, etc), I make it resemble the functionality of register_pernet_device(). The new ids is stored in the *id pointer _before_ calling the init callback to make this id available in this callback. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/net_namespace.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index e2aee2689ab..72fad1a0956 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -185,6 +185,8 @@ extern int register_pernet_subsys(struct pernet_operations *); extern void unregister_pernet_subsys(struct pernet_operations *); extern int register_pernet_device(struct pernet_operations *); extern void unregister_pernet_device(struct pernet_operations *); +extern int register_pernet_gen_device(int *id, struct pernet_operations *); +extern void unregister_pernet_gen_device(int id, struct pernet_operations *); struct ctl_path; struct ctl_table; -- cgit v1.2.3 From dec827d174d7f76c457238800183ca864a639365 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 15 Apr 2008 00:36:08 -0700 Subject: [NETNS]: The generic per-net pointers. Add the elastic array of void * pointer to the struct net. The access rules are simple: 1. register the ops with register_pernet_gen_device to get the id of your private pointer 2. call net_assign_generic() to put the private data on the struct net (most preferably this should be done in the ->init callback of the ops registered) 3. do not store any private reference on the net_generic array; 4. do not change this pointer while the net is alive; 5. use the net_generic() to get the pointer. When adding a new pointer, I copy the old array, replace it with a new one and schedule the old for kfree after an RCU grace period. Since the net_generic explores the net->gen array inside rcu read section and once set the net->gen->ptr[x] pointer never changes, this grants us a safe access to generic pointers. Quoting Paul: "... RCU is protecting -only- the net_generic structure that net_generic() is traversing, and the [pointer] returned by net_generic() is protected by a reference counter in the upper-level struct net." Signed-off-by: Pavel Emelyanov Acked-by: Paul E. McKenney Signed-off-by: David S. Miller --- include/net/net_namespace.h | 2 ++ include/net/netns/generic.h | 49 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 include/net/netns/generic.h (limited to 'include') diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 72fad1a0956..f880b0f9f10 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -20,6 +20,7 @@ struct proc_dir_entry; struct net_device; struct sock; struct ctl_table_header; +struct net_generic; struct net { atomic_t count; /* To decided when the network @@ -61,6 +62,7 @@ struct net { #ifdef CONFIG_NETFILTER struct netns_xt xt; #endif + struct net_generic *gen; }; diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h new file mode 100644 index 00000000000..0c04fd2a700 --- /dev/null +++ b/include/net/netns/generic.h @@ -0,0 +1,49 @@ +/* + * generic net pointers + */ + +#ifndef __NET_GENERIC_H__ +#define __NET_GENERIC_H__ + +#include + +/* + * Generic net pointers are to be used by modules to put some private + * stuff on the struct net without explicit struct net modification + * + * The rules are simple: + * 1. register the ops with register_pernet_gen_device to get the id + * of your private pointer; + * 2. call net_assign_generic() to put the private data on the struct + * net (most preferably this should be done in the ->init callback + * of the ops registered); + * 3. do not change this pointer while the net is alive; + * 4. do not try to have any private reference on the net_generic object. + * + * After accomplishing all of the above, the private pointer can be + * accessed with the net_generic() call. + */ + +struct net_generic { + unsigned int len; + struct rcu_head rcu; + + void *ptr[0]; +}; + +static inline void *net_generic(struct net *net, int id) +{ + struct net_generic *ng; + void *ptr; + + rcu_read_lock(); + ng = rcu_dereference(net->gen); + BUG_ON(id == 0 || id > ng->len); + ptr = ng->ptr[id - 1]; + rcu_read_unlock(); + + return ptr; +} + +extern int net_assign_generic(struct net *net, int id, void *data); +#endif -- cgit v1.2.3 From 669f87baab90183e13b95480aecf8d7bac92ca3c Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Wed, 16 Apr 2008 00:46:52 -0700 Subject: [RTNL]: Introduce the rtnl_kill_links helper. This one is responsible for calling ->dellink on each net device found in net to help with vlan net_exit hook in the nearest future. Signed-off-by: Pavel Emelyanov Acked-by: Patrick McHardy Signed-off-by: David S. Miller --- include/net/rtnetlink.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index 793863e09c6..3c1895e54b7 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h @@ -74,6 +74,7 @@ struct rtnl_link_ops { extern int __rtnl_link_register(struct rtnl_link_ops *ops); extern void __rtnl_link_unregister(struct rtnl_link_ops *ops); +extern void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops); extern int rtnl_link_register(struct rtnl_link_ops *ops); extern void rtnl_link_unregister(struct rtnl_link_ops *ops); -- cgit v1.2.3 From a9fde2607895667823e9d1172fc193087125ef68 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Wed, 16 Apr 2008 00:48:04 -0700 Subject: [VLAN]: Tag vlan_group_device with net device, not ifindex. Currently vlan group is searched using one key - the ifindex. We'll have to lookup the vlan_group by two keys - ifindex and net. Turning the vlan_group lookup key to struct net_device pointer will make this process easier. Besides, this will eliminate one more place in the networking, that assumes that indexes are unique in the kernel. Signed-off-by: Pavel Emelyanov Acked-by: Patrick McHardy Signed-off-by: David S. Miller --- include/linux/if_vlan.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index edd55af7ebd..15ace02b7b2 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -81,7 +81,9 @@ extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); #define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS) struct vlan_group { - int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ + struct net_device *real_dev; /* The ethernet(like) device + * the vlan is attached to. + */ unsigned int nr_vlans; struct hlist_node hlist; /* linked list */ struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; -- cgit v1.2.3 From 5d1e4468a7705db7c1415a65fd16f07113afc1b2 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Wed, 16 Apr 2008 01:58:04 -0700 Subject: [NETNS]: Make netns refconting debug like a socket one. Make release_net/hold_net noop for performance-hungry people. This is a debug staff and should be used in the debug mode only. Add check for net != NULL in hold/release calls. This will be required later on. [ Added minor simplifications suggested by Brian Haley. -DaveM ] Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/net_namespace.h | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index f880b0f9f10..aa540e6be50 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -26,9 +26,11 @@ struct net { atomic_t count; /* To decided when the network * namespace should be freed. */ +#ifdef NETNS_REFCNT_DEBUG atomic_t use_count; /* To track references we * destroy on demand */ +#endif struct list_head list; /* list of network namespaces */ struct work_struct work; /* work struct for freeing */ @@ -117,17 +119,6 @@ static inline void put_net(struct net *net) __put_net(net); } -static inline struct net *hold_net(struct net *net) -{ - atomic_inc(&net->use_count); - return net; -} - -static inline void release_net(struct net *net) -{ - atomic_dec(&net->use_count); -} - static inline int net_eq(const struct net *net1, const struct net *net2) { @@ -143,27 +134,44 @@ static inline void put_net(struct net *net) { } +static inline struct net *maybe_get_net(struct net *net) +{ + return net; +} + +static inline +int net_eq(const struct net *net1, const struct net *net2) +{ + return 1; +} +#endif + + +#ifdef NETNS_REFCNT_DEBUG static inline struct net *hold_net(struct net *net) { + if (net) + atomic_inc(&net->use_count); return net; } static inline void release_net(struct net *net) { + if (net) + atomic_dec(&net->use_count); } - -static inline struct net *maybe_get_net(struct net *net) +#else +static inline struct net *hold_net(struct net *net) { return net; } -static inline -int net_eq(const struct net *net1, const struct net *net2) +static inline void release_net(struct net *net) { - return 1; } #endif + #define for_each_net(VAR) \ list_for_each_entry(VAR, &net_namespace_list, list) -- cgit v1.2.3 From 65a18ec58e5e6186103f62f720acea94dfb26f4e Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Wed, 16 Apr 2008 01:59:46 -0700 Subject: [NETNS]: Add netns refcnt debug for kernel sockets. Protocol control sockets and netlink kernel sockets should not prevent the namespace stop request. They are initialized and disposed in a special way by sk_change_net/sk_release_kernel. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/sock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/net/sock.h b/include/net/sock.h index 09255eae93e..dc42b44c2aa 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1314,7 +1314,7 @@ void sock_net_set(struct sock *sk, struct net *net) static inline void sk_change_net(struct sock *sk, struct net *net) { put_net(sock_net(sk)); - sock_net_set(sk, net); + sock_net_set(sk, hold_net(net)); } extern void sock_enable_timestamp(struct sock *sk); -- cgit v1.2.3 From 3661a910836a509be65afc3c1e512d900e1280f9 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Wed, 16 Apr 2008 02:01:56 -0700 Subject: [NETNS]: Add netns refcnt debug to fib rules. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/net/fib_rules.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 34349f9f433..a5c6ccc5bb1 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h @@ -87,6 +87,7 @@ static inline void fib_rule_get(struct fib_rule *rule) static inline void fib_rule_put_rcu(struct rcu_head *head) { struct fib_rule *rule = container_of(head, struct fib_rule, rcu); + release_net(rule->fr_net); kfree(rule); } -- cgit v1.2.3 From f3005d7f4abe03ad41af33b1548602cd086d86a2 Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Wed, 16 Apr 2008 02:02:18 -0700 Subject: [NETNS]: Add netns refcnt debug for network devices. dev_set_net is called for - just allocated devices - devices moving from one namespace to another release_net has proper check inside to distinguish these cases. Signed-off-by: Denis V. Lunev Signed-off-by: David S. Miller --- include/linux/netdevice.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 8b17ed40dea..7c1d4466583 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -758,7 +758,8 @@ static inline void dev_net_set(struct net_device *dev, struct net *net) { #ifdef CONFIG_NET_NS - dev->nd_net = net; + release_net(dev->nd_net); + dev->nd_net = hold_net(net); #endif } -- cgit v1.2.3 From dd9e0dda66ba38a2ddd1405ac279894260dc5c36 Mon Sep 17 00:00:00 2001 From: John Heffner Date: Tue, 15 Apr 2008 15:26:39 -0700 Subject: [TCP]: Increase the max_burst threshold from 3 to tp->reordering. This change is necessary to allow cwnd to grow during persistent reordering. Cwnd moderation is applied when in the disorder state and an ack that fills the hole comes in. If the hole was greater than 3 packets, but less than tp->reordering, cwnd will shrink when it should not have. Signed-off-by: John Heffner Signed-off-by: David S. Miller --- include/net/tcp.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/tcp.h b/include/net/tcp.h index 2c14edf7b07..633147cb6bb 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -787,11 +787,14 @@ extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); /* Slow start with delack produces 3 packets of burst, so that - * it is safe "de facto". + * it is safe "de facto". This will be the default - same as + * the default reordering threshold - but if reordering increases, + * we must be able to allow cwnd to burst at least this much in order + * to not pull it back when holes are filled. */ static __inline__ __u32 tcp_max_burst(const struct tcp_sock *tp) { - return 3; + return tp->reordering; } /* Returns end sequence number of the receiver's advertised window */ -- cgit v1.2.3 From d18ef29f34eb33099d387a327abe139f3915a829 Mon Sep 17 00:00:00 2001 From: Reinette Chatre Date: Wed, 9 Apr 2008 16:56:15 -0700 Subject: mac80211: no BSS changes to driver from beacons processed during scanning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no need to send BSS changes to driver from beacons processed during scanning. We are more interested in beacons from an AP with which we are associated - these will still be used to send updates to driver as the beacons are received without scanning. This change·removes the requirement that bss_info_changed needs to be atomic. The beacons received during scanning are processed from a tasklet, but if we do not call bss_info_changed for these beacons there is no need for it to be atomic. This function (bss_info_changed) is called either from workqueue or ioctl in all other instances. Signed-off-by: Reinette Chatre Acked-by: Tomas Winkler Acked-by: Johannes Berg Signed-off-by: John W. Linville --- include/net/mac80211.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 079e7bd86c9..4a80d74975e 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -1020,8 +1020,7 @@ enum ieee80211_ampdu_mlme_action { * level driver (e.g. assoc/disassoc status, erp parameters). * This function should not be used if no BSS has been set, unless * for association indication. The @changed parameter indicates which - * of the bss parameters has changed when a call is made. This callback - * has to be atomic. + * of the bss parameters has changed when a call is made. * * @configure_filter: Configure the device's RX filter. * See the section "Frame filtering" for more information. -- cgit v1.2.3 From 9d9326d3bc0ea9a8bbe40bf3e5e66c7b9858caa0 Mon Sep 17 00:00:00 2001 From: Andy Fleming Date: Wed, 9 Apr 2008 19:38:13 -0500 Subject: phy: Change mii_bus id field to a string Having the id field be an int was making more complex bus topologies excessively difficult. For now, just convert it to a string, and change all instances of "bus->id = val" to snprintf(id, MII_BUS_ID_LEN, "%x", val). Signed-off-by: Andy Fleming Signed-off-by: Jeff Garzik --- include/linux/fsl_devices.h | 2 +- include/linux/phy.h | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h index 1831b196c70..2cad5c67397 100644 --- a/include/linux/fsl_devices.h +++ b/include/linux/fsl_devices.h @@ -50,7 +50,7 @@ struct gianfar_platform_data { u32 device_flags; /* board specific information */ u32 board_flags; - u32 bus_id; + char bus_id[MII_BUS_ID_SIZE]; u32 phy_id; u8 mac_addr[6]; phy_interface_t interface; diff --git a/include/linux/phy.h b/include/linux/phy.h index 5e43ae75141..6509f377bb1 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -63,8 +63,6 @@ typedef enum { PHY_INTERFACE_MODE_RTBI } phy_interface_t; -#define MII_BUS_MAX 4 - #define PHY_INIT_TIMEOUT 100000 #define PHY_STATE_TIME 1 @@ -74,13 +72,19 @@ typedef enum { #define PHY_MAX_ADDR 32 /* Used when trying to connect to a specific phy (mii bus id:phy device id) */ -#define PHY_ID_FMT "%x:%02x" +#define PHY_ID_FMT "%s:%02x" + +/* + * Need to be a little smaller than phydev->dev.bus_id to leave room + * for the ":%02x" + */ +#define MII_BUS_ID_SIZE (BUS_ID_SIZE - 3) /* The Bus class for PHYs. Devices which provide access to * PHYs should register using this structure */ struct mii_bus { const char *name; - int id; + char id[MII_BUS_ID_SIZE]; void *priv; int (*read)(struct mii_bus *bus, int phy_id, int regnum); int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val); -- cgit v1.2.3 From c5e38a949bfa11d10f73927fbf4fe66b73bc3001 Mon Sep 17 00:00:00 2001 From: Andy Fleming Date: Wed, 9 Apr 2008 19:38:27 -0500 Subject: phy: Clean up header style Multi-line comments weren't all CodingStyle compliant Signed-off-by: Andy Fleming Signed-off-by: Jeff Garzik --- include/linux/phy.h | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/linux/phy.h b/include/linux/phy.h index 6509f377bb1..2d838448415 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -39,7 +39,8 @@ SUPPORTED_1000baseT_Half | \ SUPPORTED_1000baseT_Full) -/* Set phydev->irq to PHY_POLL if interrupts are not supported, +/* + * Set phydev->irq to PHY_POLL if interrupts are not supported, * or not desired for this PHY. Set to PHY_IGNORE_INTERRUPT if * the attached driver handles the interrupt */ @@ -80,8 +81,10 @@ typedef enum { */ #define MII_BUS_ID_SIZE (BUS_ID_SIZE - 3) -/* The Bus class for PHYs. Devices which provide access to - * PHYs should register using this structure */ +/* + * The Bus class for PHYs. Devices which provide access to + * PHYs should register using this structure + */ struct mii_bus { const char *name; char id[MII_BUS_ID_SIZE]; @@ -90,8 +93,10 @@ struct mii_bus { int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val); int (*reset)(struct mii_bus *bus); - /* A lock to ensure that only one thing can read/write - * the MDIO bus at a time */ + /* + * A lock to ensure that only one thing can read/write + * the MDIO bus at a time + */ struct mutex mdio_lock; struct device *dev; @@ -102,8 +107,10 @@ struct mii_bus { /* Phy addresses to be ignored when probing */ u32 phy_mask; - /* Pointer to an array of interrupts, each PHY's - * interrupt at the index matching its address */ + /* + * Pointer to an array of interrupts, each PHY's + * interrupt at the index matching its address + */ int *irq; }; @@ -255,7 +262,8 @@ struct phy_device { /* Bus address of the PHY (0-32) */ int addr; - /* forced speed & duplex (no autoneg) + /* + * forced speed & duplex (no autoneg) * partner speed & duplex & pause (autoneg) */ int speed; @@ -278,8 +286,10 @@ struct phy_device { int link_timeout; - /* Interrupt number for this PHY - * -1 means no interrupt */ + /* + * Interrupt number for this PHY + * -1 means no interrupt + */ int irq; /* private data pointer */ @@ -329,22 +339,28 @@ struct phy_driver { u32 features; u32 flags; - /* Called to initialize the PHY, - * including after a reset */ + /* + * Called to initialize the PHY, + * including after a reset + */ int (*config_init)(struct phy_device *phydev); - /* Called during discovery. Used to set - * up device-specific structures, if any */ + /* + * Called during discovery. Used to set + * up device-specific structures, if any + */ int (*probe)(struct phy_device *phydev); /* PHY Power Management */ int (*suspend)(struct phy_device *phydev); int (*resume)(struct phy_device *phydev); - /* Configures the advertisement and resets + /* + * Configures the advertisement and resets * autonegotiation if phydev->autoneg is on, * forces the speed to the current settings in phydev - * if phydev->autoneg is off */ + * if phydev->autoneg is off + */ int (*config_aneg)(struct phy_device *phydev); /* Determines the negotiated speed and duplex */ -- cgit v1.2.3 From cac1f3c8a80f3fc0b4489d1d3ba29214677ffab2 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Tue, 15 Apr 2008 12:49:21 -0400 Subject: phylib: factor out get_phy_id from within get_phy_device We were already doing what amounts to a get_phy_id from within get_phy_device, and rather than duplicate this for the TBIPA probing, we might as well just factor it out and make it available instead. Signed-off-by: Paul Gortmaker Acked-by: Andy Fleming Signed-off-by: Jeff Garzik --- include/linux/phy.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/phy.h b/include/linux/phy.h index 2d838448415..779cbcd65f6 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -381,6 +381,7 @@ struct phy_driver { int phy_read(struct phy_device *phydev, u16 regnum); int phy_write(struct phy_device *phydev, u16 regnum, u16 val); +int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); struct phy_device* get_phy_device(struct mii_bus *bus, int addr); int phy_clear_interrupt(struct phy_device *phydev); int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); -- cgit v1.2.3 From e56d8b8a2ee5fb7f63ceba58e1c0fb3c844888a4 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 17 Apr 2008 23:17:34 -0700 Subject: [INET]: Drop the inet_inherit_port() call. As I can see from the code, two places (tcp_v6_syn_recv_sock and dccp_v6_request_recv_sock) that call this one already run with BHs disabled, so it's safe to call __inet_inherit_port there. Besides (in case I missed smth with code review) the calltrace tcp_v6_syn_recv_sock `- tcp_v4_syn_recv_sock `- __inet_inherit_port and the similar for DCCP are valid, but assumes BHs to be disabled. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/inet_hashtables.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'include') diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 5525227c5e9..5ec91d88b51 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -235,13 +235,6 @@ static inline void __inet_inherit_port(struct sock *sk, struct sock *child) spin_unlock(&head->lock); } -static inline void inet_inherit_port(struct sock *sk, struct sock *child) -{ - local_bh_disable(); - __inet_inherit_port(sk, child); - local_bh_enable(); -} - extern void inet_put_port(struct sock *sk); extern void inet_listen_wlock(struct inet_hashinfo *hashinfo); -- cgit v1.2.3 From 53083773dcbd3c80477e2ace143e361e1e806745 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 17 Apr 2008 23:18:15 -0700 Subject: [INET]: Uninline the __inet_inherit_port call. This deblats ~200 bytes when ipv6 and dccp are 'y'. Besides, this will ease compilation issues for patches I'm working on to make inet hash tables more scalable wrt net namespaces. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- include/net/inet_hashtables.h | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'include') diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 5ec91d88b51..735b926a349 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -221,19 +221,7 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk) } /* Caller must disable local BH processing. */ -static inline void __inet_inherit_port(struct sock *sk, struct sock *child) -{ - struct inet_hashinfo *table = sk->sk_prot->h.hashinfo; - const int bhash = inet_bhashfn(inet_sk(child)->num, table->bhash_size); - struct inet_bind_hashbucket *head = &table->bhash[bhash]; - struct inet_bind_bucket *tb; - - spin_lock(&head->lock); - tb = inet_csk(sk)->icsk_bind_hash; - sk_add_bind_node(child, &tb->owners); - inet_csk(child)->icsk_bind_hash = tb; - spin_unlock(&head->lock); -} +extern void __inet_inherit_port(struct sock *sk, struct sock *child); extern void inet_put_port(struct sock *sk); -- cgit v1.2.3