diff options
Diffstat (limited to 'include')
46 files changed, 1910 insertions, 199 deletions
diff --git a/include/linux/caif/caif_socket.h b/include/linux/caif/caif_socket.h new file mode 100644 index 00000000000..8e5c8444a3f --- /dev/null +++ b/include/linux/caif/caif_socket.h @@ -0,0 +1,164 @@ +/* linux/caif_socket.h + * CAIF Definitions for CAIF socket and network layer + * Copyright (C) ST-Ericsson AB 2010 + * Author:	 Sjur Brendeland/ sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef _LINUX_CAIF_SOCKET_H +#define _LINUX_CAIF_SOCKET_H + +#include <linux/types.h> + +#ifdef __KERNEL__ +#include <linux/socket.h> +#else +#include <sys/socket.h> +#endif + + +/** + * enum caif_link_selector -    Physical Link Selection. + * @CAIF_LINK_HIGH_BANDW:	Physical interface for high-bandwidth + *				traffic. + * @CAIF_LINK_LOW_LATENCY:	Physical interface for low-latency + *				traffic. + * + * CAIF Link Layers can register their link properties. + * This enum is used for choosing between CAIF Link Layers when + * setting up CAIF Channels when multiple CAIF Link Layers exists. + */ +enum caif_link_selector { +	CAIF_LINK_HIGH_BANDW, +	CAIF_LINK_LOW_LATENCY +}; + +/** + * enum caif_channel_priority - CAIF channel priorities. + * + * @CAIF_PRIO_MIN:	Min priority for a channel. + * @CAIF_PRIO_LOW:	Low-priority channel. + * @CAIF_PRIO_NORMAL:	Normal/default priority level. + * @CAIF_PRIO_HIGH:	High priority level + * @CAIF_PRIO_MAX:	Max priority for channel + * + * Priority can be set on CAIF Channels in order to + * prioritize between traffic on different CAIF Channels. + * These priority levels are recommended, but the priority value + * is not restricted to the values defined in this enum, any value + * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used. + */ +enum caif_channel_priority { +	CAIF_PRIO_MIN	 = 0x01, +	CAIF_PRIO_LOW	 = 0x04, +	CAIF_PRIO_NORMAL = 0x0f, +	CAIF_PRIO_HIGH	 = 0x14, +	CAIF_PRIO_MAX	 = 0x1F +}; + +/** + * enum caif_protocol_type  -	CAIF Channel type. + * @CAIFPROTO_AT:		Classic AT channel. + * @CAIFPROTO_DATAGRAM:		Datagram channel. + * @CAIFPROTO_DATAGRAM_LOOP:	Datagram loopback channel, used for testing. + * @CAIFPROTO_UTIL:		Utility (Psock) channel. + * @CAIFPROTO_RFM:		Remote File Manager + * + * This enum defines the CAIF Channel type to be used. This defines + * the service to connect to on the modem. + */ +enum caif_protocol_type { +	CAIFPROTO_AT, +	CAIFPROTO_DATAGRAM, +	CAIFPROTO_DATAGRAM_LOOP, +	CAIFPROTO_UTIL, +	CAIFPROTO_RFM, +	_CAIFPROTO_MAX +}; +#define	CAIFPROTO_MAX _CAIFPROTO_MAX + +/** + * enum caif_at_type - AT Service Endpoint + * @CAIF_ATTYPE_PLAIN:	     Connects to a plain vanilla AT channel. + */ +enum caif_at_type { +	CAIF_ATTYPE_PLAIN = 2 +}; + +/** + * struct sockaddr_caif - the sockaddr structure for CAIF sockets. + * @u:			     Union of address data 'switched' by family. + * : + * @u.at:                    Applies when family = CAIFPROTO_AT. + * + * @u.at.type:               Type of AT link to set up (enum caif_at_type). + * + * @u.util:                  Applies when family = CAIFPROTO_UTIL + * + * @u.util.service:          Utility service name. + * + * @u.dgm:                   Applies when family = CAIFPROTO_DATAGRAM + * + * @u.dgm.connection_id:     Datagram connection id. + * + * @u.dgm.nsapi:             NSAPI of the PDP-Context. + * + * @u.rfm:                   Applies when family = CAIFPROTO_RFM + * + * @u.rfm.connection_id:     Connection ID for RFM. + * + * @u.rfm.volume:            Volume to mount. + * + * Description: + * This structure holds the connect parameters used for setting up a + * CAIF Channel. It defines the service to connect to on the modem. + */ +struct sockaddr_caif { +	sa_family_t  family; +	union { +		struct { +			__u8  type;		/* type: enum caif_at_type */ +		} at;				/* CAIFPROTO_AT */ +		struct { +			char	  service[16]; +		} util;				/* CAIFPROTO_UTIL */ +		union { +			__u32 connection_id; +			__u8  nsapi; +		} dgm;				/* CAIFPROTO_DATAGRAM(_LOOP)*/ +		struct { +			__u32 connection_id; +			char	  volume[16]; +		} rfm;				/* CAIFPROTO_RFM */ +	} u; +}; + +/** + * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt. + * + * @CAIFSO_LINK_SELECT:		Selector used if multiple CAIF Link layers are + *				available. Either a high bandwidth + *				link can be selected (CAIF_LINK_HIGH_BANDW) or + *				or a low latency link (CAIF_LINK_LOW_LATENCY). + *                              This option is of type __u32. + *				Alternatively SO_BINDTODEVICE can be used. + * + * @CAIFSO_REQ_PARAM:		Used to set the request parameters for a + *				utility channel. (maximum 256 bytes). This + *				option must be set before connecting. + * + * @CAIFSO_RSP_PARAM:		Gets the response parameters for a utility + *				channel. (maximum 256 bytes). This option + *				is valid after a successful connect. + * + * + * This enum defines the CAIF Socket options to be used on a socket + * + */ +enum caif_socket_opts { +	CAIFSO_LINK_SELECT	= 127, +	CAIFSO_REQ_PARAM	= 128, +	CAIFSO_RSP_PARAM	= 129, +}; + +#endif /* _LINUX_CAIF_SOCKET_H */ diff --git a/include/linux/caif/if_caif.h b/include/linux/caif/if_caif.h new file mode 100644 index 00000000000..5e7eed4edf5 --- /dev/null +++ b/include/linux/caif/if_caif.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) ST-Ericsson AB 2010 + * Author:	Sjur Brendeland/ sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef IF_CAIF_H_ +#define IF_CAIF_H_ +#include <linux/sockios.h> +#include <linux/types.h> +#include <linux/socket.h> + +/** + * enum ifla_caif - CAIF NetlinkRT parameters. + * @IFLA_CAIF_IPV4_CONNID:  Connection ID for IPv4 PDP Context. + *			    The type of attribute is NLA_U32. + * @IFLA_CAIF_IPV6_CONNID:  Connection ID for IPv6 PDP Context. + *			    The type of attribute is NLA_U32. + * @IFLA_CAIF_LOOPBACK:	    If different from zero, device is doing loopback + *			    The type of attribute is NLA_U8. + * + * When using RT Netlink to create, destroy or configure a CAIF IP interface, + * enum ifla_caif is used to specify the configuration attributes. + */ +enum ifla_caif { +	__IFLA_CAIF_UNSPEC, +	IFLA_CAIF_IPV4_CONNID, +	IFLA_CAIF_IPV6_CONNID, +	IFLA_CAIF_LOOPBACK, +	__IFLA_CAIF_MAX +}; +#define	IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1) + +#endif /*IF_CAIF_H_*/ diff --git a/include/linux/can/platform/mcp251x.h b/include/linux/can/platform/mcp251x.h index 1448177d86d..dba28268e65 100644 --- a/include/linux/can/platform/mcp251x.h +++ b/include/linux/can/platform/mcp251x.h @@ -26,8 +26,8 @@  struct mcp251x_platform_data {  	unsigned long oscillator_frequency;  	int model; -#define CAN_MCP251X_MCP2510 0 -#define CAN_MCP251X_MCP2515 1 +#define CAN_MCP251X_MCP2510 0x2510 +#define CAN_MCP251X_MCP2515 0x2515  	int (*board_specific_setup)(struct spi_device *spi);  	int (*transceiver_enable)(int enable);  	int (*power_enable) (int enable); diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index b33f316bb92..276b40a1683 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -310,6 +310,7 @@ struct ethtool_perm_addr {  enum ethtool_flags {  	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */  	ETH_FLAG_NTUPLE		= (1 << 27),	/* N-tuple filters enabled */ +	ETH_FLAG_RXHASH		= (1 << 28),  };  /* The following structures are for supporting RX network flow @@ -490,12 +491,12 @@ void ethtool_ntuple_flush(struct net_device *dev);   * get_ufo: Report whether UDP fragmentation offload is enabled   * set_ufo: Turn UDP fragmentation offload on or off   * self_test: Run specified self-tests - * get_strings: Return a set of strings that describe the requested objects  + * get_strings: Return a set of strings that describe the requested objects   * phys_id: Identify the device   * get_stats: Return statistics about the device   * get_flags: get 32-bit flags bitmap   * set_flags: set 32-bit flags bitmap - *  + *   * Description:   *   * get_settings: @@ -531,14 +532,20 @@ struct ethtool_ops {  	int	(*nway_reset)(struct net_device *);  	u32	(*get_link)(struct net_device *);  	int	(*get_eeprom_len)(struct net_device *); -	int	(*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); -	int	(*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); +	int	(*get_eeprom)(struct net_device *, +			      struct ethtool_eeprom *, u8 *); +	int	(*set_eeprom)(struct net_device *, +			      struct ethtool_eeprom *, u8 *);  	int	(*get_coalesce)(struct net_device *, struct ethtool_coalesce *);  	int	(*set_coalesce)(struct net_device *, struct ethtool_coalesce *); -	void	(*get_ringparam)(struct net_device *, struct ethtool_ringparam *); -	int	(*set_ringparam)(struct net_device *, struct ethtool_ringparam *); -	void	(*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*); -	int	(*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*); +	void	(*get_ringparam)(struct net_device *, +				 struct ethtool_ringparam *); +	int	(*set_ringparam)(struct net_device *, +				 struct ethtool_ringparam *); +	void	(*get_pauseparam)(struct net_device *, +				  struct ethtool_pauseparam*); +	int	(*set_pauseparam)(struct net_device *, +				  struct ethtool_pauseparam*);  	u32	(*get_rx_csum)(struct net_device *);  	int	(*set_rx_csum)(struct net_device *, u32);  	u32	(*get_tx_csum)(struct net_device *); @@ -550,21 +557,24 @@ struct ethtool_ops {  	void	(*self_test)(struct net_device *, struct ethtool_test *, u64 *);  	void	(*get_strings)(struct net_device *, u32 stringset, u8 *);  	int	(*phys_id)(struct net_device *, u32); -	void	(*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); +	void	(*get_ethtool_stats)(struct net_device *, +				     struct ethtool_stats *, u64 *);  	int	(*begin)(struct net_device *);  	void	(*complete)(struct net_device *); -	u32     (*get_ufo)(struct net_device *); -	int     (*set_ufo)(struct net_device *, u32); -	u32     (*get_flags)(struct net_device *); -	int     (*set_flags)(struct net_device *, u32); -	u32     (*get_priv_flags)(struct net_device *); -	int     (*set_priv_flags)(struct net_device *, u32); +	u32	(*get_ufo)(struct net_device *); +	int	(*set_ufo)(struct net_device *, u32); +	u32	(*get_flags)(struct net_device *); +	int	(*set_flags)(struct net_device *, u32); +	u32	(*get_priv_flags)(struct net_device *); +	int	(*set_priv_flags)(struct net_device *, u32);  	int	(*get_sset_count)(struct net_device *, int); -	int	(*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *); +	int	(*get_rxnfc)(struct net_device *, +			     struct ethtool_rxnfc *, void *);  	int	(*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); -	int     (*flash_device)(struct net_device *, struct ethtool_flash *); +	int	(*flash_device)(struct net_device *, struct ethtool_flash *);  	int	(*reset)(struct net_device *, u32 *); -	int	(*set_rx_ntuple)(struct net_device *, struct ethtool_rx_ntuple *); +	int	(*set_rx_ntuple)(struct net_device *, +				 struct ethtool_rx_ntuple *);  	int	(*get_rx_ntuple)(struct net_device *, u32 stringset, void *);  };  #endif /* __KERNEL__ */ @@ -576,29 +586,29 @@ struct ethtool_ops {  #define ETHTOOL_GREGS		0x00000004 /* Get NIC registers. */  #define ETHTOOL_GWOL		0x00000005 /* Get wake-on-lan options. */  #define ETHTOOL_SWOL		0x00000006 /* Set wake-on-lan options. */ -#define ETHTOOL_GMSGLVL		0x00000007 /* Get driver message level */ -#define ETHTOOL_SMSGLVL		0x00000008 /* Set driver msg level. */ +#define ETHTOOL_GMSGLVL	0x00000007 /* Get driver message level */ +#define ETHTOOL_SMSGLVL	0x00000008 /* Set driver msg level. */  #define ETHTOOL_NWAY_RST	0x00000009 /* Restart autonegotiation. */  #define ETHTOOL_GLINK		0x0000000a /* Get link status (ethtool_value) */ -#define ETHTOOL_GEEPROM		0x0000000b /* Get EEPROM data */ -#define ETHTOOL_SEEPROM		0x0000000c /* Set EEPROM data. */ +#define ETHTOOL_GEEPROM	0x0000000b /* Get EEPROM data */ +#define ETHTOOL_SEEPROM	0x0000000c /* Set EEPROM data. */  #define ETHTOOL_GCOALESCE	0x0000000e /* Get coalesce config */  #define ETHTOOL_SCOALESCE	0x0000000f /* Set coalesce config. */  #define ETHTOOL_GRINGPARAM	0x00000010 /* Get ring parameters */  #define ETHTOOL_SRINGPARAM	0x00000011 /* Set ring parameters. */  #define ETHTOOL_GPAUSEPARAM	0x00000012 /* Get pause parameters */  #define ETHTOOL_SPAUSEPARAM	0x00000013 /* Set pause parameters. */ -#define ETHTOOL_GRXCSUM		0x00000014 /* Get RX hw csum enable (ethtool_value) */ -#define ETHTOOL_SRXCSUM		0x00000015 /* Set RX hw csum enable (ethtool_value) */ -#define ETHTOOL_GTXCSUM		0x00000016 /* Get TX hw csum enable (ethtool_value) */ -#define ETHTOOL_STXCSUM		0x00000017 /* Set TX hw csum enable (ethtool_value) */ +#define ETHTOOL_GRXCSUM	0x00000014 /* Get RX hw csum enable (ethtool_value) */ +#define ETHTOOL_SRXCSUM	0x00000015 /* Set RX hw csum enable (ethtool_value) */ +#define ETHTOOL_GTXCSUM	0x00000016 /* Get TX hw csum enable (ethtool_value) */ +#define ETHTOOL_STXCSUM	0x00000017 /* Set TX hw csum enable (ethtool_value) */  #define ETHTOOL_GSG		0x00000018 /* Get scatter-gather enable  					    * (ethtool_value) */  #define ETHTOOL_SSG		0x00000019 /* Set scatter-gather enable  					    * (ethtool_value). */  #define ETHTOOL_TEST		0x0000001a /* execute NIC self-test. */  #define ETHTOOL_GSTRINGS	0x0000001b /* get specified string set */ -#define ETHTOOL_PHYS_ID		0x0000001c /* identify the NIC */ +#define ETHTOOL_PHYS_ID	0x0000001c /* identify the NIC */  #define ETHTOOL_GSTATS		0x0000001d /* get NIC-specific statistics */  #define ETHTOOL_GTSO		0x0000001e /* Get TSO enable (ethtool_value) */  #define ETHTOOL_STSO		0x0000001f /* Set TSO enable (ethtool_value) */ @@ -609,24 +619,24 @@ struct ethtool_ops {  #define ETHTOOL_SGSO		0x00000024 /* Set GSO enable (ethtool_value) */  #define ETHTOOL_GFLAGS		0x00000025 /* Get flags bitmap(ethtool_value) */  #define ETHTOOL_SFLAGS		0x00000026 /* Set flags bitmap(ethtool_value) */ -#define ETHTOOL_GPFLAGS		0x00000027 /* Get driver-private flags bitmap */ -#define ETHTOOL_SPFLAGS		0x00000028 /* Set driver-private flags bitmap */ +#define ETHTOOL_GPFLAGS	0x00000027 /* Get driver-private flags bitmap */ +#define ETHTOOL_SPFLAGS	0x00000028 /* Set driver-private flags bitmap */ -#define	ETHTOOL_GRXFH		0x00000029 /* Get RX flow hash configuration */ -#define	ETHTOOL_SRXFH		0x0000002a /* Set RX flow hash configuration */ +#define ETHTOOL_GRXFH		0x00000029 /* Get RX flow hash configuration */ +#define ETHTOOL_SRXFH		0x0000002a /* Set RX flow hash configuration */  #define ETHTOOL_GGRO		0x0000002b /* Get GRO enable (ethtool_value) */  #define ETHTOOL_SGRO		0x0000002c /* Set GRO enable (ethtool_value) */ -#define	ETHTOOL_GRXRINGS	0x0000002d /* Get RX rings available for LB */ -#define	ETHTOOL_GRXCLSRLCNT	0x0000002e /* Get RX class rule count */ -#define	ETHTOOL_GRXCLSRULE	0x0000002f /* Get RX classification rule */ -#define	ETHTOOL_GRXCLSRLALL	0x00000030 /* Get all RX classification rule */ -#define	ETHTOOL_SRXCLSRLDEL	0x00000031 /* Delete RX classification rule */ -#define	ETHTOOL_SRXCLSRLINS	0x00000032 /* Insert RX classification rule */ -#define	ETHTOOL_FLASHDEV	0x00000033 /* Flash firmware to device */ -#define	ETHTOOL_RESET		0x00000034 /* Reset hardware */ -#define	ETHTOOL_SRXNTUPLE	0x00000035 /* Add an n-tuple filter to device */ -#define	ETHTOOL_GRXNTUPLE	0x00000036 /* Get n-tuple filters from device */ -#define	ETHTOOL_GSSET_INFO	0x00000037 /* Get string set info */ +#define ETHTOOL_GRXRINGS	0x0000002d /* Get RX rings available for LB */ +#define ETHTOOL_GRXCLSRLCNT	0x0000002e /* Get RX class rule count */ +#define ETHTOOL_GRXCLSRULE	0x0000002f /* Get RX classification rule */ +#define ETHTOOL_GRXCLSRLALL	0x00000030 /* Get all RX classification rule */ +#define ETHTOOL_SRXCLSRLDEL	0x00000031 /* Delete RX classification rule */ +#define ETHTOOL_SRXCLSRLINS	0x00000032 /* Insert RX classification rule */ +#define ETHTOOL_FLASHDEV	0x00000033 /* Flash firmware to device */ +#define ETHTOOL_RESET		0x00000034 /* Reset hardware */ +#define ETHTOOL_SRXNTUPLE	0x00000035 /* Add an n-tuple filter to device */ +#define ETHTOOL_GRXNTUPLE	0x00000036 /* Get n-tuple filters from device */ +#define ETHTOOL_GSSET_INFO	0x00000037 /* Get string set info */  /* compatibility with older code */  #define SPARC_ETH_GSET		ETHTOOL_GSET @@ -635,18 +645,18 @@ struct ethtool_ops {  /* Indicates what features are supported by the interface. */  #define SUPPORTED_10baseT_Half		(1 << 0)  #define SUPPORTED_10baseT_Full		(1 << 1) -#define SUPPORTED_100baseT_Half		(1 << 2) -#define SUPPORTED_100baseT_Full		(1 << 3) +#define SUPPORTED_100baseT_Half	(1 << 2) +#define SUPPORTED_100baseT_Full	(1 << 3)  #define SUPPORTED_1000baseT_Half	(1 << 4)  #define SUPPORTED_1000baseT_Full	(1 << 5)  #define SUPPORTED_Autoneg		(1 << 6)  #define SUPPORTED_TP			(1 << 7)  #define SUPPORTED_AUI			(1 << 8)  #define SUPPORTED_MII			(1 << 9) -#define SUPPORTED_FIBRE			(1 << 10) +#define SUPPORTED_FIBRE		(1 << 10)  #define SUPPORTED_BNC			(1 << 11)  #define SUPPORTED_10000baseT_Full	(1 << 12) -#define SUPPORTED_Pause			(1 << 13) +#define SUPPORTED_Pause		(1 << 13)  #define SUPPORTED_Asym_Pause		(1 << 14)  #define SUPPORTED_2500baseX_Full	(1 << 15)  #define SUPPORTED_Backplane		(1 << 16) @@ -656,8 +666,8 @@ struct ethtool_ops {  #define SUPPORTED_10000baseR_FEC	(1 << 20)  /* Indicates what features are advertised by the interface. */ -#define ADVERTISED_10baseT_Half		(1 << 0) -#define ADVERTISED_10baseT_Full		(1 << 1) +#define ADVERTISED_10baseT_Half	(1 << 0) +#define ADVERTISED_10baseT_Full	(1 << 1)  #define ADVERTISED_100baseT_Half	(1 << 2)  #define ADVERTISED_100baseT_Full	(1 << 3)  #define ADVERTISED_1000baseT_Half	(1 << 4) @@ -696,12 +706,12 @@ struct ethtool_ops {  #define DUPLEX_FULL		0x01  /* Which connector port. */ -#define PORT_TP			0x00 +#define PORT_TP		0x00  #define PORT_AUI		0x01  #define PORT_MII		0x02  #define PORT_FIBRE		0x03  #define PORT_BNC		0x04 -#define PORT_DA			0x05 +#define PORT_DA		0x05  #define PORT_NONE		0xef  #define PORT_OTHER		0xff @@ -715,7 +725,7 @@ struct ethtool_ops {  /* Enable or disable autonegotiation.  If this is set to enable,   * the forced link modes above are completely ignored.   */ -#define AUTONEG_DISABLE		0x00 +#define AUTONEG_DISABLE	0x00  #define AUTONEG_ENABLE		0x01  /* Mode MDI or MDI-X */ @@ -746,8 +756,8 @@ struct ethtool_ops {  #define	AH_V6_FLOW	0x0b  #define	ESP_V6_FLOW	0x0c  #define	IP_USER_FLOW	0x0d -#define IPV4_FLOW       0x10 -#define IPV6_FLOW       0x11 +#define	IPV4_FLOW	0x10 +#define	IPV6_FLOW	0x11  /* L3-L4 network traffic flow hash options */  #define	RXH_L2DA	(1 << 1) diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h index b834ef6d59f..61549b26ad6 100644 --- a/include/linux/genetlink.h +++ b/include/linux/genetlink.h @@ -80,4 +80,12 @@ enum {  #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) +#ifdef __KERNEL__ + +/* All generic netlink requests are serialized by a global lock.  */ +extern void genl_lock(void); +extern void genl_unlock(void); + +#endif /* __KERNEL__ */ +  #endif	/* __LINUX_GENERIC_NETLINK_H */ diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index e80b7f88f7c..6d722f41ee7 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h @@ -90,6 +90,7 @@  #define ARPHRD_PHONET	820		/* PhoNet media type		*/  #define ARPHRD_PHONET_PIPE 821		/* PhoNet pipe header		*/ +#define ARPHRD_CAIF	822		/* CAIF media type		*/  #define ARPHRD_VOID	  0xFFFF	/* Void type, nothing is known */  #define ARPHRD_NONE	  0xFFFE	/* zero header length */ diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index 299b4121f91..bed7a4682b9 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h @@ -109,6 +109,7 @@  #define ETH_P_TRAILER	0x001C		/* Trailer switch tagging	*/  #define ETH_P_PHONET	0x00F5		/* Nokia Phonet frames          */  #define ETH_P_IEEE802154 0x00F6		/* IEEE802.15.4 frame		*/ +#define ETH_P_CAIF	0x00F7		/* ST-Ericsson CAIF protocol	*/  /*   *	This is an Ethernet frame header. diff --git a/include/linux/if_link.h b/include/linux/if_link.h index c9bf92cd765..cfd420ba72d 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h @@ -37,6 +37,38 @@ struct rtnl_link_stats {  	__u32	tx_compressed;  }; +struct rtnl_link_stats64 { +	__u64	rx_packets;		/* total packets received	*/ +	__u64	tx_packets;		/* total packets transmitted	*/ +	__u64	rx_bytes;		/* total bytes received 	*/ +	__u64	tx_bytes;		/* total bytes transmitted	*/ +	__u64	rx_errors;		/* bad packets received		*/ +	__u64	tx_errors;		/* packet transmit problems	*/ +	__u64	rx_dropped;		/* no space in linux buffers	*/ +	__u64	tx_dropped;		/* no space available in linux	*/ +	__u64	multicast;		/* multicast packets received	*/ +	__u64	collisions; + +	/* detailed rx_errors: */ +	__u64	rx_length_errors; +	__u64	rx_over_errors;		/* receiver ring buff overflow	*/ +	__u64	rx_crc_errors;		/* recved pkt with crc error	*/ +	__u64	rx_frame_errors;	/* recv'd frame alignment error */ +	__u64	rx_fifo_errors;		/* recv'r fifo overrun		*/ +	__u64	rx_missed_errors;	/* receiver missed packet	*/ + +	/* detailed tx_errors */ +	__u64	tx_aborted_errors; +	__u64	tx_carrier_errors; +	__u64	tx_fifo_errors; +	__u64	tx_heartbeat_errors; +	__u64	tx_window_errors; + +	/* for cslip etc */ +	__u64	rx_compressed; +	__u64	tx_compressed; +}; +  /* The struct should be in sync with struct ifmap */  struct rtnl_link_ifmap {  	__u64	mem_start; @@ -83,6 +115,7 @@ enum {  	IFLA_VF_VLAN,  	IFLA_VF_TX_RATE,	/* TX Bandwidth Allocation */  	IFLA_VFINFO, +	IFLA_STATS64,  	__IFLA_MAX  }; diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h index c58baea4a25..184bc556620 100644 --- a/include/linux/if_pppol2tp.h +++ b/include/linux/if_pppol2tp.h @@ -2,7 +2,7 @@   * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661)   *   * This file supplies definitions required by the PPP over L2TP driver - * (pppol2tp.c).  All version information wrt this file is located in pppol2tp.c + * (l2tp_ppp.c).  All version information wrt this file is located in l2tp_ppp.c   *   * License:   *		This program is free software; you can redistribute it and/or @@ -35,6 +35,20 @@ struct pppol2tp_addr {  	__u16 d_tunnel, d_session;	/* For sending outgoing packets */  }; +/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 + * bits. So we need a different sockaddr structure. + */ +struct pppol2tpv3_addr { +	pid_t	pid;			/* pid that owns the fd. +					 * 0 => current */ +	int	fd;			/* FD of UDP or IP socket to use */ + +	struct sockaddr_in addr;	/* IP address and port to send to */ + +	__u32 s_tunnel, s_session;	/* For matching incoming packets */ +	__u32 d_tunnel, d_session;	/* For sending outgoing packets */ +}; +  /* Socket options:   * DEBUG	- bitmask of debug message categories   * SENDSEQ	- 0 => don't send packets with sequence numbers diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index 90b5fae5d71..a6577af0c4e 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h @@ -72,6 +72,15 @@ struct sockaddr_pppol2tp {  	struct pppol2tp_addr pppol2tp;  }__attribute__ ((packed)); +/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32 + * bits. So we need a different sockaddr structure. + */ +struct sockaddr_pppol2tpv3 { +	sa_family_t     sa_family;      /* address family, AF_PPPOX */ +	unsigned int    sa_protocol;    /* protocol identifier */ +	struct pppol2tpv3_addr pppol2tp; +} __attribute__ ((packed)); +  /*********************************************************************   *   * ioctl interface for defining forwarding of connections diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h new file mode 100644 index 00000000000..4bdb31df8e7 --- /dev/null +++ b/include/linux/l2tp.h @@ -0,0 +1,163 @@ +/* + * L2TP-over-IP socket for L2TPv3. + * + * Author: James Chapman <jchapman@katalix.com> + */ + +#ifndef _LINUX_L2TP_H_ +#define _LINUX_L2TP_H_ + +#include <linux/types.h> +#ifdef __KERNEL__ +#include <linux/socket.h> +#include <linux/in.h> +#else +#include <netinet/in.h> +#endif + +#define IPPROTO_L2TP		115 + +/** + * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets + * @l2tp_family:  address family number AF_L2TPIP. + * @l2tp_addr:    protocol specific address information + * @l2tp_conn_id: connection id of tunnel + */ +#define __SOCK_SIZE__	16		/* sizeof(struct sockaddr)	*/ +struct sockaddr_l2tpip { +	/* The first fields must match struct sockaddr_in */ +	sa_family_t	l2tp_family;	/* AF_INET */ +	__be16		l2tp_unused;	/* INET port number (unused) */ +	struct in_addr	l2tp_addr;	/* Internet address */ + +	__u32		l2tp_conn_id;	/* Connection ID of tunnel */ + +	/* Pad to size of `struct sockaddr'. */ +	unsigned char	__pad[sizeof(struct sockaddr) - sizeof(sa_family_t) - +			      sizeof(__be16) - sizeof(struct in_addr) - +			      sizeof(__u32)]; +}; + +/***************************************************************************** + *  NETLINK_GENERIC netlink family. + *****************************************************************************/ + +/* + * Commands. + * Valid TLVs of each command are:- + * TUNNEL_CREATE	- CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid + * TUNNEL_DELETE	- CONN_ID + * TUNNEL_MODIFY	- CONN_ID, udpcsum + * TUNNEL_GETSTATS	- CONN_ID, (stats) + * TUNNEL_GET		- CONN_ID, (...) + * SESSION_CREATE	- SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec + * SESSION_DELETE	- SESSION_ID + * SESSION_MODIFY	- SESSION_ID, data_seq + * SESSION_GET		- SESSION_ID, (...) + * SESSION_GETSTATS	- SESSION_ID, (stats) + * + */ +enum { +	L2TP_CMD_NOOP, +	L2TP_CMD_TUNNEL_CREATE, +	L2TP_CMD_TUNNEL_DELETE, +	L2TP_CMD_TUNNEL_MODIFY, +	L2TP_CMD_TUNNEL_GET, +	L2TP_CMD_SESSION_CREATE, +	L2TP_CMD_SESSION_DELETE, +	L2TP_CMD_SESSION_MODIFY, +	L2TP_CMD_SESSION_GET, +	__L2TP_CMD_MAX, +}; + +#define L2TP_CMD_MAX			(__L2TP_CMD_MAX - 1) + +/* + * ATTR types defined for L2TP + */ +enum { +	L2TP_ATTR_NONE,			/* no data */ +	L2TP_ATTR_PW_TYPE,		/* u16, enum l2tp_pwtype */ +	L2TP_ATTR_ENCAP_TYPE,		/* u16, enum l2tp_encap_type */ +	L2TP_ATTR_OFFSET,		/* u16 */ +	L2TP_ATTR_DATA_SEQ,		/* u16 */ +	L2TP_ATTR_L2SPEC_TYPE,		/* u8, enum l2tp_l2spec_type */ +	L2TP_ATTR_L2SPEC_LEN,		/* u8, enum l2tp_l2spec_type */ +	L2TP_ATTR_PROTO_VERSION,	/* u8 */ +	L2TP_ATTR_IFNAME,		/* string */ +	L2TP_ATTR_CONN_ID,		/* u32 */ +	L2TP_ATTR_PEER_CONN_ID,		/* u32 */ +	L2TP_ATTR_SESSION_ID,		/* u32 */ +	L2TP_ATTR_PEER_SESSION_ID,	/* u32 */ +	L2TP_ATTR_UDP_CSUM,		/* u8 */ +	L2TP_ATTR_VLAN_ID,		/* u16 */ +	L2TP_ATTR_COOKIE,		/* 0, 4 or 8 bytes */ +	L2TP_ATTR_PEER_COOKIE,		/* 0, 4 or 8 bytes */ +	L2TP_ATTR_DEBUG,		/* u32 */ +	L2TP_ATTR_RECV_SEQ,		/* u8 */ +	L2TP_ATTR_SEND_SEQ,		/* u8 */ +	L2TP_ATTR_LNS_MODE,		/* u8 */ +	L2TP_ATTR_USING_IPSEC,		/* u8 */ +	L2TP_ATTR_RECV_TIMEOUT,		/* msec */ +	L2TP_ATTR_FD,			/* int */ +	L2TP_ATTR_IP_SADDR,		/* u32 */ +	L2TP_ATTR_IP_DADDR,		/* u32 */ +	L2TP_ATTR_UDP_SPORT,		/* u16 */ +	L2TP_ATTR_UDP_DPORT,		/* u16 */ +	L2TP_ATTR_MTU,			/* u16 */ +	L2TP_ATTR_MRU,			/* u16 */ +	L2TP_ATTR_STATS,		/* nested */ +	__L2TP_ATTR_MAX, +}; + +#define L2TP_ATTR_MAX			(__L2TP_ATTR_MAX - 1) + +/* Nested in L2TP_ATTR_STATS */ +enum { +	L2TP_ATTR_STATS_NONE,		/* no data */ +	L2TP_ATTR_TX_PACKETS,		/* u64 */ +	L2TP_ATTR_TX_BYTES,		/* u64 */ +	L2TP_ATTR_TX_ERRORS,		/* u64 */ +	L2TP_ATTR_RX_PACKETS,		/* u64 */ +	L2TP_ATTR_RX_BYTES,		/* u64 */ +	L2TP_ATTR_RX_SEQ_DISCARDS,	/* u64 */ +	L2TP_ATTR_RX_OOS_PACKETS,	/* u64 */ +	L2TP_ATTR_RX_ERRORS,		/* u64 */ +	__L2TP_ATTR_STATS_MAX, +}; + +#define L2TP_ATTR_STATS_MAX		(__L2TP_ATTR_STATS_MAX - 1) + +enum l2tp_pwtype { +	L2TP_PWTYPE_NONE = 0x0000, +	L2TP_PWTYPE_ETH_VLAN = 0x0004, +	L2TP_PWTYPE_ETH = 0x0005, +	L2TP_PWTYPE_PPP = 0x0007, +	L2TP_PWTYPE_PPP_AC = 0x0008, +	L2TP_PWTYPE_IP = 0x000b, +	__L2TP_PWTYPE_MAX +}; + +enum l2tp_l2spec_type { +	L2TP_L2SPECTYPE_NONE, +	L2TP_L2SPECTYPE_DEFAULT, +}; + +enum l2tp_encap_type { +	L2TP_ENCAPTYPE_UDP, +	L2TP_ENCAPTYPE_IP, +}; + +enum l2tp_seqmode { +	L2TP_SEQ_NONE = 0, +	L2TP_SEQ_IP = 1, +	L2TP_SEQ_ALL = 2, +}; + +/* + * NETLINK_GENERIC related info + */ +#define L2TP_GENL_NAME		"l2tp" +#define L2TP_GENL_VERSION	0x1 + +#endif diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index f58e9d836f3..55f1f9c9506 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -474,4 +474,30 @@ struct platform_device_id {  			__attribute__((aligned(sizeof(kernel_ulong_t))));  }; +#define MDIO_MODULE_PREFIX	"mdio:" + +#define MDIO_ID_FMT "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" +#define MDIO_ID_ARGS(_id) \ +	(_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1,	\ +	((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \ +	((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \ +	((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \ +	((_id)>>15) & 1, ((_id)>>14) & 1, ((_id)>>13) & 1, ((_id)>>12) & 1, \ +	((_id)>>11) & 1, ((_id)>>10) & 1, ((_id)>>9) & 1, ((_id)>>8) & 1, \ +	((_id)>>7) & 1, ((_id)>>6) & 1, ((_id)>>5) & 1, ((_id)>>4) & 1, \ +	((_id)>>3) & 1, ((_id)>>2) & 1, ((_id)>>1) & 1, (_id) & 1 + +/** + * struct mdio_device_id - identifies PHY devices on an MDIO/MII bus + * @phy_id: The result of + *     (mdio_read(&MII_PHYSID1) << 16 | mdio_read(&PHYSID2)) & @phy_id_mask + *     for this PHY type + * @phy_id_mask: Defines the significant bits of @phy_id.  A value of 0 + *     is used to terminate an array of struct mdio_device_id. + */ +struct mdio_device_id { +	__u32 phy_id; +	__u32 phy_id_mask; +}; +  #endif /* LINUX_MOD_DEVICETABLE_H */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index fa8b4763799..d1a21b576a4 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -223,29 +223,11 @@ struct netif_rx_stats {  	unsigned dropped;  	unsigned time_squeeze;  	unsigned cpu_collision; +	unsigned received_rps;  };  DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat); -struct dev_addr_list { -	struct dev_addr_list	*next; -	u8			da_addr[MAX_ADDR_LEN]; -	u8			da_addrlen; -	u8			da_synced; -	int			da_users; -	int			da_gusers; -}; - -/* - *	We tag multicasts with these structures. - */ - -#define dev_mc_list	dev_addr_list -#define dmi_addr	da_addr -#define dmi_addrlen	da_addrlen -#define dmi_users	da_users -#define dmi_gusers	da_gusers -  struct netdev_hw_addr {  	struct list_head	list;  	unsigned char		addr[MAX_ADDR_LEN]; @@ -254,8 +236,10 @@ struct netdev_hw_addr {  #define NETDEV_HW_ADDR_T_SAN		2  #define NETDEV_HW_ADDR_T_SLAVE		3  #define NETDEV_HW_ADDR_T_UNICAST	4 +#define NETDEV_HW_ADDR_T_MULTICAST	5  	int			refcount;  	bool			synced; +	bool			global_use;  	struct rcu_head		rcu_head;  }; @@ -264,16 +248,20 @@ struct netdev_hw_addr_list {  	int			count;  }; -#define netdev_uc_count(dev) ((dev)->uc.count) -#define netdev_uc_empty(dev) ((dev)->uc.count == 0) -#define netdev_for_each_uc_addr(ha, dev) \ -	list_for_each_entry(ha, &dev->uc.list, list) +#define netdev_hw_addr_list_count(l) ((l)->count) +#define netdev_hw_addr_list_empty(l) (netdev_hw_addr_list_count(l) == 0) +#define netdev_hw_addr_list_for_each(ha, l) \ +	list_for_each_entry(ha, &(l)->list, list) -#define netdev_mc_count(dev) ((dev)->mc_count) -#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0) +#define netdev_uc_count(dev) netdev_hw_addr_list_count(&(dev)->uc) +#define netdev_uc_empty(dev) netdev_hw_addr_list_empty(&(dev)->uc) +#define netdev_for_each_uc_addr(ha, dev) \ +	netdev_hw_addr_list_for_each(ha, &(dev)->uc) -#define netdev_for_each_mc_addr(mclist, dev) \ -	for (mclist = dev->mc_list; mclist; mclist = mclist->next) +#define netdev_mc_count(dev) netdev_hw_addr_list_count(&(dev)->mc) +#define netdev_mc_empty(dev) netdev_hw_addr_list_empty(&(dev)->mc) +#define netdev_for_each_mc_addr(ha, dev) \ +	netdev_hw_addr_list_for_each(ha, &(dev)->mc)  struct hh_cache {  	struct hh_cache *hh_next;	/* Next entry			     */ @@ -530,6 +518,26 @@ struct netdev_queue {  	unsigned long		tx_dropped;  } ____cacheline_aligned_in_smp; +#ifdef CONFIG_RPS +/* + * This structure holds an RPS map which can be of variable length.  The + * map is an array of CPUs. + */ +struct rps_map { +	unsigned int len; +	struct rcu_head rcu; +	u16 cpus[0]; +}; +#define RPS_MAP_SIZE(_num) (sizeof(struct rps_map) + (_num * sizeof(u16))) + +/* This structure contains an instance of an RX queue. */ +struct netdev_rx_queue { +	struct rps_map *rps_map; +	struct kobject kobj; +	struct netdev_rx_queue *first; +	atomic_t count; +} ____cacheline_aligned_in_smp; +#endif  /*   * This structure defines the management hooks for network devices. @@ -764,6 +772,7 @@ struct net_device {  #define NETIF_F_SCTP_CSUM	(1 << 25) /* SCTP checksum offload */  #define NETIF_F_FCOE_MTU	(1 << 26) /* Supports max FCoE MTU, 2158 bytes*/  #define NETIF_F_NTUPLE		(1 << 27) /* N-tuple filters supported */ +#define NETIF_F_RXHASH		(1 << 28) /* Receive hashing offload */  	/* Segmentation offload features */  #define NETIF_F_GSO_SHIFT	16 @@ -840,12 +849,10 @@ struct net_device {  	unsigned char		addr_len;	/* hardware address length	*/  	unsigned short          dev_id;		/* for shared network cards */ -	struct netdev_hw_addr_list	uc;	/* Secondary unicast -						   mac addresses */ -	int			uc_promisc;  	spinlock_t		addr_list_lock; -	struct dev_addr_list	*mc_list;	/* Multicast mac addresses	*/ -	int			mc_count;	/* Number of installed mcasts	*/ +	struct netdev_hw_addr_list	uc;	/* Unicast mac addresses */ +	struct netdev_hw_addr_list	mc;	/* Multicast mac addresses */ +	int			uc_promisc;  	unsigned int		promiscuity;  	unsigned int		allmulti; @@ -878,6 +885,15 @@ struct net_device {  	unsigned char		broadcast[MAX_ADDR_LEN];	/* hw bcast add	*/ +#ifdef CONFIG_RPS +	struct kset		*queues_kset; + +	struct netdev_rx_queue	*_rx; + +	/* Number of RX queues allocated at alloc_netdev_mq() time  */ +	unsigned int		num_rx_queues; +#endif +  	struct netdev_queue	rx_queue;  	struct netdev_queue	*_tx ____cacheline_aligned_in_smp; @@ -1311,14 +1327,18 @@ static inline int unregister_gifconf(unsigned int family)   */  struct softnet_data {  	struct Qdisc		*output_queue; -	struct sk_buff_head	input_pkt_queue;  	struct list_head	poll_list;  	struct sk_buff		*completion_queue; +	/* Elements below can be accessed between CPUs for RPS */ +#ifdef CONFIG_SMP +	struct call_single_data	csd ____cacheline_aligned_in_smp; +#endif +	struct sk_buff_head	input_pkt_queue;  	struct napi_struct	backlog;  }; -DECLARE_PER_CPU(struct softnet_data,softnet_data); +DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);  #define HAVE_NETIF_QUEUE @@ -1945,6 +1965,22 @@ extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,  extern int		register_netdev(struct net_device *dev);  extern void		unregister_netdev(struct net_device *dev); +/* General hardware address lists handling functions */ +extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list, +				  struct netdev_hw_addr_list *from_list, +				  int addr_len, unsigned char addr_type); +extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list, +				   struct netdev_hw_addr_list *from_list, +				   int addr_len, unsigned char addr_type); +extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list, +			  struct netdev_hw_addr_list *from_list, +			  int addr_len); +extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, +			     struct netdev_hw_addr_list *from_list, +			     int addr_len); +extern void __hw_addr_flush(struct netdev_hw_addr_list *list); +extern void __hw_addr_init(struct netdev_hw_addr_list *list); +  /* Functions used for device addresses handling */  extern int dev_addr_add(struct net_device *dev, unsigned char *addr,  			unsigned char addr_type); @@ -1956,26 +1992,34 @@ extern int dev_addr_add_multiple(struct net_device *to_dev,  extern int dev_addr_del_multiple(struct net_device *to_dev,  				 struct net_device *from_dev,  				 unsigned char addr_type); +extern void dev_addr_flush(struct net_device *dev); +extern int dev_addr_init(struct net_device *dev); + +/* Functions used for unicast addresses handling */ +extern int dev_uc_add(struct net_device *dev, unsigned char *addr); +extern int dev_uc_del(struct net_device *dev, unsigned char *addr); +extern int dev_uc_sync(struct net_device *to, struct net_device *from); +extern void dev_uc_unsync(struct net_device *to, struct net_device *from); +extern void dev_uc_flush(struct net_device *dev); +extern void dev_uc_init(struct net_device *dev); + +/* Functions used for multicast addresses handling */ +extern int dev_mc_add(struct net_device *dev, unsigned char *addr); +extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr); +extern int dev_mc_del(struct net_device *dev, unsigned char *addr); +extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr); +extern int dev_mc_sync(struct net_device *to, struct net_device *from); +extern void dev_mc_unsync(struct net_device *to, struct net_device *from); +extern void dev_mc_flush(struct net_device *dev); +extern void dev_mc_init(struct net_device *dev);  /* Functions used for secondary unicast and multicast support */  extern void		dev_set_rx_mode(struct net_device *dev);  extern void		__dev_set_rx_mode(struct net_device *dev); -extern int		dev_unicast_delete(struct net_device *dev, void *addr); -extern int		dev_unicast_add(struct net_device *dev, void *addr); -extern int		dev_unicast_sync(struct net_device *to, struct net_device *from); -extern void		dev_unicast_unsync(struct net_device *to, struct net_device *from); -extern int 		dev_mc_delete(struct net_device *dev, void *addr, int alen, int all); -extern int		dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly); -extern int		dev_mc_sync(struct net_device *to, struct net_device *from); -extern void		dev_mc_unsync(struct net_device *to, struct net_device *from); -extern int 		__dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all); -extern int		__dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly); -extern int		__dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count); -extern void		__dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);  extern int		dev_set_promiscuity(struct net_device *dev, int inc);  extern int		dev_set_allmulti(struct net_device *dev, int inc);  extern void		netdev_state_change(struct net_device *dev); -extern void		netdev_bonding_change(struct net_device *dev, +extern int		netdev_bonding_change(struct net_device *dev,  					      unsigned long event);  extern void		netdev_features_change(struct net_device *dev);  /* Load a device via the kmod */ diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 28ba20fda3e..daf6a3432b9 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h @@ -323,6 +323,12 @@   *	the TX command and %NL80211_ATTR_FRAME includes the contents of the   *	frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged   *	the frame. + * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command + *	is used to configure connection quality monitoring notification trigger + *	levels. + * @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This + *	command is used as an event to indicate the that a trigger level was + *	reached.   *   * @NL80211_CMD_MAX: highest used command number   * @__NL80211_CMD_AFTER_LAST: internal use @@ -419,6 +425,9 @@ enum nl80211_commands {  	NL80211_CMD_SET_POWER_SAVE,  	NL80211_CMD_GET_POWER_SAVE, +	NL80211_CMD_SET_CQM, +	NL80211_CMD_NOTIFY_CQM, +  	/* add new commands above here */  	/* used to define NL80211_CMD_MAX below */ @@ -691,6 +700,9 @@ enum nl80211_commands {   * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was   *	acknowledged by the recipient.   * + * @NL80211_ATTR_CQM: connection quality monitor configuration in a + *	nested attribute with %NL80211_ATTR_CQM_* sub-attributes. + *   * @NL80211_ATTR_MAX: highest attribute number currently defined   * @__NL80211_ATTR_AFTER_LAST: internal use   */ @@ -842,6 +854,8 @@ enum nl80211_attrs {  	NL80211_ATTR_PS_STATE, +	NL80211_ATTR_CQM, +  	/* add attributes here, update the policy in nl80211.c */  	__NL80211_ATTR_AFTER_LAST, @@ -1583,4 +1597,40 @@ enum nl80211_ps_state {  	NL80211_PS_ENABLED,  }; +/** + * enum nl80211_attr_cqm - connection quality monitor attributes + * @__NL80211_ATTR_CQM_INVALID: invalid + * @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies + *	the threshold for the RSSI level at which an event will be sent. Zero + *	to disable. + * @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies + *	the minimum amount the RSSI level must change after an event before a + *	new event may be issued (to reduce effects of RSSI oscillation). + * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event + * @__NL80211_ATTR_CQM_AFTER_LAST: internal + * @NL80211_ATTR_CQM_MAX: highest key attribute + */ +enum nl80211_attr_cqm { +	__NL80211_ATTR_CQM_INVALID, +	NL80211_ATTR_CQM_RSSI_THOLD, +	NL80211_ATTR_CQM_RSSI_HYST, +	NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, + +	/* keep last */ +	__NL80211_ATTR_CQM_AFTER_LAST, +	NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1 +}; + +/** + * enum nl80211_cqm_rssi_threshold_event - RSSI threshold event + * @NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW - The RSSI level is lower than the + *      configured threshold + * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH - The RSSI is higher than the + *      configured threshold + */ +enum nl80211_cqm_rssi_threshold_event { +	NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, +	NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, +}; +  #endif /* __LINUX_NL80211_H */ diff --git a/include/linux/notifier.h b/include/linux/notifier.h index fee6c2f6807..9c5d3fad01f 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -182,7 +182,10 @@ static inline int notifier_to_errno(int ret)   *	VC switch chains (for loadable kernel svgalib VC switch helpers) etc...   */ -/* netdevice notifier chain */ +/* netdevice notifier chain. Please remember to update the rtnetlink + * notification exclusion list in rtnetlink_event() when adding new + * types. + */  #define NETDEV_UP	0x0001	/* For now you can't veto a device up/down */  #define NETDEV_DOWN	0x0002  #define NETDEV_REBOOT	0x0003	/* Tell a protocol stack a network interface @@ -199,8 +202,8 @@ static inline int notifier_to_errno(int ret)  #define NETDEV_FEAT_CHANGE	0x000B  #define NETDEV_BONDING_FAILOVER 0x000C  #define NETDEV_PRE_UP		0x000D -#define NETDEV_BONDING_OLDTYPE  0x000E -#define NETDEV_BONDING_NEWTYPE  0x000F +#define NETDEV_PRE_TYPE_CHANGE	0x000E +#define NETDEV_POST_TYPE_CHANGE	0x000F  #define NETDEV_POST_INIT	0x0010  #define NETDEV_UNREGISTER_BATCH 0x0011 diff --git a/include/linux/phy.h b/include/linux/phy.h index 14d7fdf6a90..987e111f7b1 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -24,6 +24,7 @@  #include <linux/mii.h>  #include <linux/timer.h>  #include <linux/workqueue.h> +#include <linux/mod_devicetable.h>  #include <asm/atomic.h> @@ -81,6 +82,10 @@ typedef enum {   */  #define MII_BUS_ID_SIZE	(20 - 3) +/* Or MII_ADDR_C45 into regnum for read/write on mii_bus to enable the 21 bit +   IEEE 802.3ae clause 45 addressing mode used by 10GIGE phy chips. */ +#define MII_ADDR_C45 (1<<30) +  /*   * The Bus class for PHYs.  Devices which provide access to   * PHYs should register using this structure @@ -127,8 +132,8 @@ int mdiobus_register(struct mii_bus *bus);  void mdiobus_unregister(struct mii_bus *bus);  void mdiobus_free(struct mii_bus *bus);  struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr); -int mdiobus_read(struct mii_bus *bus, int addr, u16 regnum); -int mdiobus_write(struct mii_bus *bus, int addr, u16 regnum, u16 val); +int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum); +int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val);  #define PHY_INTERRUPT_DISABLED	0x0 @@ -422,7 +427,7 @@ struct phy_fixup {   * because the bus read/write functions may wait for an interrupt   * to conclude the operation.   */ -static inline int phy_read(struct phy_device *phydev, u16 regnum) +static inline int phy_read(struct phy_device *phydev, u32 regnum)  {  	return mdiobus_read(phydev->bus, phydev->addr, regnum);  } @@ -437,7 +442,7 @@ static inline int phy_read(struct phy_device *phydev, u16 regnum)   * because the bus read/write functions may wait for an interrupt   * to conclude the operation.   */ -static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val) +static inline int phy_write(struct phy_device *phydev, u32 regnum, u16 val)  {  	return mdiobus_write(phydev->bus, phydev->addr, regnum, val);  } diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h index 0d3fa63e90e..bff98ec1bfe 100644 --- a/include/linux/ppp_channel.h +++ b/include/linux/ppp_channel.h @@ -72,6 +72,9 @@ extern int ppp_channel_index(struct ppp_channel *);  /* Get the unit number associated with a channel, or -1 if none */  extern int ppp_unit_number(struct ppp_channel *); +/* Get the device name associated with a channel, or NULL if none */ +extern char *ppp_dev_name(struct ppp_channel *); +  /*   * SMP locking notes:   * The channel code must ensure that when it calls ppp_unregister_channel, diff --git a/include/linux/rculist.h b/include/linux/rculist.h index 2c9b46cff3d..004908b104d 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h @@ -428,5 +428,18 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,  		({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; }); \  		pos = rcu_dereference_raw(pos->next)) +/** + * hlist_for_each_entry_continue_rcu - iterate over a hlist continuing after current point + * @tpos:	the type * to use as a loop cursor. + * @pos:	the &struct hlist_node to use as a loop cursor. + * @member:	the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_continue_rcu(tpos, pos, member)		\ +	for (pos = rcu_dereference((pos)->next);			\ +	     pos && ({ prefetch(pos->next); 1; }) &&			\ +	     ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1; });  \ +	     pos = rcu_dereference(pos->next)) + +  #endif	/* __KERNEL__ */  #endif diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 124f90cd5a3..cf42f194616 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -294,6 +294,7 @@ typedef unsigned char *sk_buff_data_t;   *	@nfct_reasm: netfilter conntrack re-assembly pointer   *	@nf_bridge: Saved data about a bridged frame - see br_netfilter.c   *	@skb_iif: ifindex of device we arrived on + *	@rxhash: the packet hash computed on receive   *	@queue_mapping: Queue mapping for multiqueue devices   *	@tc_index: Traffic control index   *	@tc_verd: traffic control verdict @@ -369,6 +370,8 @@ struct sk_buff {  #endif  #endif +	__u32			rxhash; +  	kmemcheck_bitfield_begin(flags2);  	__u16			queue_mapping:16;  #ifdef CONFIG_IPV6_NDISC_NODETYPE diff --git a/include/linux/snmp.h b/include/linux/snmp.h index 4435d108475..52797714ade 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h @@ -100,6 +100,7 @@ enum  	ICMP6_MIB_INMSGS,			/* InMsgs */  	ICMP6_MIB_INERRORS,			/* InErrors */  	ICMP6_MIB_OUTMSGS,			/* OutMsgs */ +	ICMP6_MIB_OUTERRORS,			/* OutErrors */  	__ICMP6_MIB_MAX  }; @@ -227,6 +228,7 @@ enum  	LINUX_MIB_SACKSHIFTFALLBACK,  	LINUX_MIB_TCPBACKLOGDROP,  	LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */ +	LINUX_MIB_TCPDEFERACCEPTDROP,  	__LINUX_MIB_MAX  }; diff --git a/include/linux/socket.h b/include/linux/socket.h index 354cc5617f8..032a19eb61b 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -189,7 +189,8 @@ struct ucred {  #define AF_ISDN		34	/* mISDN sockets 		*/  #define AF_PHONET	35	/* Phonet sockets		*/  #define AF_IEEE802154	36	/* IEEE802154 sockets		*/ -#define AF_MAX		37	/* For now.. */ +#define AF_CAIF		37	/* CAIF sockets			*/ +#define AF_MAX		38	/* For now.. */  /* Protocol families, same as address families. */  #define PF_UNSPEC	AF_UNSPEC @@ -229,6 +230,7 @@ struct ucred {  #define PF_ISDN		AF_ISDN  #define PF_PHONET	AF_PHONET  #define PF_IEEE802154	AF_IEEE802154 +#define PF_CAIF		AF_CAIF  #define PF_MAX		AF_MAX  /* Maximum queue length specifiable by listen.  */ @@ -301,6 +303,7 @@ struct ucred {  #define SOL_PNPIPE	275  #define SOL_RDS		276  #define SOL_IUCV	277 +#define SOL_CAIF	278  /* IPX options */  #define IPX_TYPE	1 diff --git a/include/linux/tipc.h b/include/linux/tipc.h index 3d92396639d..9536d8aeadf 100644 --- a/include/linux/tipc.h +++ b/include/linux/tipc.h @@ -127,23 +127,17 @@ static inline unsigned int tipc_node(__u32 addr)   * TIPC topology subscription service definitions   */ -#define TIPC_SUB_PORTS     	0x01  	/* filter for port availability */ -#define TIPC_SUB_SERVICE     	0x02  	/* filter for service availability */ -#define TIPC_SUB_CANCEL         0x04    /* cancel a subscription */ -#if 0 -/* The following filter options are not currently implemented */ -#define TIPC_SUB_NO_BIND_EVTS	0x04	/* filter out "publish" events */ -#define TIPC_SUB_NO_UNBIND_EVTS	0x08	/* filter out "withdraw" events */ -#define TIPC_SUB_SINGLE_EVT	0x10	/* expire after first event */ -#endif +#define TIPC_SUB_SERVICE     	0x00  	/* Filter for service availability    */ +#define TIPC_SUB_PORTS     	0x01  	/* Filter for port availability  */ +#define TIPC_SUB_CANCEL         0x04    /* Cancel a subscription         */  #define TIPC_WAIT_FOREVER	~0	/* timeout for permanent subscription */  struct tipc_subscr { -	struct tipc_name_seq seq;	/* name sequence of interest */ -	__u32 timeout;			/* subscription duration (in ms) */ -        __u32 filter;   		/* bitmask of filter options */ -	char usr_handle[8];		/* available for subscriber use */ +	struct tipc_name_seq seq;	/* NBO. Name sequence of interest */ +	__u32 timeout;			/* NBO. Subscription duration (in ms) */ +        __u32 filter;   		/* NBO. Bitmask of filter options */ +	char usr_handle[8];		/* Opaque. Available for subscriber use */  };  #define TIPC_PUBLISHED		1	/* publication event */ @@ -151,11 +145,11 @@ struct tipc_subscr {  #define TIPC_SUBSCR_TIMEOUT	3	/* subscription timeout event */  struct tipc_event { -	__u32 event;			/* event type */ -	__u32 found_lower;		/* matching name seq instances */ -	__u32 found_upper;		/*    "      "    "     "      */ -	struct tipc_portid port;	/* associated port */ -	struct tipc_subscr s;		/* associated subscription */ +	__u32 event;			/* NBO. Event type, as defined above */ +	__u32 found_lower;		/* NBO. Matching name seq instances  */ +	__u32 found_upper;		/*  "      "       "   "    "        */ +	struct tipc_portid port;	/* NBO. Associated port              */ +	struct tipc_subscr s;		/* Original, associated subscription */  };  /* diff --git a/include/linux/tty.h b/include/linux/tty.h index 4409967db0c..bb44fa9ae13 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -23,7 +23,7 @@   */  #define NR_UNIX98_PTY_DEFAULT	4096      /* Default maximum for Unix98 ptys */  #define NR_UNIX98_PTY_MAX	(1 << MINORBITS) /* Absolute limit */ -#define NR_LDISCS		20 +#define NR_LDISCS		21  /* line disciplines */  #define N_TTY		0 @@ -46,8 +46,8 @@  #define N_GIGASET_M101	16	/* Siemens Gigaset M101 serial DECT adapter */  #define N_SLCAN		17	/* Serial / USB serial CAN Adaptors */  #define N_PPS		18	/* Pulse per Second */ -  #define N_V253		19	/* Codec control over voice modem */ +#define N_CAIF		20      /* CAIF protocol for talking to modems */  /*   * This character is the same as _POSIX_VDISABLE: it cannot be used as diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 5b4c6c772a9..e6827eedf18 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h @@ -346,6 +346,8 @@  #define SIOCIWFIRST	0x8B00  #define SIOCIWLAST	SIOCIWLASTPRIV		/* 0x8BFF */  #define IW_IOCTL_IDX(cmd)	((cmd) - SIOCIWFIRST) +#define IW_HANDLER(id, func)			\ +	[IW_IOCTL_IDX(id)] = func  /* Odd : get (world access), even : set (root access) */  #define IW_IS_SET(cmd)	(!((cmd) & 0x1)) @@ -648,7 +650,7 @@   * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */  #define IW_EVENT_CAPA_BASE(cmd)		((cmd >= SIOCIWFIRSTPRIV) ? \  					 (cmd - SIOCIWFIRSTPRIV + 0x60) : \ -					 (cmd - SIOCSIWCOMMIT)) +					 (cmd - SIOCIWFIRST))  #define IW_EVENT_CAPA_INDEX(cmd)	(IW_EVENT_CAPA_BASE(cmd) >> 5)  #define IW_EVENT_CAPA_MASK(cmd)		(1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))  /* Event capability constants - event autogenerated by the kernel diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h new file mode 100644 index 00000000000..42a7c786784 --- /dev/null +++ b/include/net/caif/caif_dev.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) ST-Ericsson AB 2010 + * Author:	Sjur Brendeland/ sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef CAIF_DEV_H_ +#define CAIF_DEV_H_ + +#include <net/caif/caif_layer.h> +#include <net/caif/cfcnfg.h> +#include <linux/caif/caif_socket.h> +#include <linux/if.h> + +/** + * struct caif_param - CAIF parameters. + * @size:	Length of data + * @data:	Binary Data Blob + */ +struct caif_param { +	u16  size; +	u8   data[256]; +}; + +/** + * caif_connect_request - Request data for CAIF channel setup. + * @sockaddr:		Socket address to connect. + * @priority:		Priority of the connection. + * @link_selector:	Link selector (high bandwidth or low latency) + * @link_name:		Name of the CAIF Link Layer to use. + * + * This struct is used when connecting a CAIF channel. + * It contains all CAIF channel configuration options. + */ +struct caif_connect_request { +	int protocol; +	struct sockaddr_caif sockaddr; +	enum caif_channel_priority priority; +	enum caif_link_selector link_selector; +	char link_name[16]; +	struct caif_param param; +}; + +/** + * caif_connect_client - Connect a client to CAIF Core Stack. + * @config:		Channel setup parameters, specifying what address + *			to connect on the Modem. + * @client_layer:	User implementation of client layer. This layer + *			MUST have receive and control callback functions + *			implemented. + * + * This function connects a CAIF channel. The Client must implement + * the struct cflayer. This layer represents the Client layer and holds + * receive functions and control callback functions. Control callback + * function will receive information about connect/disconnect responses, + * flow control etc (see enum caif_control). + * E.g. CAIF Socket will call this function for each socket it connects + * and have one client_layer instance for each socket. + */ +int caif_connect_client(struct caif_connect_request *config, +			   struct cflayer *client_layer); + +/** + * caif_disconnect_client - Disconnects a client from the CAIF stack. + * + * @client_layer: Client layer to be removed. + */ +int caif_disconnect_client(struct cflayer *client_layer); + +/** + * connect_req_to_link_param - Translate configuration parameters + *				from socket format to internal format. + * @cnfg:	Pointer to configuration handler + * @con_req:	Configuration parameters supplied in function + *		caif_connect_client + * @channel_setup_param: Parameters supplied to the CAIF Core stack for + *			 setting up channels. + * + */ +int connect_req_to_link_param(struct cfcnfg *cnfg, +				struct caif_connect_request *con_req, +				struct cfctrl_link_param *channel_setup_param); + +/** + * get_caif_conf() - Get the configuration handler. + */ +struct cfcnfg *get_caif_conf(void); + + +#endif /* CAIF_DEV_H_ */ diff --git a/include/net/caif/caif_device.h b/include/net/caif/caif_device.h new file mode 100644 index 00000000000..d02f044adb8 --- /dev/null +++ b/include/net/caif/caif_device.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) ST-Ericsson AB 2010 + * Author:	Sjur Brendeland/ sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef CAIF_DEVICE_H_ +#define CAIF_DEVICE_H_ +#include <linux/kernel.h> +#include <linux/net.h> +#include <linux/netdevice.h> +#include <linux/caif/caif_socket.h> +#include <net/caif/caif_device.h> + +/** + * struct caif_dev_common - data shared between CAIF drivers and stack. + * @flowctrl:		Flow Control callback function. This function is + *                      supplied by CAIF Core Stack and is used by CAIF + *                      Link Layer to send flow-stop to CAIF Core. + *                      The flow information will be distributed to all + *                      clients of CAIF. + * + * @link_select:	Profile of device, either high-bandwidth or + *			low-latency. This member is set by CAIF Link + *			Layer Device in	order to indicate if this device + *			is a high bandwidth or low latency device. + * + * @use_frag:		CAIF Frames may be fragmented. + *			Is set by CAIF Link Layer in order to indicate if the + *			interface receives fragmented frames that must be + *			assembled by CAIF Core Layer. + * + * @use_fcs:		Indicate if Frame CheckSum (fcs) is used. + *			Is set if the physical interface is + *			using Frame Checksum on the CAIF Frames. + * + * @use_stx:		Indicate STart of frame eXtension (stx) in use. + *			Is set if the CAIF Link Layer expects + *			CAIF Frames to start with the STX byte. + * + * This structure is shared between the CAIF drivers and the CAIF stack. + * It is used by the device to register its behavior. + * CAIF Core layer must set the member flowctrl in order to supply + * CAIF Link Layer with the flow control function. + * + */ + struct caif_dev_common { +	void (*flowctrl)(struct net_device *net, int on); +	enum caif_link_selector link_select; +	int use_frag; +	int use_fcs; +	int use_stx; +}; + +#endif	/* CAIF_DEVICE_H_ */ diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h new file mode 100644 index 00000000000..25c472f0e5b --- /dev/null +++ b/include/net/caif/caif_layer.h @@ -0,0 +1,283 @@ +/* + * Copyright (C) ST-Ericsson AB 2010 + * Author:	Sjur Brendeland / sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef CAIF_LAYER_H_ +#define CAIF_LAYER_H_ + +#include <linux/list.h> + +struct cflayer; +struct cfpkt; +struct cfpktq; +struct caif_payload_info; +struct caif_packet_funcs; + +#define CAIF_MAX_FRAMESIZE 4096 +#define CAIF_MAX_PAYLOAD_SIZE (4096 - 64) +#define CAIF_NEEDED_HEADROOM (10) +#define CAIF_NEEDED_TAILROOM (2) + +#define CAIF_LAYER_NAME_SZ 16 +#define CAIF_SUCCESS	1 +#define CAIF_FAILURE	0 + +/** + * caif_assert() - Assert function for CAIF. + * @assert: expression to evaluate. + * + * This function will print a error message and a do WARN_ON if the + * assertion failes. Normally this will do a stack up at the current location. + */ +#define caif_assert(assert)					\ +do {								\ +	if (!(assert)) {					\ +		pr_err("caif:Assert detected:'%s'\n", #assert); \ +		WARN_ON(!(assert));				\ +	}							\ +} while (0) + + +/** + * enum caif_ctrlcmd - CAIF Stack Control Signaling sent in layer.ctrlcmd(). + * + * @CAIF_CTRLCMD_FLOW_OFF_IND:		Flow Control is OFF, transmit function + *					should stop sending data + * + * @CAIF_CTRLCMD_FLOW_ON_IND:		Flow Control is ON, transmit function + *					can start sending data + * + * @CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND:	Remote end modem has decided to close + *					down channel + * + * @CAIF_CTRLCMD_INIT_RSP:		Called initially when the layer below + *					has finished initialization + * + * @CAIF_CTRLCMD_DEINIT_RSP:		Called when de-initialization is + *					complete + * + * @CAIF_CTRLCMD_INIT_FAIL_RSP:		Called if initialization fails + * + * @_CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND:	CAIF Link layer temporarily cannot + *					send more packets. + * @_CAIF_CTRLCMD_PHYIF_FLOW_ON_IND:	Called if CAIF Link layer is able + *					to send packets again. + * @_CAIF_CTRLCMD_PHYIF_DOWN_IND:	Called if CAIF Link layer is going + *					down. + * + * These commands are sent upwards in the CAIF stack to the CAIF Client. + * They are used for signaling originating from the modem or CAIF Link Layer. + * These are either responses (*_RSP) or events (*_IND). + */ +enum caif_ctrlcmd { +	CAIF_CTRLCMD_FLOW_OFF_IND, +	CAIF_CTRLCMD_FLOW_ON_IND, +	CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND, +	CAIF_CTRLCMD_INIT_RSP, +	CAIF_CTRLCMD_DEINIT_RSP, +	CAIF_CTRLCMD_INIT_FAIL_RSP, +	_CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND, +	_CAIF_CTRLCMD_PHYIF_FLOW_ON_IND, +	_CAIF_CTRLCMD_PHYIF_DOWN_IND, +}; + +/** + * enum caif_modemcmd -	 Modem Control Signaling, sent from CAIF Client + *			 to the CAIF Link Layer or modem. + * + * @CAIF_MODEMCMD_FLOW_ON_REQ:		Flow Control is ON, transmit function + *					can start sending data. + * + * @CAIF_MODEMCMD_FLOW_OFF_REQ:		Flow Control is OFF, transmit function + *					should stop sending data. + * + * @_CAIF_MODEMCMD_PHYIF_USEFULL:	Notify physical layer that it is in use + * + * @_CAIF_MODEMCMD_PHYIF_USELESS:	Notify physical layer that it is + *					no longer in use. + * + * These are requests sent 'downwards' in the stack. + * Flow ON, OFF can be indicated to the modem. + */ +enum caif_modemcmd { +	CAIF_MODEMCMD_FLOW_ON_REQ = 0, +	CAIF_MODEMCMD_FLOW_OFF_REQ = 1, +	_CAIF_MODEMCMD_PHYIF_USEFULL = 3, +	_CAIF_MODEMCMD_PHYIF_USELESS = 4 +}; + +/** + * enum caif_direction - CAIF Packet Direction. + * Indicate if a packet is to be sent out or to be received in. + * @CAIF_DIR_IN:		Incoming packet received. + * @CAIF_DIR_OUT:		Outgoing packet to be transmitted. + */ +enum caif_direction { +	CAIF_DIR_IN = 0, +	CAIF_DIR_OUT = 1 +}; + +/** + * struct cflayer - CAIF Stack layer. + * Defines the framework for the CAIF Core Stack. + * @up:		Pointer up to the layer above. + * @dn:		Pointer down to the layer below. + * @node:	List node used when layer participate in a list. + * @receive:	Packet receive function. + * @transmit:	Packet transmit funciton. + * @ctrlcmd:	Used for control signalling upwards in the stack. + * @modemcmd:	Used for control signaling downwards in the stack. + * @prio:	Priority of this layer. + * @id:		The identity of this layer + * @type:	The type of this layer + * @name:	Name of the layer. + * + *  This structure defines the layered structure in CAIF. + * + *  It defines CAIF layering structure, used by all CAIF Layers and the + *  layers interfacing CAIF. + * + *  In order to integrate with CAIF an adaptation layer on top of the CAIF stack + *  and PHY layer below the CAIF stack + *  must be implemented. These layer must follow the design principles below. + * + *  Principles for layering of protocol layers: + *    - All layers must use this structure. If embedding it, then place this + *	structure first in the layer specific structure. + * + *    - Each layer should not depend on any others layer private data. + * + *    - In order to send data upwards do + *	layer->up->receive(layer->up, packet); + * + *    - In order to send data downwards do + *	layer->dn->transmit(layer->dn, info, packet); + */ +struct cflayer { +	struct cflayer *up; +	struct cflayer *dn; +	struct list_head node; + +	/* +	 *  receive() - Receive Function. +	 *  Contract: Each layer must implement a receive function passing the +	 *  CAIF packets upwards in the stack. +	 *	Packet handling rules: +	 *	      - The CAIF packet (cfpkt) cannot be accessed after +	 *		     passing it to the next layer using up->receive(). +	 *	      - If parsing of the packet fails, the packet must be +	 *		     destroyed and -1 returned from the function. +	 *	      - If parsing succeeds (and above layers return OK) then +	 *		      the function must return a value > 0. +	 * +	 *  Returns result < 0 indicates an error, 0 or positive value +	 *	     indicates success. +	 * +	 *  @layr: Pointer to the current layer the receive function is +	 *		implemented for (this pointer). +	 *  @cfpkt: Pointer to CaifPacket to be handled. +	 */ +	int (*receive)(struct cflayer *layr, struct cfpkt *cfpkt); + +	/* +	 *  transmit() - Transmit Function. +	 *  Contract: Each layer must implement a transmit function passing the +	 *	CAIF packet downwards in the stack. +	 *	Packet handling rules: +	 *	      - The CAIF packet (cfpkt) ownership is passed to the +	 *		transmit function. This means that the the packet +	 *		cannot be accessed after passing it to the below +	 *		layer using dn->transmit(). +	 * +	 *	      - If transmit fails, however, the ownership is returned +	 *		to thecaller. The caller of "dn->transmit()" must +	 *		destroy or resend packet. +	 * +	 *	      - Return value less than zero means error, zero or +	 *		greater than zero means OK. +	 * +	 *	 result < 0 indicates an error, 0 or positive value +	 *	 indicate success. +	 * +	 *  @layr:	Pointer to the current layer the receive function +	 *		isimplemented for (this pointer). +	 *  @cfpkt:	 Pointer to CaifPacket to be handled. +	 */ +	int (*transmit) (struct cflayer *layr, struct cfpkt *cfpkt); + +	/* +	 *  cttrlcmd() - Control Function upwards in CAIF Stack. +	 *  Used for signaling responses (CAIF_CTRLCMD_*_RSP) +	 *  and asynchronous events from the modem  (CAIF_CTRLCMD_*_IND) +	 * +	 *  @layr:	Pointer to the current layer the receive function +	 *		is implemented for (this pointer). +	 *  @ctrl:	Control Command. +	 */ +	void (*ctrlcmd) (struct cflayer *layr, enum caif_ctrlcmd ctrl, +			 int phyid); + +	/* +	 *  modemctrl() - Control Function used for controlling the modem. +	 *  Used to signal down-wards in the CAIF stack. +	 *  Returns 0 on success, < 0 upon failure. +	 * +	 *  @layr:	Pointer to the current layer the receive function +	 *		is implemented for (this pointer). +	 *  @ctrl:  Control Command. +	 */ +	int (*modemcmd) (struct cflayer *layr, enum caif_modemcmd ctrl); + +	unsigned short prio; +	unsigned int id; +	unsigned int type; +	char name[CAIF_LAYER_NAME_SZ]; +}; + +/** + * layer_set_up() - Set the up pointer for a specified layer. + *  @layr: Layer where up pointer shall be set. + *  @above: Layer above. + */ +#define layer_set_up(layr, above) ((layr)->up = (struct cflayer *)(above)) + +/** + *  layer_set_dn() - Set the down pointer for a specified layer. + *  @layr:  Layer where down pointer shall be set. + *  @below: Layer below. + */ +#define layer_set_dn(layr, below) ((layr)->dn = (struct cflayer *)(below)) + +/** + * struct dev_info - Physical Device info information about physical layer. + * @dev:	Pointer to native physical device. + * @id:		Physical ID of the physical connection used by the + *		logical CAIF connection. Used by service layers to + *		identify their physical id to Caif MUX (CFMUXL)so + *		that the MUX can add the correct physical ID to the + *		packet. + */ +struct dev_info { +	void *dev; +	unsigned int id; +}; + +/** + * struct caif_payload_info - Payload information embedded in packet (sk_buff). + * + * @dev_info:	Information about the receiving device. + * + * @hdr_len:	Header length, used to align pay load on 32bit boundary. + * + * @channel_id: Channel ID of the logical CAIF connection. + *		Used by mux to insert channel id into the caif packet. + */ +struct caif_payload_info { +	struct dev_info *dev_info; +	unsigned short hdr_len; +	unsigned short channel_id; +}; + +#endif	/* CAIF_LAYER_H_ */ diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h new file mode 100644 index 00000000000..366082c5d43 --- /dev/null +++ b/include/net/caif/cfcnfg.h @@ -0,0 +1,133 @@ +/* + * Copyright (C) ST-Ericsson AB 2010 + * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef CFCNFG_H_ +#define CFCNFG_H_ +#include <linux/spinlock.h> +#include <net/caif/caif_layer.h> +#include <net/caif/cfctrl.h> + +struct cfcnfg; + +/** + * enum cfcnfg_phy_type -  Types of physical layers defined in CAIF Stack + * + * @CFPHYTYPE_FRAG:	Fragmented frames physical interface. + * @CFPHYTYPE_CAIF:	Generic CAIF physical interface + */ +enum cfcnfg_phy_type { +	CFPHYTYPE_FRAG = 1, +	CFPHYTYPE_CAIF, +	CFPHYTYPE_MAX +}; + +/** + * enum cfcnfg_phy_preference - Physical preference HW Abstraction + * + * @CFPHYPREF_UNSPECIFIED:	Default physical interface + * + * @CFPHYPREF_LOW_LAT:		Default physical interface for low-latency + *				traffic + * @CFPHYPREF_HIGH_BW:		Default physical interface for high-bandwidth + *				traffic + * @CFPHYPREF_LOOP:		TEST only Loopback interface simulating modem + *				responses. + * + */ +enum cfcnfg_phy_preference { +	CFPHYPREF_UNSPECIFIED, +	CFPHYPREF_LOW_LAT, +	CFPHYPREF_HIGH_BW, +	CFPHYPREF_LOOP +}; + +/** + * cfcnfg_create() - Create the CAIF configuration object. + */ +struct cfcnfg *cfcnfg_create(void); + +/** + * cfcnfg_remove() -  Remove the CFCNFG object + * @cfg: config object + */ +void cfcnfg_remove(struct cfcnfg *cfg); + +/** + * cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack. + * @cnfg:	Pointer to a CAIF configuration object, created by + *		cfcnfg_create(). + * @phy_type:	Specifies the type of physical interface, e.g. + *			CFPHYTYPE_FRAG. + * @dev:	Pointer to link layer device + * @phy_layer:	Specify the physical layer. The transmit function + *		MUST be set in the structure. + * @phyid:	The assigned physical ID for this layer, used in + *		cfcnfg_add_adapt_layer to specify PHY for the link. + * @pref:	The phy (link layer) preference. + * @fcs:	Specify if checksum is used in CAIF Framing Layer. + * @stx:	Specify if Start Of Frame eXtention is used. + */ + +void +cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, +		     void *dev, struct cflayer *phy_layer, u16 *phyid, +		     enum cfcnfg_phy_preference pref, +		     bool fcs, bool stx); + +/** + * cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack. + * + * @cnfg:	Pointer to a CAIF configuration object, created by + *		cfcnfg_create(). + * @phy_layer:	Adaptation layer to be removed. + */ +int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer); + +/** + * cfcnfg_del_adapt_layer - Deletes an adaptation layer from the CAIF stack. + * + * @cnfg:	Pointer to a CAIF configuration object, created by + *		cfcnfg_create(). + * @adap_layer: Adaptation layer to be removed. + */ +int cfcnfg_del_adapt_layer(struct cfcnfg *cnfg, struct cflayer *adap_layer); + +/** + * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack. + * + * The adaptation Layer is where the interface to application or higher-level + * driver functionality is implemented. + * + * @cnfg:		Pointer to a CAIF configuration object, created by + *				cfcnfg_create(). + * @param:		Link setup parameters. + * @adap_layer:		Specify the adaptation layer; the receive and + *			flow-control functions MUST be set in the structure. + * + */ +int +cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, +			    struct cfctrl_link_param *param, +			    struct cflayer *adap_layer); + +/** + * cfcnfg_get_phyid() - Get physical ID, given type. + * Returns one of the physical interfaces matching the given type. + * Zero if no match is found. + * @cnfg:	Configuration object + * @phy_pref:	Caif Link Layer preference + */ +struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg, +		     enum cfcnfg_phy_preference phy_pref); + +/** + * cfcnfg_get_named() - Get the Physical Identifier of CAIF Link Layer + * @cnfg:	Configuration object + * @name:	Name of the Physical Layer (Caif Link Layer) + */ +int cfcnfg_get_named(struct cfcnfg *cnfg, char *name); + +#endif				/* CFCNFG_H_ */ diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h new file mode 100644 index 00000000000..dee25b86caa --- /dev/null +++ b/include/net/caif/cfctrl.h @@ -0,0 +1,138 @@ +/* + * Copyright (C) ST-Ericsson AB 2010 + * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef CFCTRL_H_ +#define CFCTRL_H_ +#include <net/caif/caif_layer.h> +#include <net/caif/cfsrvl.h> + +/* CAIF Control packet commands */ +enum cfctrl_cmd { +	CFCTRL_CMD_LINK_SETUP = 0, +	CFCTRL_CMD_LINK_DESTROY = 1, +	CFCTRL_CMD_LINK_ERR = 2, +	CFCTRL_CMD_ENUM = 3, +	CFCTRL_CMD_SLEEP = 4, +	CFCTRL_CMD_WAKE = 5, +	CFCTRL_CMD_LINK_RECONF = 6, +	CFCTRL_CMD_START_REASON = 7, +	CFCTRL_CMD_RADIO_SET = 8, +	CFCTRL_CMD_MODEM_SET = 9, +	CFCTRL_CMD_MASK = 0xf +}; + +/* Channel types */ +enum cfctrl_srv { +	CFCTRL_SRV_DECM = 0, +	CFCTRL_SRV_VEI = 1, +	CFCTRL_SRV_VIDEO = 2, +	CFCTRL_SRV_DBG = 3, +	CFCTRL_SRV_DATAGRAM = 4, +	CFCTRL_SRV_RFM = 5, +	CFCTRL_SRV_UTIL = 6, +	CFCTRL_SRV_MASK = 0xf +}; + +#define CFCTRL_RSP_BIT 0x20 +#define CFCTRL_ERR_BIT 0x10 + +struct cfctrl_rsp { +	void (*linksetup_rsp)(struct cflayer *layer, u8 linkid, +			      enum cfctrl_srv serv, u8 phyid, +			      struct cflayer *adapt_layer); +	void (*linkdestroy_rsp)(struct cflayer *layer, u8 linkid, +				struct cflayer *client_layer); +	void (*linkerror_ind)(void); +	void (*enum_rsp)(void); +	void (*sleep_rsp)(void); +	void (*wake_rsp)(void); +	void (*restart_rsp)(void); +	void (*radioset_rsp)(void); +	void (*reject_rsp)(struct cflayer *layer, u8 linkid, +				struct cflayer *client_layer);; +}; + +/* Link Setup Parameters for CAIF-Links. */ +struct cfctrl_link_param { +	enum cfctrl_srv linktype;/* (T3,T0) Type of Channel */ +	u8 priority;		  /* (P4,P0) Priority of the channel */ +	u8 phyid;		  /* (U2-U0) Physical interface to connect */ +	u8 endpoint;		  /* (E1,E0) Endpoint for data channels */ +	u8 chtype;		  /* (H1,H0) Channel-Type, applies to +				   *            VEI, DEBUG */ +	union { +		struct { +			u8 connid;	/*  (D7,D0) Video LinkId */ +		} video; + +		struct { +			u32 connid;	/* (N31,Ngit0) Connection ID used +					 *  for Datagram */ +		} datagram; + +		struct { +			u32 connid;	/* Connection ID used for RFM */ +			char volume[20];	/* Volume to mount for RFM */ +		} rfm;		/* Configuration for RFM */ + +		struct { +			u16 fifosize_kb;	/* Psock FIFO size in KB */ +			u16 fifosize_bufs;	/* Psock # signal buffers */ +			char name[16];	/* Name of the PSOCK service */ +			u8 params[255];	/* Link setup Parameters> */ +			u16 paramlen;	/* Length of Link Setup +						 *   Parameters */ +		} utility;	/* Configuration for Utility Links (Psock) */ +	} u; +}; + +/* This structure is used internally in CFCTRL */ +struct cfctrl_request_info { +	int sequence_no; +	enum cfctrl_cmd cmd; +	u8 channel_id; +	struct cfctrl_link_param param; +	struct cfctrl_request_info *next; +	struct cflayer *client_layer; +}; + +struct cfctrl { +	struct cfsrvl serv; +	struct cfctrl_rsp res; +	atomic_t req_seq_no; +	atomic_t rsp_seq_no; +	struct cfctrl_request_info *first_req; +	/* Protects from simultaneous access to first_req list */ +	spinlock_t info_list_lock; +#ifndef CAIF_NO_LOOP +	u8 loop_linkid; +	int loop_linkused[256]; +	/* Protects simultaneous access to loop_linkid and loop_linkused */ +	spinlock_t loop_linkid_lock; +#endif + +}; + +void cfctrl_enum_req(struct cflayer *cfctrl, u8 physlinkid); +void cfctrl_linkup_request(struct cflayer *cfctrl, +			   struct cfctrl_link_param *param, +			   struct cflayer *user_layer); +int  cfctrl_linkdown_req(struct cflayer *cfctrl, u8 linkid, +			 struct cflayer *client); +void cfctrl_sleep_req(struct cflayer *cfctrl); +void cfctrl_wake_req(struct cflayer *cfctrl); +void cfctrl_getstartreason_req(struct cflayer *cfctrl); +struct cflayer *cfctrl_create(void); +void cfctrl_set_dnlayer(struct cflayer *this, struct cflayer *dn); +void cfctrl_set_uplayer(struct cflayer *this, struct cflayer *up); +struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer); +bool cfctrl_req_eq(struct cfctrl_request_info *r1, +		   struct cfctrl_request_info *r2); +void cfctrl_insert_req(struct cfctrl *ctrl, +			      struct cfctrl_request_info *req); +struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl, +					      struct cfctrl_request_info *req); +#endif				/* CFCTRL_H_ */ diff --git a/include/net/caif/cffrml.h b/include/net/caif/cffrml.h new file mode 100644 index 00000000000..3f14d2e1ce6 --- /dev/null +++ b/include/net/caif/cffrml.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) ST-Ericsson AB 2010 + * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef CFFRML_H_ +#define CFFRML_H_ +#include <net/caif/caif_layer.h> + +struct cffrml; +struct cflayer *cffrml_create(u16 phyid, bool DoFCS); +void cffrml_set_uplayer(struct cflayer *this, struct cflayer *up); +void cffrml_set_dnlayer(struct cflayer *this, struct cflayer *dn); + +#endif /* CFFRML_H_ */ diff --git a/include/net/caif/cfmuxl.h b/include/net/caif/cfmuxl.h new file mode 100644 index 00000000000..4e1b4f33423 --- /dev/null +++ b/include/net/caif/cfmuxl.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) ST-Ericsson AB 2010 + * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef CFMUXL_H_ +#define CFMUXL_H_ +#include <net/caif/caif_layer.h> + +struct cfsrvl; +struct cffrml; + +struct cflayer *cfmuxl_create(void); +int cfmuxl_set_uplayer(struct cflayer *layr, struct cflayer *up, u8 linkid); +struct cflayer *cfmuxl_remove_dnlayer(struct cflayer *layr, u8 phyid); +int cfmuxl_set_dnlayer(struct cflayer *layr, struct cflayer *up, u8 phyid); +struct cflayer *cfmuxl_remove_uplayer(struct cflayer *layr, u8 linkid); +bool cfmuxl_is_phy_inuse(struct cflayer *layr, u8 phyid); +u8 cfmuxl_get_phyid(struct cflayer *layr, u8 channel_id); + +#endif				/* CFMUXL_H_ */ diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h new file mode 100644 index 00000000000..fbc681beff5 --- /dev/null +++ b/include/net/caif/cfpkt.h @@ -0,0 +1,274 @@ +/* + * Copyright (C) ST-Ericsson AB 2010 + * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef CFPKT_H_ +#define CFPKT_H_ +#include <net/caif/caif_layer.h> +#include <linux/types.h> +struct cfpkt; + +/* Create a CAIF packet. + * len: Length of packet to be created + * @return New packet. + */ +struct cfpkt *cfpkt_create(u16 len); + +/* Create a CAIF packet. + * data Data to copy. + * len Length of packet to be created + * @return New packet. + */ +struct cfpkt *cfpkt_create_uplink(const unsigned char *data, unsigned int len); +/* + * Destroy a CAIF Packet. + * pkt Packet to be destoyed. + */ +void cfpkt_destroy(struct cfpkt *pkt); + +/* + * Extract header from packet. + * + * pkt Packet to extract header data from. + * data Pointer to copy the header data into. + * len Length of head data to copy. + * @return zero on success and error code upon failure + */ +int cfpkt_extr_head(struct cfpkt *pkt, void *data, u16 len); + +/* + * Peek header from packet. + * Reads data from packet without changing packet. + * + * pkt Packet to extract header data from. + * data Pointer to copy the header data into. + * len Length of head data to copy. + * @return zero on success and error code upon failure + */ +int cfpkt_peek_head(struct cfpkt *pkt, void *data, u16 len); + +/* + * Extract header from trailer (end of packet). + * + * pkt Packet to extract header data from. + * data Pointer to copy the trailer data into. + * len Length of header data to copy. + * @return zero on success and error code upon failure + */ +int cfpkt_extr_trail(struct cfpkt *pkt, void *data, u16 len); + +/* + * Add header to packet. + * + * + * pkt Packet to add header data to. + * data Pointer to data to copy into the header. + * len Length of header data to copy. + * @return zero on success and error code upon failure + */ +int cfpkt_add_head(struct cfpkt *pkt, const void *data, u16 len); + +/* + * Add trailer to packet. + * + * + * pkt Packet to add trailer data to. + * data Pointer to data to copy into the trailer. + * len Length of trailer data to copy. + * @return zero on success and error code upon failure + */ +int cfpkt_add_trail(struct cfpkt *pkt, const void *data, u16 len); + +/* + * Pad trailer on packet. + * Moves data pointer in packet, no content copied. + * + * pkt Packet in which to pad trailer. + * len Length of padding to add. + * @return zero on success and error code upon failure + */ +int cfpkt_pad_trail(struct cfpkt *pkt, u16 len); + +/* + * Add a single byte to packet body (tail). + * + * pkt Packet in which to add byte. + * data Byte to add. + * @return zero on success and error code upon failure + */ +int cfpkt_addbdy(struct cfpkt *pkt, const u8 data); + +/* + * Add a data to packet body (tail). + * + * pkt Packet in which to add data. + * data Pointer to data to copy into the packet body. + * len Length of data to add. + * @return zero on success and error code upon failure + */ +int cfpkt_add_body(struct cfpkt *pkt, const void *data, u16 len); + +/* + * Checks whether there are more data to process in packet. + * pkt Packet to check. + * @return true if more data are available in packet false otherwise + */ +bool cfpkt_more(struct cfpkt *pkt); + +/* + * Checks whether the packet is erroneous, + * i.e. if it has been attempted to extract more data than available in packet + * or writing more data than has been allocated in cfpkt_create(). + * pkt Packet to check. + * @return true on error false otherwise + */ +bool cfpkt_erroneous(struct cfpkt *pkt); + +/* + * Get the packet length. + * pkt Packet to get length from. + * @return Number of bytes in packet. + */ +u16 cfpkt_getlen(struct cfpkt *pkt); + +/* + * Set the packet length, by adjusting the trailer pointer according to length. + * pkt Packet to set length. + * len Packet length. + * @return Number of bytes in packet. + */ +int cfpkt_setlen(struct cfpkt *pkt, u16 len); + +/* + * cfpkt_append - Appends a packet's data to another packet. + * dstpkt:    Packet to append data into, WILL BE FREED BY THIS FUNCTION + * addpkt:    Packet to be appended and automatically released, + *            WILL BE FREED BY THIS FUNCTION. + * expectlen: Packet's expected total length. This should be considered + *            as a hint. + * NB: Input packets will be destroyed after appending and cannot be used + * after calling this function. + * @return    The new appended packet. + */ +struct cfpkt *cfpkt_append(struct cfpkt *dstpkt, struct cfpkt *addpkt, +		      u16 expectlen); + +/* + * cfpkt_split - Split a packet into two packets at the specified split point. + * pkt: Packet to be split (will contain the first part of the data on exit) + * pos: Position to split packet in two parts. + * @return The new packet, containing the second part of the data. + */ +struct cfpkt *cfpkt_split(struct cfpkt *pkt, u16 pos); + +/* + * Iteration function, iterates the packet buffers from start to end. + * + * Checksum iteration function used to iterate buffers + * (we may have packets consisting of a chain of buffers) + * pkt:       Packet to calculate checksum for + * iter_func: Function pointer to iteration function + * chks:      Checksum calculated so far. + * buf:       Pointer to the buffer to checksum + * len:       Length of buf. + * data:      Initial checksum value. + * @return    Checksum of buffer. + */ + +u16 cfpkt_iterate(struct cfpkt *pkt, +		u16 (*iter_func)(u16 chks, void *buf, u16 len), +		u16 data); + +/* Append by giving user access to packet buffer + * cfpkt Packet to append to + * buf Buffer inside pkt that user shall copy data into + * buflen Length of buffer and number of bytes added to packet + * @return 0 on error, 1 on success + */ +int cfpkt_raw_append(struct cfpkt *cfpkt, void **buf, unsigned int buflen); + +/* Extract by giving user access to packet buffer + * cfpkt Packet to extract from + * buf Buffer inside pkt that user shall copy data from + * buflen Length of buffer and number of bytes removed from packet + * @return 0 on error, 1 on success + */ +int cfpkt_raw_extract(struct cfpkt *cfpkt, void **buf, unsigned int buflen); + +/* Map from a "native" packet (e.g. Linux Socket Buffer) to a CAIF packet. + *  dir - Direction indicating whether this packet is to be sent or received. + *  nativepkt  - The native packet to be transformed to a CAIF packet + *  @return The mapped CAIF Packet CFPKT. + */ +struct cfpkt *cfpkt_fromnative(enum caif_direction dir, void *nativepkt); + +/* Map from a CAIF packet to a "native" packet (e.g. Linux Socket Buffer). + *  pkt  - The CAIF packet to be transformed into a "native" packet. + *  @return The native packet transformed from a CAIF packet. + */ +void *cfpkt_tonative(struct cfpkt *pkt); + +/* + * Insert a packet in the packet queue. + * pktq Packet queue to insert into + * pkt Packet to be inserted in queue + * prio Priority of packet + */ +void cfpkt_queue(struct cfpktq *pktq, struct cfpkt *pkt, +		 unsigned short prio); + +/* + * Remove a packet from the packet queue. + * pktq Packet queue to fetch packets from. + * @return Dequeued packet. + */ +struct cfpkt *cfpkt_dequeue(struct cfpktq *pktq); + +/* + * Peek into a packet from the packet queue. + * pktq Packet queue to fetch packets from. + * @return Peeked packet. + */ +struct cfpkt *cfpkt_qpeek(struct cfpktq *pktq); + +/* + * Initiates the packet queue. + * @return Pointer to new packet queue. + */ +struct cfpktq *cfpktq_create(void); + +/* + * Get the number of packets in the queue. + * pktq Packet queue to fetch count from. + * @return Number of packets in queue. + */ +int cfpkt_qcount(struct cfpktq *pktq); + +/* + * Put content of packet into buffer for debuging purposes. + * pkt Packet to copy data from + * buf Buffer to copy data into + * buflen Length of data to copy + * @return Pointer to copied data + */ +char *cfpkt_log_pkt(struct cfpkt *pkt, char *buf, int buflen); + +/* + * Clones a packet and releases the original packet. + * This is used for taking ownership of a packet e.g queueing. + * pkt Packet to clone and release. + * @return Cloned packet. + */ +struct cfpkt *cfpkt_clone_release(struct cfpkt *pkt); + + +/* + * Returns packet information for a packet. + * pkt Packet to get info from; + * @return Packet information + */ +struct caif_payload_info *cfpkt_info(struct cfpkt *pkt); +/*! @} */ +#endif				/* CFPKT_H_ */ diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h new file mode 100644 index 00000000000..b8374321b36 --- /dev/null +++ b/include/net/caif/cfserl.h @@ -0,0 +1,12 @@ +/* + * Copyright (C) ST-Ericsson AB 2010 + * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef CFSERL_H_ +#define CFSERL_H_ +#include <net/caif/caif_layer.h> + +struct cflayer *cfserl_create(int type, int instance, bool use_stx); +#endif				/* CFSERL_H_ */ diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h new file mode 100644 index 00000000000..b2a12db20cd --- /dev/null +++ b/include/net/caif/cfsrvl.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) ST-Ericsson AB 2010 + * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * License terms: GNU General Public License (GPL) version 2 + */ + +#ifndef CFSRVL_H_ +#define CFSRVL_H_ +#include <linux/list.h> +#include <linux/stddef.h> +#include <linux/types.h> +struct cfsrvl { +	struct cflayer layer; +	bool open; +	bool phy_flow_on; +	bool modem_flow_on; +	struct dev_info dev_info; +}; + +struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info); +struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info); +struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info); +struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info); +struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info); +struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info); +bool cfsrvl_phyid_match(struct cflayer *layer, int phyid); +void cfservl_destroy(struct cflayer *layer); +void cfsrvl_init(struct cfsrvl *service, +		 u8 channel_id, +		 struct dev_info *dev_info); +bool cfsrvl_ready(struct cfsrvl *service, int *err); +u8 cfsrvl_getphyid(struct cflayer *layer); + +#endif				/* CFSRVL_H_ */ diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 3d134a1fb96..868cfd3b972 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1007,6 +1007,7 @@ struct cfg80211_pmksa {   *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.   * @del_pmksa: Delete a cached PMKID.   * @flush_pmksa: Flush all cached PMKIDs. + * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.   *   */  struct cfg80211_ops { @@ -1152,6 +1153,10 @@ struct cfg80211_ops {  	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,  				  bool enabled, int timeout); + +	int	(*set_cqm_rssi_config)(struct wiphy *wiphy, +				       struct net_device *dev, +				       s32 rssi_thold, u32 rssi_hyst);  };  /* @@ -2337,4 +2342,18 @@ bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf,  void cfg80211_action_tx_status(struct net_device *dev, u64 cookie,  			       const u8 *buf, size_t len, bool ack, gfp_t gfp); + +/** + * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event + * @dev: network device + * @rssi_event: the triggered RSSI event + * @gfp: context flags + * + * This function is called when a configured connection quality monitoring + * rssi threshold reached event occurs. + */ +void cfg80211_cqm_rssi_notify(struct net_device *dev, +			      enum nl80211_cqm_rssi_threshold_event rssi_event, +			      gfp_t gfp); +  #endif /* __NET_CFG80211_H */ diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index 52da6c3dd50..bbcde3238e5 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h @@ -50,10 +50,6 @@ struct dn_fib_info {  	__le16			fib_prefsrc;  	__u32			fib_priority;  	__u32			fib_metrics[RTAX_MAX]; -#define dn_fib_mtu  fib_metrics[RTAX_MTU-1] -#define dn_fib_window fib_metrics[RTAX_WINDOW-1] -#define dn_fib_rtt fib_metrics[RTAX_RTT-1] -#define dn_fib_advmss fib_metrics[RTAX_ADVMSS-1]  	int			fib_nhs;  	int			fib_power;  	struct dn_fib_nh	fib_nh[0]; diff --git a/include/net/flow.h b/include/net/flow.h index 809970b7dfe..bb08692a20b 100644 --- a/include/net/flow.h +++ b/include/net/flow.h @@ -86,11 +86,26 @@ struct flowi {  struct net;  struct sock; -typedef int (*flow_resolve_t)(struct net *net, struct flowi *key, u16 family, -			      u8 dir, void **objp, atomic_t **obj_refp); +struct flow_cache_ops; + +struct flow_cache_object { +	const struct flow_cache_ops *ops; +}; + +struct flow_cache_ops { +	struct flow_cache_object *(*get)(struct flow_cache_object *); +	int (*check)(struct flow_cache_object *); +	void (*delete)(struct flow_cache_object *); +}; + +typedef struct flow_cache_object *(*flow_resolve_t)( +		struct net *net, struct flowi *key, u16 family, +		u8 dir, struct flow_cache_object *oldobj, void *ctx); + +extern struct flow_cache_object *flow_cache_lookup( +		struct net *net, struct flowi *key, u16 family, +		u8 dir, flow_resolve_t resolver, void *ctx); -extern void *flow_cache_lookup(struct net *net, struct flowi *key, u16 family, -			       u8 dir, flow_resolve_t resolver);  extern void flow_cache_flush(void);  extern atomic_t flow_cache_genid; diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index 545d8b059be..13f9fc086d5 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h @@ -54,16 +54,17 @@ struct inet6_ifaddr {  	struct inet6_dev	*idev;  	struct rt6_info		*rt; -	struct inet6_ifaddr	*lst_next;      /* next addr in addr_lst */ -	struct inet6_ifaddr	*if_next;       /* next addr in inet6_dev */ +	struct hlist_node	addr_lst; +	struct list_head	if_list;  #ifdef CONFIG_IPV6_PRIVACY -	struct inet6_ifaddr	*tmp_next;	/* next addr in tempaddr_lst */ +	struct list_head	tmp_list;  	struct inet6_ifaddr	*ifpub;  	int			regen_count;  #endif  	int			dead; +	struct rcu_head		rcu;  };  struct ip6_sf_socklist { @@ -151,9 +152,9 @@ struct ipv6_devstat {  };  struct inet6_dev { -	struct net_device		*dev; +	struct net_device	*dev; -	struct inet6_ifaddr	*addr_list; +	struct list_head	addr_list;  	struct ifmcaddr6	*mc_list;  	struct ifmcaddr6	*mc_tomb; @@ -175,7 +176,7 @@ struct inet6_dev {  #ifdef CONFIG_IPV6_PRIVACY  	u8			rndid[8];  	struct timer_list	regen_timer; -	struct inet6_ifaddr	*tempaddr_list; +	struct list_head	tempaddr_list;  #endif  	struct neigh_parms	*nd_parms; diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 86f46c49e31..4b1dc1161c3 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -88,34 +88,37 @@ struct rt6_info {  		struct dst_entry	dst;  	} u; -	struct inet6_dev		*rt6i_idev; -  #define rt6i_dev			u.dst.dev  #define rt6i_nexthop			u.dst.neighbour  #define rt6i_expires			u.dst.expires +	/* +	 * Tail elements of dst_entry (__refcnt etc.) +	 * and these elements (rarely used in hot path) are in +	 * the same cache line. +	 */ +	struct fib6_table		*rt6i_table;  	struct fib6_node		*rt6i_node;  	struct in6_addr			rt6i_gateway; -	 -	u32				rt6i_flags; -	u32				rt6i_metric; -	atomic_t			rt6i_ref; -	/* more non-fragment space at head required */ -	unsigned short			rt6i_nfheader_len; - -	u8				rt6i_protocol; +	atomic_t			rt6i_ref; -	struct fib6_table		*rt6i_table; +	/* These are in a separate cache line. */ +	struct rt6key			rt6i_dst ____cacheline_aligned_in_smp; +	u32				rt6i_flags; +	struct rt6key			rt6i_src; +	u32				rt6i_metric; -	struct rt6key			rt6i_dst; +	struct inet6_dev		*rt6i_idev;  #ifdef CONFIG_XFRM  	u32				rt6i_flow_cache_genid;  #endif +	/* more non-fragment space at head required */ +	unsigned short			rt6i_nfheader_len; -	struct rt6key			rt6i_src; +	u8				rt6i_protocol;  };  static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) diff --git a/include/net/ipv6.h b/include/net/ipv6.h index e72fb10ce57..033ddd4652a 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -422,7 +422,7 @@ static inline int __ipv6_addr_diff(const void *token1, const void *token2, int a  	for (i = 0; i < addrlen; i++) {  		__be32 xb = a1[i] ^ a2[i];  		if (xb) -			return i * 32 + 32 - fls(ntohl(xb)); +			return i * 32 + 31 - __fls(ntohl(xb));  	}  	/* diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 45d7d44d7cb..20823d04e03 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -144,6 +144,7 @@ struct ieee80211_low_level_stats {   *	new beacon (beaconing modes)   * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be   *	enabled/disabled (beaconing modes) + * @BSS_CHANGED_CQM: Connection quality monitor config changed   */  enum ieee80211_bss_change {  	BSS_CHANGED_ASSOC		= 1<<0, @@ -156,6 +157,7 @@ enum ieee80211_bss_change {  	BSS_CHANGED_BSSID		= 1<<7,  	BSS_CHANGED_BEACON		= 1<<8,  	BSS_CHANGED_BEACON_ENABLED	= 1<<9, +	BSS_CHANGED_CQM			= 1<<10,  };  /** @@ -185,6 +187,9 @@ enum ieee80211_bss_change {   * @enable_beacon: whether beaconing should be enabled or not   * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info).   *	This field is only valid when the channel type is one of the HT types. + * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value + *	implies disabled + * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis   */  struct ieee80211_bss_conf {  	const u8 *bssid; @@ -202,6 +207,8 @@ struct ieee80211_bss_conf {  	u64 timestamp;  	u32 basic_rates;  	u16 ht_operation_mode; +	s32 cqm_rssi_thold; +	u32 cqm_rssi_hyst;  };  /** @@ -543,7 +550,7 @@ enum mac80211_rx_flags {   * @signal: signal strength when receiving this frame, either in dBm, in dB or   *	unspecified depending on the hardware capabilities flags   *	@IEEE80211_HW_SIGNAL_* - * @noise: noise when receiving this frame, in dBm. + * @noise: noise when receiving this frame, in dBm (DEPRECATED).   * @antenna: antenna used   * @rate_idx: index of data rate into band's supported rates or MCS index if   *	HT rates are use (RX_FLAG_HT) @@ -554,7 +561,7 @@ struct ieee80211_rx_status {  	enum ieee80211_band band;  	int freq;  	int signal; -	int noise; +	int noise __deprecated;  	int antenna;  	int rate_idx;  	int flag; @@ -954,6 +961,17 @@ enum ieee80211_tkip_key_type {   *	Hardware can provide ack status reports of Tx frames to   *	the stack.   * + * @IEEE80211_HW_CONNECTION_MONITOR: + *      The hardware performs its own connection monitoring, including + *      periodic keep-alives to the AP and probing the AP on beacon loss. + *      When this flag is set, signaling beacon-loss will cause an immediate + *      change to disassociated state. + * + * @IEEE80211_HW_SUPPORTS_CQM_RSSI: + *	Hardware can do connection quality monitoring - i.e. it can monitor + *	connection quality related parameters, such as the RSSI level and + *	provide notifications if configured trigger levels are reached. + *   */  enum ieee80211_hw_flags {  	IEEE80211_HW_HAS_RATE_CONTROL			= 1<<0, @@ -975,6 +993,8 @@ enum ieee80211_hw_flags {  	IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS		= 1<<16,  	IEEE80211_HW_SUPPORTS_UAPSD			= 1<<17,  	IEEE80211_HW_REPORTS_TX_ACK_STATUS		= 1<<18, +	IEEE80211_HW_CONNECTION_MONITOR			= 1<<19, +	IEEE80211_HW_SUPPORTS_CQM_RSSI			= 1<<20,  };  /** @@ -1606,7 +1626,7 @@ struct ieee80211_ops {  				 struct ieee80211_bss_conf *info,  				 u32 changed);  	u64 (*prepare_multicast)(struct ieee80211_hw *hw, -				 int mc_count, struct dev_addr_list *mc_list); +				 struct netdev_hw_addr_list *mc_list);  	void (*configure_filter)(struct ieee80211_hw *hw,  				 unsigned int changed_flags,  				 unsigned int *total_flags, @@ -2364,12 +2384,42 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,   *   * @vif: &struct ieee80211_vif pointer from the add_interface callback.   * - * When beacon filtering is enabled with IEEE80211_HW_BEACON_FILTERING and - * IEEE80211_CONF_PS is set, the driver needs to inform whenever the + * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING and + * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the   * hardware is not receiving beacons with this function.   */  void ieee80211_beacon_loss(struct ieee80211_vif *vif); +/** + * ieee80211_connection_loss - inform hardware has lost connection to the AP + * + * @vif: &struct ieee80211_vif pointer from the add_interface callback. + * + * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING, and + * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver + * needs to inform if the connection to the AP has been lost. + * + * This function will cause immediate change to disassociated state, + * without connection recovery attempts. + */ +void ieee80211_connection_loss(struct ieee80211_vif *vif); + +/** + * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring + *	rssi threshold triggered + * + * @vif: &struct ieee80211_vif pointer from the add_interface callback. + * @rssi_event: the RSSI trigger event type + * @gfp: context flags + * + * When the %IEEE80211_HW_SUPPORTS_CQM_RSSI is set, and a connection quality + * monitoring is configured with an rssi threshold, the driver will inform + * whenever the rssi level reaches the threshold. + */ +void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, +			       enum nl80211_cqm_rssi_threshold_event rssi_event, +			       gfp_t gfp); +  /* Rate control API */  /** diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index b6cdc33b39c..9d4d87cc970 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -12,7 +12,7 @@ struct qdisc_walker {  	int	(*fn)(struct Qdisc *, unsigned long cl, struct qdisc_walker *);  }; -#define QDISC_ALIGNTO		32 +#define QDISC_ALIGNTO		64  #define QDISC_ALIGN(len)	(((len) + QDISC_ALIGNTO-1) & ~(QDISC_ALIGNTO-1))  static inline void *qdisc_priv(struct Qdisc *q) diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 67dc08eaaa4..03ca5d82675 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -73,6 +73,7 @@ struct Qdisc {  	struct sk_buff_head	q;  	struct gnet_stats_basic_packed bstats;  	struct gnet_stats_queue	qstats; +	struct rcu_head     rcu_head;  };  struct Qdisc_class_ops { diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 78740ec57d5..59151557406 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -268,7 +268,7 @@ enum {  #define SCTP_MIB_MAX    __SCTP_MIB_MAX  struct sctp_mib {          unsigned long   mibs[SCTP_MIB_MAX]; -} __SNMP_MIB_ALIGN__; +};  /* Print debugging messages.  */ diff --git a/include/net/snmp.h b/include/net/snmp.h index 692ee0061dc..884fdbb74b2 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h @@ -52,26 +52,11 @@ struct snmp_mib {   * count on the 20Gb/s + networks people expect in a few years time!   */ -/*  - * The rule for padding:  - * Best is power of two because then the right structure can be found by a  - * simple shift. The structure should be always cache line aligned. - * gcc needs n=alignto(cachelinesize, popcnt(sizeof(bla_mib))) shift/add  - * instructions to emulate multiply in case it is not power-of-two.  - * Currently n is always <=3 for all sizes so simple cache line alignment  - * is enough.  - *  - * The best solution would be a global CPU local area , especially on 64  - * and 128byte cacheline machine it makes a *lot* of sense -AK - */  - -#define __SNMP_MIB_ALIGN__	____cacheline_aligned -  /* IPstats */  #define IPSTATS_MIB_MAX	__IPSTATS_MIB_MAX  struct ipstats_mib {  	unsigned long	mibs[IPSTATS_MIB_MAX]; -} __SNMP_MIB_ALIGN__; +};  /* ICMP */  #define ICMP_MIB_DUMMY	__ICMP_MIB_MAX @@ -79,36 +64,36 @@ struct ipstats_mib {  struct icmp_mib {  	unsigned long	mibs[ICMP_MIB_MAX]; -} __SNMP_MIB_ALIGN__; +};  #define ICMPMSG_MIB_MAX	__ICMPMSG_MIB_MAX  struct icmpmsg_mib {  	unsigned long	mibs[ICMPMSG_MIB_MAX]; -} __SNMP_MIB_ALIGN__; +};  /* ICMP6 (IPv6-ICMP) */  #define ICMP6_MIB_MAX	__ICMP6_MIB_MAX  struct icmpv6_mib {  	unsigned long	mibs[ICMP6_MIB_MAX]; -} __SNMP_MIB_ALIGN__; +};  #define ICMP6MSG_MIB_MAX  __ICMP6MSG_MIB_MAX  struct icmpv6msg_mib {  	unsigned long	mibs[ICMP6MSG_MIB_MAX]; -} __SNMP_MIB_ALIGN__; +};  /* TCP */  #define TCP_MIB_MAX	__TCP_MIB_MAX  struct tcp_mib {  	unsigned long	mibs[TCP_MIB_MAX]; -} __SNMP_MIB_ALIGN__; +};  /* UDP */  #define UDP_MIB_MAX	__UDP_MIB_MAX  struct udp_mib {  	unsigned long	mibs[UDP_MIB_MAX]; -} __SNMP_MIB_ALIGN__; +};  /* Linux */  #define LINUX_MIB_MAX	__LINUX_MIB_MAX diff --git a/include/net/xfrm.h b/include/net/xfrm.h index ac52f33f3e4..1913af67c43 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -20,6 +20,7 @@  #include <net/route.h>  #include <net/ipv6.h>  #include <net/ip6_fib.h> +#include <net/flow.h>  #include <linux/interrupt.h> @@ -267,7 +268,6 @@ struct xfrm_policy_afinfo {  					       xfrm_address_t *saddr,  					       xfrm_address_t *daddr);  	int			(*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr); -	struct dst_entry	*(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy);  	void			(*decode_session)(struct sk_buff *skb,  						  struct flowi *fl,  						  int reverse); @@ -482,13 +482,14 @@ struct xfrm_policy {  	atomic_t		refcnt;  	struct timer_list	timer; +	struct flow_cache_object flo; +	atomic_t		genid;  	u32			priority;  	u32			index;  	struct xfrm_mark	mark;  	struct xfrm_selector	selector;  	struct xfrm_lifetime_cfg lft;  	struct xfrm_lifetime_cur curlft; -	struct dst_entry       *bundles;  	struct xfrm_policy_walk_entry walk;  	u8			type;  	u8			action; @@ -735,19 +736,12 @@ static inline void xfrm_pol_put(struct xfrm_policy *policy)  		xfrm_policy_destroy(policy);  } -#ifdef CONFIG_XFRM_SUB_POLICY  static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols)  {  	int i;  	for (i = npols - 1; i >= 0; --i)  		xfrm_pol_put(pols[i]);  } -#else -static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols) -{ -	xfrm_pol_put(pols[0]); -} -#endif  extern void __xfrm_state_destroy(struct xfrm_state *); @@ -878,11 +872,15 @@ struct xfrm_dst {  		struct rt6_info		rt6;  	} u;  	struct dst_entry *route; +	struct flow_cache_object flo; +	struct xfrm_policy *pols[XFRM_POLICY_TYPE_MAX]; +	int num_pols, num_xfrms;  #ifdef CONFIG_XFRM_SUB_POLICY  	struct flowi *origin;  	struct xfrm_selector *partner;  #endif -	u32 genid; +	u32 xfrm_genid; +	u32 policy_genid;  	u32 route_mtu_cached;  	u32 child_mtu_cached;  	u32 route_cookie; @@ -892,6 +890,7 @@ struct xfrm_dst {  #ifdef CONFIG_XFRM  static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)  { +	xfrm_pols_put(xdst->pols, xdst->num_pols);  	dst_release(xdst->route);  	if (likely(xdst->u.dst.xfrm))  		xfrm_state_put(xdst->u.dst.xfrm);  |