diff options
Diffstat (limited to 'include')
428 files changed, 8451 insertions, 4807 deletions
diff --git a/include/Kbuild b/include/Kbuild index 1dfd33e8d43..bab1145bc7a 100644 --- a/include/Kbuild +++ b/include/Kbuild @@ -1,5 +1,2 @@  # Top-level Makefile calls into asm-$(ARCH)  # List only non-arch directories below - -header-y += video/ -header-y += scsi/ diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 9bf59d0e8aa..cf051e05a8f 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h @@ -44,17 +44,50 @@  #ifndef __ACEXCEP_H__  #define __ACEXCEP_H__ +/* This module contains all possible exception codes for acpi_status */ +  /* - * Exceptions returned by external ACPI interfaces + * Exception code classes   */ -#define AE_CODE_ENVIRONMENTAL           0x0000 -#define AE_CODE_PROGRAMMER              0x1000 -#define AE_CODE_ACPI_TABLES             0x2000 -#define AE_CODE_AML                     0x3000 -#define AE_CODE_CONTROL                 0x4000 +#define AE_CODE_ENVIRONMENTAL           0x0000	/* General ACPICA environment */ +#define AE_CODE_PROGRAMMER              0x1000	/* External ACPICA interface caller */ +#define AE_CODE_ACPI_TABLES             0x2000	/* ACPI tables */ +#define AE_CODE_AML                     0x3000	/* From executing AML code */ +#define AE_CODE_CONTROL                 0x4000	/* Internal control codes */ +  #define AE_CODE_MAX                     0x4000  #define AE_CODE_MASK                    0xF000 +/* + * Macros to insert the exception code classes + */ +#define EXCEP_ENV(code)                 ((acpi_status) (code | AE_CODE_ENVIRONMENTAL)) +#define EXCEP_PGM(code)                 ((acpi_status) (code | AE_CODE_PROGRAMMER)) +#define EXCEP_TBL(code)                 ((acpi_status) (code | AE_CODE_ACPI_TABLES)) +#define EXCEP_AML(code)                 ((acpi_status) (code | AE_CODE_AML)) +#define EXCEP_CTL(code)                 ((acpi_status) (code | AE_CODE_CONTROL)) + +/* + * Exception info table. The "Description" field is used only by the + * ACPICA help application (acpihelp). + */ +struct acpi_exception_info { +	char *name; + +#ifdef ACPI_HELP_APP +	char *description; +#endif +}; + +#ifdef ACPI_HELP_APP +#define EXCEP_TXT(name,description)     {name, description} +#else +#define EXCEP_TXT(name,description)     {name} +#endif + +/* + * Success is always zero, failure is non-zero + */  #define ACPI_SUCCESS(a)                 (!(a))  #define ACPI_FAILURE(a)                 (a) @@ -64,60 +97,60 @@  /*   * Environmental exceptions   */ -#define AE_ERROR                        (acpi_status) (0x0001 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_ACPI_TABLES               (acpi_status) (0x0002 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_NAMESPACE                 (acpi_status) (0x0003 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_MEMORY                    (acpi_status) (0x0004 | AE_CODE_ENVIRONMENTAL) -#define AE_NOT_FOUND                    (acpi_status) (0x0005 | AE_CODE_ENVIRONMENTAL) -#define AE_NOT_EXIST                    (acpi_status) (0x0006 | AE_CODE_ENVIRONMENTAL) -#define AE_ALREADY_EXISTS               (acpi_status) (0x0007 | AE_CODE_ENVIRONMENTAL) -#define AE_TYPE                         (acpi_status) (0x0008 | AE_CODE_ENVIRONMENTAL) -#define AE_NULL_OBJECT                  (acpi_status) (0x0009 | AE_CODE_ENVIRONMENTAL) -#define AE_NULL_ENTRY                   (acpi_status) (0x000A | AE_CODE_ENVIRONMENTAL) -#define AE_BUFFER_OVERFLOW              (acpi_status) (0x000B | AE_CODE_ENVIRONMENTAL) -#define AE_STACK_OVERFLOW               (acpi_status) (0x000C | AE_CODE_ENVIRONMENTAL) -#define AE_STACK_UNDERFLOW              (acpi_status) (0x000D | AE_CODE_ENVIRONMENTAL) -#define AE_NOT_IMPLEMENTED              (acpi_status) (0x000E | AE_CODE_ENVIRONMENTAL) -#define AE_SUPPORT                      (acpi_status) (0x000F | AE_CODE_ENVIRONMENTAL) -#define AE_LIMIT                        (acpi_status) (0x0010 | AE_CODE_ENVIRONMENTAL) -#define AE_TIME                         (acpi_status) (0x0011 | AE_CODE_ENVIRONMENTAL) -#define AE_ACQUIRE_DEADLOCK             (acpi_status) (0x0012 | AE_CODE_ENVIRONMENTAL) -#define AE_RELEASE_DEADLOCK             (acpi_status) (0x0013 | AE_CODE_ENVIRONMENTAL) -#define AE_NOT_ACQUIRED                 (acpi_status) (0x0014 | AE_CODE_ENVIRONMENTAL) -#define AE_ALREADY_ACQUIRED             (acpi_status) (0x0015 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_HARDWARE_RESPONSE         (acpi_status) (0x0016 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_GLOBAL_LOCK               (acpi_status) (0x0017 | AE_CODE_ENVIRONMENTAL) -#define AE_ABORT_METHOD                 (acpi_status) (0x0018 | AE_CODE_ENVIRONMENTAL) -#define AE_SAME_HANDLER                 (acpi_status) (0x0019 | AE_CODE_ENVIRONMENTAL) -#define AE_NO_HANDLER                   (acpi_status) (0x001A | AE_CODE_ENVIRONMENTAL) -#define AE_OWNER_ID_LIMIT               (acpi_status) (0x001B | AE_CODE_ENVIRONMENTAL) -#define AE_NOT_CONFIGURED               (acpi_status) (0x001C | AE_CODE_ENVIRONMENTAL) +#define AE_ERROR                        EXCEP_ENV (0x0001) +#define AE_NO_ACPI_TABLES               EXCEP_ENV (0x0002) +#define AE_NO_NAMESPACE                 EXCEP_ENV (0x0003) +#define AE_NO_MEMORY                    EXCEP_ENV (0x0004) +#define AE_NOT_FOUND                    EXCEP_ENV (0x0005) +#define AE_NOT_EXIST                    EXCEP_ENV (0x0006) +#define AE_ALREADY_EXISTS               EXCEP_ENV (0x0007) +#define AE_TYPE                         EXCEP_ENV (0x0008) +#define AE_NULL_OBJECT                  EXCEP_ENV (0x0009) +#define AE_NULL_ENTRY                   EXCEP_ENV (0x000A) +#define AE_BUFFER_OVERFLOW              EXCEP_ENV (0x000B) +#define AE_STACK_OVERFLOW               EXCEP_ENV (0x000C) +#define AE_STACK_UNDERFLOW              EXCEP_ENV (0x000D) +#define AE_NOT_IMPLEMENTED              EXCEP_ENV (0x000E) +#define AE_SUPPORT                      EXCEP_ENV (0x000F) +#define AE_LIMIT                        EXCEP_ENV (0x0010) +#define AE_TIME                         EXCEP_ENV (0x0011) +#define AE_ACQUIRE_DEADLOCK             EXCEP_ENV (0x0012) +#define AE_RELEASE_DEADLOCK             EXCEP_ENV (0x0013) +#define AE_NOT_ACQUIRED                 EXCEP_ENV (0x0014) +#define AE_ALREADY_ACQUIRED             EXCEP_ENV (0x0015) +#define AE_NO_HARDWARE_RESPONSE         EXCEP_ENV (0x0016) +#define AE_NO_GLOBAL_LOCK               EXCEP_ENV (0x0017) +#define AE_ABORT_METHOD                 EXCEP_ENV (0x0018) +#define AE_SAME_HANDLER                 EXCEP_ENV (0x0019) +#define AE_NO_HANDLER                   EXCEP_ENV (0x001A) +#define AE_OWNER_ID_LIMIT               EXCEP_ENV (0x001B) +#define AE_NOT_CONFIGURED               EXCEP_ENV (0x001C)  #define AE_CODE_ENV_MAX                 0x001C  /*   * Programmer exceptions   */ -#define AE_BAD_PARAMETER                (acpi_status) (0x0001 | AE_CODE_PROGRAMMER) -#define AE_BAD_CHARACTER                (acpi_status) (0x0002 | AE_CODE_PROGRAMMER) -#define AE_BAD_PATHNAME                 (acpi_status) (0x0003 | AE_CODE_PROGRAMMER) -#define AE_BAD_DATA                     (acpi_status) (0x0004 | AE_CODE_PROGRAMMER) -#define AE_BAD_HEX_CONSTANT             (acpi_status) (0x0005 | AE_CODE_PROGRAMMER) -#define AE_BAD_OCTAL_CONSTANT           (acpi_status) (0x0006 | AE_CODE_PROGRAMMER) -#define AE_BAD_DECIMAL_CONSTANT         (acpi_status) (0x0007 | AE_CODE_PROGRAMMER) -#define AE_MISSING_ARGUMENTS            (acpi_status) (0x0008 | AE_CODE_PROGRAMMER) -#define AE_BAD_ADDRESS                  (acpi_status) (0x0009 | AE_CODE_PROGRAMMER) +#define AE_BAD_PARAMETER                EXCEP_PGM (0x0001) +#define AE_BAD_CHARACTER                EXCEP_PGM (0x0002) +#define AE_BAD_PATHNAME                 EXCEP_PGM (0x0003) +#define AE_BAD_DATA                     EXCEP_PGM (0x0004) +#define AE_BAD_HEX_CONSTANT             EXCEP_PGM (0x0005) +#define AE_BAD_OCTAL_CONSTANT           EXCEP_PGM (0x0006) +#define AE_BAD_DECIMAL_CONSTANT         EXCEP_PGM (0x0007) +#define AE_MISSING_ARGUMENTS            EXCEP_PGM (0x0008) +#define AE_BAD_ADDRESS                  EXCEP_PGM (0x0009)  #define AE_CODE_PGM_MAX                 0x0009  /*   * Acpi table exceptions   */ -#define AE_BAD_SIGNATURE                (acpi_status) (0x0001 | AE_CODE_ACPI_TABLES) -#define AE_BAD_HEADER                   (acpi_status) (0x0002 | AE_CODE_ACPI_TABLES) -#define AE_BAD_CHECKSUM                 (acpi_status) (0x0003 | AE_CODE_ACPI_TABLES) -#define AE_BAD_VALUE                    (acpi_status) (0x0004 | AE_CODE_ACPI_TABLES) -#define AE_INVALID_TABLE_LENGTH         (acpi_status) (0x0005 | AE_CODE_ACPI_TABLES) +#define AE_BAD_SIGNATURE                EXCEP_TBL (0x0001) +#define AE_BAD_HEADER                   EXCEP_TBL (0x0002) +#define AE_BAD_CHECKSUM                 EXCEP_TBL (0x0003) +#define AE_BAD_VALUE                    EXCEP_TBL (0x0004) +#define AE_INVALID_TABLE_LENGTH         EXCEP_TBL (0x0005)  #define AE_CODE_TBL_MAX                 0x0005 @@ -125,58 +158,58 @@   * AML exceptions. These are caused by problems with   * the actual AML byte stream   */ -#define AE_AML_BAD_OPCODE               (acpi_status) (0x0001 | AE_CODE_AML) -#define AE_AML_NO_OPERAND               (acpi_status) (0x0002 | AE_CODE_AML) -#define AE_AML_OPERAND_TYPE             (acpi_status) (0x0003 | AE_CODE_AML) -#define AE_AML_OPERAND_VALUE            (acpi_status) (0x0004 | AE_CODE_AML) -#define AE_AML_UNINITIALIZED_LOCAL      (acpi_status) (0x0005 | AE_CODE_AML) -#define AE_AML_UNINITIALIZED_ARG        (acpi_status) (0x0006 | AE_CODE_AML) -#define AE_AML_UNINITIALIZED_ELEMENT    (acpi_status) (0x0007 | AE_CODE_AML) -#define AE_AML_NUMERIC_OVERFLOW         (acpi_status) (0x0008 | AE_CODE_AML) -#define AE_AML_REGION_LIMIT             (acpi_status) (0x0009 | AE_CODE_AML) -#define AE_AML_BUFFER_LIMIT             (acpi_status) (0x000A | AE_CODE_AML) -#define AE_AML_PACKAGE_LIMIT            (acpi_status) (0x000B | AE_CODE_AML) -#define AE_AML_DIVIDE_BY_ZERO           (acpi_status) (0x000C | AE_CODE_AML) -#define AE_AML_BAD_NAME                 (acpi_status) (0x000D | AE_CODE_AML) -#define AE_AML_NAME_NOT_FOUND           (acpi_status) (0x000E | AE_CODE_AML) -#define AE_AML_INTERNAL                 (acpi_status) (0x000F | AE_CODE_AML) -#define AE_AML_INVALID_SPACE_ID         (acpi_status) (0x0010 | AE_CODE_AML) -#define AE_AML_STRING_LIMIT             (acpi_status) (0x0011 | AE_CODE_AML) -#define AE_AML_NO_RETURN_VALUE          (acpi_status) (0x0012 | AE_CODE_AML) -#define AE_AML_METHOD_LIMIT             (acpi_status) (0x0013 | AE_CODE_AML) -#define AE_AML_NOT_OWNER                (acpi_status) (0x0014 | AE_CODE_AML) -#define AE_AML_MUTEX_ORDER              (acpi_status) (0x0015 | AE_CODE_AML) -#define AE_AML_MUTEX_NOT_ACQUIRED       (acpi_status) (0x0016 | AE_CODE_AML) -#define AE_AML_INVALID_RESOURCE_TYPE    (acpi_status) (0x0017 | AE_CODE_AML) -#define AE_AML_INVALID_INDEX            (acpi_status) (0x0018 | AE_CODE_AML) -#define AE_AML_REGISTER_LIMIT           (acpi_status) (0x0019 | AE_CODE_AML) -#define AE_AML_NO_WHILE                 (acpi_status) (0x001A | AE_CODE_AML) -#define AE_AML_ALIGNMENT                (acpi_status) (0x001B | AE_CODE_AML) -#define AE_AML_NO_RESOURCE_END_TAG      (acpi_status) (0x001C | AE_CODE_AML) -#define AE_AML_BAD_RESOURCE_VALUE       (acpi_status) (0x001D | AE_CODE_AML) -#define AE_AML_CIRCULAR_REFERENCE       (acpi_status) (0x001E | AE_CODE_AML) -#define AE_AML_BAD_RESOURCE_LENGTH      (acpi_status) (0x001F | AE_CODE_AML) -#define AE_AML_ILLEGAL_ADDRESS          (acpi_status) (0x0020 | AE_CODE_AML) -#define AE_AML_INFINITE_LOOP            (acpi_status) (0x0021 | AE_CODE_AML) +#define AE_AML_BAD_OPCODE               EXCEP_AML (0x0001) +#define AE_AML_NO_OPERAND               EXCEP_AML (0x0002) +#define AE_AML_OPERAND_TYPE             EXCEP_AML (0x0003) +#define AE_AML_OPERAND_VALUE            EXCEP_AML (0x0004) +#define AE_AML_UNINITIALIZED_LOCAL      EXCEP_AML (0x0005) +#define AE_AML_UNINITIALIZED_ARG        EXCEP_AML (0x0006) +#define AE_AML_UNINITIALIZED_ELEMENT    EXCEP_AML (0x0007) +#define AE_AML_NUMERIC_OVERFLOW         EXCEP_AML (0x0008) +#define AE_AML_REGION_LIMIT             EXCEP_AML (0x0009) +#define AE_AML_BUFFER_LIMIT             EXCEP_AML (0x000A) +#define AE_AML_PACKAGE_LIMIT            EXCEP_AML (0x000B) +#define AE_AML_DIVIDE_BY_ZERO           EXCEP_AML (0x000C) +#define AE_AML_BAD_NAME                 EXCEP_AML (0x000D) +#define AE_AML_NAME_NOT_FOUND           EXCEP_AML (0x000E) +#define AE_AML_INTERNAL                 EXCEP_AML (0x000F) +#define AE_AML_INVALID_SPACE_ID         EXCEP_AML (0x0010) +#define AE_AML_STRING_LIMIT             EXCEP_AML (0x0011) +#define AE_AML_NO_RETURN_VALUE          EXCEP_AML (0x0012) +#define AE_AML_METHOD_LIMIT             EXCEP_AML (0x0013) +#define AE_AML_NOT_OWNER                EXCEP_AML (0x0014) +#define AE_AML_MUTEX_ORDER              EXCEP_AML (0x0015) +#define AE_AML_MUTEX_NOT_ACQUIRED       EXCEP_AML (0x0016) +#define AE_AML_INVALID_RESOURCE_TYPE    EXCEP_AML (0x0017) +#define AE_AML_INVALID_INDEX            EXCEP_AML (0x0018) +#define AE_AML_REGISTER_LIMIT           EXCEP_AML (0x0019) +#define AE_AML_NO_WHILE                 EXCEP_AML (0x001A) +#define AE_AML_ALIGNMENT                EXCEP_AML (0x001B) +#define AE_AML_NO_RESOURCE_END_TAG      EXCEP_AML (0x001C) +#define AE_AML_BAD_RESOURCE_VALUE       EXCEP_AML (0x001D) +#define AE_AML_CIRCULAR_REFERENCE       EXCEP_AML (0x001E) +#define AE_AML_BAD_RESOURCE_LENGTH      EXCEP_AML (0x001F) +#define AE_AML_ILLEGAL_ADDRESS          EXCEP_AML (0x0020) +#define AE_AML_INFINITE_LOOP            EXCEP_AML (0x0021)  #define AE_CODE_AML_MAX                 0x0021  /*   * Internal exceptions used for control   */ -#define AE_CTRL_RETURN_VALUE            (acpi_status) (0x0001 | AE_CODE_CONTROL) -#define AE_CTRL_PENDING                 (acpi_status) (0x0002 | AE_CODE_CONTROL) -#define AE_CTRL_TERMINATE               (acpi_status) (0x0003 | AE_CODE_CONTROL) -#define AE_CTRL_TRUE                    (acpi_status) (0x0004 | AE_CODE_CONTROL) -#define AE_CTRL_FALSE                   (acpi_status) (0x0005 | AE_CODE_CONTROL) -#define AE_CTRL_DEPTH                   (acpi_status) (0x0006 | AE_CODE_CONTROL) -#define AE_CTRL_END                     (acpi_status) (0x0007 | AE_CODE_CONTROL) -#define AE_CTRL_TRANSFER                (acpi_status) (0x0008 | AE_CODE_CONTROL) -#define AE_CTRL_BREAK                   (acpi_status) (0x0009 | AE_CODE_CONTROL) -#define AE_CTRL_CONTINUE                (acpi_status) (0x000A | AE_CODE_CONTROL) -#define AE_CTRL_SKIP                    (acpi_status) (0x000B | AE_CODE_CONTROL) -#define AE_CTRL_PARSE_CONTINUE          (acpi_status) (0x000C | AE_CODE_CONTROL) -#define AE_CTRL_PARSE_PENDING           (acpi_status) (0x000D | AE_CODE_CONTROL) +#define AE_CTRL_RETURN_VALUE            EXCEP_CTL (0x0001) +#define AE_CTRL_PENDING                 EXCEP_CTL (0x0002) +#define AE_CTRL_TERMINATE               EXCEP_CTL (0x0003) +#define AE_CTRL_TRUE                    EXCEP_CTL (0x0004) +#define AE_CTRL_FALSE                   EXCEP_CTL (0x0005) +#define AE_CTRL_DEPTH                   EXCEP_CTL (0x0006) +#define AE_CTRL_END                     EXCEP_CTL (0x0007) +#define AE_CTRL_TRANSFER                EXCEP_CTL (0x0008) +#define AE_CTRL_BREAK                   EXCEP_CTL (0x0009) +#define AE_CTRL_CONTINUE                EXCEP_CTL (0x000A) +#define AE_CTRL_SKIP                    EXCEP_CTL (0x000B) +#define AE_CTRL_PARSE_CONTINUE          EXCEP_CTL (0x000C) +#define AE_CTRL_PARSE_PENDING           EXCEP_CTL (0x000D)  #define AE_CODE_CTRL_MAX                0x000D @@ -188,112 +221,156 @@   * String versions of the exception codes above   * These strings must match the corresponding defines exactly   */ -char const *acpi_gbl_exception_names_env[] = { -	"AE_OK", -	"AE_ERROR", -	"AE_NO_ACPI_TABLES", -	"AE_NO_NAMESPACE", -	"AE_NO_MEMORY", -	"AE_NOT_FOUND", -	"AE_NOT_EXIST", -	"AE_ALREADY_EXISTS", -	"AE_TYPE", -	"AE_NULL_OBJECT", -	"AE_NULL_ENTRY", -	"AE_BUFFER_OVERFLOW", -	"AE_STACK_OVERFLOW", -	"AE_STACK_UNDERFLOW", -	"AE_NOT_IMPLEMENTED", -	"AE_SUPPORT", -	"AE_LIMIT", -	"AE_TIME", -	"AE_ACQUIRE_DEADLOCK", -	"AE_RELEASE_DEADLOCK", -	"AE_NOT_ACQUIRED", -	"AE_ALREADY_ACQUIRED", -	"AE_NO_HARDWARE_RESPONSE", -	"AE_NO_GLOBAL_LOCK", -	"AE_ABORT_METHOD", -	"AE_SAME_HANDLER", -	"AE_NO_HANDLER", -	"AE_OWNER_ID_LIMIT", -	"AE_NOT_CONFIGURED" +static const struct acpi_exception_info acpi_gbl_exception_names_env[] = { +	EXCEP_TXT("AE_OK", "No error"), +	EXCEP_TXT("AE_ERROR", "Unspecified error"), +	EXCEP_TXT("AE_NO_ACPI_TABLES", "ACPI tables could not be found"), +	EXCEP_TXT("AE_NO_NAMESPACE", "A namespace has not been loaded"), +	EXCEP_TXT("AE_NO_MEMORY", "Insufficient dynamic memory"), +	EXCEP_TXT("AE_NOT_FOUND", "The name was not found in the namespace"), +	EXCEP_TXT("AE_NOT_EXIST", "A required entity does not exist"), +	EXCEP_TXT("AE_ALREADY_EXISTS", "An entity already exists"), +	EXCEP_TXT("AE_TYPE", "The object type is incorrect"), +	EXCEP_TXT("AE_NULL_OBJECT", "A required object was missing"), +	EXCEP_TXT("AE_NULL_ENTRY", "The requested object does not exist"), +	EXCEP_TXT("AE_BUFFER_OVERFLOW", "The buffer provided is too small"), +	EXCEP_TXT("AE_STACK_OVERFLOW", "An internal stack overflowed"), +	EXCEP_TXT("AE_STACK_UNDERFLOW", "An internal stack underflowed"), +	EXCEP_TXT("AE_NOT_IMPLEMENTED", "The feature is not implemented"), +	EXCEP_TXT("AE_SUPPORT", "The feature is not supported"), +	EXCEP_TXT("AE_LIMIT", "A predefined limit was exceeded"), +	EXCEP_TXT("AE_TIME", "A time limit or timeout expired"), +	EXCEP_TXT("AE_ACQUIRE_DEADLOCK", +		  "Internal error, attempt was made to acquire a mutex in improper order"), +	EXCEP_TXT("AE_RELEASE_DEADLOCK", +		  "Internal error, attempt was made to release a mutex in improper order"), +	EXCEP_TXT("AE_NOT_ACQUIRED", +		  "An attempt to release a mutex or Global Lock without a previous acquire"), +	EXCEP_TXT("AE_ALREADY_ACQUIRED", +		  "Internal error, attempt was made to acquire a mutex twice"), +	EXCEP_TXT("AE_NO_HARDWARE_RESPONSE", +		  "Hardware did not respond after an I/O operation"), +	EXCEP_TXT("AE_NO_GLOBAL_LOCK", "There is no FACS Global Lock"), +	EXCEP_TXT("AE_ABORT_METHOD", "A control method was aborted"), +	EXCEP_TXT("AE_SAME_HANDLER", +		  "Attempt was made to install the same handler that is already installed"), +	EXCEP_TXT("AE_NO_HANDLER", +		  "A handler for the operation is not installed"), +	EXCEP_TXT("AE_OWNER_ID_LIMIT", +		  "There are no more Owner IDs available for ACPI tables or control methods"), +	EXCEP_TXT("AE_NOT_CONFIGURED", +		  "The interface is not part of the current subsystem configuration")  }; -char const *acpi_gbl_exception_names_pgm[] = { -	NULL, -	"AE_BAD_PARAMETER", -	"AE_BAD_CHARACTER", -	"AE_BAD_PATHNAME", -	"AE_BAD_DATA", -	"AE_BAD_HEX_CONSTANT", -	"AE_BAD_OCTAL_CONSTANT", -	"AE_BAD_DECIMAL_CONSTANT", -	"AE_MISSING_ARGUMENTS", -	"AE_BAD_ADDRESS" +static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = { +	EXCEP_TXT(NULL, NULL), +	EXCEP_TXT("AE_BAD_PARAMETER", "A parameter is out of range or invalid"), +	EXCEP_TXT("AE_BAD_CHARACTER", +		  "An invalid character was found in a name"), +	EXCEP_TXT("AE_BAD_PATHNAME", +		  "An invalid character was found in a pathname"), +	EXCEP_TXT("AE_BAD_DATA", +		  "A package or buffer contained incorrect data"), +	EXCEP_TXT("AE_BAD_HEX_CONSTANT", "Invalid character in a Hex constant"), +	EXCEP_TXT("AE_BAD_OCTAL_CONSTANT", +		  "Invalid character in an Octal constant"), +	EXCEP_TXT("AE_BAD_DECIMAL_CONSTANT", +		  "Invalid character in a Decimal constant"), +	EXCEP_TXT("AE_MISSING_ARGUMENTS", +		  "Too few arguments were passed to a control method"), +	EXCEP_TXT("AE_BAD_ADDRESS", "An illegal null I/O address")  }; -char const *acpi_gbl_exception_names_tbl[] = { -	NULL, -	"AE_BAD_SIGNATURE", -	"AE_BAD_HEADER", -	"AE_BAD_CHECKSUM", -	"AE_BAD_VALUE", -	"AE_INVALID_TABLE_LENGTH" +static const struct acpi_exception_info acpi_gbl_exception_names_tbl[] = { +	EXCEP_TXT(NULL, NULL), +	EXCEP_TXT("AE_BAD_SIGNATURE", "An ACPI table has an invalid signature"), +	EXCEP_TXT("AE_BAD_HEADER", "Invalid field in an ACPI table header"), +	EXCEP_TXT("AE_BAD_CHECKSUM", "An ACPI table checksum is not correct"), +	EXCEP_TXT("AE_BAD_VALUE", "An invalid value was found in a table"), +	EXCEP_TXT("AE_INVALID_TABLE_LENGTH", +		  "The FADT or FACS has improper length")  }; -char const *acpi_gbl_exception_names_aml[] = { -	NULL, -	"AE_AML_BAD_OPCODE", -	"AE_AML_NO_OPERAND", -	"AE_AML_OPERAND_TYPE", -	"AE_AML_OPERAND_VALUE", -	"AE_AML_UNINITIALIZED_LOCAL", -	"AE_AML_UNINITIALIZED_ARG", -	"AE_AML_UNINITIALIZED_ELEMENT", -	"AE_AML_NUMERIC_OVERFLOW", -	"AE_AML_REGION_LIMIT", -	"AE_AML_BUFFER_LIMIT", -	"AE_AML_PACKAGE_LIMIT", -	"AE_AML_DIVIDE_BY_ZERO", -	"AE_AML_BAD_NAME", -	"AE_AML_NAME_NOT_FOUND", -	"AE_AML_INTERNAL", -	"AE_AML_INVALID_SPACE_ID", -	"AE_AML_STRING_LIMIT", -	"AE_AML_NO_RETURN_VALUE", -	"AE_AML_METHOD_LIMIT", -	"AE_AML_NOT_OWNER", -	"AE_AML_MUTEX_ORDER", -	"AE_AML_MUTEX_NOT_ACQUIRED", -	"AE_AML_INVALID_RESOURCE_TYPE", -	"AE_AML_INVALID_INDEX", -	"AE_AML_REGISTER_LIMIT", -	"AE_AML_NO_WHILE", -	"AE_AML_ALIGNMENT", -	"AE_AML_NO_RESOURCE_END_TAG", -	"AE_AML_BAD_RESOURCE_VALUE", -	"AE_AML_CIRCULAR_REFERENCE", -	"AE_AML_BAD_RESOURCE_LENGTH", -	"AE_AML_ILLEGAL_ADDRESS", -	"AE_AML_INFINITE_LOOP" +static const struct acpi_exception_info acpi_gbl_exception_names_aml[] = { +	EXCEP_TXT(NULL, NULL), +	EXCEP_TXT("AE_AML_BAD_OPCODE", "Invalid AML opcode encountered"), +	EXCEP_TXT("AE_AML_NO_OPERAND", "A required operand is missing"), +	EXCEP_TXT("AE_AML_OPERAND_TYPE", +		  "An operand of an incorrect type was encountered"), +	EXCEP_TXT("AE_AML_OPERAND_VALUE", +		  "The operand had an inappropriate or invalid value"), +	EXCEP_TXT("AE_AML_UNINITIALIZED_LOCAL", +		  "Method tried to use an uninitialized local variable"), +	EXCEP_TXT("AE_AML_UNINITIALIZED_ARG", +		  "Method tried to use an uninitialized argument"), +	EXCEP_TXT("AE_AML_UNINITIALIZED_ELEMENT", +		  "Method tried to use an empty package element"), +	EXCEP_TXT("AE_AML_NUMERIC_OVERFLOW", +		  "Overflow during BCD conversion or other"), +	EXCEP_TXT("AE_AML_REGION_LIMIT", +		  "Tried to access beyond the end of an Operation Region"), +	EXCEP_TXT("AE_AML_BUFFER_LIMIT", +		  "Tried to access beyond the end of a buffer"), +	EXCEP_TXT("AE_AML_PACKAGE_LIMIT", +		  "Tried to access beyond the end of a package"), +	EXCEP_TXT("AE_AML_DIVIDE_BY_ZERO", +		  "During execution of AML Divide operator"), +	EXCEP_TXT("AE_AML_BAD_NAME", +		  "An ACPI name contains invalid character(s)"), +	EXCEP_TXT("AE_AML_NAME_NOT_FOUND", +		  "Could not resolve a named reference"), +	EXCEP_TXT("AE_AML_INTERNAL", "An internal error within the interprete"), +	EXCEP_TXT("AE_AML_INVALID_SPACE_ID", +		  "An Operation Region SpaceID is invalid"), +	EXCEP_TXT("AE_AML_STRING_LIMIT", +		  "String is longer than 200 characters"), +	EXCEP_TXT("AE_AML_NO_RETURN_VALUE", +		  "A method did not return a required value"), +	EXCEP_TXT("AE_AML_METHOD_LIMIT", +		  "A control method reached the maximum reentrancy limit of 255"), +	EXCEP_TXT("AE_AML_NOT_OWNER", +		  "A thread tried to release a mutex that it does not own"), +	EXCEP_TXT("AE_AML_MUTEX_ORDER", "Mutex SyncLevel release mismatch"), +	EXCEP_TXT("AE_AML_MUTEX_NOT_ACQUIRED", +		  "Attempt to release a mutex that was not previously acquired"), +	EXCEP_TXT("AE_AML_INVALID_RESOURCE_TYPE", +		  "Invalid resource type in resource list"), +	EXCEP_TXT("AE_AML_INVALID_INDEX", +		  "Invalid Argx or Localx (x too large)"), +	EXCEP_TXT("AE_AML_REGISTER_LIMIT", +		  "Bank value or Index value beyond range of register"), +	EXCEP_TXT("AE_AML_NO_WHILE", "Break or Continue without a While"), +	EXCEP_TXT("AE_AML_ALIGNMENT", +		  "Non-aligned memory transfer on platform that does not support this"), +	EXCEP_TXT("AE_AML_NO_RESOURCE_END_TAG", +		  "No End Tag in a resource list"), +	EXCEP_TXT("AE_AML_BAD_RESOURCE_VALUE", +		  "Invalid value of a resource element"), +	EXCEP_TXT("AE_AML_CIRCULAR_REFERENCE", +		  "Two references refer to each other"), +	EXCEP_TXT("AE_AML_BAD_RESOURCE_LENGTH", +		  "The length of a Resource Descriptor in the AML is incorrect"), +	EXCEP_TXT("AE_AML_ILLEGAL_ADDRESS", +		  "A memory, I/O, or PCI configuration address is invalid"), +	EXCEP_TXT("AE_AML_INFINITE_LOOP", +		  "An apparent infinite AML While loop, method was aborted")  }; -char const *acpi_gbl_exception_names_ctrl[] = { -	NULL, -	"AE_CTRL_RETURN_VALUE", -	"AE_CTRL_PENDING", -	"AE_CTRL_TERMINATE", -	"AE_CTRL_TRUE", -	"AE_CTRL_FALSE", -	"AE_CTRL_DEPTH", -	"AE_CTRL_END", -	"AE_CTRL_TRANSFER", -	"AE_CTRL_BREAK", -	"AE_CTRL_CONTINUE", -	"AE_CTRL_SKIP", -	"AE_CTRL_PARSE_CONTINUE", -	"AE_CTRL_PARSE_PENDING" +static const struct acpi_exception_info acpi_gbl_exception_names_ctrl[] = { +	EXCEP_TXT(NULL, NULL), +	EXCEP_TXT("AE_CTRL_RETURN_VALUE", "A Method returned a value"), +	EXCEP_TXT("AE_CTRL_PENDING", "Method is calling another method"), +	EXCEP_TXT("AE_CTRL_TERMINATE", "Terminate the executing method"), +	EXCEP_TXT("AE_CTRL_TRUE", "An If or While predicate result"), +	EXCEP_TXT("AE_CTRL_FALSE", "An If or While predicate result"), +	EXCEP_TXT("AE_CTRL_DEPTH", "Maximum search depth has been reached"), +	EXCEP_TXT("AE_CTRL_END", "An If or While predicate is false"), +	EXCEP_TXT("AE_CTRL_TRANSFER", "Transfer control to called method"), +	EXCEP_TXT("AE_CTRL_BREAK", "A Break has been executed"), +	EXCEP_TXT("AE_CTRL_CONTINUE", "A Continue has been executed"), +	EXCEP_TXT("AE_CTRL_SKIP", "Not currently used"), +	EXCEP_TXT("AE_CTRL_PARSE_CONTINUE", "Used to skip over bad opcodes"), +	EXCEP_TXT("AE_CTRL_PARSE_PENDING", "Used to implement AML While loops")  };  #endif				/* EXCEPTION_TABLE */ diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 9885276178e..4f52ea795c7 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h @@ -324,9 +324,9 @@  /* Helper macro */ -#define ACPI_TRACE_ENTRY(name, function, cast, param) \ +#define ACPI_TRACE_ENTRY(name, function, type, param) \  	ACPI_FUNCTION_NAME (name) \ -	function (ACPI_DEBUG_PARAMETERS, cast (param)) +	function (ACPI_DEBUG_PARAMETERS, (type) (param))  /* The actual entry trace macros */ @@ -335,13 +335,13 @@  	acpi_ut_trace (ACPI_DEBUG_PARAMETERS)  #define ACPI_FUNCTION_TRACE_PTR(name, pointer) \ -	ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, (void *), pointer) +	ACPI_TRACE_ENTRY (name, acpi_ut_trace_ptr, void *, pointer)  #define ACPI_FUNCTION_TRACE_U32(name, value) \ -	ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, (u32), value) +	ACPI_TRACE_ENTRY (name, acpi_ut_trace_u32, u32, value)  #define ACPI_FUNCTION_TRACE_STR(name, string) \ -	ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, (char *), string) +	ACPI_TRACE_ENTRY (name, acpi_ut_trace_str, char *, string)  #define ACPI_FUNCTION_ENTRY() \  	acpi_ut_track_stack_ptr() @@ -355,16 +355,37 @@   *   * One of the FUNCTION_TRACE macros above must be used in conjunction   * with these macros so that "_AcpiFunctionName" is defined. + * + * There are two versions of most of the return macros. The default version is + * safer, since it avoids side-effects by guaranteeing that the argument will + * not be evaluated twice. + * + * A less-safe version of the macros is provided for optional use if the + * compiler uses excessive CPU stack (for example, this may happen in the + * debug case if code optimzation is disabled.)   */  /* Exit trace helper macro */ -#define ACPI_TRACE_EXIT(function, cast, param) \ +#ifndef ACPI_SIMPLE_RETURN_MACROS + +#define ACPI_TRACE_EXIT(function, type, param) \ +	ACPI_DO_WHILE0 ({ \ +		register type _param = (type) (param); \ +		function (ACPI_DEBUG_PARAMETERS, _param); \ +		return (_param); \ +	}) + +#else				/* Use original less-safe macros */ + +#define ACPI_TRACE_EXIT(function, type, param) \  	ACPI_DO_WHILE0 ({ \ -		function (ACPI_DEBUG_PARAMETERS, cast (param)); \ -		return ((param)); \ +		function (ACPI_DEBUG_PARAMETERS, (type) (param)); \ +		return (param); \  	}) +#endif				/* ACPI_SIMPLE_RETURN_MACROS */ +  /* The actual exit macros */  #define return_VOID \ @@ -374,13 +395,19 @@  	})  #define return_ACPI_STATUS(status) \ -	ACPI_TRACE_EXIT (acpi_ut_status_exit, (acpi_status), status) +	ACPI_TRACE_EXIT (acpi_ut_status_exit, acpi_status, status)  #define return_PTR(pointer) \ -	ACPI_TRACE_EXIT (acpi_ut_ptr_exit, (u8 *), pointer) +	ACPI_TRACE_EXIT (acpi_ut_ptr_exit, void *, pointer)  #define return_VALUE(value) \ -	ACPI_TRACE_EXIT (acpi_ut_value_exit, (u64), value) +	ACPI_TRACE_EXIT (acpi_ut_value_exit, u64, value) + +#define return_UINT32(value) \ +	ACPI_TRACE_EXIT (acpi_ut_value_exit, u32, value) + +#define return_UINT8(value) \ +	ACPI_TRACE_EXIT (acpi_ut_value_exit, u8, value)  /* Conditional execution */ @@ -428,8 +455,10 @@  #define return_VOID                     return  #define return_ACPI_STATUS(s)           return(s) -#define return_VALUE(s)                 return(s)  #define return_PTR(s)                   return(s) +#define return_VALUE(s)                 return(s) +#define return_UINT8(s)                 return(s) +#define return_UINT32(s)                return(s)  #endif				/* ACPI_DEBUG_OUTPUT */ diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 22ba56e834e..98db31d9f9b 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -88,11 +88,30 @@ struct acpi_device;   * -----------------   */ +enum acpi_hotplug_mode { +	AHM_GENERIC = 0, +	AHM_CONTAINER, +	AHM_COUNT +}; + +struct acpi_hotplug_profile { +	struct kobject kobj; +	bool enabled:1; +	enum acpi_hotplug_mode mode; +}; + +static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile( +						struct kobject *kobj) +{ +	return container_of(kobj, struct acpi_hotplug_profile, kobj); +} +  struct acpi_scan_handler {  	const struct acpi_device_id *ids;  	struct list_head list_node;  	int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);  	void (*detach)(struct acpi_device *dev); +	struct acpi_hotplug_profile hotplug;  };  /* @@ -142,7 +161,6 @@ struct acpi_device_status {  struct acpi_device_flags {  	u32 dynamic_status:1; -	u32 bus_address:1;  	u32 removable:1;  	u32 ejectable:1;  	u32 suprise_removal_ok:1; @@ -150,7 +168,7 @@ struct acpi_device_flags {  	u32 performance_manageable:1;  	u32 eject_pending:1;  	u32 match_driver:1; -	u32 reserved:23; +	u32 reserved:24;  };  /* File System */ @@ -173,10 +191,17 @@ struct acpi_hardware_id {  	char *id;  }; +struct acpi_pnp_type { +	u32 hardware_id:1; +	u32 bus_address:1; +	u32 reserved:30; +}; +  struct acpi_device_pnp { -	acpi_bus_id bus_id;	/* Object name */ +	acpi_bus_id bus_id;		/* Object name */ +	struct acpi_pnp_type type;	/* ID type */  	acpi_bus_address bus_address;	/* _ADR */ -	char *unique_id;	/* _UID */ +	char *unique_id;		/* _UID */  	struct list_head ids;		/* _HID and _CIDs */  	acpi_device_name device_name;	/* Driver-determined */  	acpi_device_class device_class;	/*        "          */ diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h index 627749af0ba..e6168a24b9f 100644 --- a/include/acpi/acpi_drivers.h +++ b/include/acpi/acpi_drivers.h @@ -95,7 +95,6 @@ int acpi_pci_link_free_irq(acpi_handle handle);  struct pci_bus;  struct pci_dev *acpi_get_pci_dev(acpi_handle); -int acpi_pci_bind_root(struct acpi_device *device);  /* Arch-defined function to add a bus to the system */ diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 03322dddd88..454881e6450 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -46,7 +46,7 @@  /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION                 0x20130117 +#define ACPI_CA_VERSION                 0x20130328  #include <acpi/acconfig.h>  #include <acpi/actypes.h> diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index 77dc7a4099a..ffaac0e7e0c 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -72,11 +72,13 @@  #define ACPI_SIG_IVRS           "IVRS"	/* I/O Virtualization Reporting Structure */  #define ACPI_SIG_MCFG           "MCFG"	/* PCI Memory Mapped Configuration table */  #define ACPI_SIG_MCHI           "MCHI"	/* Management Controller Host Interface table */ +#define ACPI_SIG_MTMR           "MTMR"	/* MID Timer table */  #define ACPI_SIG_SLIC           "SLIC"	/* Software Licensing Description Table */  #define ACPI_SIG_SPCR           "SPCR"	/* Serial Port Console Redirection table */  #define ACPI_SIG_SPMI           "SPMI"	/* Server Platform Management Interface table */  #define ACPI_SIG_TCPA           "TCPA"	/* Trusted Computing Platform Alliance table */  #define ACPI_SIG_UEFI           "UEFI"	/* Uefi Boot Optimization Table */ +#define ACPI_SIG_VRTC           "VRTC"	/* Virtual Real Time Clock Table */  #define ACPI_SIG_WAET           "WAET"	/* Windows ACPI Emulated devices Table */  #define ACPI_SIG_WDAT           "WDAT"	/* Watchdog Action Table */  #define ACPI_SIG_WDDT           "WDDT"	/* Watchdog Timer Description Table */ @@ -852,6 +854,29 @@ struct acpi_table_mchi {  /*******************************************************************************   * + * MTMR - MID Timer Table + *        Version 1 + * + * Conforms to "Simple Firmware Interface Specification", + * Draft 0.8.2, Oct 19, 2010 + * NOTE: The ACPI MTMR is equivalent to the SFI MTMR table. + * + ******************************************************************************/ + +struct acpi_table_mtmr { +	struct acpi_table_header header;	/* Common ACPI table header */ +}; + +/* MTMR entry */ + +struct acpi_mtmr_entry { +	struct acpi_generic_address physical_address; +	u32 frequency; +	u32 irq; +}; + +/******************************************************************************* + *   * SLIC - Software Licensing Description Table   *        Version 1   * @@ -1025,6 +1050,28 @@ struct acpi_table_uefi {  /*******************************************************************************   * + * VRTC - Virtual Real Time Clock Table + *        Version 1 + * + * Conforms to "Simple Firmware Interface Specification", + * Draft 0.8.2, Oct 19, 2010 + * NOTE: The ACPI VRTC is equivalent to The SFI MRTC table. + * + ******************************************************************************/ + +struct acpi_table_vrtc { +	struct acpi_table_header header;	/* Common ACPI table header */ +}; + +/* VRTC entry */ + +struct acpi_vrtc_entry { +	struct acpi_generic_address physical_address; +	u32 irq; +}; + +/******************************************************************************* + *   * WAET - Windows ACPI Emulated devices Table   *        Version 1   * diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h index 332b17e3bec..e2c0931a3d6 100644 --- a/include/acpi/actbl3.h +++ b/include/acpi/actbl3.h @@ -174,7 +174,7 @@ struct acpi_fpdt_header {  enum acpi_fpdt_type {  	ACPI_FPDT_TYPE_BOOT = 0, -	ACPI_FPDT_TYPE_S3PERF = 1, +	ACPI_FPDT_TYPE_S3PERF = 1  };  /* @@ -223,7 +223,7 @@ struct acpi_s3pt_header {  enum acpi_s3pt_type {  	ACPI_S3PT_TYPE_RESUME = 0, -	ACPI_S3PT_TYPE_SUSPEND = 1, +	ACPI_S3PT_TYPE_SUSPEND = 1  };  struct acpi_s3pt_resume { @@ -505,26 +505,59 @@ struct acpi_rasf_shared_memory {  	u32 signature;  	u16 command;  	u16 status; -	u64 requested_address; -	u64 requested_length; -	u64 actual_address; -	u64 actual_length; +	u16 version; +	u8 capabilities[16]; +	u8 set_capabilities[16]; +	u16 num_parameter_blocks; +	u32 set_capabilities_status; +}; + +/* RASF Parameter Block Structure Header */ + +struct acpi_rasf_parameter_block { +	u16 type; +	u16 version; +	u16 length; +}; + +/* RASF Parameter Block Structure for PATROL_SCRUB */ + +struct acpi_rasf_patrol_scrub_parameter { +	struct acpi_rasf_parameter_block header; +	u16 patrol_scrub_command; +	u64 requested_address_range[2]; +	u64 actual_address_range[2];  	u16 flags; -	u8 speed; +	u8 requested_speed;  };  /* Masks for Flags and Speed fields above */  #define ACPI_RASF_SCRUBBER_RUNNING      1  #define ACPI_RASF_SPEED                 (7<<1) +#define ACPI_RASF_SPEED_SLOW            (0<<1) +#define ACPI_RASF_SPEED_MEDIUM          (4<<1) +#define ACPI_RASF_SPEED_FAST            (7<<1)  /* Channel Commands */  enum acpi_rasf_commands { -	ACPI_RASF_GET_RAS_CAPABILITIES = 1, -	ACPI_RASF_GET_PATROL_PARAMETERS = 2, -	ACPI_RASF_START_PATROL_SCRUBBER = 3, -	ACPI_RASF_STOP_PATROL_SCRUBBER = 4 +	ACPI_RASF_EXECUTE_RASF_COMMAND = 1 +}; + +/* Platform RAS Capabilities */ + +enum acpi_rasf_capabiliities { +	ACPI_HW_PATROL_SCRUB_SUPPORTED = 0, +	ACPI_SW_PATROL_SCRUB_EXPOSED = 1 +}; + +/* Patrol Scrub Commands */ + +enum acpi_rasf_patrol_scrub_commands { +	ACPI_RASF_GET_PATROL_PARAMETERS = 1, +	ACPI_RASF_START_PATROL_SCRUBBER = 2, +	ACPI_RASF_STOP_PATROL_SCRUBBER = 3  };  /* Channel Command flags */ diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 845e75f1ffd..a64adcc29ae 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h @@ -650,13 +650,14 @@ typedef u32 acpi_event_type;   * The encoding of acpi_event_status is illustrated below.   * Note that a set bit (1) indicates the property is TRUE   * (e.g. if bit 0 is set then the event is enabled). - * +-------------+-+-+-+ - * |   Bits 31:3 |2|1|0| - * +-------------+-+-+-+ - *          |     | | | - *          |     | | +- Enabled? - *          |     | +--- Enabled for wake? - *          |     +----- Set? + * +-------------+-+-+-+-+ + * |   Bits 31:4 |3|2|1|0| + * +-------------+-+-+-+-+ + *          |     | | | | + *          |     | | | +- Enabled? + *          |     | | +--- Enabled for wake? + *          |     | +----- Set? + *          |     +------- Has a handler?   *          +----------- <Reserved>   */  typedef u32 acpi_event_status; @@ -1128,7 +1129,6 @@ struct acpi_memory_list {  	u16 object_size;  	u16 max_depth;  	u16 current_depth; -	u16 link_offset;  #ifdef ACPI_DBG_TRACK_ALLOCATIONS diff --git a/include/asm-generic/hugetlb.h b/include/asm-generic/hugetlb.h new file mode 100644 index 00000000000..d06079c774a --- /dev/null +++ b/include/asm-generic/hugetlb.h @@ -0,0 +1,40 @@ +#ifndef _ASM_GENERIC_HUGETLB_H +#define _ASM_GENERIC_HUGETLB_H + +static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot) +{ +	return mk_pte(page, pgprot); +} + +static inline int huge_pte_write(pte_t pte) +{ +	return pte_write(pte); +} + +static inline int huge_pte_dirty(pte_t pte) +{ +	return pte_dirty(pte); +} + +static inline pte_t huge_pte_mkwrite(pte_t pte) +{ +	return pte_mkwrite(pte); +} + +static inline pte_t huge_pte_mkdirty(pte_t pte) +{ +	return pte_mkdirty(pte); +} + +static inline pte_t huge_pte_modify(pte_t pte, pgprot_t newprot) +{ +	return pte_modify(pte, newprot); +} + +static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr, +				  pte_t *ptep) +{ +	pte_clear(mm, addr, ptep); +} + +#endif /* _ASM_GENERIC_HUGETLB_H */ diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index bfd87685fc1..a59ff51b016 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -7,6 +7,16 @@  #include <linux/mm_types.h>  #include <linux/bug.h> +/* + * On almost all architectures and configurations, 0 can be used as the + * upper ceiling to free_pgtables(): on many architectures it has the same + * effect as using TASK_SIZE.  However, there is one configuration which + * must impose a more careful limit, to avoid freeing kernel pgtables. + */ +#ifndef USER_PGTABLES_CEILING +#define USER_PGTABLES_CEILING	0UL +#endif +  #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS  extern int ptep_set_access_flags(struct vm_area_struct *vma,  				 unsigned long address, pte_t *ptep, diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 25f01d0bc14..b1b1fa6ffff 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -99,7 +99,12 @@ struct mmu_gather {  	unsigned int		need_flush : 1,	/* Did free PTEs */  				fast_mode  : 1; /* No batching   */ -	unsigned int		fullmm; +	/* we are in the middle of an operation to clear +	 * a full mm and can make some optimizations */ +	unsigned int		fullmm : 1, +	/* we have performed an operation which +	 * requires a complete flush of the tlb */ +				need_flush_all : 1;  	struct mmu_gather_batch *active;  	struct mmu_gather_batch	local; diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index 4077b5d9ff8..0501fa3f783 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h @@ -9,20 +9,3 @@  #define __ARCH_WANT_STAT64  #define __ARCH_WANT_SYS_LLSEEK  #endif - -/* - * "Conditional" syscalls - * - * What we want is __attribute__((weak,alias("sys_ni_syscall"))), - * but it doesn't work on all toolchains, so we just do it by hand - */ -#ifndef cond_syscall -#ifdef CONFIG_SYMBOL_PREFIX -#define __SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX -#else -#define __SYMBOL_PREFIX -#endif -#define cond_syscall(x) asm(".weak\t" __SYMBOL_PREFIX #x "\n\t" \ -			    ".set\t" __SYMBOL_PREFIX #x "," \ -			    __SYMBOL_PREFIX "sys_ni_syscall") -#endif diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 2d94d7413d7..60c33f14408 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1022,7 +1022,7 @@ struct drm_info_list {  struct drm_info_node {  	struct list_head list;  	struct drm_minor *minor; -	struct drm_info_list *info_ent; +	const struct drm_info_list *info_ent;  	struct dentry *dent;  }; @@ -1546,8 +1546,7 @@ extern struct idr drm_minors_idr;  extern struct drm_local_map *drm_getsarea(struct drm_device *dev);  				/* Proc support (drm_proc.h) */ -extern int drm_proc_init(struct drm_minor *minor, int minor_id, -			 struct proc_dir_entry *root); +extern int drm_proc_init(struct drm_minor *minor, struct proc_dir_entry *root);  extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);  				/* Debugfs support */ diff --git a/include/linux/acpi.h b/include/linux/acpi.h index bcbdd7484e5..17b5b596764 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -152,15 +152,6 @@ void acpi_penalize_isa_irq(int irq, int active);  void acpi_pci_irq_disable (struct pci_dev *dev); -struct acpi_pci_driver { -	struct list_head node; -	int (*add)(struct acpi_pci_root *root); -	void (*remove)(struct acpi_pci_root *root); -}; - -int acpi_pci_register_driver(struct acpi_pci_driver *driver); -void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); -  extern int ec_read(u8 addr, u8 *val);  extern int ec_write(u8 addr, u8 val);  extern int ec_transaction(u8 command, @@ -204,7 +195,7 @@ extern bool wmi_has_guid(const char *guid);  #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE)  extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle); -extern long acpi_is_video_device(struct acpi_device *device); +extern long acpi_is_video_device(acpi_handle handle);  extern void acpi_video_dmi_promote_vendor(void);  extern void acpi_video_dmi_demote_vendor(void);  extern int acpi_video_backlight_support(void); @@ -217,7 +208,7 @@ static inline long acpi_video_get_capabilities(acpi_handle graphics_dev_handle)  	return 0;  } -static inline long acpi_is_video_device(struct acpi_device *device) +static inline long acpi_is_video_device(acpi_handle handle)  {  	return 0;  } diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h index f612c783170..62d9303c283 100644 --- a/include/linux/amba/serial.h +++ b/include/linux/amba/serial.h @@ -203,6 +203,9 @@ struct amba_pl011_data {  	bool (*dma_filter)(struct dma_chan *chan, void *filter_param);  	void *dma_rx_param;  	void *dma_tx_param; +	bool dma_rx_poll_enable; +	unsigned int dma_rx_poll_rate; +	unsigned int dma_rx_poll_timeout;          void (*init) (void);  	void (*exit) (void);  }; diff --git a/include/linux/async.h b/include/linux/async.h index a2e3f18b2ad..6b0226bdaad 100644 --- a/include/linux/async.h +++ b/include/linux/async.h @@ -16,9 +16,8 @@  #include <linux/list.h>  typedef u64 async_cookie_t; -typedef void (async_func_ptr) (void *data, async_cookie_t cookie); +typedef void (*async_func_t) (void *data, async_cookie_t cookie);  struct async_domain { -	struct list_head node;  	struct list_head pending;  	unsigned registered:1;  }; @@ -27,8 +26,7 @@ struct async_domain {   * domain participates in global async_synchronize_full   */  #define ASYNC_DOMAIN(_name) \ -	struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \ -				      .pending = LIST_HEAD_INIT(_name.pending), \ +	struct async_domain _name = { .pending = LIST_HEAD_INIT(_name.pending),	\  				      .registered = 1 }  /* @@ -36,12 +34,11 @@ struct async_domain {   * complete, this domain does not participate in async_synchronize_full   */  #define ASYNC_DOMAIN_EXCLUSIVE(_name) \ -	struct async_domain _name = { .node = LIST_HEAD_INIT(_name.node), \ -				      .pending = LIST_HEAD_INIT(_name.pending), \ +	struct async_domain _name = { .pending = LIST_HEAD_INIT(_name.pending), \  				      .registered = 0 } -extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data); -extern async_cookie_t async_schedule_domain(async_func_ptr *ptr, void *data, +extern async_cookie_t async_schedule(async_func_t func, void *data); +extern async_cookie_t async_schedule_domain(async_func_t func, void *data,  					    struct async_domain *domain);  void async_unregister_domain(struct async_domain *domain);  extern void async_synchronize_full(void); diff --git a/include/linux/ata.h b/include/linux/ata.h index 8f7a3d68371..ee0bd952405 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -954,7 +954,7 @@ static inline int atapi_cdb_len(const u16 *dev_id)  	}  } -static inline bool atapi_command_packet_set(const u16 *dev_id) +static inline int atapi_command_packet_set(const u16 *dev_id)  {  	return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f;  } diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index e0ce311011c..f14a98a79c9 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h @@ -134,6 +134,7 @@ struct bcma_host_ops {  #define BCMA_CORE_I2S			0x834  #define BCMA_CORE_SDR_DDR1_MEM_CTL	0x835	/* SDR/DDR1 memory controller core */  #define BCMA_CORE_SHIM			0x837	/* SHIM component in ubus/6362 */ +#define BCMA_CORE_ARM_CR4		0x83e  #define BCMA_CORE_DEFAULT		0xFFF  #define BCMA_MAX_NR_CORES		16 @@ -173,6 +174,60 @@ struct bcma_host_ops {  #define BCMA_CHIP_ID_BCM53572	53572  #define  BCMA_PKG_ID_BCM47188	9 +/* Board types (on PCI usually equals to the subsystem dev id) */ +/* BCM4313 */ +#define BCMA_BOARD_TYPE_BCM94313BU	0X050F +#define BCMA_BOARD_TYPE_BCM94313HM	0X0510 +#define BCMA_BOARD_TYPE_BCM94313EPA	0X0511 +#define BCMA_BOARD_TYPE_BCM94313HMG	0X051C +/* BCM4716 */ +#define BCMA_BOARD_TYPE_BCM94716NR2	0X04CD +/* BCM43224 */ +#define BCMA_BOARD_TYPE_BCM943224X21	0X056E +#define BCMA_BOARD_TYPE_BCM943224X21_FCC	0X00D1 +#define BCMA_BOARD_TYPE_BCM943224X21B	0X00E9 +#define BCMA_BOARD_TYPE_BCM943224M93	0X008B +#define BCMA_BOARD_TYPE_BCM943224M93A	0X0090 +#define BCMA_BOARD_TYPE_BCM943224X16	0X0093 +#define BCMA_BOARD_TYPE_BCM94322X9	0X008D +#define BCMA_BOARD_TYPE_BCM94322M35E	0X008E +/* BCM43228 */ +#define BCMA_BOARD_TYPE_BCM943228BU8	0X0540 +#define BCMA_BOARD_TYPE_BCM943228BU9	0X0541 +#define BCMA_BOARD_TYPE_BCM943228BU	0X0542 +#define BCMA_BOARD_TYPE_BCM943227HM4L	0X0543 +#define BCMA_BOARD_TYPE_BCM943227HMB	0X0544 +#define BCMA_BOARD_TYPE_BCM943228HM4L	0X0545 +#define BCMA_BOARD_TYPE_BCM943228SD	0X0573 +/* BCM4331 */ +#define BCMA_BOARD_TYPE_BCM94331X19	0X00D6 +#define BCMA_BOARD_TYPE_BCM94331X28	0X00E4 +#define BCMA_BOARD_TYPE_BCM94331X28B	0X010E +#define BCMA_BOARD_TYPE_BCM94331PCIEBT3AX	0X00E4 +#define BCMA_BOARD_TYPE_BCM94331X12_2G	0X00EC +#define BCMA_BOARD_TYPE_BCM94331X12_5G	0X00ED +#define BCMA_BOARD_TYPE_BCM94331X29B	0X00EF +#define BCMA_BOARD_TYPE_BCM94331CSAX	0X00EF +#define BCMA_BOARD_TYPE_BCM94331X19C	0X00F5 +#define BCMA_BOARD_TYPE_BCM94331X33	0X00F4 +#define BCMA_BOARD_TYPE_BCM94331BU	0X0523 +#define BCMA_BOARD_TYPE_BCM94331S9BU	0X0524 +#define BCMA_BOARD_TYPE_BCM94331MC	0X0525 +#define BCMA_BOARD_TYPE_BCM94331MCI	0X0526 +#define BCMA_BOARD_TYPE_BCM94331PCIEBT4	0X0527 +#define BCMA_BOARD_TYPE_BCM94331HM	0X0574 +#define BCMA_BOARD_TYPE_BCM94331PCIEDUAL	0X059B +#define BCMA_BOARD_TYPE_BCM94331MCH5	0X05A9 +#define BCMA_BOARD_TYPE_BCM94331CS	0X05C6 +#define BCMA_BOARD_TYPE_BCM94331CD	0X05DA +/* BCM53572 */ +#define BCMA_BOARD_TYPE_BCM953572BU	0X058D +#define BCMA_BOARD_TYPE_BCM953572NR2	0X058E +#define BCMA_BOARD_TYPE_BCM947188NR2	0X058F +#define BCMA_BOARD_TYPE_BCM953572SDRNR2	0X0590 +/* BCM43142 */ +#define BCMA_BOARD_TYPE_BCM943142HM	0X05E0 +  struct bcma_device {  	struct bcma_bus *bus;  	struct bcma_device_id id; diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h index 8390c474f69..b8b09eac60a 100644 --- a/include/linux/bcma/bcma_driver_chipcommon.h +++ b/include/linux/bcma/bcma_driver_chipcommon.h @@ -104,6 +104,7 @@  #define  BCMA_CC_CHIPST_4706_MIPS_BENDIAN	BIT(3) /* 0: little, 1: big endian */  #define  BCMA_CC_CHIPST_4706_PCIE1_DISABLE	BIT(5) /* PCIE1 enable strap pin */  #define  BCMA_CC_CHIPST_5357_NAND_BOOT		BIT(4) /* NAND boot, valid for CC rev 38 and/or BCM5357 */ +#define  BCMA_CC_CHIPST_4360_XTAL_40MZ		0x00000001  #define BCMA_CC_JCMD			0x0030		/* Rev >= 10 only */  #define  BCMA_CC_JCMD_START		0x80000000  #define  BCMA_CC_JCMD_BUSY		0x80000000 @@ -315,6 +316,9 @@  #define BCMA_CC_PMU_CTL			0x0600 /* PMU control */  #define  BCMA_CC_PMU_CTL_ILP_DIV	0xFFFF0000 /* ILP div mask */  #define  BCMA_CC_PMU_CTL_ILP_DIV_SHIFT	16 +#define  BCMA_CC_PMU_CTL_RES		0x00006000 /* reset control mask */ +#define  BCMA_CC_PMU_CTL_RES_SHIFT	13 +#define  BCMA_CC_PMU_CTL_RES_RELOAD	0x2	/* reload POR values */  #define  BCMA_CC_PMU_CTL_PLL_UPD	0x00000400  #define  BCMA_CC_PMU_CTL_NOILPONW	0x00000200 /* No ILP on wait */  #define  BCMA_CC_PMU_CTL_HTREQEN	0x00000100 /* HT req enable */ @@ -607,6 +611,8 @@ void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable);  extern u32 bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, u32 ticks); +extern u32 bcma_chipco_get_alp_clock(struct bcma_drv_cc *cc); +  void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value);  u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask); diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h index 7e8104bb7a7..917dcd7965e 100644 --- a/include/linux/bcma/bcma_regs.h +++ b/include/linux/bcma/bcma_regs.h @@ -37,6 +37,7 @@  #define  BCMA_IOST_BIST_DONE		0x8000  #define BCMA_RESET_CTL			0x0800  #define  BCMA_RESET_CTL_RESET		0x0001 +#define BCMA_RESET_ST			0x0804  /* BCMA PCI config space registers. */  #define BCMA_PCI_PMCSR			0x44 diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index c3a09149f79..70cf138690e 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -118,5 +118,6 @@ extern int prepare_bprm_creds(struct linux_binprm *bprm);  extern void install_exec_creds(struct linux_binprm *bprm);  extern void set_binfmt(struct linux_binfmt *new);  extern void free_bprm(struct linux_binprm *); +extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t);  #endif /* _LINUX_BINFMTS_H */ diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index cdf11191e64..22990cf4439 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -111,12 +111,13 @@ struct bio {  #define BIO_FS_INTEGRITY 9	/* fs owns integrity data, not block layer */  #define BIO_QUIET	10	/* Make BIO Quiet */  #define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */ +#define BIO_SNAP_STABLE	12	/* bio data must be snapshotted during write */  /*   * Flags starting here get preserved by bio_reset() - this includes   * BIO_POOL_IDX()   */ -#define BIO_RESET_BITS	12 +#define BIO_RESET_BITS	13  #define bio_flagged(bio, flag)	((bio)->bi_flags & (1 << (flag))) diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 0ea61e07a91..7c2e030e72f 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h @@ -12,7 +12,6 @@  struct blk_trace {  	int trace_state; -	bool rq_based;  	struct rchan *rchan;  	unsigned long __percpu *sequence;  	unsigned char __percpu *msg_data; diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index cdc3bab0183..5f0b0e1f7c0 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h @@ -44,7 +44,6 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,  				       unsigned long endpfn);  extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); -extern unsigned long free_low_memory_core_early(int nodeid);  extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);  extern unsigned long free_all_bootmem(void); diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 5afc4f94d11..9e52b0626b3 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -34,6 +34,8 @@ enum bh_state_bits {  	BH_Write_EIO,	/* I/O error on write */  	BH_Unwritten,	/* Buffer is allocated on disk but not written */  	BH_Quiet,	/* Buffer Error Prinks to be quiet */ +	BH_Meta,	/* Buffer contains metadata */ +	BH_Prio,	/* Buffer should be submitted with REQ_PRIO */  	BH_PrivateStart,/* not a state bit, but the first bit available  			 * for private allocation by other entities @@ -124,6 +126,8 @@ BUFFER_FNS(Delay, delay)  BUFFER_FNS(Boundary, boundary)  BUFFER_FNS(Write_EIO, write_io_error)  BUFFER_FNS(Unwritten, unwritten) +BUFFER_FNS(Meta, meta) +BUFFER_FNS(Prio, prio)  #define bh_offset(bh)		((unsigned long)(bh)->b_data & ~PAGE_MASK) @@ -181,6 +185,7 @@ void ll_rw_block(int, int, struct buffer_head * bh[]);  int sync_dirty_buffer(struct buffer_head *bh);  int __sync_dirty_buffer(struct buffer_head *bh, int rw);  void write_dirty_buffer(struct buffer_head *bh, int rw); +int _submit_bh(int rw, struct buffer_head *bh, unsigned long bio_flags);  int submit_bh(int, struct buffer_head *);  void write_boundary_block(struct block_device *bdev,  			sector_t bblock, unsigned blocksize); diff --git a/include/linux/capability.h b/include/linux/capability.h index 98503b79236..d9a4f7f40f3 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -35,6 +35,7 @@ struct cpu_vfs_cap_data {  #define _KERNEL_CAP_T_SIZE     (sizeof(kernel_cap_t)) +struct file;  struct inode;  struct dentry;  struct user_namespace; @@ -211,6 +212,7 @@ extern bool capable(int cap);  extern bool ns_capable(struct user_namespace *ns, int cap);  extern bool nsown_capable(int cap);  extern bool inode_capable(const struct inode *inode, int cap); +extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);  /* audit system wants to get cap info from files as well */  extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps); diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 900af5964f5..3bff9ce09cf 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -19,6 +19,7 @@  #include <linux/idr.h>  #include <linux/workqueue.h>  #include <linux/xattr.h> +#include <linux/fs.h>  #ifdef CONFIG_CGROUPS @@ -30,10 +31,6 @@ struct css_id;  extern int cgroup_init_early(void);  extern int cgroup_init(void); -extern void cgroup_lock(void); -extern int cgroup_lock_is_held(void); -extern bool cgroup_lock_live_group(struct cgroup *cgrp); -extern void cgroup_unlock(void);  extern void cgroup_fork(struct task_struct *p);  extern void cgroup_post_fork(struct task_struct *p);  extern void cgroup_exit(struct task_struct *p, int run_callbacks); @@ -42,16 +39,27 @@ extern int cgroupstats_build(struct cgroupstats *stats,  extern int cgroup_load_subsys(struct cgroup_subsys *ss);  extern void cgroup_unload_subsys(struct cgroup_subsys *ss); -extern const struct file_operations proc_cgroup_operations; +extern int proc_cgroup_show(struct seq_file *, void *); -/* Define the enumeration of all builtin cgroup subsystems */ +/* + * Define the enumeration of all cgroup subsystems. + * + * We define ids for builtin subsystems and then modular ones. + */  #define SUBSYS(_x) _x ## _subsys_id, -#define IS_SUBSYS_ENABLED(option) IS_ENABLED(option)  enum cgroup_subsys_id { +#define IS_SUBSYS_ENABLED(option) IS_BUILTIN(option)  #include <linux/cgroup_subsys.h> +#undef IS_SUBSYS_ENABLED +	CGROUP_BUILTIN_SUBSYS_COUNT, + +	__CGROUP_SUBSYS_TEMP_PLACEHOLDER = CGROUP_BUILTIN_SUBSYS_COUNT - 1, + +#define IS_SUBSYS_ENABLED(option) IS_MODULE(option) +#include <linux/cgroup_subsys.h> +#undef IS_SUBSYS_ENABLED  	CGROUP_SUBSYS_COUNT,  }; -#undef IS_SUBSYS_ENABLED  #undef SUBSYS  /* Per-subsystem/per-cgroup state maintained by the system. */ @@ -148,6 +156,13 @@ enum {  	 * specified at mount time and thus is implemented here.  	 */  	CGRP_CPUSET_CLONE_CHILDREN, +	/* see the comment above CGRP_ROOT_SANE_BEHAVIOR for details */ +	CGRP_SANE_BEHAVIOR, +}; + +struct cgroup_name { +	struct rcu_head rcu_head; +	char name[];  };  struct cgroup { @@ -172,11 +187,23 @@ struct cgroup {  	struct cgroup *parent;		/* my parent */  	struct dentry *dentry;		/* cgroup fs entry, RCU protected */ +	/* +	 * This is a copy of dentry->d_name, and it's needed because +	 * we can't use dentry->d_name in cgroup_path(). +	 * +	 * You must acquire rcu_read_lock() to access cgrp->name, and +	 * the only place that can change it is rename(), which is +	 * protected by parent dir's i_mutex. +	 * +	 * Normally you should use cgroup_name() wrapper rather than +	 * access it directly. +	 */ +	struct cgroup_name __rcu *name; +  	/* Private pointers for each registered subsystem */  	struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];  	struct cgroupfs_root *root; -	struct cgroup *top_cgroup;  	/*  	 * List of cg_cgroup_links pointing at css_sets with @@ -213,6 +240,96 @@ struct cgroup {  	struct simple_xattrs xattrs;  }; +#define MAX_CGROUP_ROOT_NAMELEN 64 + +/* cgroupfs_root->flags */ +enum { +	/* +	 * Unfortunately, cgroup core and various controllers are riddled +	 * with idiosyncrasies and pointless options.  The following flag, +	 * when set, will force sane behavior - some options are forced on, +	 * others are disallowed, and some controllers will change their +	 * hierarchical or other behaviors. +	 * +	 * The set of behaviors affected by this flag are still being +	 * determined and developed and the mount option for this flag is +	 * prefixed with __DEVEL__.  The prefix will be dropped once we +	 * reach the point where all behaviors are compatible with the +	 * planned unified hierarchy, which will automatically turn on this +	 * flag. +	 * +	 * The followings are the behaviors currently affected this flag. +	 * +	 * - Mount options "noprefix" and "clone_children" are disallowed. +	 *   Also, cgroupfs file cgroup.clone_children is not created. +	 * +	 * - When mounting an existing superblock, mount options should +	 *   match. +	 * +	 * - Remount is disallowed. +	 * +	 * - memcg: use_hierarchy is on by default and the cgroup file for +	 *   the flag is not created. +	 * +	 * The followings are planned changes. +	 * +	 * - release_agent will be disallowed once replacement notification +	 *   mechanism is implemented. +	 */ +	CGRP_ROOT_SANE_BEHAVIOR	= (1 << 0), + +	CGRP_ROOT_NOPREFIX	= (1 << 1), /* mounted subsystems have no named prefix */ +	CGRP_ROOT_XATTR		= (1 << 2), /* supports extended attributes */ +}; + +/* + * A cgroupfs_root represents the root of a cgroup hierarchy, and may be + * associated with a superblock to form an active hierarchy.  This is + * internal to cgroup core.  Don't access directly from controllers. + */ +struct cgroupfs_root { +	struct super_block *sb; + +	/* +	 * The bitmask of subsystems intended to be attached to this +	 * hierarchy +	 */ +	unsigned long subsys_mask; + +	/* Unique id for this hierarchy. */ +	int hierarchy_id; + +	/* The bitmask of subsystems currently attached to this hierarchy */ +	unsigned long actual_subsys_mask; + +	/* A list running through the attached subsystems */ +	struct list_head subsys_list; + +	/* The root cgroup for this hierarchy */ +	struct cgroup top_cgroup; + +	/* Tracks how many cgroups are currently defined in hierarchy.*/ +	int number_of_cgroups; + +	/* A list running through the active hierarchies */ +	struct list_head root_list; + +	/* All cgroups on this root, cgroup_mutex protected */ +	struct list_head allcg_list; + +	/* Hierarchy-specific flags */ +	unsigned long flags; + +	/* IDs for cgroups in this hierarchy */ +	struct ida cgroup_ida; + +	/* The path to use for release notifications. */ +	char release_agent_path[PATH_MAX]; + +	/* The name for this hierarchy - may be empty */ +	char name[MAX_CGROUP_ROOT_NAMELEN]; +}; +  /*   * A css_set is a structure holding pointers to a set of   * cgroup_subsys_state objects. This saves space in the task struct @@ -278,6 +395,7 @@ struct cgroup_map_cb {  /* cftype->flags */  #define CFTYPE_ONLY_ON_ROOT	(1U << 0)	/* only create on root cg */  #define CFTYPE_NOT_ON_ROOT	(1U << 1)	/* don't create on root cg */ +#define CFTYPE_INSANE		(1U << 2)	/* don't create if sane_behavior */  #define MAX_CFTYPE_NAME		64 @@ -304,9 +422,6 @@ struct cftype {  	/* CFTYPE_* flags */  	unsigned int flags; -	/* file xattrs */ -	struct simple_xattrs xattrs; -  	int (*open)(struct inode *inode, struct file *file);  	ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft,  			struct file *file, @@ -404,18 +519,31 @@ struct cgroup_scanner {  	void *data;  }; +/* + * See the comment above CGRP_ROOT_SANE_BEHAVIOR for details.  This + * function can be called as long as @cgrp is accessible. + */ +static inline bool cgroup_sane_behavior(const struct cgroup *cgrp) +{ +	return cgrp->root->flags & CGRP_ROOT_SANE_BEHAVIOR; +} + +/* Caller should hold rcu_read_lock() */ +static inline const char *cgroup_name(const struct cgroup *cgrp) +{ +	return rcu_dereference(cgrp->name)->name; +} +  int cgroup_add_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);  int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts);  int cgroup_is_removed(const struct cgroup *cgrp); +bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor);  int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);  int cgroup_task_count(const struct cgroup *cgrp); -/* Return true if cgrp is a descendant of the task's cgroup */ -int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task); -  /*   * Control Group taskset, used to pass around set of tasks to cgroup_subsys   * methods. @@ -458,7 +586,6 @@ struct cgroup_subsys {  	void (*bind)(struct cgroup *root);  	int subsys_id; -	int active;  	int disabled;  	int early_init;  	/* @@ -523,10 +650,16 @@ static inline struct cgroup_subsys_state *cgroup_subsys_state(   * rcu_dereference_check() conditions, such as locks used during the   * cgroup_subsys::attach() methods.   */ +#ifdef CONFIG_PROVE_RCU +extern struct mutex cgroup_mutex;  #define task_subsys_state_check(task, subsys_id, __c)			\ -	rcu_dereference_check(task->cgroups->subsys[subsys_id],		\ -			      lockdep_is_held(&task->alloc_lock) ||	\ -			      cgroup_lock_is_held() || (__c)) +	rcu_dereference_check((task)->cgroups->subsys[(subsys_id)],	\ +			      lockdep_is_held(&(task)->alloc_lock) ||	\ +			      lockdep_is_held(&cgroup_mutex) || (__c)) +#else +#define task_subsys_state_check(task, subsys_id, __c)			\ +	rcu_dereference((task)->cgroups->subsys[(subsys_id)]) +#endif  static inline struct cgroup_subsys_state *  task_subsys_state(struct task_struct *task, int subsys_id) @@ -661,8 +794,8 @@ struct task_struct *cgroup_iter_next(struct cgroup *cgrp,  					struct cgroup_iter *it);  void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);  int cgroup_scan_tasks(struct cgroup_scanner *scan); -int cgroup_attach_task(struct cgroup *, struct task_struct *);  int cgroup_attach_task_all(struct task_struct *from, struct task_struct *); +int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from);  /*   * CSS ID is ID for cgroup_subsys_state structs under subsys. This only works @@ -687,13 +820,6 @@ void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css);  struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id); -/* - * Get a cgroup whose id is greater than or equal to id under tree of root. - * Returning a cgroup_subsys_state or NULL. - */ -struct cgroup_subsys_state *css_get_next(struct cgroup_subsys *ss, int id, -		struct cgroup_subsys_state *root, int *foundid); -  /* Returns true if root is ancestor of cg */  bool css_is_ancestor(struct cgroup_subsys_state *cg,  		     const struct cgroup_subsys_state *root); diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h index 42e55deee75..4ce9056b31a 100644 --- a/include/linux/cleancache.h +++ b/include/linux/cleancache.h @@ -33,7 +33,7 @@ struct cleancache_ops {  	void (*invalidate_fs)(int);  }; -extern struct cleancache_ops +extern struct cleancache_ops *  	cleancache_register_ops(struct cleancache_ops *ops);  extern void __cleancache_init_fs(struct super_block *);  extern void __cleancache_init_shared_fs(char *, struct super_block *); @@ -42,9 +42,9 @@ extern void __cleancache_put_page(struct page *);  extern void __cleancache_invalidate_page(struct address_space *, struct page *);  extern void __cleancache_invalidate_inode(struct address_space *);  extern void __cleancache_invalidate_fs(struct super_block *); -extern int cleancache_enabled;  #ifdef CONFIG_CLEANCACHE +#define cleancache_enabled (1)  static inline bool cleancache_fs_enabled(struct page *page)  {  	return page->mapping->host->i_sb->cleancache_poolid >= 0; diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h index 9c7f5807824..dd7adff76e8 100644 --- a/include/linux/clk-private.h +++ b/include/linux/clk-private.h @@ -152,7 +152,7 @@ struct clk {  		},						\  		.reg = _reg,					\  		.shift = _shift,				\ -		.width = _width,				\ +		.mask = BIT(_width) - 1,			\  		.flags = _mux_flags,				\  		.lock = _lock,					\  	};							\ diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 7f197d7addb..11860985fec 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -45,6 +45,14 @@ struct clk_hw;   * 		undo any work done in the @prepare callback. Called with   * 		prepare_lock held.   * + * @is_prepared: Queries the hardware to determine if the clock is prepared. + *		This function is allowed to sleep. Optional, if this op is not + *		set then the prepare count will be used. + * + * @unprepare_unused: Unprepare the clock atomically.  Only called from + *		clk_disable_unused for prepare clocks with special needs. + *		Called with prepare mutex held. This function may sleep. + *   * @enable:	Enable the clock atomically. This must not return until the   * 		clock is generating a valid clock signal, usable by consumer   * 		devices. Called with enable_lock held. This function must not @@ -108,6 +116,8 @@ struct clk_hw;  struct clk_ops {  	int		(*prepare)(struct clk_hw *hw);  	void		(*unprepare)(struct clk_hw *hw); +	int		(*is_prepared)(struct clk_hw *hw); +	void		(*unprepare_unused)(struct clk_hw *hw);  	int		(*enable)(struct clk_hw *hw);  	void		(*disable)(struct clk_hw *hw);  	int		(*is_enabled)(struct clk_hw *hw); @@ -239,9 +249,14 @@ struct clk_div_table {   * CLK_DIVIDER_ONE_BASED - by default the divisor is the value read from the   * 	register plus one.  If CLK_DIVIDER_ONE_BASED is set then the divider is   * 	the raw value read from the register, with the value of zero considered - * 	invalid + *	invalid, unless CLK_DIVIDER_ALLOW_ZERO is set.   * CLK_DIVIDER_POWER_OF_TWO - clock divisor is 2 raised to the value read from   * 	the hardware register + * CLK_DIVIDER_ALLOW_ZERO - Allow zero divisors.  For dividers which have + *	CLK_DIVIDER_ONE_BASED set, it is possible to end up with a zero divisor. + *	Some hardware implementations gracefully handle this case and allow a + *	zero divisor by not modifying their input clock + *	(divide by one / bypass).   */  struct clk_divider {  	struct clk_hw	hw; @@ -255,6 +270,7 @@ struct clk_divider {  #define CLK_DIVIDER_ONE_BASED		BIT(0)  #define CLK_DIVIDER_POWER_OF_TWO	BIT(1) +#define CLK_DIVIDER_ALLOW_ZERO		BIT(2)  extern const struct clk_ops clk_divider_ops;  struct clk *clk_register_divider(struct device *dev, const char *name, @@ -274,7 +290,7 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,   * @reg:	register controlling multiplexer   * @shift:	shift to multiplexer bit field   * @width:	width of mutliplexer bit field - * @num_clks:	number of parent clocks + * @flags:	hardware-specific flags   * @lock:	register lock   *   * Clock with multiple selectable parents.  Implements .get_parent, .set_parent @@ -287,8 +303,9 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name,  struct clk_mux {  	struct clk_hw	hw;  	void __iomem	*reg; +	u32		*table; +	u32		mask;  	u8		shift; -	u8		width;  	u8		flags;  	spinlock_t	*lock;  }; @@ -297,11 +314,19 @@ struct clk_mux {  #define CLK_MUX_INDEX_BIT		BIT(1)  extern const struct clk_ops clk_mux_ops; +  struct clk *clk_register_mux(struct device *dev, const char *name,  		const char **parent_names, u8 num_parents, unsigned long flags,  		void __iomem *reg, u8 shift, u8 width,  		u8 clk_mux_flags, spinlock_t *lock); +struct clk *clk_register_mux_table(struct device *dev, const char *name, +		const char **parent_names, u8 num_parents, unsigned long flags, +		void __iomem *reg, u8 shift, u32 mask, +		u8 clk_mux_flags, u32 *table, spinlock_t *lock); + +void of_fixed_factor_clk_setup(struct device_node *node); +  /**   * struct clk_fixed_factor - fixed multiplier and divider clock   * @@ -325,6 +350,37 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name,  		const char *parent_name, unsigned long flags,  		unsigned int mult, unsigned int div); +/*** + * struct clk_composite - aggregate clock of mux, divider and gate clocks + * + * @hw:		handle between common and hardware-specific interfaces + * @mux_hw:	handle between composite and hardware-specific mux clock + * @rate_hw:	handle between composite and hardware-specific rate clock + * @gate_hw:	handle between composite and hardware-specific gate clock + * @mux_ops:	clock ops for mux + * @rate_ops:	clock ops for rate + * @gate_ops:	clock ops for gate + */ +struct clk_composite { +	struct clk_hw	hw; +	struct clk_ops	ops; + +	struct clk_hw	*mux_hw; +	struct clk_hw	*rate_hw; +	struct clk_hw	*gate_hw; + +	const struct clk_ops	*mux_ops; +	const struct clk_ops	*rate_ops; +	const struct clk_ops	*gate_ops; +}; + +struct clk *clk_register_composite(struct device *dev, const char *name, +		const char **parent_names, int num_parents, +		struct clk_hw *mux_hw, const struct clk_ops *mux_ops, +		struct clk_hw *rate_hw, const struct clk_ops *rate_ops, +		struct clk_hw *gate_hw, const struct clk_ops *gate_ops, +		unsigned long flags); +  /**   * clk_register - allocate a new clock, register it and return an opaque cookie   * @dev: device that is registering this clock @@ -351,6 +407,7 @@ unsigned int __clk_get_enable_count(struct clk *clk);  unsigned int __clk_get_prepare_count(struct clk *clk);  unsigned long __clk_get_rate(struct clk *clk);  unsigned long __clk_get_flags(struct clk *clk); +bool __clk_is_prepared(struct clk *clk);  bool __clk_is_enabled(struct clk *clk);  struct clk *__clk_lookup(const char *name); diff --git a/include/linux/clk.h b/include/linux/clk.h index b3ac22d0fc1..9a6d04524b1 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -28,16 +28,16 @@ struct clk;   * PRE_RATE_CHANGE - called immediately before the clk rate is changed,   *     to indicate that the rate change will proceed.  Drivers must   *     immediately terminate any operations that will be affected by the - *     rate change.  Callbacks may either return NOTIFY_DONE or - *     NOTIFY_STOP. + *     rate change.  Callbacks may either return NOTIFY_DONE, NOTIFY_OK, + *     NOTIFY_STOP or NOTIFY_BAD.   *   * ABORT_RATE_CHANGE: called if the rate change failed for some reason   *     after PRE_RATE_CHANGE.  In this case, all registered notifiers on   *     the clk will be called with ABORT_RATE_CHANGE. Callbacks must - *     always return NOTIFY_DONE. + *     always return NOTIFY_DONE or NOTIFY_OK.   *   * POST_RATE_CHANGE - called after the clk rate change has successfully - *     completed.  Callbacks must always return NOTIFY_DONE. + *     completed.  Callbacks must always return NOTIFY_DONE or NOTIFY_OK.   *   */  #define PRE_RATE_CHANGE			BIT(0) diff --git a/include/linux/clk/mxs.h b/include/linux/clk/mxs.h new file mode 100644 index 00000000000..90c30dc3efc --- /dev/null +++ b/include/linux/clk/mxs.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) 2013 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __LINUX_CLK_MXS_H +#define __LINUX_CLK_MXS_H + +int mx23_clocks_init(void); +int mx28_clocks_init(void); +int mxs_saif_clkmux_select(unsigned int clkmux); + +#endif diff --git a/include/linux/sunxi_timer.h b/include/linux/clk/sunxi.h index 18081787e5f..e074fdd5a23 100644 --- a/include/linux/sunxi_timer.h +++ b/include/linux/clk/sunxi.h @@ -14,11 +14,9 @@   * GNU General Public License for more details.   */ -#ifndef __SUNXI_TIMER_H -#define __SUNXI_TIMER_H +#ifndef __LINUX_CLK_SUNXI_H_ +#define __LINUX_CLK_SUNXI_H_ -#include <asm/mach/time.h> - -void sunxi_timer_init(void); +void __init sunxi_init_clocks(void);  #endif diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h index 66346521cb6..963d7143138 100644 --- a/include/linux/clockchips.h +++ b/include/linux/clockchips.h @@ -8,6 +8,20 @@  #ifndef _LINUX_CLOCKCHIPS_H  #define _LINUX_CLOCKCHIPS_H +/* Clock event notification values */ +enum clock_event_nofitiers { +	CLOCK_EVT_NOTIFY_ADD, +	CLOCK_EVT_NOTIFY_BROADCAST_ON, +	CLOCK_EVT_NOTIFY_BROADCAST_OFF, +	CLOCK_EVT_NOTIFY_BROADCAST_FORCE, +	CLOCK_EVT_NOTIFY_BROADCAST_ENTER, +	CLOCK_EVT_NOTIFY_BROADCAST_EXIT, +	CLOCK_EVT_NOTIFY_SUSPEND, +	CLOCK_EVT_NOTIFY_RESUME, +	CLOCK_EVT_NOTIFY_CPU_DYING, +	CLOCK_EVT_NOTIFY_CPU_DEAD, +}; +  #ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD  #include <linux/clocksource.h> @@ -26,20 +40,6 @@ enum clock_event_mode {  	CLOCK_EVT_MODE_RESUME,  }; -/* Clock event notification values */ -enum clock_event_nofitiers { -	CLOCK_EVT_NOTIFY_ADD, -	CLOCK_EVT_NOTIFY_BROADCAST_ON, -	CLOCK_EVT_NOTIFY_BROADCAST_OFF, -	CLOCK_EVT_NOTIFY_BROADCAST_FORCE, -	CLOCK_EVT_NOTIFY_BROADCAST_ENTER, -	CLOCK_EVT_NOTIFY_BROADCAST_EXIT, -	CLOCK_EVT_NOTIFY_SUSPEND, -	CLOCK_EVT_NOTIFY_RESUME, -	CLOCK_EVT_NOTIFY_CPU_DYING, -	CLOCK_EVT_NOTIFY_CPU_DEAD, -}; -  /*   * Clock event features   */ @@ -55,6 +55,11 @@ enum clock_event_nofitiers {  #define CLOCK_EVT_FEAT_C3STOP		0x000008  #define CLOCK_EVT_FEAT_DUMMY		0x000010 +/* + * Core shall set the interrupt affinity dynamically in broadcast mode + */ +#define CLOCK_EVT_FEAT_DYNIRQ		0x000020 +  /**   * struct clock_event_device - clock event device descriptor   * @event_handler:	Assigned by the framework to be called by the low @@ -170,10 +175,16 @@ extern void tick_broadcast(const struct cpumask *mask);  extern int tick_receive_broadcast(void);  #endif +#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) +extern int tick_check_broadcast_expired(void); +#else +static inline int tick_check_broadcast_expired(void) { return 0; } +#endif +  #ifdef CONFIG_GENERIC_CLOCKEVENTS  extern void clockevents_notify(unsigned long reason, void *arg);  #else -# define clockevents_notify(reason, arg) do { } while (0) +static inline void clockevents_notify(unsigned long reason, void *arg) {}  #endif  #else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */ @@ -181,7 +192,8 @@ extern void clockevents_notify(unsigned long reason, void *arg);  static inline void clockevents_suspend(void) {}  static inline void clockevents_resume(void) {} -#define clockevents_notify(reason, arg) do { } while (0) +static inline void clockevents_notify(unsigned long reason, void *arg) {} +static inline int tick_check_broadcast_expired(void) { return 0; }  #endif diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 27cfda427dd..7279b94c01d 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h @@ -206,6 +206,7 @@ struct clocksource {  #define CLOCK_SOURCE_WATCHDOG			0x10  #define CLOCK_SOURCE_VALID_FOR_HRES		0x20  #define CLOCK_SOURCE_UNSTABLE			0x40 +#define CLOCK_SOURCE_SUSPEND_NONSTOP		0x80  /* simplify initialization of mask field */  #define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) @@ -332,15 +333,23 @@ extern int clocksource_mmio_init(void __iomem *, const char *,  extern int clocksource_i8253_init(void); +struct device_node; +typedef void(*clocksource_of_init_fn)(struct device_node *);  #ifdef CONFIG_CLKSRC_OF  extern void clocksource_of_init(void);  #define CLOCKSOURCE_OF_DECLARE(name, compat, fn)			\  	static const struct of_device_id __clksrc_of_table_##name	\  		__used __section(__clksrc_of_table)			\ -		 = { .compatible = compat, .data = fn }; +		 = { .compatible = compat,				\ +		     .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }  #else -#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) +static inline void clocksource_of_init(void) {} +#define CLOCKSOURCE_OF_DECLARE(name, compat, fn)			\ +	static const struct of_device_id __clksrc_of_table_##name	\ +		__attribute__((unused))					\ +		 = { .compatible = compat,				\ +		     .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }  #endif  #endif /* _LINUX_CLOCKSOURCE_H */ diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h index 2c1bc1ea04e..1d5b02a96c4 100644 --- a/include/linux/cn_proc.h +++ b/include/linux/cn_proc.h @@ -26,6 +26,7 @@ void proc_id_connector(struct task_struct *task, int which_id);  void proc_sid_connector(struct task_struct *task);  void proc_ptrace_connector(struct task_struct *task, int which_id);  void proc_comm_connector(struct task_struct *task); +void proc_coredump_connector(struct task_struct *task);  void proc_exit_connector(struct task_struct *task);  #else  static inline void proc_fork_connector(struct task_struct *task) @@ -48,6 +49,9 @@ static inline void proc_ptrace_connector(struct task_struct *task,  					 int ptrace_id)  {} +static inline void proc_coredump_connector(struct task_struct *task) +{} +  static inline void proc_exit_connector(struct task_struct *task)  {}  #endif	/* CONFIG_PROC_EVENTS */ diff --git a/include/linux/compat.h b/include/linux/compat.h index 76a87fb57ac..d53c35352ea 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -27,12 +27,6 @@  #define __SC_DELOUSE(t,v) ((t)(unsigned long)(v))  #endif -#define __SC_CCAST1(t1, a1)      __SC_DELOUSE(t1,a1) -#define __SC_CCAST2(t2, a2, ...) __SC_DELOUSE(t2,a2), __SC_CCAST1(__VA_ARGS__) -#define __SC_CCAST3(t3, a3, ...) __SC_DELOUSE(t3,a3), __SC_CCAST2(__VA_ARGS__) -#define __SC_CCAST4(t4, a4, ...) __SC_DELOUSE(t4,a4), __SC_CCAST3(__VA_ARGS__) -#define __SC_CCAST5(t5, a5, ...) __SC_DELOUSE(t5,a5), __SC_CCAST4(__VA_ARGS__) -#define __SC_CCAST6(t6, a6, ...) __SC_DELOUSE(t6,a6), __SC_CCAST5(__VA_ARGS__)  #define COMPAT_SYSCALL_DEFINE1(name, ...) \          COMPAT_SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)  #define COMPAT_SYSCALL_DEFINE2(name, ...) \ @@ -46,24 +40,15 @@  #define COMPAT_SYSCALL_DEFINE6(name, ...) \  	COMPAT_SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) -#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS -  #define COMPAT_SYSCALL_DEFINEx(x, name, ...)				\ -	asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__));	\ -	static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__));	\ -	asmlinkage long compat_SyS##name(__SC_LONG##x(__VA_ARGS__))	\ +	asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ +	static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));\ +	asmlinkage long compat_SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))\  	{								\ -		return (long) C_SYSC##name(__SC_CCAST##x(__VA_ARGS__));	\ +		return C_SYSC##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));	\  	}								\  	SYSCALL_ALIAS(compat_sys##name, compat_SyS##name);		\ -	static inline long C_SYSC##name(__SC_DECL##x(__VA_ARGS__)) - -#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ - -#define COMPAT_SYSCALL_DEFINEx(x, name, ...)				\ -	asmlinkage long compat_sys##name(__SC_DECL##x(__VA_ARGS__)) - -#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ +	static inline long C_SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))  #ifndef compat_user_stack_pointer  #define compat_user_stack_pointer() current_user_stack_pointer() @@ -141,11 +126,11 @@ typedef struct {  } compat_sigset_t;  struct compat_sigaction { -#ifndef __ARCH_HAS_ODD_SIGACTION +#ifndef __ARCH_HAS_IRIX_SIGACTION  	compat_uptr_t			sa_handler;  	compat_ulong_t			sa_flags;  #else -	compat_ulong_t			sa_flags; +	compat_uint_t			sa_flags;  	compat_uptr_t			sa_handler;  #endif  #ifdef __ARCH_HAS_SA_RESTORER @@ -326,21 +311,13 @@ asmlinkage long  compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,  			   compat_size_t __user *len_ptr); -#ifdef CONFIG_ARCH_WANT_OLD_COMPAT_IPC -long compat_sys_semctl(int first, int second, int third, void __user *uptr); -long compat_sys_msgsnd(int first, int second, int third, void __user *uptr); -long compat_sys_msgrcv(int first, int second, int msgtyp, int third, -		int version, void __user *uptr); -long compat_sys_shmat(int first, int second, compat_uptr_t third, int version, -		void __user *uptr); -#else -long compat_sys_semctl(int semid, int semnum, int cmd, int arg); -long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp, +asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32); +asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg); +asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg); +asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp,  		compat_ssize_t msgsz, int msgflg); -long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp, +asmlinkage long compat_sys_msgrcv(int msqid, compat_uptr_t msgp,  		compat_ssize_t msgsz, long msgtyp, int msgflg); -long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg); -#endif  long compat_sys_msgctl(int first, int second, void __user *uptr);  long compat_sys_shmctl(int first, int second, void __user *uptr);  long compat_sys_semtimedop(int semid, struct sembuf __user *tsems, @@ -444,13 +421,13 @@ extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,  asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,  				  compat_long_t addr, compat_long_t data); +asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, size_t);  /*   * epoll (fs/eventpoll.c) compat bits follow ...   */ -struct epoll_event; -#define compat_epoll_event	epoll_event +struct epoll_event;	/* fortunately, this one is fixed-layout */  asmlinkage long compat_sys_epoll_pwait(int epfd, -			struct compat_epoll_event __user *events, +			struct epoll_event __user *events,  			int maxevents, int timeout,  			const compat_sigset_t __user *sigmask,  			compat_size_t sigsetsize); @@ -685,6 +662,8 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,  asmlinkage long compat_sys_sendfile(int out_fd, int in_fd,  				    compat_off_t __user *offset, compat_size_t count); +asmlinkage long compat_sys_sendfile64(int out_fd, int in_fd, +				    compat_loff_t __user *offset, compat_size_t count);  asmlinkage long compat_sys_sigaltstack(const compat_stack_t __user *uss_ptr,  				       compat_stack_t __user *uoss_ptr); diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index 68b162d9225..842de225055 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h @@ -13,7 +13,7 @@  #define __must_check 		__attribute__((warn_unused_result))  #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) -#if GCC_VERSION >= 40100 +#if GCC_VERSION >= 40100 && GCC_VERSION < 40600  # define __compiletime_object_size(obj) __builtin_object_size(obj, 0)  #endif diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 10b8f23fab0..92669cd182a 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -351,4 +351,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);   */  #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) +/* Ignore/forbid kprobes attach on very low level functions marked by this attribute: */ +#ifdef CONFIG_KPROBES +# define __kprobes	__attribute__((__section__(".kprobes.text"))) +#else +# define __kprobes +#endif  #endif /* __LINUX_COMPILER_H */ diff --git a/include/linux/console.h b/include/linux/console.h index 29680a8cda9..73bab0f58af 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -141,6 +141,7 @@ struct console {  	for (con = console_drivers; con != NULL; con = con->next)  extern int console_set_on_cmdline; +extern struct console *early_console;  extern int add_preferred_console(char *name, int idx, char *options);  extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options); diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h index b28d161c109..365f4a61bf0 100644 --- a/include/linux/context_tracking.h +++ b/include/linux/context_tracking.h @@ -1,9 +1,9 @@  #ifndef _LINUX_CONTEXT_TRACKING_H  #define _LINUX_CONTEXT_TRACKING_H -#ifdef CONFIG_CONTEXT_TRACKING  #include <linux/sched.h>  #include <linux/percpu.h> +#include <asm/ptrace.h>  struct context_tracking {  	/* @@ -13,12 +13,13 @@ struct context_tracking {  	 * may be further optimized using static keys.  	 */  	bool active; -	enum { +	enum ctx_state {  		IN_KERNEL = 0,  		IN_USER,  	} state;  }; +#ifdef CONFIG_CONTEXT_TRACKING  DECLARE_PER_CPU(struct context_tracking, context_tracking);  static inline bool context_tracking_in_user(void) @@ -33,12 +34,31 @@ static inline bool context_tracking_active(void)  extern void user_enter(void);  extern void user_exit(void); + +static inline enum ctx_state exception_enter(void) +{ +	enum ctx_state prev_ctx; + +	prev_ctx = this_cpu_read(context_tracking.state); +	user_exit(); + +	return prev_ctx; +} + +static inline void exception_exit(enum ctx_state prev_ctx) +{ +	if (prev_ctx == IN_USER) +		user_enter(); +} +  extern void context_tracking_task_switch(struct task_struct *prev,  					 struct task_struct *next);  #else  static inline bool context_tracking_in_user(void) { return false; }  static inline void user_enter(void) { }  static inline void user_exit(void) { } +static inline enum ctx_state exception_enter(void) { return 0; } +static inline void exception_exit(enum ctx_state prev_ctx) { }  static inline void context_tracking_task_switch(struct task_struct *prev,  						struct task_struct *next) { }  #endif /* !CONFIG_CONTEXT_TRACKING */ diff --git a/include/linux/cpu.h b/include/linux/cpu.h index ce7a074f251..c6f6e0839b6 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -212,4 +212,20 @@ static inline int disable_nonboot_cpus(void) { return 0; }  static inline void enable_nonboot_cpus(void) {}  #endif /* !CONFIG_PM_SLEEP_SMP */ +enum cpuhp_state { +	CPUHP_OFFLINE, +	CPUHP_ONLINE, +}; + +void cpu_startup_entry(enum cpuhp_state state); +void cpu_idle(void); + +void cpu_idle_poll_ctrl(bool enable); + +void arch_cpu_idle(void); +void arch_cpu_idle_prepare(void); +void arch_cpu_idle_enter(void); +void arch_cpu_idle_exit(void); +void arch_cpu_idle_dead(void); +  #endif /* _LINUX_CPU_H_ */ diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index a22944ca052..037d36ae63e 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -106,6 +106,7 @@ struct cpufreq_policy {  					 * governors are used */  	unsigned int		policy; /* see above */  	struct cpufreq_governor	*governor; /* see below */ +	void			*governor_data;  	struct work_struct	update; /* if update_policy() needs to be  					 * called, but you're in IRQ context */ @@ -178,9 +179,11 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mu   *                          CPUFREQ GOVERNORS                        *   *********************************************************************/ -#define CPUFREQ_GOV_START  1 -#define CPUFREQ_GOV_STOP   2 -#define CPUFREQ_GOV_LIMITS 3 +#define CPUFREQ_GOV_START	1 +#define CPUFREQ_GOV_STOP	2 +#define CPUFREQ_GOV_LIMITS	3 +#define CPUFREQ_GOV_POLICY_INIT	4 +#define CPUFREQ_GOV_POLICY_EXIT	5  struct cpufreq_governor {  	char	name[CPUFREQ_NAME_LEN]; @@ -229,6 +232,13 @@ struct cpufreq_driver {  	struct module           *owner;  	char			name[CPUFREQ_NAME_LEN];  	u8			flags; +	/* +	 * This should be set by platforms having multiple clock-domains, i.e. +	 * supporting multiple policies. With this sysfs directories of governor +	 * would be created in cpu/cpu<num>/cpufreq/ directory and so they can +	 * use the same governor with different tunables for different clusters. +	 */ +	bool			have_governor_per_policy;  	/* needed by all drivers */  	int	(*init)		(struct cpufreq_policy *policy); @@ -268,8 +278,8 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data);  int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); -void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state); - +void cpufreq_notify_transition(struct cpufreq_policy *policy, +		struct cpufreq_freqs *freqs, unsigned int state);  static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max)  { @@ -329,6 +339,7 @@ const char *cpufreq_get_current_driver(void);   *********************************************************************/  int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);  int cpufreq_update_policy(unsigned int cpu); +bool have_governor_per_policy(void);  #ifdef CONFIG_CPU_FREQ  /* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 480c14dc1dd..3c86faa5979 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -57,6 +57,7 @@ struct cpuidle_state {  /* Idle State Flags */  #define CPUIDLE_FLAG_TIME_VALID	(0x01) /* is residency time measurable? */  #define CPUIDLE_FLAG_COUPLED	(0x02) /* state applies to multiple cpus */ +#define CPUIDLE_FLAG_TIMER_STOP (0x04)  /* timer is stopped on this state */  #define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000) @@ -104,8 +105,8 @@ struct cpuidle_driver {  	struct module 		*owner;  	int                     refcnt; -	/* set to 1 to use the core cpuidle time keeping (for all states). */ -	unsigned int		en_core_tk_irqen:1; +        /* used by the cpuidle framework to setup the broadcast timer */ +	unsigned int            bctimer:1;  	/* states array must be ordered in decreasing power consumption */  	struct cpuidle_state	states[CPUIDLE_STATE_MAX];  	int			state_count; @@ -122,17 +123,15 @@ extern void cpuidle_driver_unref(void);  extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);  extern int cpuidle_register_device(struct cpuidle_device *dev);  extern void cpuidle_unregister_device(struct cpuidle_device *dev); - +extern int cpuidle_register(struct cpuidle_driver *drv, +			    const struct cpumask *const coupled_cpus); +extern void cpuidle_unregister(struct cpuidle_driver *drv);  extern void cpuidle_pause_and_lock(void);  extern void cpuidle_resume_and_unlock(void);  extern void cpuidle_pause(void);  extern void cpuidle_resume(void);  extern int cpuidle_enable_device(struct cpuidle_device *dev);  extern void cpuidle_disable_device(struct cpuidle_device *dev); -extern int cpuidle_wrap_enter(struct cpuidle_device *dev, -				struct cpuidle_driver *drv, int index, -				int (*enter)(struct cpuidle_device *dev, -					struct cpuidle_driver *drv, int index));  extern int cpuidle_play_dead(void);  extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev); @@ -151,7 +150,10 @@ static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }  static inline int cpuidle_register_device(struct cpuidle_device *dev)  {return -ENODEV; }  static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { } - +static inline int cpuidle_register(struct cpuidle_driver *drv, +				   const struct cpumask *const coupled_cpus) +{return -ENODEV; } +static inline void cpuidle_unregister(struct cpuidle_driver *drv) { }  static inline void cpuidle_pause_and_lock(void) { }  static inline void cpuidle_resume_and_unlock(void) { }  static inline void cpuidle_pause(void) { } @@ -159,11 +161,6 @@ static inline void cpuidle_resume(void) { }  static inline int cpuidle_enable_device(struct cpuidle_device *dev)  {return -ENODEV; }  static inline void cpuidle_disable_device(struct cpuidle_device *dev) { } -static inline int cpuidle_wrap_enter(struct cpuidle_device *dev, -				struct cpuidle_driver *drv, int index, -				int (*enter)(struct cpuidle_device *dev, -					struct cpuidle_driver *drv, int index)) -{ return -ENODEV; }  static inline int cpuidle_play_dead(void) {return -ENODEV; }  #endif diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 032560295fc..d08e4d2a9b9 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -591,6 +591,21 @@ static inline int cpulist_scnprintf(char *buf, int len,  }  /** + * cpumask_parse - extract a cpumask from from a string + * @buf: the buffer to extract from + * @dstp: the cpumask to set. + * + * Returns -errno, or 0 for success. + */ +static inline int cpumask_parse(const char *buf, struct cpumask *dstp) +{ +	char *nl = strchr(buf, '\n'); +	int len = nl ? nl - buf : strlen(buf); + +	return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits); +} + +/**   * cpulist_parse - extract a cpumask from a user string of ranges   * @buf: the buffer to extract from   * @dstp: the cpumask to set. diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h index 8c8a60d2940..cc1b01cf203 100644 --- a/include/linux/cpuset.h +++ b/include/linux/cpuset.h @@ -11,7 +11,6 @@  #include <linux/sched.h>  #include <linux/cpumask.h>  #include <linux/nodemask.h> -#include <linux/cgroup.h>  #include <linux/mm.h>  #ifdef CONFIG_CPUSETS @@ -64,10 +63,9 @@ extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,  extern int cpuset_memory_pressure_enabled;  extern void __cpuset_memory_pressure_bump(void); -extern const struct file_operations proc_cpuset_operations; -struct seq_file;  extern void cpuset_task_status_allowed(struct seq_file *m,  					struct task_struct *task); +extern int proc_cpuset_show(struct seq_file *, void *);  extern int cpuset_mem_spread_node(void);  extern int cpuset_slab_spread_node(void); diff --git a/include/linux/ctype.h b/include/linux/ctype.h index 8acfe312f94..653589e3e30 100644 --- a/include/linux/ctype.h +++ b/include/linux/ctype.h @@ -61,4 +61,10 @@ static inline char _tolower(const char c)  	return c | 0x20;  } +/* Fast check for octal digit */ +static inline int isodigit(const char c) +{ +	return c >= '0' && c <= '7'; +} +  #endif diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index 3bd46f76675..21ca773f77b 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h @@ -27,7 +27,7 @@ extern int debug_locks_off(void);  									\  	if (!oops_in_progress && unlikely(c)) {				\  		if (debug_locks_off() && !debug_locks_silent)		\ -			WARN_ON(1);					\ +			WARN(1, "DEBUG_LOCKS_WARN_ON(%s)", #c);		\  		__ret = 1;						\  	}								\  	__ret;								\ diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index e83ef39b3be..fe8c4476f7e 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -213,7 +213,7 @@ struct devfreq_simple_ondemand_data {  #endif  #else /* !CONFIG_PM_DEVFREQ */ -static struct devfreq *devfreq_add_device(struct device *dev, +static inline struct devfreq *devfreq_add_device(struct device *dev,  					  struct devfreq_dev_profile *profile,  					  const char *governor_name,  					  void *data) @@ -221,34 +221,34 @@ static struct devfreq *devfreq_add_device(struct device *dev,  	return NULL;  } -static int devfreq_remove_device(struct devfreq *devfreq) +static inline int devfreq_remove_device(struct devfreq *devfreq)  {  	return 0;  } -static int devfreq_suspend_device(struct devfreq *devfreq) +static inline int devfreq_suspend_device(struct devfreq *devfreq)  {  	return 0;  } -static int devfreq_resume_device(struct devfreq *devfreq) +static inline int devfreq_resume_device(struct devfreq *devfreq)  {  	return 0;  } -static struct opp *devfreq_recommended_opp(struct device *dev, +static inline struct opp *devfreq_recommended_opp(struct device *dev,  					   unsigned long *freq, u32 flags)  { -	return -EINVAL; +	return ERR_PTR(-EINVAL);  } -static int devfreq_register_opp_notifier(struct device *dev, +static inline int devfreq_register_opp_notifier(struct device *dev,  					 struct devfreq *devfreq)  {  	return -EINVAL;  } -static int devfreq_unregister_opp_notifier(struct device *dev, +static inline int devfreq_unregister_opp_notifier(struct device *dev,  					   struct devfreq *devfreq)  {  	return -EINVAL; diff --git a/include/linux/device.h b/include/linux/device.h index 9d6464ea99c..c0a12612532 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -25,6 +25,7 @@  #include <linux/pm.h>  #include <linux/atomic.h>  #include <linux/ratelimit.h> +#include <linux/uidgid.h>  #include <asm/device.h>  struct device; @@ -111,17 +112,11 @@ struct bus_type {  	struct iommu_ops *iommu_ops;  	struct subsys_private *p; +	struct lock_class_key lock_key;  }; -/* This is a #define to keep the compiler from merging different - * instances of the __key variable */ -#define bus_register(subsys)			\ -({						\ -	static struct lock_class_key __key;	\ -	__bus_register(subsys, &__key);	\ -}) -extern int __must_check __bus_register(struct bus_type *bus, -				       struct lock_class_key *key); +extern int __must_check bus_register(struct bus_type *bus); +  extern void bus_unregister(struct bus_type *bus);  extern int __must_check bus_rescan_devices(struct bus_type *bus); @@ -302,6 +297,8 @@ void subsys_interface_unregister(struct subsys_interface *sif);  int subsys_system_register(struct bus_type *subsys,  			   const struct attribute_group **groups); +int subsys_virtual_register(struct bus_type *subsys, +			    const struct attribute_group **groups);  /**   * struct class - device classes @@ -471,7 +468,8 @@ struct device_type {  	const char *name;  	const struct attribute_group **groups;  	int (*uevent)(struct device *dev, struct kobj_uevent_env *env); -	char *(*devnode)(struct device *dev, umode_t *mode); +	char *(*devnode)(struct device *dev, umode_t *mode, +			 kuid_t *uid, kgid_t *gid);  	void (*release)(struct device *dev);  	const struct dev_pm_ops *pm; @@ -578,6 +576,10 @@ void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);  void __iomem *devm_request_and_ioremap(struct device *dev,  			struct resource *res); +/* allows to add/remove a custom action to devres stack */ +int devm_add_action(struct device *dev, void (*action)(void *), void *data); +void devm_remove_action(struct device *dev, void (*action)(void *), void *data); +  struct device_dma_parameters {  	/*  	 * a low level driver may set these to teach IOMMU code about @@ -849,7 +851,8 @@ extern int device_rename(struct device *dev, const char *new_name);  extern int device_move(struct device *dev, struct device *new_parent,  		       enum dpm_order dpm_order);  extern const char *device_get_devnode(struct device *dev, -				      umode_t *mode, const char **tmp); +				      umode_t *mode, kuid_t *uid, kgid_t *gid, +				      const char **tmp);  extern void *dev_get_drvdata(const struct device *dev);  extern int dev_set_drvdata(struct device *dev, void *data); diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index 9978b614a1a..dfac5ed3112 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -112,6 +112,8 @@ struct dma_buf_ops {   * @file: file pointer used for sharing buffers across, and for refcounting.   * @attachments: list of dma_buf_attachment that denotes all devices attached.   * @ops: dma_buf_ops associated with this buffer object. + * @exp_name: name of the exporter; useful for debugging. + * @list_node: node for dma_buf accounting and debugging.   * @priv: exporter specific private data for this buffer object.   */  struct dma_buf { @@ -123,6 +125,8 @@ struct dma_buf {  	struct mutex lock;  	unsigned vmapping_counter;  	void *vmap_ptr; +	const char *exp_name; +	struct list_head list_node;  	void *priv;  }; @@ -162,8 +166,13 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,  							struct device *dev);  void dma_buf_detach(struct dma_buf *dmabuf,  				struct dma_buf_attachment *dmabuf_attach); -struct dma_buf *dma_buf_export(void *priv, const struct dma_buf_ops *ops, -			       size_t size, int flags); + +struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, +			       size_t size, int flags, const char *); + +#define dma_buf_export(priv, ops, size, flags)	\ +	dma_buf_export_named(priv, ops, size, flags, __FILE__) +  int dma_buf_fd(struct dma_buf *dmabuf, int flags);  struct dma_buf *dma_buf_get(int fd);  void dma_buf_put(struct dma_buf *dmabuf); @@ -185,5 +194,6 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *,  		 unsigned long);  void *dma_buf_vmap(struct dma_buf *);  void dma_buf_vunmap(struct dma_buf *, void *vaddr); - +int dma_buf_debugfs_create_file(const char *name, +				int (*write)(struct seq_file *));  #endif /* __DMA_BUF_H__ */ diff --git a/include/linux/dmi.h b/include/linux/dmi.h index f156cca25ad..b6eb7a05d58 100644 --- a/include/linux/dmi.h +++ b/include/linux/dmi.h @@ -99,6 +99,7 @@ extern const char * dmi_get_system_info(int field);  extern const struct dmi_device * dmi_find_device(int type, const char *name,  	const struct dmi_device *from);  extern void dmi_scan_machine(void); +extern void dmi_set_dump_stack_arch_desc(void);  extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);  extern int dmi_name_in_vendors(const char *str);  extern int dmi_name_in_serial(const char *str); @@ -114,6 +115,7 @@ static inline const char * dmi_get_system_info(int field) { return NULL; }  static inline const struct dmi_device * dmi_find_device(int type, const char *name,  	const struct dmi_device *from) { return NULL; }  static inline void dmi_scan_machine(void) { return; } +static inline void dmi_set_dump_stack_arch_desc(void) { }  static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)  {  	if (yearp) diff --git a/include/linux/efi.h b/include/linux/efi.h index 9bf2f1fcae2..2bc0ad78d05 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -333,6 +333,7 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,  					      unsigned long count,  					      u64 *max_size,  					      int *reset_type); +typedef efi_status_t efi_query_variable_store_t(u32 attributes, unsigned long size);  /*   *  EFI Configuration Table and GUID definitions @@ -575,9 +576,15 @@ extern void efi_enter_virtual_mode (void);	/* switch EFI to virtual mode, if pos  #ifdef CONFIG_X86  extern void efi_late_init(void);  extern void efi_free_boot_services(void); +extern efi_status_t efi_query_variable_store(u32 attributes, unsigned long size);  #else  static inline void efi_late_init(void) {}  static inline void efi_free_boot_services(void) {} + +static inline efi_status_t efi_query_variable_store(u32 attributes, unsigned long size) +{ +	return EFI_SUCCESS; +}  #endif  extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr);  extern u64 efi_get_iobase (void); @@ -663,6 +670,12 @@ static inline int efi_enabled(int facility)  				EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \  				EFI_VARIABLE_APPEND_WRITE)  /* + * Length of a GUID string (strlen("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")) + * not including trailing NUL + */ +#define EFI_VARIABLE_GUID_LEN 36 + +/*   * The type of search to perform when calling boottime->locate_handle   */  #define EFI_LOCATE_ALL_HANDLES			0 @@ -719,7 +732,6 @@ static inline void memrange_efi_to_native(u64 *addr, u64 *npages)  	*addr &= PAGE_MASK;  } -#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE)  /*   * EFI Variable support.   * @@ -731,7 +743,7 @@ struct efivar_operations {  	efi_get_variable_t *get_variable;  	efi_get_next_variable_t *get_next_variable;  	efi_set_variable_t *set_variable; -	efi_query_variable_info_t *query_variable_info; +	efi_query_variable_store_t *query_variable_store;  };  struct efivars { @@ -745,19 +757,88 @@ struct efivars {  	 * which is protected by the BKL, so that path is safe.  	 */  	spinlock_t lock; -	struct list_head list;  	struct kset *kset;  	struct kobject *kobject; -	struct bin_attribute *new_var, *del_var;  	const struct efivar_operations *ops; -	struct efivar_entry *walk_entry; -	struct pstore_info efi_pstore_info;  }; -int register_efivars(struct efivars *efivars, +/* + * The maximum size of VariableName + Data = 1024 + * Therefore, it's reasonable to save that much + * space in each part of the structure, + * and we use a page for reading/writing. + */ + +struct efi_variable { +	efi_char16_t  VariableName[1024/sizeof(efi_char16_t)]; +	efi_guid_t    VendorGuid; +	unsigned long DataSize; +	__u8          Data[1024]; +	efi_status_t  Status; +	__u32         Attributes; +} __attribute__((packed)); + +struct efivar_entry { +	struct efi_variable var; +	struct list_head list; +	struct kobject kobj; +}; + +extern struct list_head efivar_sysfs_list; + +static inline void +efivar_unregister(struct efivar_entry *var) +{ +	kobject_put(&var->kobj); +} + +int efivars_register(struct efivars *efivars,  		     const struct efivar_operations *ops, -		     struct kobject *parent_kobj); -void unregister_efivars(struct efivars *efivars); +		     struct kobject *kobject); +int efivars_unregister(struct efivars *efivars); +struct kobject *efivars_kobject(void); + +int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), +		void *data, bool atomic, bool duplicates, +		struct list_head *head); + +void efivar_entry_add(struct efivar_entry *entry, struct list_head *head); +void efivar_entry_remove(struct efivar_entry *entry); + +int __efivar_entry_delete(struct efivar_entry *entry); +int efivar_entry_delete(struct efivar_entry *entry); + +int efivar_entry_size(struct efivar_entry *entry, unsigned long *size); +int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, +		       unsigned long *size, void *data); +int efivar_entry_get(struct efivar_entry *entry, u32 *attributes, +		     unsigned long *size, void *data); +int efivar_entry_set(struct efivar_entry *entry, u32 attributes, +		     unsigned long size, void *data, struct list_head *head); +int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes, +			      unsigned long *size, void *data, bool *set); +int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes, +			  bool block, unsigned long size, void *data); + +void efivar_entry_iter_begin(void); +void efivar_entry_iter_end(void); + +int __efivar_entry_iter(int (*func)(struct efivar_entry *, void *), +			struct list_head *head, void *data, +			struct efivar_entry **prev); +int efivar_entry_iter(int (*func)(struct efivar_entry *, void *), +		      struct list_head *head, void *data); + +struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, +				       struct list_head *head, bool remove); + +bool efivar_validate(struct efi_variable *var, u8 *data, unsigned long len); + +extern struct work_struct efivar_work; +void efivar_run_worker(void); + +#if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) +int efivars_sysfs_init(void);  #endif /* CONFIG_EFI_VARS */ diff --git a/include/linux/evm.h b/include/linux/evm.h index 9fc13a76092..1fcb88ca88d 100644 --- a/include/linux/evm.h +++ b/include/linux/evm.h @@ -96,5 +96,5 @@ static inline int evm_inode_init_security(struct inode *inode,  	return 0;  } -#endif /* CONFIG_EVM_H */ +#endif /* CONFIG_EVM */  #endif /* LINUX_EVM_H */ diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 5b9b5b31718..41b223a59a6 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h @@ -85,6 +85,17 @@ enum fid_type {  	FILEID_NILFS_WITH_PARENT = 0x62,  	/* +	 * 32 bit generation number, 40 bit i_pos. +	 */ +	FILEID_FAT_WITHOUT_PARENT = 0x71, + +	/* +	 * 32 bit generation number, 40 bit i_pos, +	 * 32 bit parent generation number, 40 bit parent i_pos +	 */ +	FILEID_FAT_WITH_PARENT = 0x72, + +	/*  	 * Filesystems must not use 0xff file ID.  	 */  	FILEID_INVALID = 0xff, diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h index fb7dacae052..085197bd881 100644 --- a/include/linux/fdtable.h +++ b/include/linux/fdtable.h @@ -27,7 +27,6 @@ struct fdtable {  	unsigned long *close_on_exec;  	unsigned long *open_fds;  	struct rcu_head rcu; -	struct fdtable *next;  };  static inline bool close_on_exec(int fd, const struct fdtable *fdt) diff --git a/include/linux/filter.h b/include/linux/filter.h index c45eabc135e..c050dcc322a 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -48,8 +48,22 @@ extern int sk_chk_filter(struct sock_filter *filter, unsigned int flen);  extern int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned len);  #ifdef CONFIG_BPF_JIT +#include <stdarg.h> +#include <linux/linkage.h> +#include <linux/printk.h> +  extern void bpf_jit_compile(struct sk_filter *fp);  extern void bpf_jit_free(struct sk_filter *fp); + +static inline void bpf_jit_dump(unsigned int flen, unsigned int proglen, +				u32 pass, void *image) +{ +	pr_err("flen=%u proglen=%u pass=%u image=%p\n", +	       flen, proglen, pass, image); +	if (image) +		print_hex_dump(KERN_ERR, "JIT code: ", DUMP_PREFIX_ADDRESS, +			       16, 1, image, proglen, false); +}  #define SK_RUN_FILTER(FILTER, SKB) (*FILTER->bpf_func)(SKB, FILTER->insns)  #else  static inline void bpf_jit_compile(struct sk_filter *fp) @@ -126,6 +140,7 @@ enum {  	BPF_S_ANC_SECCOMP_LD_W,  	BPF_S_ANC_VLAN_TAG,  	BPF_S_ANC_VLAN_TAG_PRESENT, +	BPF_S_ANC_PAY_OFFSET,  };  #endif /* __LINUX_FILTER_H__ */ diff --git a/include/linux/frontswap.h b/include/linux/frontswap.h index 30442547b9e..8293262401d 100644 --- a/include/linux/frontswap.h +++ b/include/linux/frontswap.h @@ -14,7 +14,7 @@ struct frontswap_ops {  };  extern bool frontswap_enabled; -extern struct frontswap_ops +extern struct frontswap_ops *  	frontswap_register_ops(struct frontswap_ops *ops);  extern void frontswap_shrink(unsigned long);  extern unsigned long frontswap_curr_pages(void); @@ -22,33 +22,19 @@ extern void frontswap_writethrough(bool);  #define FRONTSWAP_HAS_EXCLUSIVE_GETS  extern void frontswap_tmem_exclusive_gets(bool); -extern void __frontswap_init(unsigned type); +extern bool __frontswap_test(struct swap_info_struct *, pgoff_t); +extern void __frontswap_init(unsigned type, unsigned long *map);  extern int __frontswap_store(struct page *page);  extern int __frontswap_load(struct page *page);  extern void __frontswap_invalidate_page(unsigned, pgoff_t);  extern void __frontswap_invalidate_area(unsigned);  #ifdef CONFIG_FRONTSWAP +#define frontswap_enabled (1)  static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset)  { -	bool ret = false; - -	if (frontswap_enabled && sis->frontswap_map) -		ret = test_bit(offset, sis->frontswap_map); -	return ret; -} - -static inline void frontswap_set(struct swap_info_struct *sis, pgoff_t offset) -{ -	if (frontswap_enabled && sis->frontswap_map) -		set_bit(offset, sis->frontswap_map); -} - -static inline void frontswap_clear(struct swap_info_struct *sis, pgoff_t offset) -{ -	if (frontswap_enabled && sis->frontswap_map) -		clear_bit(offset, sis->frontswap_map); +	return __frontswap_test(sis, offset);  }  static inline void frontswap_map_set(struct swap_info_struct *p, @@ -71,14 +57,6 @@ static inline bool frontswap_test(struct swap_info_struct *sis, pgoff_t offset)  	return false;  } -static inline void frontswap_set(struct swap_info_struct *sis, pgoff_t offset) -{ -} - -static inline void frontswap_clear(struct swap_info_struct *sis, pgoff_t offset) -{ -} -  static inline void frontswap_map_set(struct swap_info_struct *p,  				     unsigned long *map)  { @@ -120,10 +98,10 @@ static inline void frontswap_invalidate_area(unsigned type)  		__frontswap_invalidate_area(type);  } -static inline void frontswap_init(unsigned type) +static inline void frontswap_init(unsigned type, unsigned long *map)  {  	if (frontswap_enabled) -		__frontswap_init(type); +		__frontswap_init(type, map);  }  #endif /* _LINUX_FRONTSWAP_H */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 2c28271ab9d..e8cd6b83967 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -675,9 +675,11 @@ static inline loff_t i_size_read(const struct inode *inode)  static inline void i_size_write(struct inode *inode, loff_t i_size)  {  #if BITS_PER_LONG==32 && defined(CONFIG_SMP) +	preempt_disable();  	write_seqcount_begin(&inode->i_size_seqcount);  	inode->i_size = i_size;  	write_seqcount_end(&inode->i_size_seqcount); +	preempt_enable();  #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)  	preempt_disable();  	inode->i_size = i_size; @@ -2080,7 +2082,6 @@ extern int sync_filesystem(struct super_block *);  extern const struct file_operations def_blk_fops;  extern const struct file_operations def_chr_fops;  extern const struct file_operations bad_sock_fops; -extern const struct file_operations def_fifo_fops;  #ifdef CONFIG_BLOCK  extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);  extern int blkdev_ioctl(struct block_device *, fmode_t, unsigned, unsigned long); @@ -2152,10 +2153,6 @@ extern void init_special_inode(struct inode *, umode_t, dev_t);  extern void make_bad_inode(struct inode *);  extern int is_bad_inode(struct inode *); -extern const struct file_operations read_pipefifo_fops; -extern const struct file_operations write_pipefifo_fops; -extern const struct file_operations rdwr_pipefifo_fops; -  #ifdef CONFIG_BLOCK  /*   * return READ, READA, or WRITE @@ -2223,6 +2220,20 @@ static inline struct inode *file_inode(struct file *f)  	return f->f_inode;  } +static inline void file_start_write(struct file *file) +{ +	if (!S_ISREG(file_inode(file)->i_mode)) +		return; +	__sb_start_write(file_inode(file)->i_sb, SB_FREEZE_WRITE, true); +} + +static inline void file_end_write(struct file *file) +{ +	if (!S_ISREG(file_inode(file)->i_mode)) +		return; +	__sb_end_write(file_inode(file)->i_sb, SB_FREEZE_WRITE); +} +  /*   * get_write_access() gets write permission for a file.   * put_write_access() releases this write permission. diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index d5b0910d496..4b2ee8d12f5 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -157,7 +157,6 @@ struct fsnotify_group {  		struct inotify_group_private_data {  			spinlock_t	idr_lock;  			struct idr      idr; -			u32             last_wd;  			struct user_struct      *user;  		} inotify_data;  #endif diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index e5ca8ef50e9..f83e17a40e8 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -89,6 +89,7 @@ typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,   *            that the call back has its own recursion protection. If it does   *            not set this, then the ftrace infrastructure will add recursion   *            protection for the caller. + * STUB   - The ftrace_ops is just a place holder.   */  enum {  	FTRACE_OPS_FL_ENABLED			= 1 << 0, @@ -98,6 +99,7 @@ enum {  	FTRACE_OPS_FL_SAVE_REGS			= 1 << 4,  	FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED	= 1 << 5,  	FTRACE_OPS_FL_RECURSION_SAFE		= 1 << 6, +	FTRACE_OPS_FL_STUB			= 1 << 7,  };  struct ftrace_ops { @@ -259,8 +261,10 @@ struct ftrace_probe_ops {  	void			(*func)(unsigned long ip,  					unsigned long parent_ip,  					void **data); -	int			(*callback)(unsigned long ip, void **data); -	void			(*free)(void **data); +	int			(*init)(struct ftrace_probe_ops *ops, +					unsigned long ip, void **data); +	void			(*free)(struct ftrace_probe_ops *ops, +					unsigned long ip, void **data);  	int			(*print)(struct seq_file *m,  					 unsigned long ip,  					 struct ftrace_probe_ops *ops, @@ -394,7 +398,6 @@ ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,  			    size_t cnt, loff_t *ppos);  ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,  			     size_t cnt, loff_t *ppos); -loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence);  int ftrace_regex_release(struct inode *inode, struct file *file);  void __init @@ -567,6 +570,8 @@ static inline int  ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }  #endif /* CONFIG_DYNAMIC_FTRACE */ +loff_t ftrace_filter_lseek(struct file *file, loff_t offset, int whence); +  /* totally disable ftrace - can not re-enable after this */  void ftrace_kill(void); diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 13a54d0bdfa..34e00fb49be 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h @@ -8,6 +8,7 @@  #include <linux/perf_event.h>  struct trace_array; +struct trace_buffer;  struct tracer;  struct dentry; @@ -38,6 +39,12 @@ const char *ftrace_print_symbols_seq_u64(struct trace_seq *p,  const char *ftrace_print_hex_seq(struct trace_seq *p,  				 const unsigned char *buf, int len); +struct trace_iterator; +struct trace_event; + +int ftrace_raw_output_prep(struct trace_iterator *iter, +			   struct trace_event *event); +  /*   * The trace entry - the most basic unit of tracing. This is what   * is printed in the end as a single line in the trace output, such as: @@ -61,6 +68,7 @@ struct trace_entry {  struct trace_iterator {  	struct trace_array	*tr;  	struct tracer		*trace; +	struct trace_buffer	*trace_buffer;  	void			*private;  	int			cpu_file;  	struct mutex		mutex; @@ -95,8 +103,6 @@ enum trace_iter_flags {  }; -struct trace_event; -  typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter,  				      int flags, struct trace_event *event); @@ -128,6 +134,13 @@ enum print_line_t {  void tracing_generic_entry_update(struct trace_entry *entry,  				  unsigned long flags,  				  int pc); +struct ftrace_event_file; + +struct ring_buffer_event * +trace_event_buffer_lock_reserve(struct ring_buffer **current_buffer, +				struct ftrace_event_file *ftrace_file, +				int type, unsigned long len, +				unsigned long flags, int pc);  struct ring_buffer_event *  trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer,  				  int type, unsigned long len, @@ -182,53 +195,49 @@ extern int ftrace_event_reg(struct ftrace_event_call *event,  			    enum trace_reg type, void *data);  enum { -	TRACE_EVENT_FL_ENABLED_BIT,  	TRACE_EVENT_FL_FILTERED_BIT, -	TRACE_EVENT_FL_RECORDED_CMD_BIT,  	TRACE_EVENT_FL_CAP_ANY_BIT,  	TRACE_EVENT_FL_NO_SET_FILTER_BIT,  	TRACE_EVENT_FL_IGNORE_ENABLE_BIT, +	TRACE_EVENT_FL_WAS_ENABLED_BIT,  }; +/* + * Event flags: + *  FILTERED	  - The event has a filter attached + *  CAP_ANY	  - Any user can enable for perf + *  NO_SET_FILTER - Set when filter has error and is to be ignored + *  IGNORE_ENABLE - For ftrace internal events, do not enable with debugfs file + *  WAS_ENABLED   - Set and stays set when an event was ever enabled + *                    (used for module unloading, if a module event is enabled, + *                     it is best to clear the buffers that used it). + */  enum { -	TRACE_EVENT_FL_ENABLED		= (1 << TRACE_EVENT_FL_ENABLED_BIT),  	TRACE_EVENT_FL_FILTERED		= (1 << TRACE_EVENT_FL_FILTERED_BIT), -	TRACE_EVENT_FL_RECORDED_CMD	= (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),  	TRACE_EVENT_FL_CAP_ANY		= (1 << TRACE_EVENT_FL_CAP_ANY_BIT),  	TRACE_EVENT_FL_NO_SET_FILTER	= (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),  	TRACE_EVENT_FL_IGNORE_ENABLE	= (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT), +	TRACE_EVENT_FL_WAS_ENABLED	= (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),  };  struct ftrace_event_call {  	struct list_head	list;  	struct ftrace_event_class *class;  	char			*name; -	struct dentry		*dir;  	struct trace_event	event;  	const char		*print_fmt;  	struct event_filter	*filter; +	struct list_head	*files;  	void			*mod;  	void			*data; -  	/* -	 * 32 bit flags: -	 *   bit 1:		enabled -	 *   bit 2:		filter_active -	 *   bit 3:		enabled cmd record -	 *   bit 4:		allow trace by non root (cap any) -	 *   bit 5:		failed to apply filter -	 *   bit 6:		ftrace internal event (do not enable) -	 * -	 * Changes to flags must hold the event_mutex. -	 * -	 * Note: Reads of flags do not hold the event_mutex since -	 * they occur in critical sections. But the way flags -	 * is currently used, these changes do no affect the code -	 * except that when a change is made, it may have a slight -	 * delay in propagating the changes to other CPUs due to -	 * caching and such. +	 *   bit 0:		filter_active +	 *   bit 1:		allow trace by non root (cap any) +	 *   bit 2:		failed to apply filter +	 *   bit 3:		ftrace internal event (do not enable) +	 *   bit 4:		Event was enabled by module  	 */ -	unsigned int		flags; +	int			flags; /* static flags of different events */  #ifdef CONFIG_PERF_EVENTS  	int				perf_refcount; @@ -236,6 +245,56 @@ struct ftrace_event_call {  #endif  }; +struct trace_array; +struct ftrace_subsystem_dir; + +enum { +	FTRACE_EVENT_FL_ENABLED_BIT, +	FTRACE_EVENT_FL_RECORDED_CMD_BIT, +	FTRACE_EVENT_FL_SOFT_MODE_BIT, +	FTRACE_EVENT_FL_SOFT_DISABLED_BIT, +}; + +/* + * Ftrace event file flags: + *  ENABLED	  - The event is enabled + *  RECORDED_CMD  - The comms should be recorded at sched_switch + *  SOFT_MODE     - The event is enabled/disabled by SOFT_DISABLED + *  SOFT_DISABLED - When set, do not trace the event (even though its + *                   tracepoint may be enabled) + */ +enum { +	FTRACE_EVENT_FL_ENABLED		= (1 << FTRACE_EVENT_FL_ENABLED_BIT), +	FTRACE_EVENT_FL_RECORDED_CMD	= (1 << FTRACE_EVENT_FL_RECORDED_CMD_BIT), +	FTRACE_EVENT_FL_SOFT_MODE	= (1 << FTRACE_EVENT_FL_SOFT_MODE_BIT), +	FTRACE_EVENT_FL_SOFT_DISABLED	= (1 << FTRACE_EVENT_FL_SOFT_DISABLED_BIT), +}; + +struct ftrace_event_file { +	struct list_head		list; +	struct ftrace_event_call	*event_call; +	struct dentry			*dir; +	struct trace_array		*tr; +	struct ftrace_subsystem_dir	*system; + +	/* +	 * 32 bit flags: +	 *   bit 0:		enabled +	 *   bit 1:		enabled cmd record +	 *   bit 2:		enable/disable with the soft disable bit +	 *   bit 3:		soft disabled +	 * +	 * Note: The bits must be set atomically to prevent races +	 * from other writers. Reads of flags do not need to be in +	 * sync as they occur in critical sections. But the way flags +	 * is currently used, these changes do not affect the code +	 * except that when a change is made, it may have a slight +	 * delay in propagating the changes to other CPUs due to +	 * caching and such. Which is mostly OK ;-) +	 */ +	unsigned long		flags; +}; +  #define __TRACE_EVENT_FLAGS(name, value)				\  	static int __init trace_init_flags_##name(void)			\  	{								\ @@ -274,7 +333,7 @@ extern int trace_define_field(struct ftrace_event_call *call, const char *type,  extern int trace_add_event_call(struct ftrace_event_call *call);  extern void trace_remove_event_call(struct ftrace_event_call *call); -#define is_signed_type(type)	(((type)(-1)) < (type)0) +#define is_signed_type(type)	(((type)(-1)) < (type)1)  int trace_set_clr_event(const char *system, const char *event, int set); diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h index dd7c569aaca..661d374aeb2 100644 --- a/include/linux/genalloc.h +++ b/include/linux/genalloc.h @@ -29,6 +29,10 @@  #ifndef __GENALLOC_H__  #define __GENALLOC_H__ + +struct device; +struct device_node; +  /**   * Allocation callback function type definition   * @map: Pointer to bitmap @@ -105,4 +109,18 @@ extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size,  extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size,  		unsigned long start, unsigned int nr, void *data); +extern struct gen_pool *devm_gen_pool_create(struct device *dev, +		int min_alloc_order, int nid); +extern struct gen_pool *dev_get_gen_pool(struct device *dev); + +#ifdef CONFIG_OF +extern struct gen_pool *of_get_named_gen_pool(struct device_node *np, +	const char *propname, int index); +#else +static inline struct gen_pool *of_get_named_gen_pool(struct device_node *np, +	const char *propname, int index) +{ +	return NULL; +} +#endif  #endif /* __GENALLOC_H__ */ diff --git a/include/linux/hid-debug.h b/include/linux/hid-debug.h index 53744fa1c8b..8663f216c56 100644 --- a/include/linux/hid-debug.h +++ b/include/linux/hid-debug.h @@ -22,11 +22,12 @@   *   */ -#define HID_DEBUG_BUFSIZE 512 -  #ifdef CONFIG_DEBUG_FS +#define HID_DEBUG_BUFSIZE 512 +  void hid_dump_input(struct hid_device *, struct hid_usage *, __s32); +void hid_dump_report(struct hid_device *, int , u8 *, int);  void hid_dump_device(struct hid_device *, struct seq_file *);  void hid_dump_field(struct hid_field *, int, struct seq_file *);  char *hid_resolv_usage(unsigned, struct seq_file *); @@ -50,6 +51,7 @@ struct hid_debug_list {  #else  #define hid_dump_input(a,b,c)		do { } while (0) +#define hid_dump_report(a,b,c,d)	do { } while (0)  #define hid_dump_device(a,b)		do { } while (0)  #define hid_dump_field(a,b,c)		do { } while (0)  #define hid_resolv_usage(a,b)		do { } while (0) diff --git a/include/linux/hid.h b/include/linux/hid.h index e14b465b114..af1b86d46f6 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -282,6 +282,7 @@ struct hid_item {  #define HID_QUIRK_BADPAD			0x00000020  #define HID_QUIRK_MULTI_INPUT			0x00000040  #define HID_QUIRK_HIDINPUT_FORCE		0x00000080 +#define HID_QUIRK_NO_EMPTY_INPUT		0x00000100  #define HID_QUIRK_SKIP_OUTPUT_REPORTS		0x00010000  #define HID_QUIRK_FULLSPEED_INTERVAL		0x10000000  #define HID_QUIRK_NO_INIT_REPORTS		0x20000000 @@ -456,7 +457,8 @@ struct hid_device {							/* device report descriptor */  	unsigned country;						/* HID country */  	struct hid_report_enum report_enum[HID_REPORT_TYPES]; -	struct semaphore driver_lock;					/* protects the current driver */ +	struct semaphore driver_lock;					/* protects the current driver, except during input */ +	struct semaphore driver_input_lock;				/* protects the current driver */  	struct device dev;						/* device */  	struct hid_driver *driver;  	struct hid_ll_driver *ll_driver; @@ -477,6 +479,7 @@ struct hid_device {							/* device report descriptor */  	unsigned int status;						/* see STAT flags above */  	unsigned claimed;						/* Claimed by hidinput, hiddev? */  	unsigned quirks;						/* Various quirks the device can pull on us */ +	bool io_started;						/* Protected by driver_lock. If IO has started */  	struct list_head inputs;					/* The list of inputs */  	void *hiddev;							/* The hiddev structure */ @@ -512,6 +515,7 @@ struct hid_device {							/* device report descriptor */  	struct dentry *debug_rdesc;  	struct dentry *debug_events;  	struct list_head debug_list; +	struct mutex debug_list_lock;  	wait_queue_head_t debug_wait;  }; @@ -599,6 +603,10 @@ struct hid_usage_id {   * @resume: invoked on resume if device was not reset (NULL means nop)   * @reset_resume: invoked on resume if device was reset (NULL means nop)   * + * probe should return -errno on error, or 0 on success. During probe, + * input will not be passed to raw_event unless hid_device_io_start is + * called. + *   * raw_event and event should return 0 on no action performed, 1 when no   * further processing should be done and negative on error   * @@ -662,6 +670,9 @@ struct hid_driver {   * @hidinput_input_event: event input event (e.g. ff or leds)   * @parse: this method is called only once to parse the device data,   *	   shouldn't allocate anything to not leak memory + * @request: send report request to device (e.g. feature report) + * @wait: wait for buffered io to complete (send/recv reports) + * @idle: send idle request to device   */  struct hid_ll_driver {  	int (*start)(struct hid_device *hdev); @@ -676,6 +687,13 @@ struct hid_ll_driver {  			unsigned int code, int value);  	int (*parse)(struct hid_device *hdev); + +	void (*request)(struct hid_device *hdev, +			struct hid_report *report, int reqtype); + +	int (*wait)(struct hid_device *hdev); +	int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype); +  };  #define	PM_HINT_FULLON	1<<5 @@ -738,6 +756,44 @@ const struct hid_device_id *hid_match_id(struct hid_device *hdev,  s32 hid_snto32(__u32 value, unsigned n);  /** + * hid_device_io_start - enable HID input during probe, remove + * + * @hid - the device + * + * This should only be called during probe or remove and only be + * called by the thread calling probe or remove. It will allow + * incoming packets to be delivered to the driver. + */ +static inline void hid_device_io_start(struct hid_device *hid) { +	if (hid->io_started) { +		dev_warn(&hid->dev, "io already started"); +		return; +	} +	hid->io_started = true; +	up(&hid->driver_input_lock); +} + +/** + * hid_device_io_stop - disable HID input during probe, remove + * + * @hid - the device + * + * Should only be called after hid_device_io_start. It will prevent + * incoming packets from going to the driver for the duration of + * probe, remove. If called during probe, packets will still go to the + * driver after probe is complete. This function should only be called + * by the thread calling probe or remove. + */ +static inline void hid_device_io_stop(struct hid_device *hid) { +	if (!hid->io_started) { +		dev_warn(&hid->dev, "io already stopped"); +		return; +	} +	hid->io_started = false; +	down(&hid->driver_input_lock); +} + +/**   * hid_map_usage - map usage input bits   *   * @hidinput: hidinput which we are interested in @@ -883,6 +939,49 @@ static inline int hid_hw_power(struct hid_device *hdev, int level)  	return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0;  } + +/** + * hid_hw_request - send report request to device + * + * @hdev: hid device + * @report: report to send + * @reqtype: hid request type + */ +static inline void hid_hw_request(struct hid_device *hdev, +				  struct hid_report *report, int reqtype) +{ +	if (hdev->ll_driver->request) +		hdev->ll_driver->request(hdev, report, reqtype); +} + +/** + * hid_hw_idle - send idle request to device + * + * @hdev: hid device + * @report: report to control + * @idle: idle state + * @reqtype: hid request type + */ +static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle, +		int reqtype) +{ +	if (hdev->ll_driver->idle) +		return hdev->ll_driver->idle(hdev, report, idle, reqtype); + +	return 0; +} + +/** + * hid_hw_wait - wait for buffered io to complete + * + * @hdev: hid device + */ +static inline void hid_hw_wait(struct hid_device *hdev) +{ +	if (hdev->ll_driver->wait) +		hdev->ll_driver->wait(hdev); +} +  int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,  		int interrupt); diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index cc07d2777bb..d19a5c2d227 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -157,6 +157,7 @@ enum  hrtimer_base_type {  	HRTIMER_BASE_MONOTONIC,  	HRTIMER_BASE_REALTIME,  	HRTIMER_BASE_BOOTTIME, +	HRTIMER_BASE_TAI,  	HRTIMER_MAX_CLOCK_BASES,  }; @@ -327,7 +328,9 @@ extern ktime_t ktime_get(void);  extern ktime_t ktime_get_real(void);  extern ktime_t ktime_get_boottime(void);  extern ktime_t ktime_get_monotonic_offset(void); -extern ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot); +extern ktime_t ktime_get_clocktai(void); +extern ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot, +					 ktime_t *offs_tai);  DECLARE_PER_CPU(struct tick_device, tick_cpu_device); diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index ee1c244a62a..528454c2caa 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -99,7 +99,11 @@ extern int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,  extern int handle_pte_fault(struct mm_struct *mm,  			    struct vm_area_struct *vma, unsigned long address,  			    pte_t *pte, pmd_t *pmd, unsigned int flags); -extern int split_huge_page(struct page *page); +extern int split_huge_page_to_list(struct page *page, struct list_head *list); +static inline int split_huge_page(struct page *page) +{ +	return split_huge_page_to_list(page, NULL); +}  extern void __split_huge_page_pmd(struct vm_area_struct *vma,  		unsigned long address, pmd_t *pmd);  #define split_huge_page_pmd(__vma, __address, __pmd)			\ @@ -186,6 +190,11 @@ extern int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vm  #define transparent_hugepage_enabled(__vma) 0  #define transparent_hugepage_flags 0UL +static inline int +split_huge_page_to_list(struct page *page, struct list_head *list) +{ +	return 0; +}  static inline int split_huge_page(struct page *page)  {  	return 0; diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 16e4e9a643f..3a62df310f2 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -58,6 +58,7 @@ void __unmap_hugepage_range(struct mmu_gather *tlb, struct vm_area_struct *vma,  int hugetlb_prefault(struct address_space *, struct vm_area_struct *);  void hugetlb_report_meminfo(struct seq_file *);  int hugetlb_report_node_meminfo(int, char *); +void hugetlb_show_meminfo(void);  unsigned long hugetlb_total_pages(void);  int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,  			unsigned long address, unsigned int flags); @@ -114,6 +115,9 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)  {  }  #define hugetlb_report_node_meminfo(n, buf)	0 +static inline void hugetlb_show_meminfo(void) +{ +}  #define follow_huge_pmd(mm, addr, pmd, write)	NULL  #define follow_huge_pud(mm, addr, pud, write)	NULL  #define prepare_hugepage_range(file, addr, len)	(-EINVAL) diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index df77ba9a816..c2559847d7e 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -27,6 +27,63 @@  #include <linux/types.h> + +/* + * Implementation of host controlled snapshot of the guest. + */ + +#define VSS_OP_REGISTER 128 + +enum hv_vss_op { +	VSS_OP_CREATE = 0, +	VSS_OP_DELETE, +	VSS_OP_HOT_BACKUP, +	VSS_OP_GET_DM_INFO, +	VSS_OP_BU_COMPLETE, +	/* +	 * Following operations are only supported with IC version >= 5.0 +	 */ +	VSS_OP_FREEZE, /* Freeze the file systems in the VM */ +	VSS_OP_THAW, /* Unfreeze the file systems */ +	VSS_OP_AUTO_RECOVER, +	VSS_OP_COUNT /* Number of operations, must be last */ +}; + + +/* + * Header for all VSS messages. + */ +struct hv_vss_hdr { +	__u8 operation; +	__u8 reserved[7]; +} __attribute__((packed)); + + +/* + * Flag values for the hv_vss_check_feature. Linux supports only + * one value. + */ +#define VSS_HBU_NO_AUTO_RECOVERY	0x00000005 + +struct hv_vss_check_feature { +	__u32 flags; +} __attribute__((packed)); + +struct hv_vss_check_dm_info { +	__u32 flags; +} __attribute__((packed)); + +struct hv_vss_msg { +	union { +		struct hv_vss_hdr vss_hdr; +		int error; +	}; +	union { +		struct hv_vss_check_feature vss_cf; +		struct hv_vss_check_dm_info dm_info; +	}; +} __attribute__((packed)); +  /*   * An implementation of HyperV key value pair (KVP) functionality for Linux.   * @@ -1253,6 +1310,25 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver);  		}  /* + * VSS (Backup/Restore) GUID + */ +#define HV_VSS_GUID \ +	.guid = { \ +			0x29, 0x2e, 0xfa, 0x35, 0x23, 0xea, 0x36, 0x42, \ +			0x96, 0xae, 0x3a, 0x6e, 0xba, 0xcb, 0xa4,  0x40 \ +		} +/* + * Synthetic Video GUID + * {DA0A7802-E377-4aac-8E77-0558EB1073F8} + */ +#define HV_SYNTHVID_GUID \ +	.guid = { \ +			0x02, 0x78, 0x0a, 0xda, 0x77, 0xe3, 0xac, 0x4a, \ +			0x8e, 0x77, 0x05, 0x58, 0xeb, 0x10, 0x73, 0xf8 \ +		} + + +/*   * Common header for Hyper-V ICs   */ @@ -1356,6 +1432,10 @@ int hv_kvp_init(struct hv_util_service *);  void hv_kvp_deinit(void);  void hv_kvp_onchannelcallback(void *); +int hv_vss_init(struct hv_util_service *); +void hv_vss_deinit(void); +void hv_vss_onchannelcallback(void *); +  /*   * Negotiated version with the Host.   */ diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index b4f6c29cace..630f45335c7 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h @@ -11,9 +11,21 @@ static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)  #include <linux/netdevice.h> -extern void				icmpv6_send(struct sk_buff *skb, -						    u8 type, u8 code, -						    __u32 info); +#if IS_ENABLED(CONFIG_IPV6) +extern void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info); + +typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info); +extern int inet6_register_icmp_sender(ip6_icmp_send_t *fn); +extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn); + +#else + +static inline void icmpv6_send(struct sk_buff *skb, +			       u8 type, u8 code, __u32 info) +{ + +} +#endif  extern int				icmpv6_init(void);  extern int				icmpv6_err_convert(u8 type, u8 code, diff --git a/include/linux/idr.h b/include/linux/idr.h index 2640c7e99e5..a470ac3ef49 100644 --- a/include/linux/idr.h +++ b/include/linux/idr.h @@ -42,6 +42,7 @@ struct idr {  	struct idr_layer	*id_free;  	int			layers;	/* only valid w/o concurrent changes */  	int			id_free_cnt; +	int			cur;	/* current pos for cyclic allocation */  	spinlock_t		lock;  }; @@ -75,6 +76,7 @@ struct idr {  void *idr_find_slowpath(struct idr *idp, int id);  void idr_preload(gfp_t gfp_mask);  int idr_alloc(struct idr *idp, void *ptr, int start, int end, gfp_t gfp_mask); +int idr_alloc_cyclic(struct idr *idr, void *ptr, int start, int end, gfp_t gfp_mask);  int idr_for_each(struct idr *idp,  		 int (*fn)(int id, void *p, void *data), void *data);  void *idr_get_next(struct idr *idp, int *nextid); diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 7e24fe0cfbc..06b0ed0154a 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -113,6 +113,34 @@  #define IEEE80211_CTL_EXT_SSW_FBACK	0x9000  #define IEEE80211_CTL_EXT_SSW_ACK	0xa000 + +#define IEEE80211_SN_MASK		((IEEE80211_SCTL_SEQ) >> 4) +#define IEEE80211_MAX_SN		IEEE80211_SN_MASK +#define IEEE80211_SN_MODULO		(IEEE80211_MAX_SN + 1) + +static inline int ieee80211_sn_less(u16 sn1, u16 sn2) +{ +	return ((sn1 - sn2) & IEEE80211_SN_MASK) > (IEEE80211_SN_MODULO >> 1); +} + +static inline u16 ieee80211_sn_add(u16 sn1, u16 sn2) +{ +	return (sn1 + sn2) & IEEE80211_SN_MASK; +} + +static inline u16 ieee80211_sn_inc(u16 sn) +{ +	return ieee80211_sn_add(sn, 1); +} + +static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2) +{ +	return (sn1 - sn2) & IEEE80211_SN_MASK; +} + +#define IEEE80211_SEQ_TO_SN(seq)	(((seq) & IEEE80211_SCTL_SEQ) >> 4) +#define IEEE80211_SN_TO_SEQ(ssn)	(((ssn) << 4) & IEEE80211_SCTL_SEQ) +  /* miscellaneous IEEE 802.11 constants */  #define IEEE80211_MAX_FRAG_THRESHOLD	2352  #define IEEE80211_MAX_RTS_THRESHOLD	2353 @@ -185,7 +213,7 @@ struct ieee80211_hdr {  	u8 addr3[6];  	__le16 seq_ctrl;  	u8 addr4[6]; -} __packed; +} __packed __aligned(2);  struct ieee80211_hdr_3addr {  	__le16 frame_control; @@ -194,7 +222,7 @@ struct ieee80211_hdr_3addr {  	u8 addr2[6];  	u8 addr3[6];  	__le16 seq_ctrl; -} __packed; +} __packed __aligned(2);  struct ieee80211_qos_hdr {  	__le16 frame_control; @@ -204,7 +232,7 @@ struct ieee80211_qos_hdr {  	u8 addr3[6];  	__le16 seq_ctrl;  	__le16 qos_ctrl; -} __packed; +} __packed __aligned(2);  /**   * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set @@ -581,7 +609,7 @@ struct ieee80211s_hdr {  	__le32 seqnum;  	u8 eaddr1[6];  	u8 eaddr2[6]; -} __packed; +} __packed __aligned(2);  /* Mesh flags */  #define MESH_FLAGS_AE_A4 	0x1 @@ -645,6 +673,36 @@ struct ieee80211_channel_sw_ie {  } __packed;  /** + * struct ieee80211_ext_chansw_ie + * + * This structure represents the "Extended Channel Switch Announcement element" + */ +struct ieee80211_ext_chansw_ie { +	u8 mode; +	u8 new_operating_class; +	u8 new_ch_num; +	u8 count; +} __packed; + +/** + * struct ieee80211_sec_chan_offs_ie - secondary channel offset IE + * @sec_chan_offs: secondary channel offset, uses IEEE80211_HT_PARAM_CHA_SEC_* + *	values here + * This structure represents the "Secondary Channel Offset element" + */ +struct ieee80211_sec_chan_offs_ie { +	u8 sec_chan_offs; +} __packed; + +/** + * struct ieee80211_wide_bw_chansw_ie - wide bandwidth channel switch IE + */ +struct ieee80211_wide_bw_chansw_ie { +	u8 new_channel_width; +	u8 new_center_freq_seg0, new_center_freq_seg1; +} __packed; + +/**   * struct ieee80211_tim   *   * This structure refers to "Traffic Indication Map information element" @@ -812,12 +870,15 @@ struct ieee80211_mgmt {  				} __packed wme_action;  				struct{  					u8 action_code; -					u8 element_id; -					u8 length; -					struct ieee80211_channel_sw_ie sw_elem; +					u8 variable[0];  				} __packed chan_switch;  				struct{  					u8 action_code; +					struct ieee80211_ext_chansw_ie data; +					u8 variable[0]; +				} __packed ext_chan_switch; +				struct{ +					u8 action_code;  					u8 dialog_token;  					u8 element_id;  					u8 length; @@ -875,7 +936,7 @@ struct ieee80211_mgmt {  			} u;  		} __packed action;  	} u; -} __packed; +} __packed __aligned(2);  /* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */  #define BSS_MEMBERSHIP_SELECTOR_HT_PHY	127 @@ -906,20 +967,20 @@ struct ieee80211_rts {  	__le16 duration;  	u8 ra[6];  	u8 ta[6]; -} __packed; +} __packed __aligned(2);  struct ieee80211_cts {  	__le16 frame_control;  	__le16 duration;  	u8 ra[6]; -} __packed; +} __packed __aligned(2);  struct ieee80211_pspoll {  	__le16 frame_control;  	__le16 aid;  	u8 bssid[6];  	u8 ta[6]; -} __packed; +} __packed __aligned(2);  /* TDLS */ @@ -999,6 +1060,26 @@ enum ieee80211_p2p_attr_id {  	IEEE80211_P2P_ATTR_MAX  }; +/* Notice of Absence attribute - described in P2P spec 4.1.14 */ +/* Typical max value used here */ +#define IEEE80211_P2P_NOA_DESC_MAX	4 + +struct ieee80211_p2p_noa_desc { +	u8 count; +	__le32 duration; +	__le32 interval; +	__le32 start_time; +} __packed; + +struct ieee80211_p2p_noa_attr { +	u8 index; +	u8 oppps_ctwindow; +	struct ieee80211_p2p_noa_desc desc[IEEE80211_P2P_NOA_DESC_MAX]; +} __packed; + +#define IEEE80211_P2P_OPPPS_ENABLE_BIT		BIT(7) +#define IEEE80211_P2P_OPPPS_CTWINDOW_MASK	0x7F +  /**   * struct ieee80211_bar - HT Block Ack Request   * @@ -1290,11 +1371,6 @@ struct ieee80211_vht_operation {  } __packed; -#define IEEE80211_VHT_MCS_ZERO_TO_SEVEN_SUPPORT 0 -#define IEEE80211_VHT_MCS_ZERO_TO_EIGHT_SUPPORT 1 -#define IEEE80211_VHT_MCS_ZERO_TO_NINE_SUPPORT  2 -#define IEEE80211_VHT_MCS_NOT_SUPPORTED 3 -  /* 802.11ac VHT Capabilities */  #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895			0x00000000  #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991			0x00000001 @@ -1310,10 +1386,11 @@ struct ieee80211_vht_operation {  #define IEEE80211_VHT_CAP_RXSTBC_2				0x00000200  #define IEEE80211_VHT_CAP_RXSTBC_3				0x00000300  #define IEEE80211_VHT_CAP_RXSTBC_4				0x00000400 +#define IEEE80211_VHT_CAP_RXSTBC_MASK				0x00000700  #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE			0x00000800  #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE			0x00001000  #define IEEE80211_VHT_CAP_BEAMFORMER_ANTENNAS_MAX		0x00006000 -#define IEEE80211_VHT_CAP_SOUNDING_DIMENTION_MAX		0x00030000 +#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MAX		0x00030000  #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE			0x00080000  #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE			0x00100000  #define IEEE80211_VHT_CAP_VHT_TXOP_PS				0x00200000 @@ -1594,6 +1671,7 @@ enum ieee80211_eid {  	WLAN_EID_HT_CAPABILITY = 45,  	WLAN_EID_HT_OPERATION = 61, +	WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62,  	WLAN_EID_RSN = 48,  	WLAN_EID_MMIE = 76, @@ -1628,6 +1706,8 @@ enum ieee80211_eid {  	WLAN_EID_VHT_CAPABILITY = 191,  	WLAN_EID_VHT_OPERATION = 192,  	WLAN_EID_OPMODE_NOTIF = 199, +	WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194, +	WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,  	/* 802.11ad */  	WLAN_EID_NON_TX_BSSID_CAP =  83, @@ -1751,6 +1831,7 @@ enum ieee80211_key_len {  /* Public action codes */  enum ieee80211_pub_actioncode { +	WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,  	WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14,  }; @@ -1911,6 +1992,16 @@ enum ieee80211_timeout_interval_type {  	WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */,  }; +/** + * struct ieee80211_timeout_interval_ie - Timeout Interval element + * @type: type, see &enum ieee80211_timeout_interval_type + * @value: timeout interval value + */ +struct ieee80211_timeout_interval_ie { +	u8 type; +	__le32 value; +} __packed; +  /* BACK action code */  enum ieee80211_back_actioncode {  	WLAN_ACTION_ADDBA_REQ = 0, diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index 89b4614a472..f563907ed77 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h @@ -33,7 +33,15 @@ static inline struct arphdr *arp_hdr(const struct sk_buff *skb)  static inline int arp_hdr_len(struct net_device *dev)  { -	/* ARP header, plus 2 device addresses, plus 2 IP addresses. */ -	return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2; +	switch (dev->type) { +#if IS_ENABLED(CONFIG_FIREWIRE_NET) +	case ARPHRD_IEEE1394: +		/* ARP header, device address and 2 IP addresses */ +		return sizeof(struct arphdr) + dev->addr_len + sizeof(u32) * 2; +#endif +	default: +		/* ARP header, plus 2 device addresses, plus 2 IP addresses. */ +		return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2; +	}  }  #endif	/* _LINUX_IF_ARP_H */ diff --git a/include/linux/if_team.h b/include/linux/if_team.h index cfd21e3d550..4474557904f 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h @@ -112,6 +112,10 @@ struct team_mode_ops {  	void (*port_disabled)(struct team *team, struct team_port *port);  }; +extern int team_modeop_port_enter(struct team *team, struct team_port *port); +extern void team_modeop_port_change_dev_addr(struct team *team, +					     struct team_port *port); +  enum team_option_type {  	TEAM_OPTION_TYPE_U32,  	TEAM_OPTION_TYPE_STRING, @@ -236,7 +240,26 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team,  	return NULL;  } -extern int team_port_set_team_dev_addr(struct team_port *port); +static inline struct team_port * +team_get_first_port_txable_rcu(struct team *team, struct team_port *port) +{ +	struct team_port *cur; + +	if (likely(team_port_txable(port))) +		return port; +	cur = port; +	list_for_each_entry_continue_rcu(cur, &team->port_list, list) +		if (team_port_txable(port)) +			return cur; +	list_for_each_entry_rcu(cur, &team->port_list, list) { +		if (cur == port) +			break; +		if (team_port_txable(port)) +			return cur; +	} +	return NULL; +} +  extern int team_options_register(struct team *team,  				 const struct team_option *option,  				 size_t option_count); diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 218a3b686d9..52bd03b3896 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -86,15 +86,15 @@ static inline int is_vlan_dev(struct net_device *dev)  #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)  extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, -					       u16 vlan_id); +					       __be16 vlan_proto, u16 vlan_id);  extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);  extern u16 vlan_dev_vlan_id(const struct net_device *dev);  extern bool vlan_do_receive(struct sk_buff **skb);  extern struct sk_buff *vlan_untag(struct sk_buff *skb); -extern int vlan_vid_add(struct net_device *dev, unsigned short vid); -extern void vlan_vid_del(struct net_device *dev, unsigned short vid); +extern int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid); +extern void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid);  extern int vlan_vids_add_by_dev(struct net_device *dev,  				const struct net_device *by_dev); @@ -104,7 +104,8 @@ extern void vlan_vids_del_by_dev(struct net_device *dev,  extern bool vlan_uses_dev(const struct net_device *dev);  #else  static inline struct net_device * -__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id) +__vlan_find_dev_deep(struct net_device *real_dev, +		     __be16 vlan_proto, u16 vlan_id)  {  	return NULL;  } @@ -131,12 +132,12 @@ static inline struct sk_buff *vlan_untag(struct sk_buff *skb)  	return skb;  } -static inline int vlan_vid_add(struct net_device *dev, unsigned short vid) +static inline int vlan_vid_add(struct net_device *dev, __be16 proto, u16 vid)  {  	return 0;  } -static inline void vlan_vid_del(struct net_device *dev, unsigned short vid) +static inline void vlan_vid_del(struct net_device *dev, __be16 proto, u16 vid)  {  } @@ -157,9 +158,20 @@ static inline bool vlan_uses_dev(const struct net_device *dev)  }  #endif +static inline bool vlan_hw_offload_capable(netdev_features_t features, +					   __be16 proto) +{ +	if (proto == htons(ETH_P_8021Q) && features & NETIF_F_HW_VLAN_CTAG_TX) +		return true; +	if (proto == htons(ETH_P_8021AD) && features & NETIF_F_HW_VLAN_STAG_TX) +		return true; +	return false; +} +  /**   * vlan_insert_tag - regular VLAN tag inserting   * @skb: skbuff to tag + * @vlan_proto: VLAN encapsulation protocol   * @vlan_tci: VLAN TCI to insert   *   * Inserts the VLAN tag into @skb as part of the payload @@ -170,7 +182,8 @@ static inline bool vlan_uses_dev(const struct net_device *dev)   *   * Does not change skb->protocol so this function can be used during receive.   */ -static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) +static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, +					      __be16 vlan_proto, u16 vlan_tci)  {  	struct vlan_ethhdr *veth; @@ -185,7 +198,7 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)  	skb->mac_header -= VLAN_HLEN;  	/* first, the ethernet type */ -	veth->h_vlan_proto = htons(ETH_P_8021Q); +	veth->h_vlan_proto = vlan_proto;  	/* now, the TCI */  	veth->h_vlan_TCI = htons(vlan_tci); @@ -204,24 +217,28 @@ static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)   * Following the skb_unshare() example, in case of error, the calling function   * doesn't have to worry about freeing the original skb.   */ -static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) +static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, +					     __be16 vlan_proto, u16 vlan_tci)  { -	skb = vlan_insert_tag(skb, vlan_tci); +	skb = vlan_insert_tag(skb, vlan_proto, vlan_tci);  	if (skb) -		skb->protocol = htons(ETH_P_8021Q); +		skb->protocol = vlan_proto;  	return skb;  }  /**   * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting   * @skb: skbuff to tag + * @vlan_proto: VLAN encapsulation protocol   * @vlan_tci: VLAN TCI to insert   *   * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest   */  static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, +						     __be16 vlan_proto,  						     u16 vlan_tci)  { +	skb->vlan_proto = vlan_proto;  	skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci;  	return skb;  } @@ -236,12 +253,13 @@ static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,   * Assumes skb->dev is the target that will xmit this frame.   * Returns a VLAN tagged skb.   */ -static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) +static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb, +					   __be16 vlan_proto, u16 vlan_tci)  { -	if (skb->dev->features & NETIF_F_HW_VLAN_TX) { -		return __vlan_hwaccel_put_tag(skb, vlan_tci); +	if (vlan_hw_offload_capable(skb->dev->features, vlan_proto)) { +		return __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci);  	} else { -		return __vlan_put_tag(skb, vlan_tci); +		return __vlan_put_tag(skb, vlan_proto, vlan_tci);  	}  } @@ -256,9 +274,9 @@ static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)  {  	struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; -	if (veth->h_vlan_proto != htons(ETH_P_8021Q)) { +	if (veth->h_vlan_proto != htons(ETH_P_8021Q) && +	    veth->h_vlan_proto != htons(ETH_P_8021AD))  		return -EINVAL; -	}  	*vlan_tci = ntohs(veth->h_vlan_TCI);  	return 0; @@ -294,7 +312,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,   */  static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)  { -	if (skb->dev->features & NETIF_F_HW_VLAN_TX) { +	if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) {  		return __vlan_hwaccel_get_tag(skb, vlan_tci);  	} else {  		return __vlan_get_tag(skb, vlan_tci); @@ -339,7 +357,7 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,  	 */  	proto = vhdr->h_vlan_encapsulated_proto; -	if (ntohs(proto) >= 1536) { +	if (ntohs(proto) >= ETH_P_802_3_MIN) {  		skb->protocol = proto;  		return;  	} diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h index 2e4eab9868a..e7fdec4db9d 100644 --- a/include/linux/iio/adc/ad_sigma_delta.h +++ b/include/linux/iio/adc/ad_sigma_delta.h @@ -133,9 +133,9 @@ int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig);  		.channel2 = (_channel2), \  		.address = (_address), \  		.extend_name = (_extend_name), \ -		.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ -			IIO_CHAN_INFO_SCALE_SHARED_BIT | \ -			IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \ +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ +			BIT(IIO_CHAN_INFO_OFFSET), \ +		.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \  		.scan_index = (_si), \  		.scan_type = { \  			.sign = 'u', \ diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 8bd12be0b02..172c5b23cb8 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h @@ -15,6 +15,7 @@  #include <linux/spi/spi.h>  #include <linux/irqreturn.h>  #include <linux/iio/trigger.h> +#include <linux/bitops.h>  #define ST_SENSORS_TX_MAX_LENGTH		2  #define ST_SENSORS_RX_MAX_LENGTH		6 @@ -45,8 +46,8 @@  { \  	.type = device_type, \  	.modified = 1, \ -	.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ -			IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ +	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ +			BIT(IIO_CHAN_INFO_SCALE), \  	.scan_index = index, \  	.channel2 = mod, \  	.address = addr, \ diff --git a/include/linux/iio/gyro/itg3200.h b/include/linux/iio/gyro/itg3200.h index c53f16914b7..2a820850f28 100644 --- a/include/linux/iio/gyro/itg3200.h +++ b/include/linux/iio/gyro/itg3200.h @@ -149,6 +149,6 @@ static inline void itg3200_buffer_unconfigure(struct iio_dev *indio_dev)  {  } -#endif  /* CONFIG_IIO_RING_BUFFER */ +#endif  /* CONFIG_IIO_BUFFER */  #endif /* ITG3200_H_ */ diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index da8c776ba0b..8d171f42763 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -38,76 +38,6 @@ enum iio_chan_info_enum {  	IIO_CHAN_INFO_HYSTERESIS,  }; -#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2) -#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1) -#define IIO_CHAN_INFO_BITS(type) (IIO_CHAN_INFO_SHARED_BIT(type) | \ -				    IIO_CHAN_INFO_SEPARATE_BIT(type)) - -#define IIO_CHAN_INFO_RAW_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW) -#define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED) -#define IIO_CHAN_INFO_SCALE_SEPARATE_BIT		\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE) -#define IIO_CHAN_INFO_SCALE_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE) -#define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET) -#define IIO_CHAN_INFO_OFFSET_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET) -#define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE) -#define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE) -#define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS) -#define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS) -#define IIO_CHAN_INFO_PEAK_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK) -#define IIO_CHAN_INFO_PEAK_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK) -#define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE) -#define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE) -#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT	\ -	IIO_CHAN_INFO_SEPARATE_BIT(				\ -		IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW) -#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT	\ -	IIO_CHAN_INFO_SHARED_BIT(				\ -		IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW) -#define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW) -#define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW) -#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT \ -	IIO_CHAN_INFO_SHARED_BIT(			       \ -		IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY) -#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT \ -	IIO_CHAN_INFO_SEPARATE_BIT(			       \ -		IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY) -#define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT		\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ) -#define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ) -#define IIO_CHAN_INFO_FREQUENCY_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_FREQUENCY) -#define IIO_CHAN_INFO_FREQUENCY_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_FREQUENCY) -#define IIO_CHAN_INFO_PHASE_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PHASE) -#define IIO_CHAN_INFO_PHASE_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PHASE) -#define IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN) -#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN) -#define IIO_CHAN_INFO_HYSTERESIS_SEPARATE_BIT			\ -	IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HYSTERESIS) -#define IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT			\ -	IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HYSTERESIS) -  enum iio_endian {  	IIO_CPU,  	IIO_BE, @@ -218,6 +148,10 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,   *			endianness:	little or big endian   * @info_mask:		What information is to be exported about this channel.   *			This includes calibbias, scale etc. + * @info_mask_separate: What information is to be exported that is specific to + *			this channel. + * @info_mask_shared_by_type: What information is to be exported that is shared +*			by all channels of the same type.   * @event_mask:		What events can this channel produce.   * @ext_info:		Array of extended info attributes for this channel.   *			The array is NULL terminated, the last element should @@ -253,6 +187,8 @@ struct iio_chan_spec {  		enum iio_endian endianness;  	} scan_type;  	long			info_mask; +	long			info_mask_separate; +	long			info_mask_shared_by_type;  	long			event_mask;  	const struct iio_chan_spec_ext_info *ext_info;  	const char		*extend_name; @@ -275,7 +211,8 @@ struct iio_chan_spec {  static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,  	enum iio_chan_info_enum type)  { -	return chan->info_mask & IIO_CHAN_INFO_BITS(type); +	return (chan->info_mask_separate & type) | +	       (chan->info_mask_shared_by_type & type);  }  #define IIO_ST(si, rb, sb, sh)						\ diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index ff781dca2e9..b665dc7f017 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h @@ -162,8 +162,8 @@ int adis_single_conversion(struct iio_dev *indio_dev,  	.indexed = 1, \  	.channel = (chan), \  	.extend_name = name, \ -	.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ -		IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ +	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ +		BIT(IIO_CHAN_INFO_SCALE), \  	.address = (addr), \  	.scan_index = (si), \  	.scan_type = { \ @@ -184,9 +184,9 @@ int adis_single_conversion(struct iio_dev *indio_dev,  	.type = IIO_TEMP, \  	.indexed = 1, \  	.channel = 0, \ -	.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ -		IIO_CHAN_INFO_SCALE_SEPARATE_BIT | \ -		IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \ +	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ +		BIT(IIO_CHAN_INFO_SCALE) | \ +		BIT(IIO_CHAN_INFO_OFFSET), \  	.address = (addr), \  	.scan_index = (si), \  	.scan_type = { \ @@ -197,13 +197,13 @@ int adis_single_conversion(struct iio_dev *indio_dev,  	}, \  } -#define ADIS_MOD_CHAN(_type, mod, addr, si, info, bits) { \ +#define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, bits) { \  	.type = (_type), \  	.modified = 1, \  	.channel2 = IIO_MOD_ ## mod, \ -	.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ -		 IIO_CHAN_INFO_SCALE_SHARED_BIT | \ -		 info, \ +	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ +		 info_sep, \ +	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \  	.address = (addr), \  	.scan_index = (si), \  	.scan_type = { \ @@ -214,17 +214,17 @@ int adis_single_conversion(struct iio_dev *indio_dev,  	}, \  } -#define ADIS_ACCEL_CHAN(mod, addr, si, info, bits) \ -	ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info, bits) +#define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, bits) \ +	ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, bits) -#define ADIS_GYRO_CHAN(mod, addr, si, info, bits) \ -	ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info, bits) +#define ADIS_GYRO_CHAN(mod, addr, si, info_sep, bits) \ +	ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, bits) -#define ADIS_INCLI_CHAN(mod, addr, si, info, bits) \ -	ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info, bits) +#define ADIS_INCLI_CHAN(mod, addr, si, info_sep, bits) \ +	ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, bits) -#define ADIS_ROT_CHAN(mod, addr, si, info, bits) \ -	ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info, bits) +#define ADIS_ROT_CHAN(mod, addr, si, info_sep, bits) \ +	ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, bits)  #ifdef CONFIG_IIO_ADIS_LIB_BUFFER diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h index c66e0a96f6e..3869c525b05 100644 --- a/include/linux/iio/trigger.h +++ b/include/linux/iio/trigger.h @@ -44,7 +44,6 @@ struct iio_trigger_ops {   * @id:			[INTERN] unique id number   * @name:		[DRIVER] unique name   * @dev:		[DRIVER] associated device (if relevant) - * @private_data:	[DRIVER] device specific data   * @list:		[INTERN] used in maintenance of global trigger list   * @alloc_list:		[DRIVER] used for driver specific trigger list   * @use_count:		use count for the trigger @@ -60,7 +59,6 @@ struct iio_trigger {  	const char			*name;  	struct device			dev; -	void				*private_data;  	struct list_head		list;  	struct list_head		alloc_list;  	int use_count; @@ -92,6 +90,30 @@ static inline void iio_trigger_get(struct iio_trigger *trig)  }  /** + * iio_device_set_drvdata() - Set trigger driver data + * @trig: IIO trigger structure + * @data: Driver specific data + * + * Allows to attach an arbitrary pointer to an IIO trigger, which can later be + * retrieved by iio_trigger_get_drvdata(). + */ +static inline void iio_trigger_set_drvdata(struct iio_trigger *trig, void *data) +{ +	dev_set_drvdata(&trig->dev, data); +} + +/** + * iio_trigger_get_drvdata() - Get trigger driver data + * @trig: IIO trigger structure + * + * Returns the data previously set with iio_trigger_set_drvdata() + */ +static inline void *iio_trigger_get_drvdata(struct iio_trigger *trig) +{ +	return dev_get_drvdata(&trig->dev); +} + +/**   * iio_trigger_register() - register a trigger with the IIO core   * @trig_info:	trigger to be registered   **/ diff --git a/include/linux/ima.h b/include/linux/ima.h index 86c361e947b..1b7f268cddc 100644 --- a/include/linux/ima.h +++ b/include/linux/ima.h @@ -46,7 +46,7 @@ static inline int ima_module_check(struct file *file)  	return 0;  } -#endif /* CONFIG_IMA_H */ +#endif /* CONFIG_IMA */  #ifdef CONFIG_IMA_APPRAISE  extern void ima_inode_post_setattr(struct dentry *dentry); @@ -72,5 +72,5 @@ static inline int ima_inode_removexattr(struct dentry *dentry,  {  	return 0;  } -#endif /* CONFIG_IMA_APPRAISE_H */ +#endif /* CONFIG_IMA_APPRAISE */  #endif /* _LINUX_IMA_H */ diff --git a/include/linux/input/auo-pixcir-ts.h b/include/linux/input/auo-pixcir-ts.h index 75d4be71771..5049f21928e 100644 --- a/include/linux/input/auo-pixcir-ts.h +++ b/include/linux/input/auo-pixcir-ts.h @@ -43,12 +43,10 @@   */  struct auo_pixcir_ts_platdata {  	int gpio_int; +	int gpio_rst;  	int int_setting; -	void (*init_hw)(struct i2c_client *); -	void (*exit_hw)(struct i2c_client *); -  	unsigned int x_max;  	unsigned int y_max;  }; diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h index 2e86bd0bfba..1b1dfa80d9f 100644 --- a/include/linux/input/mt.h +++ b/include/linux/input/mt.h @@ -19,6 +19,7 @@  #define INPUT_MT_DIRECT		0x0002	/* direct device, e.g. touchscreen */  #define INPUT_MT_DROP_UNUSED	0x0004	/* drop contacts not seen in frame */  #define INPUT_MT_TRACK		0x0008	/* use in-kernel tracking */ +#define INPUT_MT_SEMI_MT	0x0010	/* semi-mt device, finger count handled manually */  /**   * struct input_mt_slot - represents the state of an input MT slot diff --git a/include/linux/integrity.h b/include/linux/integrity.h index 66c5fe9550a..83222cebd47 100644 --- a/include/linux/integrity.h +++ b/include/linux/integrity.h @@ -36,5 +36,5 @@ static inline void integrity_inode_free(struct inode *inode)  {  	return;  } -#endif /* CONFIG_INTEGRITY_H */ +#endif /* CONFIG_INTEGRITY */  #endif /* _LINUX_INTEGRITY_H */ diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 85ac9b9b72a..89b7c24a36e 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -192,6 +192,10 @@ extern struct resource * __request_region(struct resource *,  extern int __check_region(struct resource *, resource_size_t, resource_size_t);  extern void __release_region(struct resource *, resource_size_t,  				resource_size_t); +#ifdef CONFIG_MEMORY_HOTREMOVE +extern int release_mem_region_adjustable(struct resource *, resource_size_t, +				resource_size_t); +#endif  static inline int __deprecated check_region(resource_size_t s,  						resource_size_t n) diff --git a/include/linux/ipack.h b/include/linux/ipack.h index fea12cbb2ae..1888e06ddf6 100644 --- a/include/linux/ipack.h +++ b/include/linux/ipack.h @@ -207,19 +207,41 @@ int ipack_driver_register(struct ipack_driver *edrv, struct module *owner,  void ipack_driver_unregister(struct ipack_driver *edrv);  /** - *	ipack_device_register -- register an IPack device with the kernel - *	@dev: the new device to register. + *	ipack_device_init -- initialize an IPack device + * @dev: the new device to initialize.   * - *	Register a new IPack device ("module" in IndustryPack jargon). The call - *	is done by the carrier driver.  The carrier should populate the fields - *	bus and slot as well as the region array of @dev prior to calling this - *	function.  The rest of the fields will be allocated and populated - *	during registration. + * Initialize a new IPack device ("module" in IndustryPack jargon). The call + * is done by the carrier driver.  The carrier should populate the fields + * bus and slot as well as the region array of @dev prior to calling this + * function.  The rest of the fields will be allocated and populated + * during initalization.   * - *	Return zero on success or error code on failure. + * Return zero on success or error code on failure. + * + * NOTE: _Never_ directly free @dev after calling this function, even + * if it returned an error! Always use ipack_put_device() to give up the + * reference initialized in this function instead. + */ +int ipack_device_init(struct ipack_device *dev); + +/** + *	ipack_device_add -- Add an IPack device + * @dev: the new device to add. + * + * Add a new IPack device. The call is done by the carrier driver + * after calling ipack_device_init(). + * + * Return zero on success or error code on failure. + * + * NOTE: _Never_ directly free @dev after calling this function, even + * if it returned an error! Always use ipack_put_device() to give up the + * reference initialized in this function instead.   */ -int ipack_device_register(struct ipack_device *dev); -void ipack_device_unregister(struct ipack_device *dev); +int ipack_device_add(struct ipack_device *dev); +void ipack_device_del(struct ipack_device *dev); + +void ipack_get_device(struct ipack_device *dev); +void ipack_put_device(struct ipack_device *dev);  /**   * DEFINE_IPACK_DEVICE_TABLE - macro used to describe a IndustryPack table diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index ae221a7b509..c4d870b0d5e 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h @@ -43,8 +43,8 @@ struct ipc_namespace {  	size_t		shm_ctlmax;  	size_t		shm_ctlall; +	unsigned long	shm_tot;  	int		shm_ctlmni; -	int		shm_tot;  	/*  	 * Defines whether IPC_RMID is forced for _all_ shm segments regardless  	 * of shmctl() diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h index 3fd8e4290a1..3e203eb23cc 100644 --- a/include/linux/irqchip/arm-gic.h +++ b/include/linux/irqchip/arm-gic.h @@ -65,7 +65,6 @@ extern struct irq_chip gic_arch_extn;  void gic_init_bases(unsigned int, int, void __iomem *, void __iomem *,  		    u32 offset, struct device_node *); -void gic_secondary_init(unsigned int);  void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);  static inline void gic_init(unsigned int nr, int start, diff --git a/include/linux/irqchip/chained_irq.h b/include/linux/irqchip/chained_irq.h new file mode 100644 index 00000000000..adf4c30f3af --- /dev/null +++ b/include/linux/irqchip/chained_irq.h @@ -0,0 +1,52 @@ +/* + * Chained IRQ handlers support. + * + * Copyright (C) 2011 ARM Ltd. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program.  If not, see <http://www.gnu.org/licenses/>. + */ +#ifndef __IRQCHIP_CHAINED_IRQ_H +#define __IRQCHIP_CHAINED_IRQ_H + +#include <linux/irq.h> + +/* + * Entry/exit functions for chained handlers where the primary IRQ chip + * may implement either fasteoi or level-trigger flow control. + */ +static inline void chained_irq_enter(struct irq_chip *chip, +				     struct irq_desc *desc) +{ +	/* FastEOI controllers require no action on entry. */ +	if (chip->irq_eoi) +		return; + +	if (chip->irq_mask_ack) { +		chip->irq_mask_ack(&desc->irq_data); +	} else { +		chip->irq_mask(&desc->irq_data); +		if (chip->irq_ack) +			chip->irq_ack(&desc->irq_data); +	} +} + +static inline void chained_irq_exit(struct irq_chip *chip, +				    struct irq_desc *desc) +{ +	if (chip->irq_eoi) +		chip->irq_eoi(&desc->irq_data); +	else +		chip->irq_unmask(&desc->irq_data); +} + +#endif /* __IRQCHIP_CHAINED_IRQ_H */ diff --git a/include/linux/irqchip/mxs.h b/include/linux/irqchip/mxs.h new file mode 100644 index 00000000000..9039a538a91 --- /dev/null +++ b/include/linux/irqchip/mxs.h @@ -0,0 +1,14 @@ +/* + * Copyright (C) 2013 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __LINUX_IRQCHIP_MXS_H +#define __LINUX_IRQCHIP_MXS_H + +extern void icoll_handle_irq(struct pt_regs *); + +#endif diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 50e5a5e6a71..6e051f472ed 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -480,6 +480,7 @@ struct transaction_s  		T_COMMIT,  		T_COMMIT_DFLUSH,  		T_COMMIT_JFLUSH, +		T_COMMIT_CALLBACK,  		T_FINISHED  	}			t_state; @@ -1144,7 +1145,7 @@ extern struct kmem_cache *jbd2_handle_cache;  static inline handle_t *jbd2_alloc_handle(gfp_t gfp_flags)  { -	return kmem_cache_alloc(jbd2_handle_cache, gfp_flags); +	return kmem_cache_zalloc(jbd2_handle_cache, gfp_flags);  }  static inline void jbd2_free_handle(handle_t *handle) @@ -1200,6 +1201,7 @@ int __jbd2_log_start_commit(journal_t *journal, tid_t tid);  int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);  int jbd2_journal_force_commit_nested(journal_t *journal);  int jbd2_log_wait_commit(journal_t *journal, tid_t tid); +int jbd2_complete_transaction(journal_t *journal, tid_t tid);  int jbd2_log_do_checkpoint(journal_t *journal);  int jbd2_trans_will_send_data_barrier(journal_t *journal, tid_t tid); diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 82ed068b1eb..8fb8edf1241 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -75,7 +75,6 @@ extern int register_refined_jiffies(long clock_tick_rate);   */  extern u64 __jiffy_data jiffies_64;  extern unsigned long volatile __jiffy_data jiffies; -extern seqlock_t jiffies_lock;  #if (BITS_PER_LONG < 64)  u64 get_jiffies_64(void); diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h index c18b46f8aee..13a3da25ff0 100644 --- a/include/linux/journal-head.h +++ b/include/linux/journal-head.h @@ -31,21 +31,14 @@ struct journal_head {  	/*  	 * Journalling list for this buffer [jbd_lock_bh_state()]  	 */ -	unsigned b_jlist; +	unsigned b_jlist:4;  	/*  	 * This flag signals the buffer has been modified by  	 * the currently running transaction  	 * [jbd_lock_bh_state()]  	 */ -	unsigned b_modified; - -	/* -	 * This feild tracks the last transaction id in which this buffer -	 * has been cowed -	 * [jbd_lock_bh_state()] -	 */ -	tid_t b_cow_tid; +	unsigned b_modified:1;  	/*  	 * Copy of the buffer data frozen for writing to the log. diff --git a/include/linux/kcore.h b/include/linux/kcore.h new file mode 100644 index 00000000000..d9276228664 --- /dev/null +++ b/include/linux/kcore.h @@ -0,0 +1,38 @@ +/* + * /proc/kcore definitions + */ +#ifndef _LINUX_KCORE_H +#define _LINUX_KCORE_H + +enum kcore_type { +	KCORE_TEXT, +	KCORE_VMALLOC, +	KCORE_RAM, +	KCORE_VMEMMAP, +	KCORE_OTHER, +}; + +struct kcore_list { +	struct list_head list; +	unsigned long addr; +	size_t size; +	int type; +}; + +struct vmcore { +	struct list_head list; +	unsigned long long paddr; +	unsigned long long size; +	loff_t offset; +}; + +#ifdef CONFIG_PROC_KCORE +extern void kclist_add(struct kcore_list *, void *, size_t, int type); +#else +static inline +void kclist_add(struct kcore_list *new, void *addr, size_t size, int type) +{ +} +#endif + +#endif /* _LINUX_KCORE_H */ diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 79fdd80a42d..6d1844f393c 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -486,6 +486,8 @@ enum ftrace_dump_mode {  void tracing_on(void);  void tracing_off(void);  int tracing_is_on(void); +void tracing_snapshot(void); +void tracing_snapshot_alloc(void);  extern void tracing_start(void);  extern void tracing_stop(void); @@ -515,10 +517,32 @@ do {									\   *   * This is intended as a debugging tool for the developer only.   * Please refrain from leaving trace_printks scattered around in - * your code. + * your code. (Extra memory is used for special buffers that are + * allocated when trace_printk() is used) + * + * A little optization trick is done here. If there's only one + * argument, there's no need to scan the string for printf formats. + * The trace_puts() will suffice. But how can we take advantage of + * using trace_puts() when trace_printk() has only one argument? + * By stringifying the args and checking the size we can tell + * whether or not there are args. __stringify((__VA_ARGS__)) will + * turn into "()\0" with a size of 3 when there are no args, anything + * else will be bigger. All we need to do is define a string to this, + * and then take its size and compare to 3. If it's bigger, use + * do_trace_printk() otherwise, optimize it to trace_puts(). Then just + * let gcc optimize the rest.   */ -#define trace_printk(fmt, args...)					\ +#define trace_printk(fmt, ...)				\ +do {							\ +	char _______STR[] = __stringify((__VA_ARGS__));	\ +	if (sizeof(_______STR) > 3)			\ +		do_trace_printk(fmt, ##__VA_ARGS__);	\ +	else						\ +		trace_puts(fmt);			\ +} while (0) + +#define do_trace_printk(fmt, args...)					\  do {									\  	static const char *trace_printk_fmt				\  		__attribute__((section("__trace_printk_fmt"))) =	\ @@ -538,7 +562,45 @@ int __trace_bprintk(unsigned long ip, const char *fmt, ...);  extern __printf(2, 3)  int __trace_printk(unsigned long ip, const char *fmt, ...); -extern void trace_dump_stack(void); +/** + * trace_puts - write a string into the ftrace buffer + * @str: the string to record + * + * Note: __trace_bputs is an internal function for trace_puts and + *       the @ip is passed in via the trace_puts macro. + * + * This is similar to trace_printk() but is made for those really fast + * paths that a developer wants the least amount of "Heisenbug" affects, + * where the processing of the print format is still too much. + * + * This function allows a kernel developer to debug fast path sections + * that printk is not appropriate for. By scattering in various + * printk like tracing in the code, a developer can quickly see + * where problems are occurring. + * + * This is intended as a debugging tool for the developer only. + * Please refrain from leaving trace_puts scattered around in + * your code. (Extra memory is used for special buffers that are + * allocated when trace_puts() is used) + * + * Returns: 0 if nothing was written, positive # if string was. + *  (1 when __trace_bputs is used, strlen(str) when __trace_puts is used) + */ + +extern int __trace_bputs(unsigned long ip, const char *str); +extern int __trace_puts(unsigned long ip, const char *str, int size); +#define trace_puts(str) ({						\ +	static const char *trace_printk_fmt				\ +		__attribute__((section("__trace_printk_fmt"))) =	\ +		__builtin_constant_p(str) ? str : NULL;			\ +									\ +	if (__builtin_constant_p(str))					\ +		__trace_bputs(_THIS_IP_, trace_printk_fmt);		\ +	else								\ +		__trace_puts(_THIS_IP_, str, strlen(str));		\ +}) + +extern void trace_dump_stack(int skip);  /*   * The double __builtin_constant_p is because gcc will give us an error @@ -573,6 +635,8 @@ static inline void trace_dump_stack(void) { }  static inline void tracing_on(void) { }  static inline void tracing_off(void) { }  static inline int tracing_is_on(void) { return 0; } +static inline void tracing_snapshot(void) { } +static inline void tracing_snapshot_alloc(void) { }  static inline __printf(1, 2)  int trace_printk(const char *fmt, ...) @@ -734,6 +798,4 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }  # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD  #endif -extern int do_sysinfo(struct sysinfo *info); -  #endif diff --git a/include/linux/kexec.h b/include/linux/kexec.h index d2e6927bbaa..d78d28a733b 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -200,6 +200,8 @@ extern size_t vmcoreinfo_max_size;  int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,  		unsigned long long *crash_size, unsigned long long *crash_base); +int parse_crashkernel_high(char *cmdline, unsigned long long system_ram, +		unsigned long long *crash_size, unsigned long long *crash_base);  int parse_crashkernel_low(char *cmdline, unsigned long long system_ram,  		unsigned long long *crash_size, unsigned long long *crash_base);  int crash_shrink_memory(unsigned long new_size); diff --git a/include/linux/kmod.h b/include/linux/kmod.h index 5398d580707..0555cc66a15 100644 --- a/include/linux/kmod.h +++ b/include/linux/kmod.h @@ -67,16 +67,15 @@ struct subprocess_info {  };  extern int -call_usermodehelper_fns(char *path, char **argv, char **envp, int wait, -			int (*init)(struct subprocess_info *info, struct cred *new), -			void (*cleanup)(struct subprocess_info *), void *data); +call_usermodehelper(char *path, char **argv, char **envp, int wait); -static inline int -call_usermodehelper(char *path, char **argv, char **envp, int wait) -{ -	return call_usermodehelper_fns(path, argv, envp, wait, -				       NULL, NULL, NULL); -} +extern struct subprocess_info * +call_usermodehelper_setup(char *path, char **argv, char **envp, gfp_t gfp_mask, +			  int (*init)(struct subprocess_info *info, struct cred *new), +			  void (*cleanup)(struct subprocess_info *), void *data); + +extern int +call_usermodehelper_exec(struct subprocess_info *info, int wait);  extern struct ctl_table usermodehelper_table[]; diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 4b6ef4d33cc..ca1d27a0d6a 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h @@ -29,6 +29,7 @@   *		<jkenisto@us.ibm.com>  and Prasanna S Panchamukhi   *		<prasanna@in.ibm.com> added function-return probes.   */ +#include <linux/compiler.h>	/* for __kprobes */  #include <linux/linkage.h>  #include <linux/list.h>  #include <linux/notifier.h> @@ -49,16 +50,11 @@  #define KPROBE_REENTER		0x00000004  #define KPROBE_HIT_SSDONE	0x00000008 -/* Attach to insert probes on any functions which should be ignored*/ -#define __kprobes	__attribute__((__section__(".kprobes.text"))) -  #else /* CONFIG_KPROBES */  typedef int kprobe_opcode_t;  struct arch_specific_insn {  	int dummy;  }; -#define __kprobes -  #endif /* CONFIG_KPROBES */  struct kprobe; diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 8d816646f76..7dcef331768 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -43,6 +43,7 @@ bool kthread_should_stop(void);  bool kthread_should_park(void);  bool kthread_freezable_should_stop(bool *was_frozen);  void *kthread_data(struct task_struct *k); +void *probe_kthread_data(struct task_struct *k);  int kthread_park(struct task_struct *k);  void kthread_unpark(struct task_struct *k);  void kthread_parkme(void); diff --git a/include/linux/ktime.h b/include/linux/ktime.h index e83512f63df..bbca12804d1 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -330,6 +330,24 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)  extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); +/** + * ktime_to_timespec_cond - convert a ktime_t variable to timespec + *			    format only if the variable contains data + * @kt:		the ktime_t variable to convert + * @ts:		the timespec variable to store the result in + * + * Returns true if there was a successful conversion, false if kt was 0. + */ +static inline bool ktime_to_timespec_cond(const ktime_t kt, struct timespec *ts) +{ +	if (kt.tv64) { +		*ts = ktime_to_timespec(kt); +		return true; +	} else { +		return false; +	} +} +  /*   * The resolution of the clocks. The resolution value is returned in   * the clock_getres() system call to give application programmers an diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index cad77fe09d7..c1395825192 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -518,7 +518,7 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,  int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,  			   void *data, unsigned long len);  int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, -			      gpa_t gpa); +			      gpa_t gpa, unsigned long len);  int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);  int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);  struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h index fa7cc7244cb..b0bcce0ddc9 100644 --- a/include/linux/kvm_types.h +++ b/include/linux/kvm_types.h @@ -71,6 +71,7 @@ struct gfn_to_hva_cache {  	u64 generation;  	gpa_t gpa;  	unsigned long hva; +	unsigned long len;  	struct kvm_memory_slot *memslot;  }; diff --git a/include/linux/libata.h b/include/linux/libata.h index 91c9d109e5f..eae7a053dc5 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -398,6 +398,7 @@ enum {  	ATA_HORKAGE_NOSETXFER	= (1 << 14),	/* skip SETXFER, SATA only */  	ATA_HORKAGE_BROKEN_FPDMA_AA	= (1 << 15),	/* skip AA */  	ATA_HORKAGE_DUMP_ID	= (1 << 16),	/* dump IDENTIFY data */ +	ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17),	/* Set max sects to 65535 */  	 /* DMA mask for user DMA control: User visible values; DO NOT  	    renumber */ diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 807f1e53322..de09dec25ec 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -2,6 +2,7 @@  #define _LINUX_LINKAGE_H  #include <linux/compiler.h> +#include <linux/stringify.h>  #include <asm/linkage.h>  #ifdef __cplusplus @@ -14,6 +15,23 @@  #define asmlinkage CPP_ASMLINKAGE  #endif +#ifdef CONFIG_SYMBOL_PREFIX +#define __SYMBOL_NAME(x) CONFIG_SYMBOL_PREFIX __stringify(x) +#else +#define __SYMBOL_NAME(x) __stringify(x) +#endif + +#ifndef cond_syscall +#define cond_syscall(x) asm(".weak\t" __SYMBOL_NAME(x) \ +	"\n\t.set\t" __SYMBOL_NAME(x) "," __SYMBOL_NAME(sys_ni_syscall)); +#endif + +#ifndef SYSCALL_ALIAS +#define SYSCALL_ALIAS(alias, name)				\ +	asm ("\t.globl " __SYMBOL_NAME(alias)			\ +	"\n\t.set\t" __SYMBOL_NAME(alias) "," __SYMBOL_NAME(name)) +#endif +  #define __page_aligned_data	__section(.data..page_aligned) __aligned(PAGE_SIZE)  #define __page_aligned_bss	__section(.bss..page_aligned) __aligned(PAGE_SIZE) diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h index 31f9d75adc5..2eb88556c5c 100644 --- a/include/linux/list_bl.h +++ b/include/linux/list_bl.h @@ -125,6 +125,11 @@ static inline void hlist_bl_unlock(struct hlist_bl_head *b)  	__bit_spin_unlock(0, (unsigned long *)b);  } +static inline bool hlist_bl_is_locked(struct hlist_bl_head *b) +{ +	return bit_spin_is_locked(0, (unsigned long *)b); +} +  /**   * hlist_bl_for_each_entry	- iterate over list of given type   * @tpos:	the type * to use as a loop cursor. diff --git a/include/linux/math64.h b/include/linux/math64.h index b8ba8554472..931a619407b 100644 --- a/include/linux/math64.h +++ b/include/linux/math64.h @@ -30,6 +30,15 @@ static inline s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder)  }  /** + * div64_u64_rem - unsigned 64bit divide with 64bit divisor + */ +static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder) +{ +	*remainder = dividend % divisor; +	return dividend / divisor; +} + +/**   * div64_u64 - unsigned 64bit divide with 64bit divisor   */  static inline u64 div64_u64(u64 dividend, u64 divisor) @@ -61,8 +70,16 @@ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder)  extern s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);  #endif +#ifndef div64_u64_rem +extern u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder); +#endif +  #ifndef div64_u64 -extern u64 div64_u64(u64 dividend, u64 divisor); +static inline u64 div64_u64(u64 dividend, u64 divisor) +{ +	u64 remainder; +	return div64_u64_rem(dividend, divisor, &remainder); +}  #endif  #ifndef div64_s64 diff --git a/include/linux/mei_cl_bus.h b/include/linux/mei_cl_bus.h new file mode 100644 index 00000000000..d14af7b722e --- /dev/null +++ b/include/linux/mei_cl_bus.h @@ -0,0 +1,44 @@ +#ifndef _LINUX_MEI_CL_BUS_H +#define _LINUX_MEI_CL_BUS_H + +#include <linux/device.h> +#include <linux/uuid.h> + +struct mei_cl_device; + +struct mei_cl_driver { +	struct device_driver driver; +	const char *name; + +	const struct mei_cl_device_id *id_table; + +	int (*probe)(struct mei_cl_device *dev, +		     const struct mei_cl_device_id *id); +	int (*remove)(struct mei_cl_device *dev); +}; + +int __mei_cl_driver_register(struct mei_cl_driver *driver, +				struct module *owner); +#define mei_cl_driver_register(driver)             \ +	__mei_cl_driver_register(driver, THIS_MODULE) + +void mei_cl_driver_unregister(struct mei_cl_driver *driver); + +int mei_cl_send(struct mei_cl_device *device, u8 *buf, size_t length); +int mei_cl_recv(struct mei_cl_device *device, u8 *buf, size_t length); + +typedef void (*mei_cl_event_cb_t)(struct mei_cl_device *device, +			       u32 events, void *context); +int mei_cl_register_event_cb(struct mei_cl_device *device, +			  mei_cl_event_cb_t read_cb, void *context); + +#define MEI_CL_EVENT_RX 0 +#define MEI_CL_EVENT_TX 1 + +void *mei_cl_get_drvdata(const struct mei_cl_device *device); +void mei_cl_set_drvdata(struct mei_cl_device *device, void *data); + +int mei_cl_enable_device(struct mei_cl_device *device); +int mei_cl_disable_device(struct mei_cl_device *device); + +#endif /* _LINUX_MEI_CL_BUS_H */ diff --git a/include/linux/memory.h b/include/linux/memory.h index 45e93b46887..85c31a8e290 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h @@ -18,6 +18,7 @@  #include <linux/node.h>  #include <linux/compiler.h>  #include <linux/mutex.h> +#include <linux/notifier.h>  #define MIN_MEMORY_BLOCK_SIZE     (1UL << SECTION_SIZE_BITS) @@ -114,9 +115,10 @@ extern void unregister_memory_notifier(struct notifier_block *nb);  extern int register_memory_isolate_notifier(struct notifier_block *nb);  extern void unregister_memory_isolate_notifier(struct notifier_block *nb);  extern int register_new_memory(int, struct mem_section *); +#ifdef CONFIG_MEMORY_HOTREMOVE  extern int unregister_memory_section(struct mem_section *); +#endif  extern int memory_dev_init(void); -extern int remove_memory_block(unsigned long, struct mem_section *, int);  extern int memory_notify(unsigned long val, void *v);  extern int memory_isolate_notify(unsigned long val, void *v);  extern struct memory_block *find_memory_block_hinted(struct mem_section *, @@ -127,13 +129,18 @@ enum mem_add_context { BOOT, HOTPLUG };  #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */  #ifdef CONFIG_MEMORY_HOTPLUG -#define hotplug_memory_notifier(fn, pri) {			\ +#define hotplug_memory_notifier(fn, pri) ({		\  	static __meminitdata struct notifier_block fn##_mem_nb =\ -		{ .notifier_call = fn, .priority = pri };	\ +		{ .notifier_call = fn, .priority = pri };\  	register_memory_notifier(&fn##_mem_nb);			\ -} +}) +#define register_hotmemory_notifier(nb)		register_memory_notifier(nb) +#define unregister_hotmemory_notifier(nb) 	unregister_memory_notifier(nb)  #else -#define hotplug_memory_notifier(fn, pri) do { } while (0) +#define hotplug_memory_notifier(fn, pri)	({ 0; }) +/* These aren't inline functions due to a GCC bug. */ +#define register_hotmemory_notifier(nb)    ({ (void)(nb); 0; }) +#define unregister_hotmemory_notifier(nb)  ({ (void)(nb); })  #endif  /* diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index b6a3be7d47b..3e622c61092 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -97,13 +97,13 @@ extern void __online_page_free(struct page *page);  #ifdef CONFIG_MEMORY_HOTREMOVE  extern bool is_pageblock_removable_nolock(struct page *page);  extern int arch_remove_memory(u64 start, u64 size); +extern int __remove_pages(struct zone *zone, unsigned long start_pfn, +	unsigned long nr_pages);  #endif /* CONFIG_MEMORY_HOTREMOVE */  /* reasonably generic interface to expand the physical pages in a zone  */  extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn,  	unsigned long nr_pages); -extern int __remove_pages(struct zone *zone, unsigned long start_pfn, -	unsigned long nr_pages);  #ifdef CONFIG_NUMA  extern int memory_add_physaddr_to_nid(u64 start); diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h index 9ead60bc66b..3301b2031c8 100644 --- a/include/linux/mfd/abx500.h +++ b/include/linux/mfd/abx500.h @@ -89,6 +89,11 @@ struct abx500_fg;   *				points.   * @maint_thres			This is the threshold where we stop reporting   *				battery full while in maintenance, in per cent + * @pcut_enable:			Enable power cut feature in ab8505 + * @pcut_max_time:		Max time threshold + * @pcut_flag_time:		Flagtime threshold + * @pcut_max_restart:		Max number of restarts + * @pcut_debounce_time:		Sets battery debounce time   */  struct abx500_fg_parameters {  	int recovery_sleep_timer; @@ -106,6 +111,11 @@ struct abx500_fg_parameters {  	int battok_raising_th_sel1;  	int user_cap_limit;  	int maint_thres; +	bool pcut_enable; +	u8 pcut_max_time; +	u8 pcut_flag_time; +	u8 pcut_max_restart; +	u8 pcut_debounce_time;  };  /** @@ -173,11 +183,11 @@ struct abx500_battery_type {  	int low_high_vol_lvl;  	int battery_resistance;  	int n_temp_tbl_elements; -	struct abx500_res_to_temp *r_to_t_tbl; +	const struct abx500_res_to_temp *r_to_t_tbl;  	int n_v_cap_tbl_elements; -	struct abx500_v_to_cap *v_to_cap_tbl; +	const struct abx500_v_to_cap *v_to_cap_tbl;  	int n_batres_tbl_elements; -	struct batres_vs_temp *batres_tbl; +	const struct batres_vs_temp *batres_tbl;  };  /** @@ -236,7 +246,11 @@ struct abx500_bm_charger_parameters {   * @interval_not_charging charge alg cycle period time when not charging (sec)   * @temp_hysteresis	temperature hysteresis   * @gnd_lift_resistance	Battery ground to phone ground resistance (mOhm) - * @maxi:		maximization parameters + * @n_chg_out_curr		number of elements in array chg_output_curr + * @n_chg_in_curr		number of elements in array chg_input_curr + * @chg_output_curr	charger output current level map + * @chg_input_curr		charger input current level map + * @maxi		maximization parameters   * @cap_levels		capacity in percent for the different capacity levels   * @bat_type		table of supported battery types   * @chg_params		charger parameters @@ -257,6 +271,7 @@ struct abx500_bm_data {  	bool autopower_cfg;  	bool ac_enabled;  	bool usb_enabled; +	bool usb_power_path;  	bool no_maintenance;  	bool capacity_scaling;  	bool chg_unknown_bat; @@ -270,6 +285,10 @@ struct abx500_bm_data {  	int interval_not_charging;  	int temp_hysteresis;  	int gnd_lift_resistance; +	int n_chg_out_curr; +	int n_chg_in_curr; +	int *chg_output_curr; +	int *chg_input_curr;  	const struct abx500_maxim_parameters *maxi;  	const struct abx500_bm_capacity_levels *cap_levels;  	struct abx500_battery_type *bat_type; diff --git a/include/linux/mfd/abx500/ab8500-bm.h b/include/linux/mfd/abx500/ab8500-bm.h index 8d35bfe164c..cc892a8d8d6 100644 --- a/include/linux/mfd/abx500/ab8500-bm.h +++ b/include/linux/mfd/abx500/ab8500-bm.h @@ -23,6 +23,7 @@   * Bank : 0x5   */  #define AB8500_USB_LINE_STAT_REG	0x80 +#define AB8500_USB_LINE_CTRL2_REG	0x82  #define AB8500_USB_LINK1_STAT_REG	0x94  /* @@ -33,7 +34,7 @@  #define AB8500_CH_STATUS2_REG		0x01  #define AB8500_CH_USBCH_STAT1_REG	0x02  #define AB8500_CH_USBCH_STAT2_REG	0x03 -#define AB8500_CH_FSM_STAT_REG		0x04 +#define AB8540_CH_USBCH_STAT3_REG	0x04  #define AB8500_CH_STAT_REG		0x05  /* @@ -69,6 +70,8 @@  #define AB8500_USBCH_CTRL1_REG		0xC0  #define AB8500_USBCH_CTRL2_REG		0xC1  #define AB8500_USBCH_IPT_CRNTLVL_REG	0xC2 +#define AB8540_USB_PP_MODE_REG		0xC5 +#define AB8540_USB_PP_CHR_REG		0xC6  /*   * Gas Gauge register offsets @@ -105,6 +108,7 @@  #define AB8500_RTC_BACKUP_CHG_REG	0x0C  #define AB8500_RTC_CC_CONF_REG		0x01  #define AB8500_RTC_CTRL_REG		0x0B +#define AB8500_RTC_CTRL1_REG		0x11  /*   * OTP register offsets @@ -154,6 +158,7 @@  #define CH_OP_CUR_LVL_1P4		0x0D  #define CH_OP_CUR_LVL_1P5		0x0E  #define CH_OP_CUR_LVL_1P6		0x0F +#define CH_OP_CUR_LVL_2P		0x3F  /* BTEMP High thermal limits */  #define BTEMP_HIGH_TH_57_0		0x00 @@ -179,10 +184,25 @@  #define BUP_ICH_SEL_300UA		0x08  #define BUP_ICH_SEL_700UA		0x0C -#define BUP_VCH_SEL_2P5V		0x00 -#define BUP_VCH_SEL_2P6V		0x01 -#define BUP_VCH_SEL_2P8V		0x02 -#define BUP_VCH_SEL_3P1V		0x03 +enum bup_vch_sel { +	BUP_VCH_SEL_2P5V, +	BUP_VCH_SEL_2P6V, +	BUP_VCH_SEL_2P8V, +	BUP_VCH_SEL_3P1V, +	/* +	 * Note that the following 5 values 2.7v, 2.9v, 3.0v, 3.2v, 3.3v +	 * are only available on ab8540. You can't choose these 5 +	 * voltage on ab8500/ab8505/ab9540. +	 */ +	BUP_VCH_SEL_2P7V, +	BUP_VCH_SEL_2P9V, +	BUP_VCH_SEL_3P0V, +	BUP_VCH_SEL_3P2V, +	BUP_VCH_SEL_3P3V, +}; + +#define BUP_VCH_RANGE		0x02 +#define VBUP33_VRTCN		0x01  /* Battery OVV constants */  #define BATT_OVV_ENA			0x02 @@ -228,6 +248,8 @@  #define BAT_CTRL_20U_ENA		0x02  #define BAT_CTRL_18U_ENA		0x01  #define BAT_CTRL_16U_ENA		0x02 +#define BAT_CTRL_60U_ENA		0x01 +#define BAT_CTRL_120U_ENA		0x02  #define BAT_CTRL_CMP_ENA		0x04  #define FORCE_BAT_CTRL_CMP_HIGH		0x08  #define BAT_CTRL_PULL_UP_ENA		0x10 @@ -235,6 +257,24 @@  /* Battery type */  #define BATTERY_UNKNOWN			00 +/* Registers for pcut feature in ab8505 and ab9540 */ +#define AB8505_RTC_PCUT_CTL_STATUS_REG	0x12 +#define AB8505_RTC_PCUT_TIME_REG	0x13 +#define AB8505_RTC_PCUT_MAX_TIME_REG	0x14 +#define AB8505_RTC_PCUT_FLAG_TIME_REG	0x15 +#define AB8505_RTC_PCUT_RESTART_REG	0x16 +#define AB8505_RTC_PCUT_DEBOUNCE_REG	0x17 + +/* USB Power Path constants for ab8540 */ +#define BUS_VSYS_VOL_SELECT_MASK		0x06 +#define BUS_VSYS_VOL_SELECT_3P6V		0x00 +#define BUS_VSYS_VOL_SELECT_3P325V		0x02 +#define BUS_VSYS_VOL_SELECT_3P9V		0x04 +#define BUS_VSYS_VOL_SELECT_4P3V		0x06 +#define BUS_POWER_PATH_MODE_ENA			0x01 +#define BUS_PP_PRECHG_CURRENT_MASK		0x0E +#define BUS_POWER_PATH_PRECHG_ENA		0x01 +  /**   * struct res_to_temp - defines one point in a temp to res curve. To   * be used in battery packs that combines the identification resistor with a @@ -283,6 +323,11 @@ struct ab8500_fg;   *				points.   * @maint_thres			This is the threshold where we stop reporting   *				battery full while in maintenance, in per cent + * @pcut_enable:			Enable power cut feature in ab8505 + * @pcut_max_time:		Max time threshold + * @pcut_flag_time:		Flagtime threshold + * @pcut_max_restart:		Max number of restarts + * @pcut_debunce_time:	Sets battery debounce time   */  struct ab8500_fg_parameters {  	int recovery_sleep_timer; @@ -299,6 +344,11 @@ struct ab8500_fg_parameters {  	int battok_raising_th_sel1;  	int user_cap_limit;  	int maint_thres; +	bool pcut_enable; +	u8 pcut_max_time; +	u8 pcut_flag_time; +	u8 pcut_max_restart; +	u8 pcut_debunce_time;  };  /** @@ -415,6 +465,7 @@ void ab8500_fg_reinit(void);  void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA);  struct ab8500_btemp *ab8500_btemp_get(void);  int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp); +int ab8500_btemp_get_temp(struct ab8500_btemp *btemp);  struct ab8500_fg *ab8500_fg_get(void);  int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev);  int ab8500_fg_inst_curr_start(struct ab8500_fg *di); diff --git a/include/linux/mfd/abx500/ab8500-gpadc.h b/include/linux/mfd/abx500/ab8500-gpadc.h index 252966769d9..49ded001049 100644 --- a/include/linux/mfd/abx500/ab8500-gpadc.h +++ b/include/linux/mfd/abx500/ab8500-gpadc.h @@ -4,32 +4,72 @@   *   * Author: Arun R Murthy <arun.murthy@stericsson.com>   * Author: Daniel Willerud <daniel.willerud@stericsson.com> + * Author: M'boumba Cedric Madianga <cedric.madianga@stericsson.com>   */  #ifndef	_AB8500_GPADC_H  #define _AB8500_GPADC_H -/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2) */ -#define BAT_CTRL	0x01 -#define BTEMP_BALL	0x02 -#define MAIN_CHARGER_V	0x03 -#define ACC_DETECT1	0x04 -#define ACC_DETECT2	0x05 -#define ADC_AUX1	0x06 -#define ADC_AUX2	0x07 -#define MAIN_BAT_V	0x08 -#define VBUS_V		0x09 -#define MAIN_CHARGER_C	0x0A -#define USB_CHARGER_C	0x0B -#define BK_BAT_V	0x0C -#define DIE_TEMP	0x0D +/* GPADC source: From datasheet(ADCSwSel[4:0] in GPADCCtrl2 + * and ADCHwSel[4:0] in GPADCCtrl3 ) */ +#define BAT_CTRL		0x01 +#define BTEMP_BALL		0x02 +#define MAIN_CHARGER_V		0x03 +#define ACC_DETECT1		0x04 +#define ACC_DETECT2		0x05 +#define ADC_AUX1		0x06 +#define ADC_AUX2		0x07 +#define MAIN_BAT_V		0x08 +#define VBUS_V			0x09 +#define MAIN_CHARGER_C		0x0A +#define USB_CHARGER_C		0x0B +#define BK_BAT_V		0x0C +#define DIE_TEMP		0x0D +#define USB_ID			0x0E +#define XTAL_TEMP		0x12 +#define VBAT_TRUE_MEAS		0x13 +#define BAT_CTRL_AND_IBAT	0x1C +#define VBAT_MEAS_AND_IBAT	0x1D +#define VBAT_TRUE_MEAS_AND_IBAT	0x1E +#define BAT_TEMP_AND_IBAT	0x1F + +/* Virtual channel used only for ibat convertion to ampere + * Battery current conversion (ibat) cannot be requested as a single conversion + *  but it is always in combination with other input requests + */ +#define IBAT_VIRTUAL_CHANNEL		0xFF + +#define SAMPLE_1        1 +#define SAMPLE_4        4 +#define SAMPLE_8        8 +#define SAMPLE_16       16 +#define RISING_EDGE     0 +#define FALLING_EDGE    1 + +/* Arbitrary ADC conversion type constants */ +#define ADC_SW				0 +#define ADC_HW				1  struct ab8500_gpadc;  struct ab8500_gpadc *ab8500_gpadc_get(char *name); -int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel); -int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel); +int ab8500_gpadc_sw_hw_convert(struct ab8500_gpadc *gpadc, u8 channel, +		u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type); +static inline int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel) +{ +	return ab8500_gpadc_sw_hw_convert(gpadc, channel, +			SAMPLE_16, 0, 0, ADC_SW); +} + +int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel, +		u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type); +int ab8500_gpadc_double_read_raw(struct ab8500_gpadc *gpadc, u8 channel, +		u8 avg_sample, u8 trig_edge, u8 trig_timer, u8 conv_type, +		int *ibat);  int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc, -    u8 channel, int ad_value); +		u8 channel, int ad_value); +void ab8540_gpadc_get_otp(struct ab8500_gpadc *gpadc, +			u16 *vmain_l, u16 *vmain_h, u16 *btemp_l, u16 *btemp_h, +			u16 *vbat_l, u16 *vbat_h, u16 *ibat_l, u16 *ibat_h);  #endif /* _AB8500_GPADC_H */ diff --git a/include/linux/mfd/abx500/ab8500-sysctrl.h b/include/linux/mfd/abx500/ab8500-sysctrl.h index ebf12e793db..990bc93f46e 100644 --- a/include/linux/mfd/abx500/ab8500-sysctrl.h +++ b/include/linux/mfd/abx500/ab8500-sysctrl.h @@ -12,6 +12,7 @@  int ab8500_sysctrl_read(u16 reg, u8 *value);  int ab8500_sysctrl_write(u16 reg, u8 mask, u8 value); +void ab8500_restart(char mode, const char *cmd);  #else @@ -40,6 +41,7 @@ static inline int ab8500_sysctrl_clear(u16 reg, u8 bits)  /* Configuration data for SysClkReq1RfClkBuf - SysClkReq8RfClkBuf */  struct ab8500_sysctrl_platform_data {  	u8 initial_req_buf_config[8]; +	u16 (*reboot_reason_code)(const char *cmd);  };  /* Registers */ @@ -299,4 +301,8 @@ struct ab8500_sysctrl_platform_data {  #define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_MASK 0xFF  #define AB9540_SYSCLK12BUF4VALID_SYSCLK12BUF4VALID_SHIFT 0 +#define AB8500_ENABLE_WD 0x1 +#define AB8500_KICK_WD 0x2 +#define AB8500_WD_RESTART_ON_EXPIRE 0x10 +  #endif /* __AB8500_SYSCTRL_H */ diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h index 9db0bda446a..fb1bf7d6a41 100644 --- a/include/linux/mfd/abx500/ab8500.h +++ b/include/linux/mfd/abx500/ab8500.h @@ -362,10 +362,10 @@ struct ab8500 {  	u8 *oldmask;  	int mask_size;  	const int *irq_reg_offset; +	int it_latchhier_num;  }; -struct regulator_reg_init; -struct regulator_init_data; +struct ab8500_regulator_platform_data;  struct ab8500_gpio_platform_data;  struct ab8500_codec_platform_data;  struct ab8500_sysctrl_platform_data; @@ -375,19 +375,13 @@ struct ab8500_sysctrl_platform_data;   * @irq_base: start of AB8500 IRQs, AB8500_NR_IRQS will be used   * @pm_power_off: Should machine pm power off hook be registered or not   * @init: board-specific initialization after detection of ab8500 - * @num_regulator_reg_init: number of regulator init registers - * @regulator_reg_init: regulator init registers - * @num_regulator: number of regulators   * @regulator: machine-specific constraints for regulators   */  struct ab8500_platform_data {  	int irq_base;  	bool pm_power_off;  	void (*init) (struct ab8500 *); -	int num_regulator_reg_init; -	struct ab8500_regulator_reg_init *regulator_reg_init; -	int num_regulator; -	struct regulator_init_data *regulator; +	struct ab8500_regulator_platform_data *regulator;  	struct abx500_gpio_platform_data *gpio;  	struct ab8500_codec_platform_data *codec;  	struct ab8500_sysctrl_platform_data *sysctrl; @@ -512,6 +506,8 @@ static inline int is_ab9540_2p0_or_earlier(struct ab8500 *ab)  	return (is_ab9540(ab) && (ab->chip_id < AB8500_CUT2P0));  } +void ab8500_override_turn_on_stat(u8 mask, u8 set); +  #ifdef CONFIG_AB8500_DEBUG  void ab8500_dump_all_banks(struct device *dev);  void ab8500_debug_register_interrupt(int line); diff --git a/include/linux/mfd/abx500/ux500_chargalg.h b/include/linux/mfd/abx500/ux500_chargalg.h index d43ac0f3552..234c99143bf 100644 --- a/include/linux/mfd/abx500/ux500_chargalg.h +++ b/include/linux/mfd/abx500/ux500_chargalg.h @@ -17,8 +17,11 @@ struct ux500_charger;  struct ux500_charger_ops {  	int (*enable) (struct ux500_charger *, int, int, int); +	int (*check_enable) (struct ux500_charger *, int, int);  	int (*kick_wd) (struct ux500_charger *);  	int (*update_curr) (struct ux500_charger *, int); +	int (*pp_enable) (struct ux500_charger *, bool); +	int (*pre_chg_enable) (struct ux500_charger *, bool);  };  /** @@ -29,6 +32,7 @@ struct ux500_charger_ops {   * @max_out_curr	maximum output charger current in mA   * @enabled		indicates if this charger is used or not   * @external		external charger unit (pm2xxx) + * @power_path		USB power path support   */  struct ux500_charger {  	struct power_supply psy; @@ -38,6 +42,9 @@ struct ux500_charger {  	int wdt_refresh;  	bool enabled;  	bool external; +	bool power_path;  }; +extern struct blocking_notifier_head charger_notifier_list; +  #endif diff --git a/include/linux/mfd/arizona/core.h b/include/linux/mfd/arizona/core.h index a710255528d..cc281368dc5 100644 --- a/include/linux/mfd/arizona/core.h +++ b/include/linux/mfd/arizona/core.h @@ -100,6 +100,9 @@ struct arizona {  	struct regmap_irq_chip_data *aod_irq_chip;  	struct regmap_irq_chip_data *irq_chip; +	bool hpdet_magic; +	unsigned int hp_ena; +  	struct mutex clk_lock;  	int clk32k_ref; diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h index 455c51d22d6..a0f940987a3 100644 --- a/include/linux/mfd/arizona/pdata.h +++ b/include/linux/mfd/arizona/pdata.h @@ -86,6 +86,11 @@ struct arizona_micd_config {  	bool gpio;  }; +struct arizona_micd_range { +	int max;  /** Ohms */ +	int key;  /** Key to report to input layer */ +}; +  struct arizona_pdata {  	int reset;      /** GPIO controlling /RESET, if any */  	int ldoena;     /** GPIO controlling LODENA, if any */ @@ -117,12 +122,21 @@ struct arizona_pdata {  	/** GPIO5 is used for jack detection */  	bool jd_gpio5; +	/** Internal pull on GPIO5 is disabled when used for jack detection */ +	bool jd_gpio5_nopull; +  	/** Use the headphone detect circuit to identify the accessory */  	bool hpdet_acc_id; +	/** Check for line output with HPDET method */ +	bool hpdet_acc_id_line; +  	/** GPIO used for mic isolation with HPDET */  	int hpdet_id_gpio; +	/** Extra debounce timeout used during initial mic detection (ms) */ +	int micd_detect_debounce; +  	/** GPIO for mic detection polarity */  	int micd_pol_gpio; @@ -135,9 +149,16 @@ struct arizona_pdata {  	/** Mic detect debounce level */  	int micd_dbtime; +	/** Mic detect timeout (ms) */ +	int micd_timeout; +  	/** Force MICBIAS on for mic detect */  	bool micd_force_micbias; +	/** Mic detect level parameters */ +	const struct arizona_micd_range *micd_ranges; +	int num_micd_ranges; +  	/** Headset polarity configurations */  	struct arizona_micd_config *micd_configs;  	int num_micd_configs; diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h index 34035513606..f43aa7c8d04 100644 --- a/include/linux/mfd/arizona/registers.h +++ b/include/linux/mfd/arizona/registers.h @@ -124,6 +124,10 @@  #define ARIZONA_MIC_DETECT_1                     0x2A3  #define ARIZONA_MIC_DETECT_2                     0x2A4  #define ARIZONA_MIC_DETECT_3                     0x2A5 +#define ARIZONA_MIC_DETECT_LEVEL_1		 0x2A6 +#define ARIZONA_MIC_DETECT_LEVEL_2		 0x2A7 +#define ARIZONA_MIC_DETECT_LEVEL_3		 0x2A8 +#define ARIZONA_MIC_DETECT_LEVEL_4		 0x2A9  #define ARIZONA_MIC_NOISE_MIX_CONTROL_1          0x2C3  #define ARIZONA_ISOLATION_CONTROL                0x2CB  #define ARIZONA_JACK_DETECT_ANALOGUE             0x2D3 diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index 3bbda22721e..ecddc5173c7 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h @@ -109,19 +109,6 @@ struct palmas_reg_init {  	 */  	int mode_sleep; -	/* tstep is the timestep loaded to the TSTEP register -	 * -	 * For SMPS -	 * -	 * 0: Jump (no slope control) -	 * 1: 10mV/us -	 * 2: 5mV/us -	 * 3: 2.5mV/us -	 * -	 * For LDO unused -	 */ -	int tstep; -  	/* voltage_sel is the bitfield loaded onto the SMPSX_VOLTAGE  	 * register. Set this is the default voltage set in OTP needs  	 * to be overridden. @@ -154,6 +141,12 @@ enum palmas_regulators {  	PALMAS_REG_LDO9,  	PALMAS_REG_LDOLN,  	PALMAS_REG_LDOUSB, +	/* External regulators */ +	PALMAS_REG_REGEN1, +	PALMAS_REG_REGEN2, +	PALMAS_REG_REGEN3, +	PALMAS_REG_SYSEN1, +	PALMAS_REG_SYSEN2,  	/* Total number of regulators */  	PALMAS_NUM_REGS,  }; @@ -171,6 +164,9 @@ struct palmas_pmic_platform_data {  	/* use LDO6 for vibrator control */  	int ldo6_vibrator; + +	/* Enable tracking mode of LDO8 */ +	bool enable_ldo8_tracking;  };  struct palmas_usb_platform_data { @@ -331,6 +327,8 @@ struct palmas_pmic {  	int smps457;  	int range[PALMAS_REG_SMPS10]; +	unsigned int ramp_delay[PALMAS_REG_SMPS10]; +	unsigned int current_reg_mode[PALMAS_REG_SMPS10];  };  struct palmas_resource { diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h index 6694cf43e8b..998628a2b08 100644 --- a/include/linux/mfd/tps65090.h +++ b/include/linux/mfd/tps65090.h @@ -86,6 +86,11 @@ struct tps65090_regulator_plat_data {  struct tps65090_platform_data {  	int irq_base; + +	char **supplied_to; +	size_t num_supplicants; +	int enable_low_current_chrg; +  	struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX];  }; diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h index 290762f9393..29eab2bd3df 100644 --- a/include/linux/mfd/tps65217.h +++ b/include/linux/mfd/tps65217.h @@ -228,6 +228,7 @@ enum tps65217_bl_fdim {  struct tps65217_bl_pdata {  	enum tps65217_bl_isel isel;  	enum tps65217_bl_fdim fdim; +	int dft_brightness;  };  /** diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index 9dbb41a4e25..8752dbbc613 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h @@ -19,6 +19,7 @@  #define PHY_ID_KSZ9021		0x00221610  #define PHY_ID_KS8737		0x00221720  #define PHY_ID_KSZ8021		0x00221555 +#define PHY_ID_KSZ8031		0x00221556  #define PHY_ID_KSZ8041		0x00221510  #define PHY_ID_KSZ8051		0x00221550  /* same id: ks8001 Rev. A/B, and ks8721 Rev 3. */ diff --git a/include/linux/mlx4/cmd.h b/include/linux/mlx4/cmd.h index 26069518625..adf6e0648f2 100644 --- a/include/linux/mlx4/cmd.h +++ b/include/linux/mlx4/cmd.h @@ -34,6 +34,7 @@  #define MLX4_CMD_H  #include <linux/dma-mapping.h> +#include <linux/if_link.h>  enum {  	/* initialization and general commands */ @@ -232,6 +233,11 @@ struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev);  void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox);  u32 mlx4_comm_get_version(void); +int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac); +int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos); +int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting); +int mlx4_get_vf_config(struct mlx4_dev *dev, int port, int vf, struct ifla_vf_info *ivf); +  #define MLX4_COMM_GET_IF_REV(cmd_chan_ver) (u8)((cmd_chan_ver) >> 8) diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h index 6f65b2c8bb8..98fa492cf40 100644 --- a/include/linux/mlx4/cq.h +++ b/include/linux/mlx4/cq.h @@ -64,6 +64,22 @@ struct mlx4_err_cqe {  	u8			owner_sr_opcode;  }; +struct mlx4_ts_cqe { +	__be32			vlan_my_qpn; +	__be32			immed_rss_invalid; +	__be32			g_mlpath_rqpn; +	__be32			timestamp_hi; +	__be16			status; +	u8			ipv6_ext_mask; +	u8			badfcs_enc; +	__be32			byte_cnt; +	__be16			wqe_index; +	__be16			checksum; +	u8			reserved; +	__be16			timestamp_lo; +	u8			owner_sr_opcode; +} __packed; +  enum {  	MLX4_CQE_VLAN_PRESENT_MASK	= 1 << 29,  	MLX4_CQE_QPN_MASK		= 0xffffff, diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index 811f91cf5e8..53acaf64189 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h @@ -40,6 +40,8 @@  #include <linux/atomic.h> +#include <linux/clocksource.h> +  #define MAX_MSIX_P_PORT		17  #define MAX_MSIX		64  #define MSIX_LEGACY_SZ		4 @@ -140,6 +142,7 @@ enum {  	MLX4_DEV_CAP_FLAG_VEP_UC_STEER	= 1LL << 41,  	MLX4_DEV_CAP_FLAG_VEP_MC_STEER	= 1LL << 42,  	MLX4_DEV_CAP_FLAG_COUNTERS	= 1LL << 48, +	MLX4_DEV_CAP_FLAG_SET_ETH_SCHED = 1LL << 53,  	MLX4_DEV_CAP_FLAG_SENSE_SUPPORT	= 1LL << 55,  	MLX4_DEV_CAP_FLAG_PORT_MNG_CHG_EV = 1LL << 59,  	MLX4_DEV_CAP_FLAG_64B_EQE	= 1LL << 61, @@ -151,7 +154,10 @@ enum {  	MLX4_DEV_CAP_FLAG2_RSS_TOP		= 1LL <<  1,  	MLX4_DEV_CAP_FLAG2_RSS_XOR		= 1LL <<  2,  	MLX4_DEV_CAP_FLAG2_FS_EN		= 1LL <<  3, -	MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN	= 1LL <<  4 +	MLX4_DEV_CAP_FLAGS2_REASSIGN_MAC_EN	= 1LL <<  4, +	MLX4_DEV_CAP_FLAG2_TS			= 1LL <<  5, +	MLX4_DEV_CAP_FLAG2_VLAN_CONTROL		= 1LL <<  6, +	MLX4_DEV_CAP_FLAG2_FSM			= 1LL <<  7  };  enum { @@ -443,6 +449,7 @@ struct mlx4_caps {  	u8			eqe_factor;  	u32			userspace_caps; /* userspace must be aware of these */  	u32			function_caps;  /* VFs must be aware of these */ +	u16			hca_core_clock;  };  struct mlx4_buf_list { @@ -837,7 +844,7 @@ void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres,  int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,  		  struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, -		  unsigned vector, int collapsed); +		  unsigned vector, int collapsed, int timestamp_en);  void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);  int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); @@ -1028,4 +1035,6 @@ int set_and_calc_slave_port_state(struct mlx4_dev *dev, int slave, u8 port, int  void mlx4_put_slave_node_guid(struct mlx4_dev *dev, int slave, __be64 guid);  __be64 mlx4_get_slave_node_guid(struct mlx4_dev *dev, int slave); +cycle_t mlx4_read_clock(struct mlx4_dev *dev); +  #endif /* MLX4_DEVICE_H */ diff --git a/include/linux/mm.h b/include/linux/mm.h index e19ff30ad0a..1a7f19e7f1a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -44,6 +44,9 @@ extern int sysctl_legacy_va_layout;  #include <asm/pgtable.h>  #include <asm/processor.h> +extern unsigned long sysctl_user_reserve_kbytes; +extern unsigned long sysctl_admin_reserve_kbytes; +  #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))  /* to align the pointer to the (next) page boundary */ @@ -899,7 +902,8 @@ extern void pagefault_out_of_memory(void);   * Flags passed to show_mem() and show_free_areas() to suppress output in   * various contexts.   */ -#define SHOW_MEM_FILTER_NODES	(0x0001u)	/* filter disallowed nodes */ +#define SHOW_MEM_FILTER_NODES		(0x0001u)	/* disallowed nodes */ +#define SHOW_MEM_FILTER_PAGE_COUNT	(0x0002u)	/* page type count */  extern void show_free_areas(unsigned int flags);  extern bool skip_free_areas_node(unsigned int flags, int nid); @@ -1078,9 +1082,6 @@ extern unsigned long move_page_tables(struct vm_area_struct *vma,  		unsigned long old_addr, struct vm_area_struct *new_vma,  		unsigned long new_addr, unsigned long len,  		bool need_rmap_locks); -extern unsigned long do_mremap(unsigned long addr, -			       unsigned long old_len, unsigned long new_len, -			       unsigned long flags, unsigned long new_addr);  extern unsigned long change_protection(struct vm_area_struct *vma, unsigned long start,  			      unsigned long end, pgprot_t newprot,  			      int dirty_accountable, int prot_numa); @@ -1294,6 +1295,61 @@ extern void free_area_init_node(int nid, unsigned long * zones_size,  		unsigned long zone_start_pfn, unsigned long *zholes_size);  extern void free_initmem(void); +/* + * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK) + * into the buddy system. The freed pages will be poisoned with pattern + * "poison" if it's non-zero. + * Return pages freed into the buddy system. + */ +extern unsigned long free_reserved_area(unsigned long start, unsigned long end, +					int poison, char *s); +#ifdef	CONFIG_HIGHMEM +/* + * Free a highmem page into the buddy system, adjusting totalhigh_pages + * and totalram_pages. + */ +extern void free_highmem_page(struct page *page); +#endif + +static inline void adjust_managed_page_count(struct page *page, long count) +{ +	totalram_pages += count; +} + +/* Free the reserved page into the buddy system, so it gets managed. */ +static inline void __free_reserved_page(struct page *page) +{ +	ClearPageReserved(page); +	init_page_count(page); +	__free_page(page); +} + +static inline void free_reserved_page(struct page *page) +{ +	__free_reserved_page(page); +	adjust_managed_page_count(page, 1); +} + +static inline void mark_page_reserved(struct page *page) +{ +	SetPageReserved(page); +	adjust_managed_page_count(page, -1); +} + +/* + * Default method to free all the __init memory into the buddy system. + * The freed pages will be poisoned with pattern "poison" if it is + * non-zero. Return pages freed into the buddy system. + */ +static inline unsigned long free_initmem_default(int poison) +{ +	extern char __init_begin[], __init_end[]; + +	return free_reserved_area(PAGE_ALIGN((unsigned long)&__init_begin) , +				  ((unsigned long)&__init_end) & PAGE_MASK, +				  poison, "unused kernel"); +} +  #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP  /*   * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its @@ -1611,6 +1667,8 @@ int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,  			unsigned long pfn);  int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr,  			unsigned long pfn); +int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long len); +  struct page *follow_page_mask(struct vm_area_struct *vma,  			      unsigned long address, unsigned int foll_flags, @@ -1673,8 +1731,12 @@ int in_gate_area_no_mm(unsigned long addr);  #define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);})  #endif	/* __HAVE_ARCH_GATE_AREA */ +#ifdef CONFIG_SYSCTL +extern int sysctl_drop_caches;  int drop_caches_sysctl_handler(struct ctl_table *, int,  					void __user *, size_t *, loff_t *); +#endif +  unsigned long shrink_slab(struct shrink_control *shrink,  			  unsigned long nr_pages_scanned,  			  unsigned long lru_pages); @@ -1702,12 +1764,12 @@ pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node);  void *vmemmap_alloc_block(unsigned long size, int node);  void *vmemmap_alloc_block_buf(unsigned long size, int node);  void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); -int vmemmap_populate_basepages(struct page *start_page, -						unsigned long pages, int node); -int vmemmap_populate(struct page *start_page, unsigned long pages, int node); +int vmemmap_populate_basepages(unsigned long start, unsigned long end, +			       int node); +int vmemmap_populate(unsigned long start, unsigned long end, int node);  void vmemmap_populate_print_last(void);  #ifdef CONFIG_MEMORY_HOTPLUG -void vmemmap_free(struct page *memmap, unsigned long nr_pages); +void vmemmap_free(unsigned long start, unsigned long end);  #endif  void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,  				  unsigned long size); @@ -1754,5 +1816,11 @@ static inline unsigned int debug_guardpage_minorder(void) { return 0; }  static inline bool page_is_guard(struct page *page) { return false; }  #endif /* CONFIG_DEBUG_PAGEALLOC */ +#if MAX_NUMNODES > 1 +void __init setup_nr_node_ids(void); +#else +static inline void setup_nr_node_ids(void) {} +#endif +  #endif /* __KERNEL__ */  #endif /* _LINUX_MM_H */ diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index c74092eebf5..5c76737d836 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -450,7 +450,7 @@ struct zone {  	 *  	 * present_pages is physical pages existing within the zone, which  	 * is calculated as: -	 *	present_pages = spanned_pages - absent_pages(pags in holes); +	 *	present_pages = spanned_pages - absent_pages(pages in holes);  	 *  	 * managed_pages is present pages managed by the buddy system, which  	 * is calculated as (reserved_pages includes pages allocated by the diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 779cf7c4a3d..b508016fb76 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -9,6 +9,7 @@  #ifdef __KERNEL__  #include <linux/types.h> +#include <linux/uuid.h>  typedef unsigned long kernel_ulong_t;  #endif @@ -568,4 +569,12 @@ struct ipack_device_id {  	__u32 device;			/* Device ID or IPACK_ANY_ID */  }; +#define MEI_CL_MODULE_PREFIX "mei:" +#define MEI_CL_NAME_SIZE 32 + +struct mei_cl_device_id { +	char name[MEI_CL_NAME_SIZE]; +	kernel_ulong_t driver_info; +}; +  #endif /* LINUX_MOD_DEVICETABLE_H */ diff --git a/include/linux/msi.h b/include/linux/msi.h index ce93a341337..20c2d6dd5d2 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -13,14 +13,14 @@ struct msi_msg {  /* Helper functions */  struct irq_data;  struct msi_desc; -extern void mask_msi_irq(struct irq_data *data); -extern void unmask_msi_irq(struct irq_data *data); -extern void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); -extern void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg); -extern void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); -extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); -extern void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg); -extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); +void mask_msi_irq(struct irq_data *data); +void unmask_msi_irq(struct irq_data *data); +void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); +void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg); +void __write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); +void read_msi_msg(unsigned int irq, struct msi_msg *msg); +void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg); +void write_msi_msg(unsigned int irq, struct msi_msg *msg);  struct msi_desc {  	struct { @@ -54,9 +54,8 @@ struct msi_desc {   */  int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);  void arch_teardown_msi_irq(unsigned int irq); -extern int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); -extern void arch_teardown_msi_irqs(struct pci_dev *dev); -extern int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); - +int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); +void arch_teardown_msi_irqs(struct pci_dev *dev); +int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);  #endif /* LINUX_MSI_H */ diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 9121595a8eb..433da8a1a42 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -53,6 +53,9 @@ struct mutex {  #if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)  	struct task_struct	*owner;  #endif +#ifdef CONFIG_MUTEX_SPIN_ON_OWNER +	void			*spin_mlock;	/* Spinner MCS lock */ +#endif  #ifdef CONFIG_DEBUG_MUTEXES  	const char 		*name;  	void			*magic; diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h index 49258e0ed1c..141d395bbb5 100644 --- a/include/linux/mv643xx_eth.h +++ b/include/linux/mv643xx_eth.h @@ -19,7 +19,6 @@  struct mv643xx_eth_shared_platform_data {  	struct mbus_dram_target_info	*dram; -	struct platform_device	*shared_smi;  	/*  	 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default  	 * limit of 9KiB will be used. diff --git a/include/linux/net.h b/include/linux/net.h index aa1673160a4..99c9f0c103c 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -240,8 +240,8 @@ do {								\  #define net_dbg_ratelimited(fmt, ...)				\  	net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__) -#define net_random()		random32() -#define net_srandom(seed)	srandom32((__force u32)seed) +#define net_random()		prandom_u32() +#define net_srandom(seed)	prandom_seed((__force u32)(seed))  extern int   	     kernel_sendmsg(struct socket *sock, struct msghdr *msg,  				    struct kvec *vec, size_t num, size_t len); diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h index 3dd39340430..09906b7ca47 100644 --- a/include/linux/netdev_features.h +++ b/include/linux/netdev_features.h @@ -22,9 +22,9 @@ enum {  	NETIF_F_IPV6_CSUM_BIT,		/* Can checksum TCP/UDP over IPV6 */  	NETIF_F_HIGHDMA_BIT,		/* Can DMA to high memory. */  	NETIF_F_FRAGLIST_BIT,		/* Scatter/gather IO. */ -	NETIF_F_HW_VLAN_TX_BIT,		/* Transmit VLAN hw acceleration */ -	NETIF_F_HW_VLAN_RX_BIT,		/* Receive VLAN hw acceleration */ -	NETIF_F_HW_VLAN_FILTER_BIT,	/* Receive filtering on VLAN */ +	NETIF_F_HW_VLAN_CTAG_TX_BIT,	/* Transmit VLAN CTAG HW acceleration */ +	NETIF_F_HW_VLAN_CTAG_RX_BIT,	/* Receive VLAN CTAG HW acceleration */ +	NETIF_F_HW_VLAN_CTAG_FILTER_BIT,/* Receive filtering on VLAN CTAGs */  	NETIF_F_VLAN_CHALLENGED_BIT,	/* Device cannot handle VLAN packets */  	NETIF_F_GSO_BIT,		/* Enable software GSO. */  	NETIF_F_LLTX_BIT,		/* LockLess TX - deprecated. Please */ @@ -42,9 +42,9 @@ enum {  	NETIF_F_TSO6_BIT,		/* ... TCPv6 segmentation */  	NETIF_F_FSO_BIT,		/* ... FCoE segmentation */  	NETIF_F_GSO_GRE_BIT,		/* ... GRE with TSO */ -	/**/NETIF_F_GSO_LAST,		/* [can't be last bit, see GSO_MASK] */ -	NETIF_F_GSO_RESERVED2		/* ... free (fill GSO_MASK to 8 bits) */ -		= NETIF_F_GSO_LAST, +	NETIF_F_GSO_UDP_TUNNEL_BIT,	/* ... UDP TUNNEL with TSO */ +	/**/NETIF_F_GSO_LAST =		/* last bit, see GSO_MASK */ +		NETIF_F_GSO_UDP_TUNNEL_BIT,  	NETIF_F_FCOE_CRC_BIT,		/* FCoE CRC32 */  	NETIF_F_SCTP_CSUM_BIT,		/* SCTP checksum offload */ @@ -56,6 +56,9 @@ enum {  	NETIF_F_LOOPBACK_BIT,		/* Enable loopback */  	NETIF_F_RXFCS_BIT,		/* Append FCS to skb pkt data */  	NETIF_F_RXALL_BIT,		/* Receive errored frames too */ +	NETIF_F_HW_VLAN_STAG_TX_BIT,	/* Transmit VLAN STAG HW acceleration */ +	NETIF_F_HW_VLAN_STAG_RX_BIT,	/* Receive VLAN STAG HW acceleration */ +	NETIF_F_HW_VLAN_STAG_FILTER_BIT,/* Receive filtering on VLAN STAGs */  	/*  	 * Add your fresh new feature above and remember to update @@ -80,9 +83,9 @@ enum {  #define NETIF_F_GSO_ROBUST	__NETIF_F(GSO_ROBUST)  #define NETIF_F_HIGHDMA		__NETIF_F(HIGHDMA)  #define NETIF_F_HW_CSUM		__NETIF_F(HW_CSUM) -#define NETIF_F_HW_VLAN_FILTER	__NETIF_F(HW_VLAN_FILTER) -#define NETIF_F_HW_VLAN_RX	__NETIF_F(HW_VLAN_RX) -#define NETIF_F_HW_VLAN_TX	__NETIF_F(HW_VLAN_TX) +#define NETIF_F_HW_VLAN_CTAG_FILTER __NETIF_F(HW_VLAN_CTAG_FILTER) +#define NETIF_F_HW_VLAN_CTAG_RX	__NETIF_F(HW_VLAN_CTAG_RX) +#define NETIF_F_HW_VLAN_CTAG_TX	__NETIF_F(HW_VLAN_CTAG_TX)  #define NETIF_F_IP_CSUM		__NETIF_F(IP_CSUM)  #define NETIF_F_IPV6_CSUM	__NETIF_F(IPV6_CSUM)  #define NETIF_F_LLTX		__NETIF_F(LLTX) @@ -102,7 +105,11 @@ enum {  #define NETIF_F_VLAN_CHALLENGED	__NETIF_F(VLAN_CHALLENGED)  #define NETIF_F_RXFCS		__NETIF_F(RXFCS)  #define NETIF_F_RXALL		__NETIF_F(RXALL) -#define NETIF_F_GRE_GSO		__NETIF_F(GSO_GRE) +#define NETIF_F_GSO_GRE		__NETIF_F(GSO_GRE) +#define NETIF_F_GSO_UDP_TUNNEL	__NETIF_F(GSO_UDP_TUNNEL) +#define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER) +#define NETIF_F_HW_VLAN_STAG_RX	__NETIF_F(HW_VLAN_STAG_RX) +#define NETIF_F_HW_VLAN_STAG_TX	__NETIF_F(HW_VLAN_STAG_TX)  /* Features valid for ethtool to change */  /* = all defined minus driver/device-class-related */ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b3d00fa4b31..f8898a435dc 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -144,8 +144,6 @@ static inline bool dev_xmit_complete(int rc)  # else  #  define LL_MAX_HEADER 96  # endif -#elif IS_ENABLED(CONFIG_TR) -# define LL_MAX_HEADER 48  #else  # define LL_MAX_HEADER 32  #endif @@ -210,9 +208,10 @@ struct netdev_hw_addr {  #define NETDEV_HW_ADDR_T_SLAVE		3  #define NETDEV_HW_ADDR_T_UNICAST	4  #define NETDEV_HW_ADDR_T_MULTICAST	5 -	bool			synced;  	bool			global_use; +	int			sync_cnt;  	int			refcount; +	int			synced;  	struct rcu_head		rcu_head;  }; @@ -785,13 +784,13 @@ struct netdev_fcoe_hbainfo {   *	3. Update dev->stats asynchronously and atomically, and define   *	   neither operation.   * - * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); - *	If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) - *	this function is called when a VLAN id is registered. + * int (*ndo_vlan_rx_add_vid)(struct net_device *dev, __be16 proto, u16t vid); + *	If device support VLAN filtering this function is called when a + *	VLAN id is registered.   *   * int (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); - *	If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) - *	this function is called when a VLAN id is unregistered. + *	If device support VLAN filtering this function is called when a + *	VLAN id is unregistered.   *   * void (*ndo_poll_controller)(struct net_device *dev);   * @@ -895,7 +894,7 @@ struct netdev_fcoe_hbainfo {   *   * int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh)   * int (*ndo_bridge_getlink)(struct sk_buff *skb, u32 pid, u32 seq, - *			     struct net_device *dev) + *			     struct net_device *dev, u32 filter_mask)   *   * int (*ndo_change_carrier)(struct net_device *dev, bool new_carrier);   *	Called to change device carrier. Soft-devices (like dummy, team, etc) @@ -935,9 +934,9 @@ struct net_device_ops {  	struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);  	int			(*ndo_vlan_rx_add_vid)(struct net_device *dev, -						       unsigned short vid); +						       __be16 proto, u16 vid);  	int			(*ndo_vlan_rx_kill_vid)(struct net_device *dev, -						        unsigned short vid); +						        __be16 proto, u16 vid);  #ifdef CONFIG_NET_POLL_CONTROLLER  	void                    (*ndo_poll_controller)(struct net_device *dev);  	int			(*ndo_netpoll_setup)(struct net_device *dev, @@ -1073,6 +1072,8 @@ struct net_device {  	struct list_head	dev_list;  	struct list_head	napi_list;  	struct list_head	unreg_list; +	struct list_head	upper_dev_list; /* List of upper devices */ +  	/* currently active device features */  	netdev_features_t	features; @@ -1145,6 +1146,13 @@ struct net_device {  	spinlock_t		addr_list_lock;  	struct netdev_hw_addr_list	uc;	/* Unicast mac addresses */  	struct netdev_hw_addr_list	mc;	/* Multicast mac addresses */ +	struct netdev_hw_addr_list	dev_addrs; /* list of device +						    * hw addresses +						    */ +#ifdef CONFIG_SYSFS +	struct kset		*queues_kset; +#endif +  	bool			uc_promisc;  	unsigned int		promiscuity;  	unsigned int		allmulti; @@ -1177,21 +1185,11 @@ struct net_device {  						 * avoid dirtying this cache line.  						 */ -	struct list_head	upper_dev_list; /* List of upper devices */ -  	/* Interface address info used in eth_type_trans() */  	unsigned char		*dev_addr;	/* hw address, (before bcast  						   because most packets are  						   unicast) */ -	struct netdev_hw_addr_list	dev_addrs; /* list of device -						      hw addresses */ - -	unsigned char		broadcast[MAX_ADDR_LEN];	/* hw bcast add	*/ - -#ifdef CONFIG_SYSFS -	struct kset		*queues_kset; -#endif  #ifdef CONFIG_RPS  	struct netdev_rx_queue	*_rx; @@ -1202,18 +1200,14 @@ struct net_device {  	/* Number of RX queues currently active in device */  	unsigned int		real_num_rx_queues; -#ifdef CONFIG_RFS_ACCEL -	/* CPU reverse-mapping for RX completion interrupts, indexed -	 * by RX queue number.  Assigned by driver.  This must only be -	 * set if the ndo_rx_flow_steer operation is defined. */ -	struct cpu_rmap		*rx_cpu_rmap; -#endif  #endif  	rx_handler_func_t __rcu	*rx_handler;  	void __rcu		*rx_handler_data;  	struct netdev_queue __rcu *ingress_queue; +	unsigned char		broadcast[MAX_ADDR_LEN];	/* hw bcast add	*/ +  /*   * Cache lines mostly used on transmit path @@ -1235,6 +1229,12 @@ struct net_device {  #ifdef CONFIG_XPS  	struct xps_dev_maps __rcu *xps_maps;  #endif +#ifdef CONFIG_RFS_ACCEL +	/* CPU reverse-mapping for RX completion interrupts, indexed +	 * by RX queue number.  Assigned by driver.  This must only be +	 * set if the ndo_rx_flow_steer operation is defined. */ +	struct cpu_rmap		*rx_cpu_rmap; +#endif  	/* These may be needed for future network-power-down code. */ @@ -1475,6 +1475,11 @@ static inline void *netdev_priv(const struct net_device *dev)   */  #define SET_NETDEV_DEVTYPE(net, devtype)	((net)->dev.type = (devtype)) +/* Default NAPI poll() weight + * Device drivers are strongly advised to not use bigger value + */ +#define NAPI_POLL_WEIGHT 64 +  /**   *	netif_napi_add - initialize a napi context   *	@dev:  network device @@ -1612,6 +1617,9 @@ extern seqcount_t	devnet_rename_seq;	/* Device rename seq */  		list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)  #define for_each_netdev_continue_rcu(net, d)		\  	list_for_each_entry_continue_rcu(d, &(net)->dev_base_head, dev_list) +#define for_each_netdev_in_bond_rcu(bond, slave)	\ +		for_each_netdev_rcu(&init_net, slave)	\ +			if (netdev_master_upper_dev_get_rcu(slave) == bond)  #define net_device_entry(lh)	list_entry(lh, struct net_device, dev_list)  static inline struct net_device *next_net_device(struct net_device *dev) @@ -1684,7 +1692,6 @@ extern int 		netdev_refcnt_read(const struct net_device *dev);  extern void		free_netdev(struct net_device *dev);  extern void		synchronize_net(void);  extern int		init_dummy_netdev(struct net_device *dev); -extern void		netdev_resync_ops(struct net_device *dev);  extern struct net_device	*dev_get_by_index(struct net *net, int ifindex);  extern struct net_device	*__dev_get_by_index(struct net *net, int ifindex); @@ -2621,6 +2628,7 @@ extern int dev_uc_add(struct net_device *dev, const unsigned char *addr);  extern int dev_uc_add_excl(struct net_device *dev, const unsigned char *addr);  extern int dev_uc_del(struct net_device *dev, const unsigned char *addr);  extern int dev_uc_sync(struct net_device *to, struct net_device *from); +extern int dev_uc_sync_multiple(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); @@ -2632,6 +2640,7 @@ extern int dev_mc_add_excl(struct net_device *dev, const unsigned char *addr);  extern int dev_mc_del(struct net_device *dev, const unsigned char *addr);  extern int dev_mc_del_global(struct net_device *dev, const unsigned char *addr);  extern int dev_mc_sync(struct net_device *to, struct net_device *from); +extern int dev_mc_sync_multiple(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); @@ -2678,6 +2687,19 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, netdev_features_t features)  {  	return __skb_gso_segment(skb, features, true);  } +__be16 skb_network_protocol(struct sk_buff *skb); + +static inline bool can_checksum_protocol(netdev_features_t features, +					 __be16 protocol) +{ +	return ((features & NETIF_F_GEN_CSUM) || +		((features & NETIF_F_V4_CSUM) && +		 protocol == htons(ETH_P_IP)) || +		((features & NETIF_F_V6_CSUM) && +		 protocol == htons(ETH_P_IPV6)) || +		((features & NETIF_F_FCOE_CRC) && +		 protocol == htons(ETH_P_FCOE))); +}  #ifdef CONFIG_BUG  extern void netdev_rx_csum_fault(struct net_device *dev); @@ -2756,6 +2778,11 @@ static inline void netif_set_gso_max_size(struct net_device *dev,  	dev->gso_max_size = size;  } +static inline bool netif_is_bond_master(struct net_device *dev) +{ +	return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING; +} +  static inline bool netif_is_bond_slave(struct net_device *dev)  {  	return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index ee142846f56..0060fde3160 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -289,11 +289,6 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)  #endif  } -#ifdef CONFIG_PROC_FS -#include <linux/proc_fs.h> -extern struct proc_dir_entry *proc_net_netfilter; -#endif -  #else /* !CONFIG_NETFILTER */  #define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)  #define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h index 7958e84a65a..d80e2753847 100644 --- a/include/linux/netfilter/ipset/ip_set.h +++ b/include/linux/netfilter/ipset/ip_set.h @@ -1,7 +1,7 @@  /* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu>   *                         Patrick Schaaf <bof@bof.de>   *                         Martin Josefsson <gandalf@wlug.westbo.se> - * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> + * Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>   *   * This program is free software; you can redistribute it and/or modify   * it under the terms of the GNU General Public License version 2 as @@ -47,10 +47,36 @@ enum ip_set_feature {  	IPSET_DUMP_LAST = (1 << IPSET_DUMP_LAST_FLAG),  }; +/* Set extensions */ +enum ip_set_extension { +	IPSET_EXT_NONE = 0, +	IPSET_EXT_BIT_TIMEOUT = 1, +	IPSET_EXT_TIMEOUT = (1 << IPSET_EXT_BIT_TIMEOUT), +	IPSET_EXT_BIT_COUNTER = 2, +	IPSET_EXT_COUNTER = (1 << IPSET_EXT_BIT_COUNTER), +}; + +/* Extension offsets */ +enum ip_set_offset { +	IPSET_OFFSET_TIMEOUT = 0, +	IPSET_OFFSET_COUNTER, +	IPSET_OFFSET_MAX, +}; + +#define SET_WITH_TIMEOUT(s)	((s)->extensions & IPSET_EXT_TIMEOUT) +#define SET_WITH_COUNTER(s)	((s)->extensions & IPSET_EXT_COUNTER) + +struct ip_set_ext { +	unsigned long timeout; +	u64 packets; +	u64 bytes; +}; +  struct ip_set;  typedef int (*ipset_adtfn)(struct ip_set *set, void *value, -			   u32 timeout, u32 flags); +			   const struct ip_set_ext *ext, +			   struct ip_set_ext *mext, u32 cmdflags);  /* Kernel API function options */  struct ip_set_adt_opt { @@ -58,7 +84,7 @@ struct ip_set_adt_opt {  	u8 dim;			/* Dimension of match/target */  	u8 flags;		/* Direction and negation flags */  	u32 cmdflags;		/* Command-like flags */ -	u32 timeout;		/* Timeout value */ +	struct ip_set_ext ext;	/* Extensions */  };  /* Set type, variant-specific part */ @@ -69,7 +95,7 @@ struct ip_set_type_variant {  	 *			positive for matching element */  	int (*kadt)(struct ip_set *set, const struct sk_buff *skb,  		    const struct xt_action_param *par, -		    enum ipset_adt adt, const struct ip_set_adt_opt *opt); +		    enum ipset_adt adt, struct ip_set_adt_opt *opt);  	/* Userspace: test/add/del entries  	 *		returns negative error code, @@ -151,10 +177,76 @@ struct ip_set {  	u8 family;  	/* The type revision */  	u8 revision; +	/* Extensions */ +	u8 extensions;  	/* The type specific data */  	void *data;  }; +struct ip_set_counter { +	atomic64_t bytes; +	atomic64_t packets; +}; + +static inline void +ip_set_add_bytes(u64 bytes, struct ip_set_counter *counter) +{ +	atomic64_add((long long)bytes, &(counter)->bytes); +} + +static inline void +ip_set_add_packets(u64 packets, struct ip_set_counter *counter) +{ +	atomic64_add((long long)packets, &(counter)->packets); +} + +static inline u64 +ip_set_get_bytes(const struct ip_set_counter *counter) +{ +	return (u64)atomic64_read(&(counter)->bytes); +} + +static inline u64 +ip_set_get_packets(const struct ip_set_counter *counter) +{ +	return (u64)atomic64_read(&(counter)->packets); +} + +static inline void +ip_set_update_counter(struct ip_set_counter *counter, +		      const struct ip_set_ext *ext, +		      struct ip_set_ext *mext, u32 flags) +{ +	if (ext->packets != ULLONG_MAX && +	    !(flags & IPSET_FLAG_SKIP_COUNTER_UPDATE)) { +		ip_set_add_bytes(ext->bytes, counter); +		ip_set_add_packets(ext->packets, counter); +	} +	if (flags & IPSET_FLAG_MATCH_COUNTERS) { +		mext->packets = ip_set_get_packets(counter); +		mext->bytes = ip_set_get_bytes(counter); +	} +} + +static inline bool +ip_set_put_counter(struct sk_buff *skb, struct ip_set_counter *counter) +{ +	return nla_put_net64(skb, IPSET_ATTR_BYTES, +			     cpu_to_be64(ip_set_get_bytes(counter))) || +	       nla_put_net64(skb, IPSET_ATTR_PACKETS, +			     cpu_to_be64(ip_set_get_packets(counter))); +} + +static inline void +ip_set_init_counter(struct ip_set_counter *counter, +		    const struct ip_set_ext *ext) +{ +	if (ext->bytes != ULLONG_MAX) +		atomic64_set(&(counter)->bytes, (long long)(ext->bytes)); +	if (ext->packets != ULLONG_MAX) +		atomic64_set(&(counter)->packets, (long long)(ext->packets)); +} +  /* register and unregister set references */  extern ip_set_id_t ip_set_get_byname(const char *name, struct ip_set **set);  extern void ip_set_put_byindex(ip_set_id_t index); @@ -167,19 +259,21 @@ extern void ip_set_nfnl_put(ip_set_id_t index);  extern int ip_set_add(ip_set_id_t id, const struct sk_buff *skb,  		      const struct xt_action_param *par, -		      const struct ip_set_adt_opt *opt); +		      struct ip_set_adt_opt *opt);  extern int ip_set_del(ip_set_id_t id, const struct sk_buff *skb,  		      const struct xt_action_param *par, -		      const struct ip_set_adt_opt *opt); +		      struct ip_set_adt_opt *opt);  extern int ip_set_test(ip_set_id_t id, const struct sk_buff *skb,  		       const struct xt_action_param *par, -		       const struct ip_set_adt_opt *opt); +		       struct ip_set_adt_opt *opt);  /* Utility functions */  extern void *ip_set_alloc(size_t size);  extern void ip_set_free(void *members);  extern int ip_set_get_ipaddr4(struct nlattr *nla,  __be32 *ipaddr);  extern int ip_set_get_ipaddr6(struct nlattr *nla, union nf_inet_addr *ipaddr); +extern int ip_set_get_extensions(struct ip_set *set, struct nlattr *tb[], +				 struct ip_set_ext *ext);  static inline int  ip_set_get_hostipaddr4(struct nlattr *nla, u32 *ipaddr) @@ -200,6 +294,14 @@ ip_set_eexist(int ret, u32 flags)  	return ret == -IPSET_ERR_EXIST && (flags & IPSET_FLAG_EXIST);  } +/* Match elements marked with nomatch */ +static inline bool +ip_set_enomatch(int ret, u32 flags, enum ipset_adt adt) +{ +	return adt == IPSET_TEST && +	       ret == -ENOTEMPTY && ((flags >> 16) & IPSET_FLAG_NOMATCH); +} +  /* Check the NLA_F_NET_BYTEORDER flag */  static inline bool  ip_set_attr_netorder(struct nlattr *tb[], int type) @@ -284,4 +386,14 @@ bitmap_bytes(u32 a, u32 b)  	return 4 * ((((b - a + 8) / 8) + 3) / 4);  } +#include <linux/netfilter/ipset/ip_set_timeout.h> + +#define IP_SET_INIT_KEXT(skb, opt, map)			\ +	{ .bytes = (skb)->len, .packets = 1,		\ +	  .timeout = ip_set_adt_opt_timeout(opt, map) } + +#define IP_SET_INIT_UEXT(map)				\ +	{ .bytes = ULLONG_MAX, .packets = ULLONG_MAX,	\ +	  .timeout = (map)->timeout } +  #endif /*_IP_SET_H */ diff --git a/include/linux/netfilter/ipset/ip_set_ahash.h b/include/linux/netfilter/ipset/ip_set_ahash.h deleted file mode 100644 index 01d25e6fc79..00000000000 --- a/include/linux/netfilter/ipset/ip_set_ahash.h +++ /dev/null @@ -1,1225 +0,0 @@ -#ifndef _IP_SET_AHASH_H -#define _IP_SET_AHASH_H - -#include <linux/rcupdate.h> -#include <linux/jhash.h> -#include <linux/netfilter/ipset/ip_set_timeout.h> - -#define CONCAT(a, b, c)		a##b##c -#define TOKEN(a, b, c)		CONCAT(a, b, c) - -#define type_pf_next		TOKEN(TYPE, PF, _elem) - -/* Hashing which uses arrays to resolve clashing. The hash table is resized - * (doubled) when searching becomes too long. - * Internally jhash is used with the assumption that the size of the - * stored data is a multiple of sizeof(u32). If storage supports timeout, - * the timeout field must be the last one in the data structure - that field - * is ignored when computing the hash key. - * - * Readers and resizing - * - * Resizing can be triggered by userspace command only, and those - * are serialized by the nfnl mutex. During resizing the set is - * read-locked, so the only possible concurrent operations are - * the kernel side readers. Those must be protected by proper RCU locking. - */ - -/* Number of elements to store in an initial array block */ -#define AHASH_INIT_SIZE			4 -/* Max number of elements to store in an array block */ -#define AHASH_MAX_SIZE			(3*AHASH_INIT_SIZE) - -/* Max number of elements can be tuned */ -#ifdef IP_SET_HASH_WITH_MULTI -#define AHASH_MAX(h)			((h)->ahash_max) - -static inline u8 -tune_ahash_max(u8 curr, u32 multi) -{ -	u32 n; - -	if (multi < curr) -		return curr; - -	n = curr + AHASH_INIT_SIZE; -	/* Currently, at listing one hash bucket must fit into a message. -	 * Therefore we have a hard limit here. -	 */ -	return n > curr && n <= 64 ? n : curr; -} -#define TUNE_AHASH_MAX(h, multi)	\ -	((h)->ahash_max = tune_ahash_max((h)->ahash_max, multi)) -#else -#define AHASH_MAX(h)			AHASH_MAX_SIZE -#define TUNE_AHASH_MAX(h, multi) -#endif - -/* A hash bucket */ -struct hbucket { -	void *value;		/* the array of the values */ -	u8 size;		/* size of the array */ -	u8 pos;			/* position of the first free entry */ -}; - -/* The hash table: the table size stored here in order to make resizing easy */ -struct htable { -	u8 htable_bits;		/* size of hash table == 2^htable_bits */ -	struct hbucket bucket[0]; /* hashtable buckets */ -}; - -#define hbucket(h, i)		(&((h)->bucket[i])) - -/* Book-keeping of the prefixes added to the set */ -struct ip_set_hash_nets { -	u8 cidr;		/* the different cidr values in the set */ -	u32 nets;		/* number of elements per cidr */ -}; - -/* The generic ip_set hash structure */ -struct ip_set_hash { -	struct htable *table;	/* the hash table */ -	u32 maxelem;		/* max elements in the hash */ -	u32 elements;		/* current element (vs timeout) */ -	u32 initval;		/* random jhash init value */ -	u32 timeout;		/* timeout value, if enabled */ -	struct timer_list gc;	/* garbage collection when timeout enabled */ -	struct type_pf_next next; /* temporary storage for uadd */ -#ifdef IP_SET_HASH_WITH_MULTI -	u8 ahash_max;		/* max elements in an array block */ -#endif -#ifdef IP_SET_HASH_WITH_NETMASK -	u8 netmask;		/* netmask value for subnets to store */ -#endif -#ifdef IP_SET_HASH_WITH_RBTREE -	struct rb_root rbtree; -#endif -#ifdef IP_SET_HASH_WITH_NETS -	struct ip_set_hash_nets nets[0]; /* book-keeping of prefixes */ -#endif -}; - -static size_t -htable_size(u8 hbits) -{ -	size_t hsize; - -	/* We must fit both into u32 in jhash and size_t */ -	if (hbits > 31) -		return 0; -	hsize = jhash_size(hbits); -	if ((((size_t)-1) - sizeof(struct htable))/sizeof(struct hbucket) -	    < hsize) -		return 0; - -	return hsize * sizeof(struct hbucket) + sizeof(struct htable); -} - -/* Compute htable_bits from the user input parameter hashsize */ -static u8 -htable_bits(u32 hashsize) -{ -	/* Assume that hashsize == 2^htable_bits */ -	u8 bits = fls(hashsize - 1); -	if (jhash_size(bits) != hashsize) -		/* Round up to the first 2^n value */ -		bits = fls(hashsize); - -	return bits; -} - -#ifdef IP_SET_HASH_WITH_NETS -#ifdef IP_SET_HASH_WITH_NETS_PACKED -/* When cidr is packed with nomatch, cidr - 1 is stored in the entry */ -#define CIDR(cidr)	(cidr + 1) -#else -#define CIDR(cidr)	(cidr) -#endif - -#define SET_HOST_MASK(family)	(family == AF_INET ? 32 : 128) -#ifdef IP_SET_HASH_WITH_MULTI -#define NETS_LENGTH(family)	(SET_HOST_MASK(family) + 1) -#else -#define NETS_LENGTH(family)	SET_HOST_MASK(family) -#endif - -/* Network cidr size book keeping when the hash stores different - * sized networks */ -static void -add_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length) -{ -	int i, j; - -	/* Add in increasing prefix order, so larger cidr first */ -	for (i = 0, j = -1; i < nets_length && h->nets[i].nets; i++) { -		if (j != -1) -			continue; -		else if (h->nets[i].cidr < cidr) -			j = i; -		else if (h->nets[i].cidr == cidr) { -			h->nets[i].nets++; -			return; -		} -	} -	if (j != -1) { -		for (; i > j; i--) { -			h->nets[i].cidr = h->nets[i - 1].cidr; -			h->nets[i].nets = h->nets[i - 1].nets; -		} -	} -	h->nets[i].cidr = cidr; -	h->nets[i].nets = 1; -} - -static void -del_cidr(struct ip_set_hash *h, u8 cidr, u8 nets_length) -{ -	u8 i, j; - -	for (i = 0; i < nets_length - 1 && h->nets[i].cidr != cidr; i++) -		; -	h->nets[i].nets--; - -	if (h->nets[i].nets != 0) -		return; - -	for (j = i; j < nets_length - 1 && h->nets[j].nets; j++) { -		h->nets[j].cidr = h->nets[j + 1].cidr; -		h->nets[j].nets = h->nets[j + 1].nets; -	} -} -#else -#define NETS_LENGTH(family)		0 -#endif - -/* Destroy the hashtable part of the set */ -static void -ahash_destroy(struct htable *t) -{ -	struct hbucket *n; -	u32 i; - -	for (i = 0; i < jhash_size(t->htable_bits); i++) { -		n = hbucket(t, i); -		if (n->size) -			/* FIXME: use slab cache */ -			kfree(n->value); -	} - -	ip_set_free(t); -} - -/* Calculate the actual memory size of the set data */ -static size_t -ahash_memsize(const struct ip_set_hash *h, size_t dsize, u8 nets_length) -{ -	u32 i; -	struct htable *t = h->table; -	size_t memsize = sizeof(*h) -			 + sizeof(*t) -#ifdef IP_SET_HASH_WITH_NETS -			 + sizeof(struct ip_set_hash_nets) * nets_length -#endif -			 + jhash_size(t->htable_bits) * sizeof(struct hbucket); - -	for (i = 0; i < jhash_size(t->htable_bits); i++) -			memsize += t->bucket[i].size * dsize; - -	return memsize; -} - -/* Flush a hash type of set: destroy all elements */ -static void -ip_set_hash_flush(struct ip_set *set) -{ -	struct ip_set_hash *h = set->data; -	struct htable *t = h->table; -	struct hbucket *n; -	u32 i; - -	for (i = 0; i < jhash_size(t->htable_bits); i++) { -		n = hbucket(t, i); -		if (n->size) { -			n->size = n->pos = 0; -			/* FIXME: use slab cache */ -			kfree(n->value); -		} -	} -#ifdef IP_SET_HASH_WITH_NETS -	memset(h->nets, 0, sizeof(struct ip_set_hash_nets) -			   * NETS_LENGTH(set->family)); -#endif -	h->elements = 0; -} - -/* Destroy a hash type of set */ -static void -ip_set_hash_destroy(struct ip_set *set) -{ -	struct ip_set_hash *h = set->data; - -	if (with_timeout(h->timeout)) -		del_timer_sync(&h->gc); - -	ahash_destroy(h->table); -#ifdef IP_SET_HASH_WITH_RBTREE -	rbtree_destroy(&h->rbtree); -#endif -	kfree(h); - -	set->data = NULL; -} - -#endif /* _IP_SET_AHASH_H */ - -#ifndef HKEY_DATALEN -#define HKEY_DATALEN	sizeof(struct type_pf_elem) -#endif - -#define HKEY(data, initval, htable_bits)			\ -(jhash2((u32 *)(data), HKEY_DATALEN/sizeof(u32), initval)	\ -	& jhash_mask(htable_bits)) - -/* Type/family dependent function prototypes */ - -#define type_pf_data_equal	TOKEN(TYPE, PF, _data_equal) -#define type_pf_data_isnull	TOKEN(TYPE, PF, _data_isnull) -#define type_pf_data_copy	TOKEN(TYPE, PF, _data_copy) -#define type_pf_data_zero_out	TOKEN(TYPE, PF, _data_zero_out) -#define type_pf_data_netmask	TOKEN(TYPE, PF, _data_netmask) -#define type_pf_data_list	TOKEN(TYPE, PF, _data_list) -#define type_pf_data_tlist	TOKEN(TYPE, PF, _data_tlist) -#define type_pf_data_next	TOKEN(TYPE, PF, _data_next) -#define type_pf_data_flags	TOKEN(TYPE, PF, _data_flags) -#ifdef IP_SET_HASH_WITH_NETS -#define type_pf_data_match	TOKEN(TYPE, PF, _data_match) -#else -#define type_pf_data_match(d)	1 -#endif - -#define type_pf_elem		TOKEN(TYPE, PF, _elem) -#define type_pf_telem		TOKEN(TYPE, PF, _telem) -#define type_pf_data_timeout	TOKEN(TYPE, PF, _data_timeout) -#define type_pf_data_expired	TOKEN(TYPE, PF, _data_expired) -#define type_pf_data_timeout_set TOKEN(TYPE, PF, _data_timeout_set) - -#define type_pf_elem_add	TOKEN(TYPE, PF, _elem_add) -#define type_pf_add		TOKEN(TYPE, PF, _add) -#define type_pf_del		TOKEN(TYPE, PF, _del) -#define type_pf_test_cidrs	TOKEN(TYPE, PF, _test_cidrs) -#define type_pf_test		TOKEN(TYPE, PF, _test) - -#define type_pf_elem_tadd	TOKEN(TYPE, PF, _elem_tadd) -#define type_pf_del_telem	TOKEN(TYPE, PF, _ahash_del_telem) -#define type_pf_expire		TOKEN(TYPE, PF, _expire) -#define type_pf_tadd		TOKEN(TYPE, PF, _tadd) -#define type_pf_tdel		TOKEN(TYPE, PF, _tdel) -#define type_pf_ttest_cidrs	TOKEN(TYPE, PF, _ahash_ttest_cidrs) -#define type_pf_ttest		TOKEN(TYPE, PF, _ahash_ttest) - -#define type_pf_resize		TOKEN(TYPE, PF, _resize) -#define type_pf_tresize		TOKEN(TYPE, PF, _tresize) -#define type_pf_flush		ip_set_hash_flush -#define type_pf_destroy		ip_set_hash_destroy -#define type_pf_head		TOKEN(TYPE, PF, _head) -#define type_pf_list		TOKEN(TYPE, PF, _list) -#define type_pf_tlist		TOKEN(TYPE, PF, _tlist) -#define type_pf_same_set	TOKEN(TYPE, PF, _same_set) -#define type_pf_kadt		TOKEN(TYPE, PF, _kadt) -#define type_pf_uadt		TOKEN(TYPE, PF, _uadt) -#define type_pf_gc		TOKEN(TYPE, PF, _gc) -#define type_pf_gc_init		TOKEN(TYPE, PF, _gc_init) -#define type_pf_variant		TOKEN(TYPE, PF, _variant) -#define type_pf_tvariant	TOKEN(TYPE, PF, _tvariant) - -/* Flavour without timeout */ - -/* Get the ith element from the array block n */ -#define ahash_data(n, i)	\ -	((struct type_pf_elem *)((n)->value) + (i)) - -/* Add an element to the hash table when resizing the set: - * we spare the maintenance of the internal counters. */ -static int -type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value, -		 u8 ahash_max, u32 cadt_flags) -{ -	struct type_pf_elem *data; - -	if (n->pos >= n->size) { -		void *tmp; - -		if (n->size >= ahash_max) -			/* Trigger rehashing */ -			return -EAGAIN; - -		tmp = kzalloc((n->size + AHASH_INIT_SIZE) -			      * sizeof(struct type_pf_elem), -			      GFP_ATOMIC); -		if (!tmp) -			return -ENOMEM; -		if (n->size) { -			memcpy(tmp, n->value, -			       sizeof(struct type_pf_elem) * n->size); -			kfree(n->value); -		} -		n->value = tmp; -		n->size += AHASH_INIT_SIZE; -	} -	data = ahash_data(n, n->pos++); -	type_pf_data_copy(data, value); -#ifdef IP_SET_HASH_WITH_NETS -	/* Resizing won't overwrite stored flags */ -	if (cadt_flags) -		type_pf_data_flags(data, cadt_flags); -#endif -	return 0; -} - -/* Resize a hash: create a new hash table with doubling the hashsize - * and inserting the elements to it. Repeat until we succeed or - * fail due to memory pressures. */ -static int -type_pf_resize(struct ip_set *set, bool retried) -{ -	struct ip_set_hash *h = set->data; -	struct htable *t, *orig = h->table; -	u8 htable_bits = orig->htable_bits; -	const struct type_pf_elem *data; -	struct hbucket *n, *m; -	u32 i, j; -	int ret; - -retry: -	ret = 0; -	htable_bits++; -	pr_debug("attempt to resize set %s from %u to %u, t %p\n", -		 set->name, orig->htable_bits, htable_bits, orig); -	if (!htable_bits) { -		/* In case we have plenty of memory :-) */ -		pr_warning("Cannot increase the hashsize of set %s further\n", -			   set->name); -		return -IPSET_ERR_HASH_FULL; -	} -	t = ip_set_alloc(sizeof(*t) -			 + jhash_size(htable_bits) * sizeof(struct hbucket)); -	if (!t) -		return -ENOMEM; -	t->htable_bits = htable_bits; - -	read_lock_bh(&set->lock); -	for (i = 0; i < jhash_size(orig->htable_bits); i++) { -		n = hbucket(orig, i); -		for (j = 0; j < n->pos; j++) { -			data = ahash_data(n, j); -			m = hbucket(t, HKEY(data, h->initval, htable_bits)); -			ret = type_pf_elem_add(m, data, AHASH_MAX(h), 0); -			if (ret < 0) { -				read_unlock_bh(&set->lock); -				ahash_destroy(t); -				if (ret == -EAGAIN) -					goto retry; -				return ret; -			} -		} -	} - -	rcu_assign_pointer(h->table, t); -	read_unlock_bh(&set->lock); - -	/* Give time to other readers of the set */ -	synchronize_rcu_bh(); - -	pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name, -		 orig->htable_bits, orig, t->htable_bits, t); -	ahash_destroy(orig); - -	return 0; -} - -static inline void -type_pf_data_next(struct ip_set_hash *h, const struct type_pf_elem *d); - -/* Add an element to a hash and update the internal counters when succeeded, - * otherwise report the proper error code. */ -static int -type_pf_add(struct ip_set *set, void *value, u32 timeout, u32 flags) -{ -	struct ip_set_hash *h = set->data; -	struct htable *t; -	const struct type_pf_elem *d = value; -	struct hbucket *n; -	int i, ret = 0; -	u32 key, multi = 0; -	u32 cadt_flags = flags >> 16; - -	if (h->elements >= h->maxelem) { -		if (net_ratelimit()) -			pr_warning("Set %s is full, maxelem %u reached\n", -				   set->name, h->maxelem); -		return -IPSET_ERR_HASH_FULL; -	} - -	rcu_read_lock_bh(); -	t = rcu_dereference_bh(h->table); -	key = HKEY(value, h->initval, t->htable_bits); -	n = hbucket(t, key); -	for (i = 0; i < n->pos; i++) -		if (type_pf_data_equal(ahash_data(n, i), d, &multi)) { -#ifdef IP_SET_HASH_WITH_NETS -			if (flags & IPSET_FLAG_EXIST) -				/* Support overwriting just the flags */ -				type_pf_data_flags(ahash_data(n, i), -						   cadt_flags); -#endif -			ret = -IPSET_ERR_EXIST; -			goto out; -		} -	TUNE_AHASH_MAX(h, multi); -	ret = type_pf_elem_add(n, value, AHASH_MAX(h), cadt_flags); -	if (ret != 0) { -		if (ret == -EAGAIN) -			type_pf_data_next(h, d); -		goto out; -	} - -#ifdef IP_SET_HASH_WITH_NETS -	add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); -#endif -	h->elements++; -out: -	rcu_read_unlock_bh(); -	return ret; -} - -/* Delete an element from the hash: swap it with the last element - * and free up space if possible. - */ -static int -type_pf_del(struct ip_set *set, void *value, u32 timeout, u32 flags) -{ -	struct ip_set_hash *h = set->data; -	struct htable *t = h->table; -	const struct type_pf_elem *d = value; -	struct hbucket *n; -	int i; -	struct type_pf_elem *data; -	u32 key, multi = 0; - -	key = HKEY(value, h->initval, t->htable_bits); -	n = hbucket(t, key); -	for (i = 0; i < n->pos; i++) { -		data = ahash_data(n, i); -		if (!type_pf_data_equal(data, d, &multi)) -			continue; -		if (i != n->pos - 1) -			/* Not last one */ -			type_pf_data_copy(data, ahash_data(n, n->pos - 1)); - -		n->pos--; -		h->elements--; -#ifdef IP_SET_HASH_WITH_NETS -		del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); -#endif -		if (n->pos + AHASH_INIT_SIZE < n->size) { -			void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) -					    * sizeof(struct type_pf_elem), -					    GFP_ATOMIC); -			if (!tmp) -				return 0; -			n->size -= AHASH_INIT_SIZE; -			memcpy(tmp, n->value, -			       n->size * sizeof(struct type_pf_elem)); -			kfree(n->value); -			n->value = tmp; -		} -		return 0; -	} - -	return -IPSET_ERR_EXIST; -} - -#ifdef IP_SET_HASH_WITH_NETS - -/* Special test function which takes into account the different network - * sizes added to the set */ -static int -type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) -{ -	struct ip_set_hash *h = set->data; -	struct htable *t = h->table; -	struct hbucket *n; -	const struct type_pf_elem *data; -	int i, j = 0; -	u32 key, multi = 0; -	u8 nets_length = NETS_LENGTH(set->family); - -	pr_debug("test by nets\n"); -	for (; j < nets_length && h->nets[j].nets && !multi; j++) { -		type_pf_data_netmask(d, h->nets[j].cidr); -		key = HKEY(d, h->initval, t->htable_bits); -		n = hbucket(t, key); -		for (i = 0; i < n->pos; i++) { -			data = ahash_data(n, i); -			if (type_pf_data_equal(data, d, &multi)) -				return type_pf_data_match(data); -		} -	} -	return 0; -} -#endif - -/* Test whether the element is added to the set */ -static int -type_pf_test(struct ip_set *set, void *value, u32 timeout, u32 flags) -{ -	struct ip_set_hash *h = set->data; -	struct htable *t = h->table; -	struct type_pf_elem *d = value; -	struct hbucket *n; -	const struct type_pf_elem *data; -	int i; -	u32 key, multi = 0; - -#ifdef IP_SET_HASH_WITH_NETS -	/* If we test an IP address and not a network address, -	 * try all possible network sizes */ -	if (CIDR(d->cidr) == SET_HOST_MASK(set->family)) -		return type_pf_test_cidrs(set, d, timeout); -#endif - -	key = HKEY(d, h->initval, t->htable_bits); -	n = hbucket(t, key); -	for (i = 0; i < n->pos; i++) { -		data = ahash_data(n, i); -		if (type_pf_data_equal(data, d, &multi)) -			return type_pf_data_match(data); -	} -	return 0; -} - -/* Reply a HEADER request: fill out the header part of the set */ -static int -type_pf_head(struct ip_set *set, struct sk_buff *skb) -{ -	const struct ip_set_hash *h = set->data; -	struct nlattr *nested; -	size_t memsize; - -	read_lock_bh(&set->lock); -	memsize = ahash_memsize(h, with_timeout(h->timeout) -					? sizeof(struct type_pf_telem) -					: sizeof(struct type_pf_elem), -				NETS_LENGTH(set->family)); -	read_unlock_bh(&set->lock); - -	nested = ipset_nest_start(skb, IPSET_ATTR_DATA); -	if (!nested) -		goto nla_put_failure; -	if (nla_put_net32(skb, IPSET_ATTR_HASHSIZE, -			  htonl(jhash_size(h->table->htable_bits))) || -	    nla_put_net32(skb, IPSET_ATTR_MAXELEM, htonl(h->maxelem))) -		goto nla_put_failure; -#ifdef IP_SET_HASH_WITH_NETMASK -	if (h->netmask != HOST_MASK && -	    nla_put_u8(skb, IPSET_ATTR_NETMASK, h->netmask)) -		goto nla_put_failure; -#endif -	if (nla_put_net32(skb, IPSET_ATTR_REFERENCES, htonl(set->ref - 1)) || -	    nla_put_net32(skb, IPSET_ATTR_MEMSIZE, htonl(memsize)) || -	    (with_timeout(h->timeout) && -	     nla_put_net32(skb, IPSET_ATTR_TIMEOUT, htonl(h->timeout)))) -		goto nla_put_failure; -	ipset_nest_end(skb, nested); - -	return 0; -nla_put_failure: -	return -EMSGSIZE; -} - -/* Reply a LIST/SAVE request: dump the elements of the specified set */ -static int -type_pf_list(const struct ip_set *set, -	     struct sk_buff *skb, struct netlink_callback *cb) -{ -	const struct ip_set_hash *h = set->data; -	const struct htable *t = h->table; -	struct nlattr *atd, *nested; -	const struct hbucket *n; -	const struct type_pf_elem *data; -	u32 first = cb->args[2]; -	/* We assume that one hash bucket fills into one page */ -	void *incomplete; -	int i; - -	atd = ipset_nest_start(skb, IPSET_ATTR_ADT); -	if (!atd) -		return -EMSGSIZE; -	pr_debug("list hash set %s\n", set->name); -	for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) { -		incomplete = skb_tail_pointer(skb); -		n = hbucket(t, cb->args[2]); -		pr_debug("cb->args[2]: %lu, t %p n %p\n", cb->args[2], t, n); -		for (i = 0; i < n->pos; i++) { -			data = ahash_data(n, i); -			pr_debug("list hash %lu hbucket %p i %u, data %p\n", -				 cb->args[2], n, i, data); -			nested = ipset_nest_start(skb, IPSET_ATTR_DATA); -			if (!nested) { -				if (cb->args[2] == first) { -					nla_nest_cancel(skb, atd); -					return -EMSGSIZE; -				} else -					goto nla_put_failure; -			} -			if (type_pf_data_list(skb, data)) -				goto nla_put_failure; -			ipset_nest_end(skb, nested); -		} -	} -	ipset_nest_end(skb, atd); -	/* Set listing finished */ -	cb->args[2] = 0; - -	return 0; - -nla_put_failure: -	nlmsg_trim(skb, incomplete); -	ipset_nest_end(skb, atd); -	if (unlikely(first == cb->args[2])) { -		pr_warning("Can't list set %s: one bucket does not fit into " -			   "a message. Please report it!\n", set->name); -		cb->args[2] = 0; -		return -EMSGSIZE; -	} -	return 0; -} - -static int -type_pf_kadt(struct ip_set *set, const struct sk_buff *skb, -	     const struct xt_action_param *par, -	     enum ipset_adt adt, const struct ip_set_adt_opt *opt); -static int -type_pf_uadt(struct ip_set *set, struct nlattr *tb[], -	     enum ipset_adt adt, u32 *lineno, u32 flags, bool retried); - -static const struct ip_set_type_variant type_pf_variant = { -	.kadt	= type_pf_kadt, -	.uadt	= type_pf_uadt, -	.adt	= { -		[IPSET_ADD] = type_pf_add, -		[IPSET_DEL] = type_pf_del, -		[IPSET_TEST] = type_pf_test, -	}, -	.destroy = type_pf_destroy, -	.flush	= type_pf_flush, -	.head	= type_pf_head, -	.list	= type_pf_list, -	.resize	= type_pf_resize, -	.same_set = type_pf_same_set, -}; - -/* Flavour with timeout support */ - -#define ahash_tdata(n, i) \ -	(struct type_pf_elem *)((struct type_pf_telem *)((n)->value) + (i)) - -static inline u32 -type_pf_data_timeout(const struct type_pf_elem *data) -{ -	const struct type_pf_telem *tdata = -		(const struct type_pf_telem *) data; - -	return tdata->timeout; -} - -static inline bool -type_pf_data_expired(const struct type_pf_elem *data) -{ -	const struct type_pf_telem *tdata = -		(const struct type_pf_telem *) data; - -	return ip_set_timeout_expired(tdata->timeout); -} - -static inline void -type_pf_data_timeout_set(struct type_pf_elem *data, u32 timeout) -{ -	struct type_pf_telem *tdata = (struct type_pf_telem *) data; - -	tdata->timeout = ip_set_timeout_set(timeout); -} - -static int -type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value, -		  u8 ahash_max, u32 cadt_flags, u32 timeout) -{ -	struct type_pf_elem *data; - -	if (n->pos >= n->size) { -		void *tmp; - -		if (n->size >= ahash_max) -			/* Trigger rehashing */ -			return -EAGAIN; - -		tmp = kzalloc((n->size + AHASH_INIT_SIZE) -			      * sizeof(struct type_pf_telem), -			      GFP_ATOMIC); -		if (!tmp) -			return -ENOMEM; -		if (n->size) { -			memcpy(tmp, n->value, -			       sizeof(struct type_pf_telem) * n->size); -			kfree(n->value); -		} -		n->value = tmp; -		n->size += AHASH_INIT_SIZE; -	} -	data = ahash_tdata(n, n->pos++); -	type_pf_data_copy(data, value); -	type_pf_data_timeout_set(data, timeout); -#ifdef IP_SET_HASH_WITH_NETS -	/* Resizing won't overwrite stored flags */ -	if (cadt_flags) -		type_pf_data_flags(data, cadt_flags); -#endif -	return 0; -} - -/* Delete expired elements from the hashtable */ -static void -type_pf_expire(struct ip_set_hash *h, u8 nets_length) -{ -	struct htable *t = h->table; -	struct hbucket *n; -	struct type_pf_elem *data; -	u32 i; -	int j; - -	for (i = 0; i < jhash_size(t->htable_bits); i++) { -		n = hbucket(t, i); -		for (j = 0; j < n->pos; j++) { -			data = ahash_tdata(n, j); -			if (type_pf_data_expired(data)) { -				pr_debug("expired %u/%u\n", i, j); -#ifdef IP_SET_HASH_WITH_NETS -				del_cidr(h, CIDR(data->cidr), nets_length); -#endif -				if (j != n->pos - 1) -					/* Not last one */ -					type_pf_data_copy(data, -						ahash_tdata(n, n->pos - 1)); -				n->pos--; -				h->elements--; -			} -		} -		if (n->pos + AHASH_INIT_SIZE < n->size) { -			void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) -					    * sizeof(struct type_pf_telem), -					    GFP_ATOMIC); -			if (!tmp) -				/* Still try to delete expired elements */ -				continue; -			n->size -= AHASH_INIT_SIZE; -			memcpy(tmp, n->value, -			       n->size * sizeof(struct type_pf_telem)); -			kfree(n->value); -			n->value = tmp; -		} -	} -} - -static int -type_pf_tresize(struct ip_set *set, bool retried) -{ -	struct ip_set_hash *h = set->data; -	struct htable *t, *orig = h->table; -	u8 htable_bits = orig->htable_bits; -	const struct type_pf_elem *data; -	struct hbucket *n, *m; -	u32 i, j; -	int ret; - -	/* Try to cleanup once */ -	if (!retried) { -		i = h->elements; -		write_lock_bh(&set->lock); -		type_pf_expire(set->data, NETS_LENGTH(set->family)); -		write_unlock_bh(&set->lock); -		if (h->elements <  i) -			return 0; -	} - -retry: -	ret = 0; -	htable_bits++; -	pr_debug("attempt to resize set %s from %u to %u, t %p\n", -		 set->name, orig->htable_bits, htable_bits, orig); -	if (!htable_bits) { -		/* In case we have plenty of memory :-) */ -		pr_warning("Cannot increase the hashsize of set %s further\n", -			   set->name); -		return -IPSET_ERR_HASH_FULL; -	} -	t = ip_set_alloc(sizeof(*t) -			 + jhash_size(htable_bits) * sizeof(struct hbucket)); -	if (!t) -		return -ENOMEM; -	t->htable_bits = htable_bits; - -	read_lock_bh(&set->lock); -	for (i = 0; i < jhash_size(orig->htable_bits); i++) { -		n = hbucket(orig, i); -		for (j = 0; j < n->pos; j++) { -			data = ahash_tdata(n, j); -			m = hbucket(t, HKEY(data, h->initval, htable_bits)); -			ret = type_pf_elem_tadd(m, data, AHASH_MAX(h), 0, -						ip_set_timeout_get(type_pf_data_timeout(data))); -			if (ret < 0) { -				read_unlock_bh(&set->lock); -				ahash_destroy(t); -				if (ret == -EAGAIN) -					goto retry; -				return ret; -			} -		} -	} - -	rcu_assign_pointer(h->table, t); -	read_unlock_bh(&set->lock); - -	/* Give time to other readers of the set */ -	synchronize_rcu_bh(); - -	ahash_destroy(orig); - -	return 0; -} - -static int -type_pf_tadd(struct ip_set *set, void *value, u32 timeout, u32 flags) -{ -	struct ip_set_hash *h = set->data; -	struct htable *t = h->table; -	const struct type_pf_elem *d = value; -	struct hbucket *n; -	struct type_pf_elem *data; -	int ret = 0, i, j = AHASH_MAX(h) + 1; -	bool flag_exist = flags & IPSET_FLAG_EXIST; -	u32 key, multi = 0; -	u32 cadt_flags = flags >> 16; - -	if (h->elements >= h->maxelem) -		/* FIXME: when set is full, we slow down here */ -		type_pf_expire(h, NETS_LENGTH(set->family)); -	if (h->elements >= h->maxelem) { -		if (net_ratelimit()) -			pr_warning("Set %s is full, maxelem %u reached\n", -				   set->name, h->maxelem); -		return -IPSET_ERR_HASH_FULL; -	} - -	rcu_read_lock_bh(); -	t = rcu_dereference_bh(h->table); -	key = HKEY(d, h->initval, t->htable_bits); -	n = hbucket(t, key); -	for (i = 0; i < n->pos; i++) { -		data = ahash_tdata(n, i); -		if (type_pf_data_equal(data, d, &multi)) { -			if (type_pf_data_expired(data) || flag_exist) -				/* Just timeout value may be updated */ -				j = i; -			else { -				ret = -IPSET_ERR_EXIST; -				goto out; -			} -		} else if (j == AHASH_MAX(h) + 1 && -			   type_pf_data_expired(data)) -			j = i; -	} -	if (j != AHASH_MAX(h) + 1) { -		data = ahash_tdata(n, j); -#ifdef IP_SET_HASH_WITH_NETS -		del_cidr(h, CIDR(data->cidr), NETS_LENGTH(set->family)); -		add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); -#endif -		type_pf_data_copy(data, d); -		type_pf_data_timeout_set(data, timeout); -#ifdef IP_SET_HASH_WITH_NETS -		type_pf_data_flags(data, cadt_flags); -#endif -		goto out; -	} -	TUNE_AHASH_MAX(h, multi); -	ret = type_pf_elem_tadd(n, d, AHASH_MAX(h), cadt_flags, timeout); -	if (ret != 0) { -		if (ret == -EAGAIN) -			type_pf_data_next(h, d); -		goto out; -	} - -#ifdef IP_SET_HASH_WITH_NETS -	add_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); -#endif -	h->elements++; -out: -	rcu_read_unlock_bh(); -	return ret; -} - -static int -type_pf_tdel(struct ip_set *set, void *value, u32 timeout, u32 flags) -{ -	struct ip_set_hash *h = set->data; -	struct htable *t = h->table; -	const struct type_pf_elem *d = value; -	struct hbucket *n; -	int i; -	struct type_pf_elem *data; -	u32 key, multi = 0; - -	key = HKEY(value, h->initval, t->htable_bits); -	n = hbucket(t, key); -	for (i = 0; i < n->pos; i++) { -		data = ahash_tdata(n, i); -		if (!type_pf_data_equal(data, d, &multi)) -			continue; -		if (type_pf_data_expired(data)) -			return -IPSET_ERR_EXIST; -		if (i != n->pos - 1) -			/* Not last one */ -			type_pf_data_copy(data, ahash_tdata(n, n->pos - 1)); - -		n->pos--; -		h->elements--; -#ifdef IP_SET_HASH_WITH_NETS -		del_cidr(h, CIDR(d->cidr), NETS_LENGTH(set->family)); -#endif -		if (n->pos + AHASH_INIT_SIZE < n->size) { -			void *tmp = kzalloc((n->size - AHASH_INIT_SIZE) -					    * sizeof(struct type_pf_telem), -					    GFP_ATOMIC); -			if (!tmp) -				return 0; -			n->size -= AHASH_INIT_SIZE; -			memcpy(tmp, n->value, -			       n->size * sizeof(struct type_pf_telem)); -			kfree(n->value); -			n->value = tmp; -		} -		return 0; -	} - -	return -IPSET_ERR_EXIST; -} - -#ifdef IP_SET_HASH_WITH_NETS -static int -type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout) -{ -	struct ip_set_hash *h = set->data; -	struct htable *t = h->table; -	struct type_pf_elem *data; -	struct hbucket *n; -	int i, j = 0; -	u32 key, multi = 0; -	u8 nets_length = NETS_LENGTH(set->family); - -	for (; j < nets_length && h->nets[j].nets && !multi; j++) { -		type_pf_data_netmask(d, h->nets[j].cidr); -		key = HKEY(d, h->initval, t->htable_bits); -		n = hbucket(t, key); -		for (i = 0; i < n->pos; i++) { -			data = ahash_tdata(n, i); -#ifdef IP_SET_HASH_WITH_MULTI -			if (type_pf_data_equal(data, d, &multi)) { -				if (!type_pf_data_expired(data)) -					return type_pf_data_match(data); -				multi = 0; -			} -#else -			if (type_pf_data_equal(data, d, &multi) && -			    !type_pf_data_expired(data)) -				return type_pf_data_match(data); -#endif -		} -	} -	return 0; -} -#endif - -static int -type_pf_ttest(struct ip_set *set, void *value, u32 timeout, u32 flags) -{ -	struct ip_set_hash *h = set->data; -	struct htable *t = h->table; -	struct type_pf_elem *data, *d = value; -	struct hbucket *n; -	int i; -	u32 key, multi = 0; - -#ifdef IP_SET_HASH_WITH_NETS -	if (CIDR(d->cidr) == SET_HOST_MASK(set->family)) -		return type_pf_ttest_cidrs(set, d, timeout); -#endif -	key = HKEY(d, h->initval, t->htable_bits); -	n = hbucket(t, key); -	for (i = 0; i < n->pos; i++) { -		data = ahash_tdata(n, i); -		if (type_pf_data_equal(data, d, &multi) && -		    !type_pf_data_expired(data)) -			return type_pf_data_match(data); -	} -	return 0; -} - -static int -type_pf_tlist(const struct ip_set *set, -	      struct sk_buff *skb, struct netlink_callback *cb) -{ -	const struct ip_set_hash *h = set->data; -	const struct htable *t = h->table; -	struct nlattr *atd, *nested; -	const struct hbucket *n; -	const struct type_pf_elem *data; -	u32 first = cb->args[2]; -	/* We assume that one hash bucket fills into one page */ -	void *incomplete; -	int i; - -	atd = ipset_nest_start(skb, IPSET_ATTR_ADT); -	if (!atd) -		return -EMSGSIZE; -	for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) { -		incomplete = skb_tail_pointer(skb); -		n = hbucket(t, cb->args[2]); -		for (i = 0; i < n->pos; i++) { -			data = ahash_tdata(n, i); -			pr_debug("list %p %u\n", n, i); -			if (type_pf_data_expired(data)) -				continue; -			pr_debug("do list %p %u\n", n, i); -			nested = ipset_nest_start(skb, IPSET_ATTR_DATA); -			if (!nested) { -				if (cb->args[2] == first) { -					nla_nest_cancel(skb, atd); -					return -EMSGSIZE; -				} else -					goto nla_put_failure; -			} -			if (type_pf_data_tlist(skb, data)) -				goto nla_put_failure; -			ipset_nest_end(skb, nested); -		} -	} -	ipset_nest_end(skb, atd); -	/* Set listing finished */ -	cb->args[2] = 0; - -	return 0; - -nla_put_failure: -	nlmsg_trim(skb, incomplete); -	ipset_nest_end(skb, atd); -	if (unlikely(first == cb->args[2])) { -		pr_warning("Can't list set %s: one bucket does not fit into " -			   "a message. Please report it!\n", set->name); -		cb->args[2] = 0; -		return -EMSGSIZE; -	} -	return 0; -} - -static const struct ip_set_type_variant type_pf_tvariant = { -	.kadt	= type_pf_kadt, -	.uadt	= type_pf_uadt, -	.adt	= { -		[IPSET_ADD] = type_pf_tadd, -		[IPSET_DEL] = type_pf_tdel, -		[IPSET_TEST] = type_pf_ttest, -	}, -	.destroy = type_pf_destroy, -	.flush	= type_pf_flush, -	.head	= type_pf_head, -	.list	= type_pf_tlist, -	.resize	= type_pf_tresize, -	.same_set = type_pf_same_set, -}; - -static void -type_pf_gc(unsigned long ul_set) -{ -	struct ip_set *set = (struct ip_set *) ul_set; -	struct ip_set_hash *h = set->data; - -	pr_debug("called\n"); -	write_lock_bh(&set->lock); -	type_pf_expire(h, NETS_LENGTH(set->family)); -	write_unlock_bh(&set->lock); - -	h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ; -	add_timer(&h->gc); -} - -static void -type_pf_gc_init(struct ip_set *set) -{ -	struct ip_set_hash *h = set->data; - -	init_timer(&h->gc); -	h->gc.data = (unsigned long) set; -	h->gc.function = type_pf_gc; -	h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ; -	add_timer(&h->gc); -	pr_debug("gc initialized, run in every %u\n", -		 IPSET_GC_PERIOD(h->timeout)); -} - -#undef HKEY_DATALEN -#undef HKEY -#undef type_pf_data_equal -#undef type_pf_data_isnull -#undef type_pf_data_copy -#undef type_pf_data_zero_out -#undef type_pf_data_netmask -#undef type_pf_data_list -#undef type_pf_data_tlist -#undef type_pf_data_next -#undef type_pf_data_flags -#undef type_pf_data_match - -#undef type_pf_elem -#undef type_pf_telem -#undef type_pf_data_timeout -#undef type_pf_data_expired -#undef type_pf_data_timeout_set - -#undef type_pf_elem_add -#undef type_pf_add -#undef type_pf_del -#undef type_pf_test_cidrs -#undef type_pf_test - -#undef type_pf_elem_tadd -#undef type_pf_del_telem -#undef type_pf_expire -#undef type_pf_tadd -#undef type_pf_tdel -#undef type_pf_ttest_cidrs -#undef type_pf_ttest - -#undef type_pf_resize -#undef type_pf_tresize -#undef type_pf_flush -#undef type_pf_destroy -#undef type_pf_head -#undef type_pf_list -#undef type_pf_tlist -#undef type_pf_same_set -#undef type_pf_kadt -#undef type_pf_uadt -#undef type_pf_gc -#undef type_pf_gc_init -#undef type_pf_variant -#undef type_pf_tvariant diff --git a/include/linux/netfilter/ipset/ip_set_bitmap.h b/include/linux/netfilter/ipset/ip_set_bitmap.h index 1a30646d5be..5e4662a71e0 100644 --- a/include/linux/netfilter/ipset/ip_set_bitmap.h +++ b/include/linux/netfilter/ipset/ip_set_bitmap.h @@ -5,6 +5,12 @@  #define IPSET_BITMAP_MAX_RANGE	0x0000FFFF +enum { +	IPSET_ADD_FAILED = 1, +	IPSET_ADD_STORE_PLAIN_TIMEOUT, +	IPSET_ADD_START_STORED_TIMEOUT, +}; +  /* Common functions */  static inline u32 diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h index 41d9cfa0816..3aac04167ca 100644 --- a/include/linux/netfilter/ipset/ip_set_timeout.h +++ b/include/linux/netfilter/ipset/ip_set_timeout.h @@ -1,7 +1,7 @@  #ifndef _IP_SET_TIMEOUT_H  #define _IP_SET_TIMEOUT_H -/* Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> +/* Copyright (C) 2003-2013 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>   *   * This program is free software; you can redistribute it and/or modify   * it under the terms of the GNU General Public License version 2 as @@ -17,13 +17,14 @@  #define IPSET_GC_PERIOD(timeout) \  	((timeout/3) ? min_t(u32, (timeout)/3, IPSET_GC_TIME) : 1) -/* Set is defined without timeout support: timeout value may be 0 */ -#define IPSET_NO_TIMEOUT	UINT_MAX +/* Entry is set with no timeout value */ +#define IPSET_ELEM_PERMANENT	0 -#define with_timeout(timeout)	((timeout) != IPSET_NO_TIMEOUT) +/* Set is defined with timeout support: timeout value may be 0 */ +#define IPSET_NO_TIMEOUT	UINT_MAX -#define opt_timeout(opt, map)	\ -	(with_timeout((opt)->timeout) ? (opt)->timeout : (map)->timeout) +#define ip_set_adt_opt_timeout(opt, map)	\ +((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (map)->timeout)  static inline unsigned int  ip_set_timeout_uget(struct nlattr *tb) @@ -38,61 +39,6 @@ ip_set_timeout_uget(struct nlattr *tb)  	return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout;  } -#ifdef IP_SET_BITMAP_TIMEOUT - -/* Bitmap specific timeout constants and macros for the entries */ - -/* Bitmap entry is unset */ -#define IPSET_ELEM_UNSET	0 -/* Bitmap entry is set with no timeout value */ -#define IPSET_ELEM_PERMANENT	(UINT_MAX/2) - -static inline bool -ip_set_timeout_test(unsigned long timeout) -{ -	return timeout != IPSET_ELEM_UNSET && -	       (timeout == IPSET_ELEM_PERMANENT || -		time_is_after_jiffies(timeout)); -} - -static inline bool -ip_set_timeout_expired(unsigned long timeout) -{ -	return timeout != IPSET_ELEM_UNSET && -	       timeout != IPSET_ELEM_PERMANENT && -	       time_is_before_jiffies(timeout); -} - -static inline unsigned long -ip_set_timeout_set(u32 timeout) -{ -	unsigned long t; - -	if (!timeout) -		return IPSET_ELEM_PERMANENT; - -	t = msecs_to_jiffies(timeout * 1000) + jiffies; -	if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT) -		/* Bingo! */ -		t++; - -	return t; -} - -static inline u32 -ip_set_timeout_get(unsigned long timeout) -{ -	return timeout == IPSET_ELEM_PERMANENT ? 0 : -		jiffies_to_msecs(timeout - jiffies)/1000; -} - -#else - -/* Hash specific timeout constants and macros for the entries */ - -/* Hash entry is set with no timeout value */ -#define IPSET_ELEM_PERMANENT	0 -  static inline bool  ip_set_timeout_test(unsigned long timeout)  { @@ -101,36 +47,32 @@ ip_set_timeout_test(unsigned long timeout)  }  static inline bool -ip_set_timeout_expired(unsigned long timeout) +ip_set_timeout_expired(unsigned long *timeout)  { -	return timeout != IPSET_ELEM_PERMANENT && -	       time_is_before_jiffies(timeout); +	return *timeout != IPSET_ELEM_PERMANENT && +	       time_is_before_jiffies(*timeout);  } -static inline unsigned long -ip_set_timeout_set(u32 timeout) +static inline void +ip_set_timeout_set(unsigned long *timeout, u32 t)  { -	unsigned long t; - -	if (!timeout) -		return IPSET_ELEM_PERMANENT; +	if (!t) { +		*timeout = IPSET_ELEM_PERMANENT; +		return; +	} -	t = msecs_to_jiffies(timeout * 1000) + jiffies; -	if (t == IPSET_ELEM_PERMANENT) +	*timeout = msecs_to_jiffies(t * 1000) + jiffies; +	if (*timeout == IPSET_ELEM_PERMANENT)  		/* Bingo! :-) */ -		t++; - -	return t; +		(*timeout)--;  }  static inline u32 -ip_set_timeout_get(unsigned long timeout) +ip_set_timeout_get(unsigned long *timeout)  { -	return timeout == IPSET_ELEM_PERMANENT ? 0 : -		jiffies_to_msecs(timeout - jiffies)/1000; +	return *timeout == IPSET_ELEM_PERMANENT ? 0 : +		jiffies_to_msecs(*timeout - jiffies)/1000;  } -#endif /* ! IP_SET_BITMAP_TIMEOUT */  #endif	/* __KERNEL__ */ -  #endif /* _IP_SET_TIMEOUT_H */ diff --git a/include/linux/netfilter/ipset/pfxlen.h b/include/linux/netfilter/ipset/pfxlen.h index 199fd11fedc..1afbb94b4b6 100644 --- a/include/linux/netfilter/ipset/pfxlen.h +++ b/include/linux/netfilter/ipset/pfxlen.h @@ -41,4 +41,13 @@ do {						\  	to = from | ~ip_set_hostmask(cidr);	\  } while (0) +static inline void +ip6_netmask(union nf_inet_addr *ip, u8 prefix) +{ +	ip->ip6[0] &= ip_set_netmask6(prefix)[0]; +	ip->ip6[1] &= ip_set_netmask6(prefix)[1]; +	ip->ip6[2] &= ip_set_netmask6(prefix)[2]; +	ip->ip6[3] &= ip_set_netmask6(prefix)[3]; +} +  #endif /*_PFXLEN_H */ diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index ecbb8e49591..cadb7402d7a 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h @@ -29,10 +29,13 @@ extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);  extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);  extern int nfnetlink_has_listeners(struct net *net, unsigned int group); -extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group, -			  int echo, gfp_t flags); -extern int nfnetlink_set_err(struct net *net, u32 pid, u32 group, int error); -extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u_int32_t pid, int flags); +extern struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size, +					   u32 dst_portid, gfp_t gfp_mask); +extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid, +			  unsigned int group, int echo, gfp_t flags); +extern int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error); +extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net, +			     u32 portid, int flags);  extern void nfnl_lock(__u8 subsys_id);  extern void nfnl_unlock(__u8 subsys_id); diff --git a/include/linux/netlink.h b/include/linux/netlink.h index e0f746b7b95..6358da5eeee 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h @@ -15,11 +15,18 @@ static inline struct nlmsghdr *nlmsg_hdr(const struct sk_buff *skb)  	return (struct nlmsghdr *)skb->data;  } +enum netlink_skb_flags { +	NETLINK_SKB_MMAPED	= 0x1,		/* Packet data is mmaped */ +	NETLINK_SKB_TX		= 0x2,		/* Packet was sent by userspace */ +	NETLINK_SKB_DELIVERED	= 0x4,		/* Packet was delivered */ +}; +  struct netlink_skb_parms {  	struct scm_creds	creds;		/* Skb credentials	*/  	__u32			portid;  	__u32			dst_group; -	struct sock		*ssk; +	__u32			flags; +	struct sock		*sk;  };  #define NETLINK_CB(skb)		(*(struct netlink_skb_parms*)&((skb)->cb)) @@ -57,6 +64,8 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group)  extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);  extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);  extern int netlink_has_listeners(struct sock *sk, unsigned int group); +extern struct sk_buff *netlink_alloc_skb(struct sock *ssk, unsigned int size, +					 u32 dst_portid, gfp_t gfp_mask);  extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock);  extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid,  			     __u32 group, gfp_t allocation); diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 9d7d8c64f7c..fa2cb76a702 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h @@ -40,7 +40,7 @@ struct netpoll_info {  	unsigned long rx_flags;  	spinlock_t rx_lock; -	struct mutex dev_lock; +	struct semaphore dev_lock;  	struct list_head rx_np; /* netpolls that registered an rx_hook */  	struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */ diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 1cc25682b20..fc01d5cb4cf 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -59,11 +59,18 @@ struct nfs_lockowner {  	pid_t l_pid;  }; +#define NFS_IO_INPROGRESS 0 +struct nfs_io_counter { +	unsigned long flags; +	atomic_t io_count; +}; +  struct nfs_lock_context {  	atomic_t count;  	struct list_head list;  	struct nfs_open_context *open_context;  	struct nfs_lockowner lockowner; +	struct nfs_io_counter io_count;  };  struct nfs4_state; @@ -77,6 +84,7 @@ struct nfs_open_context {  	unsigned long flags;  #define NFS_CONTEXT_ERROR_WRITE		(0)  #define NFS_CONTEXT_RESEND_WRITES	(1) +#define NFS_CONTEXT_BAD			(2)  	int error;  	struct list_head list; diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 6c6ed153a9b..3b7fa2abecc 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -40,6 +40,7 @@ struct nfs_client {  #define NFS_CS_NORESVPORT	0		/* - use ephemeral src port */  #define NFS_CS_DISCRTRY		1		/* - disconnect on RPC retry */  #define NFS_CS_MIGRATION	2		/* - transparent state migr */ +#define NFS_CS_INFINITE_SLOTS	3		/* - don't limit TCP slots */  	struct sockaddr_storage	cl_addr;	/* server identifier */  	size_t			cl_addrlen;  	char *			cl_hostname;	/* hostname of server */ @@ -197,5 +198,7 @@ struct nfs_server {  #define NFS_CAP_MTIME		(1U << 13)  #define NFS_CAP_POSIX_LOCK	(1U << 14)  #define NFS_CAP_UIDGID_NOMAP	(1U << 15) +#define NFS_CAP_STATEID_NFSV41	(1U << 16) +#define NFS_CAP_ATOMIC_OPEN_V1	(1U << 17)  #endif diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 4b993d358da..766c5bc9d44 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -14,9 +14,6 @@  #define NFS_DEF_FILE_IO_SIZE	(4096U)  #define NFS_MIN_FILE_IO_SIZE	(1024U) -/* Forward declaration for NFS v3 */ -struct nfs4_secinfo_flavors; -  struct nfs4_string {  	unsigned int len;  	char *data; @@ -349,6 +346,7 @@ struct nfs_openargs {  	const u32 *		bitmask;  	const u32 *		open_bitmap;  	__u32			claim; +	enum createmode4	createmode;  };  struct nfs_openres { @@ -486,6 +484,7 @@ struct nfs_readargs {  	struct nfs_fh *		fh;  	struct nfs_open_context *context;  	struct nfs_lock_context *lock_context; +	nfs4_stateid		stateid;  	__u64			offset;  	__u32			count;  	unsigned int		pgbase; @@ -507,6 +506,7 @@ struct nfs_writeargs {  	struct nfs_fh *		fh;  	struct nfs_open_context *context;  	struct nfs_lock_context *lock_context; +	nfs4_stateid		stateid;  	__u64			offset;  	__u32			count;  	enum nfs3_stable_how	stable; @@ -1050,25 +1050,14 @@ struct nfs4_fs_locations_res {  	struct nfs4_fs_locations       *fs_locations;  }; -struct nfs4_secinfo_oid { -	unsigned int len; -	char data[GSS_OID_MAX_LEN]; -}; - -struct nfs4_secinfo_gss { -	struct nfs4_secinfo_oid sec_oid4; -	unsigned int qop4; -	unsigned int service; -}; - -struct nfs4_secinfo_flavor { -	unsigned int 		flavor; -	struct nfs4_secinfo_gss	gss; +struct nfs4_secinfo4 { +	u32			flavor; +	struct rpcsec_gss_info	flavor_info;  };  struct nfs4_secinfo_flavors { -	unsigned int num_flavors; -	struct nfs4_secinfo_flavor flavors[0]; +	unsigned int		num_flavors; +	struct nfs4_secinfo4	flavors[0];  };  struct nfs4_secinfo_arg { diff --git a/include/linux/notifier.h b/include/linux/notifier.h index d65746efc95..d14a4c36246 100644 --- a/include/linux/notifier.h +++ b/include/linux/notifier.h @@ -47,8 +47,11 @@   * runtime initialization.   */ +typedef	int (*notifier_fn_t)(struct notifier_block *nb, +			unsigned long action, void *data); +  struct notifier_block { -	int (*notifier_call)(struct notifier_block *, unsigned long, void *); +	notifier_fn_t notifier_call;  	struct notifier_block __rcu *next;  	int priority;  }; diff --git a/include/linux/nubus.h b/include/linux/nubus.h index a8696bbdfbc..b3740527571 100644 --- a/include/linux/nubus.h +++ b/include/linux/nubus.h @@ -80,7 +80,11 @@ extern struct nubus_board* nubus_boards;  /* Generic NuBus interface functions, modelled after the PCI interface */  void nubus_scan_bus(void); +#ifdef CONFIG_PROC_FS  extern void nubus_proc_init(void); +#else +static inline void nubus_proc_init(void) {} +#endif  int get_nubus_list(char *buf);  int nubus_proc_attach_device(struct nubus_dev *dev);  int nubus_proc_detach_device(struct nubus_dev *dev); diff --git a/include/linux/of.h b/include/linux/of.h index a0f12928494..2d25ff8fe39 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -540,4 +540,14 @@ static inline int of_property_read_u32(const struct device_node *np,  	return of_property_read_u32_array(np, propname, out_value, 1);  } +#if defined(CONFIG_PROC_FS) && defined(CONFIG_PROC_DEVICETREE) +extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); +extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); +extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde, +					 struct property *prop); +extern void proc_device_tree_update_prop(struct proc_dir_entry *pde, +					 struct property *newprop, +					 struct property *oldprop); +#endif +  #endif /* _LINUX_OF_H */ diff --git a/include/linux/of_net.h b/include/linux/of_net.h index f4746418871..61bf53b0277 100644 --- a/include/linux/of_net.h +++ b/include/linux/of_net.h @@ -11,6 +11,16 @@  #include <linux/of.h>  extern const int of_get_phy_mode(struct device_node *np);  extern const void *of_get_mac_address(struct device_node *np); +#else +static inline const int of_get_phy_mode(struct device_node *np) +{ +	return -ENODEV; +} + +static inline const void *of_get_mac_address(struct device_node *np) +{ +	return NULL; +}  #endif  #endif /* __LINUX_OF_NET_H */ diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h index d42e174bd0c..e6b240b6196 100644 --- a/include/linux/openvswitch.h +++ b/include/linux/openvswitch.h @@ -19,435 +19,6 @@  #ifndef _LINUX_OPENVSWITCH_H  #define _LINUX_OPENVSWITCH_H 1 -#include <linux/types.h> - -/** - * struct ovs_header - header for OVS Generic Netlink messages. - * @dp_ifindex: ifindex of local port for datapath (0 to make a request not - * specific to a datapath). - * - * Attributes following the header are specific to a particular OVS Generic - * Netlink family, but all of the OVS families use this header. - */ - -struct ovs_header { -	int dp_ifindex; -}; - -/* Datapaths. */ - -#define OVS_DATAPATH_FAMILY  "ovs_datapath" -#define OVS_DATAPATH_MCGROUP "ovs_datapath" -#define OVS_DATAPATH_VERSION 0x1 - -enum ovs_datapath_cmd { -	OVS_DP_CMD_UNSPEC, -	OVS_DP_CMD_NEW, -	OVS_DP_CMD_DEL, -	OVS_DP_CMD_GET, -	OVS_DP_CMD_SET -}; - -/** - * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. - * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local - * port".  This is the name of the network device whose dp_ifindex is given in - * the &struct ovs_header.  Always present in notifications.  Required in - * %OVS_DP_NEW requests.  May be used as an alternative to specifying - * dp_ifindex in other requests (with a dp_ifindex of 0). - * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially - * set on the datapath port (for OVS_ACTION_ATTR_MISS).  Only valid on - * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should - * not be sent. - * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the - * datapath.  Always present in notifications. - * - * These attributes follow the &struct ovs_header within the Generic Netlink - * payload for %OVS_DP_* commands. - */ -enum ovs_datapath_attr { -	OVS_DP_ATTR_UNSPEC, -	OVS_DP_ATTR_NAME,       /* name of dp_ifindex netdev */ -	OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ -	OVS_DP_ATTR_STATS,      /* struct ovs_dp_stats */ -	__OVS_DP_ATTR_MAX -}; - -#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) - -struct ovs_dp_stats { -	__u64 n_hit;             /* Number of flow table matches. */ -	__u64 n_missed;          /* Number of flow table misses. */ -	__u64 n_lost;            /* Number of misses not sent to userspace. */ -	__u64 n_flows;           /* Number of flows present */ -}; - -struct ovs_vport_stats { -	__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  */ -}; - -/* Fixed logical ports. */ -#define OVSP_LOCAL      ((__u16)0) - -/* Packet transfer. */ - -#define OVS_PACKET_FAMILY "ovs_packet" -#define OVS_PACKET_VERSION 0x1 - -enum ovs_packet_cmd { -	OVS_PACKET_CMD_UNSPEC, - -	/* Kernel-to-user notifications. */ -	OVS_PACKET_CMD_MISS,    /* Flow table miss. */ -	OVS_PACKET_CMD_ACTION,  /* OVS_ACTION_ATTR_USERSPACE action. */ - -	/* Userspace commands. */ -	OVS_PACKET_CMD_EXECUTE  /* Apply actions to a packet. */ -}; - -/** - * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. - * @OVS_PACKET_ATTR_PACKET: Present for all notifications.  Contains the entire - * packet as received, from the start of the Ethernet header onward.  For - * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by - * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is - * the flow key extracted from the packet as originally received. - * @OVS_PACKET_ATTR_KEY: Present for all notifications.  Contains the flow key - * extracted from the packet as nested %OVS_KEY_ATTR_* attributes.  This allows - * userspace to adapt its flow setup strategy by comparing its notion of the - * flow key against the kernel's. - * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet.  Used - * for %OVS_PACKET_CMD_EXECUTE.  It has nested %OVS_ACTION_ATTR_* attributes. - * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION - * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an - * %OVS_USERSPACE_ATTR_USERDATA attribute. - * - * These attributes follow the &struct ovs_header within the Generic Netlink - * payload for %OVS_PACKET_* commands. - */ -enum ovs_packet_attr { -	OVS_PACKET_ATTR_UNSPEC, -	OVS_PACKET_ATTR_PACKET,      /* Packet data. */ -	OVS_PACKET_ATTR_KEY,         /* Nested OVS_KEY_ATTR_* attributes. */ -	OVS_PACKET_ATTR_ACTIONS,     /* Nested OVS_ACTION_ATTR_* attributes. */ -	OVS_PACKET_ATTR_USERDATA,    /* u64 OVS_ACTION_ATTR_USERSPACE arg. */ -	__OVS_PACKET_ATTR_MAX -}; - -#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) - -/* Virtual ports. */ - -#define OVS_VPORT_FAMILY  "ovs_vport" -#define OVS_VPORT_MCGROUP "ovs_vport" -#define OVS_VPORT_VERSION 0x1 - -enum ovs_vport_cmd { -	OVS_VPORT_CMD_UNSPEC, -	OVS_VPORT_CMD_NEW, -	OVS_VPORT_CMD_DEL, -	OVS_VPORT_CMD_GET, -	OVS_VPORT_CMD_SET -}; - -enum ovs_vport_type { -	OVS_VPORT_TYPE_UNSPEC, -	OVS_VPORT_TYPE_NETDEV,   /* network device */ -	OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ -	__OVS_VPORT_TYPE_MAX -}; - -#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) - -/** - * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. - * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. - * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type - * of vport. - * @OVS_VPORT_ATTR_NAME: Name of vport.  For a vport based on a network device - * this is the name of the network device.  Maximum length %IFNAMSIZ-1 bytes - * plus a null terminator. - * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. - * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that - * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on - * this port.  A value of zero indicates that upcalls should not be sent. - * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for - * packets sent or received through the vport. - * - * These attributes follow the &struct ovs_header within the Generic Netlink - * payload for %OVS_VPORT_* commands. - * - * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and - * %OVS_VPORT_ATTR_NAME attributes are required.  %OVS_VPORT_ATTR_PORT_NO is - * optional; if not specified a free port number is automatically selected. - * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type - * of vport. - * and other attributes are ignored. - * - * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to - * look up the vport to operate on; otherwise dp_idx from the &struct - * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. - */ -enum ovs_vport_attr { -	OVS_VPORT_ATTR_UNSPEC, -	OVS_VPORT_ATTR_PORT_NO,	/* u32 port number within datapath */ -	OVS_VPORT_ATTR_TYPE,	/* u32 OVS_VPORT_TYPE_* constant. */ -	OVS_VPORT_ATTR_NAME,	/* string name, up to IFNAMSIZ bytes long */ -	OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ -	OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */ -	OVS_VPORT_ATTR_STATS,	/* struct ovs_vport_stats */ -	__OVS_VPORT_ATTR_MAX -}; - -#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) - -/* Flows. */ - -#define OVS_FLOW_FAMILY  "ovs_flow" -#define OVS_FLOW_MCGROUP "ovs_flow" -#define OVS_FLOW_VERSION 0x1 - -enum ovs_flow_cmd { -	OVS_FLOW_CMD_UNSPEC, -	OVS_FLOW_CMD_NEW, -	OVS_FLOW_CMD_DEL, -	OVS_FLOW_CMD_GET, -	OVS_FLOW_CMD_SET -}; - -struct ovs_flow_stats { -	__u64 n_packets;         /* Number of matched packets. */ -	__u64 n_bytes;           /* Number of matched bytes. */ -}; - -enum ovs_key_attr { -	OVS_KEY_ATTR_UNSPEC, -	OVS_KEY_ATTR_ENCAP,	/* Nested set of encapsulated attributes. */ -	OVS_KEY_ATTR_PRIORITY,  /* u32 skb->priority */ -	OVS_KEY_ATTR_IN_PORT,   /* u32 OVS dp port number */ -	OVS_KEY_ATTR_ETHERNET,  /* struct ovs_key_ethernet */ -	OVS_KEY_ATTR_VLAN,	/* be16 VLAN TCI */ -	OVS_KEY_ATTR_ETHERTYPE,	/* be16 Ethernet type */ -	OVS_KEY_ATTR_IPV4,      /* struct ovs_key_ipv4 */ -	OVS_KEY_ATTR_IPV6,      /* struct ovs_key_ipv6 */ -	OVS_KEY_ATTR_TCP,       /* struct ovs_key_tcp */ -	OVS_KEY_ATTR_UDP,       /* struct ovs_key_udp */ -	OVS_KEY_ATTR_ICMP,      /* struct ovs_key_icmp */ -	OVS_KEY_ATTR_ICMPV6,    /* struct ovs_key_icmpv6 */ -	OVS_KEY_ATTR_ARP,       /* struct ovs_key_arp */ -	OVS_KEY_ATTR_ND,        /* struct ovs_key_nd */ -	OVS_KEY_ATTR_SKB_MARK,  /* u32 skb mark */ -	__OVS_KEY_ATTR_MAX -}; - -#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) - -/** - * enum ovs_frag_type - IPv4 and IPv6 fragment type - * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. - * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. - * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. - * - * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct - * ovs_key_ipv6. - */ -enum ovs_frag_type { -	OVS_FRAG_TYPE_NONE, -	OVS_FRAG_TYPE_FIRST, -	OVS_FRAG_TYPE_LATER, -	__OVS_FRAG_TYPE_MAX -}; - -#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) - -struct ovs_key_ethernet { -	__u8	 eth_src[6]; -	__u8	 eth_dst[6]; -}; - -struct ovs_key_ipv4 { -	__be32 ipv4_src; -	__be32 ipv4_dst; -	__u8   ipv4_proto; -	__u8   ipv4_tos; -	__u8   ipv4_ttl; -	__u8   ipv4_frag;	/* One of OVS_FRAG_TYPE_*. */ -}; - -struct ovs_key_ipv6 { -	__be32 ipv6_src[4]; -	__be32 ipv6_dst[4]; -	__be32 ipv6_label;	/* 20-bits in least-significant bits. */ -	__u8   ipv6_proto; -	__u8   ipv6_tclass; -	__u8   ipv6_hlimit; -	__u8   ipv6_frag;	/* One of OVS_FRAG_TYPE_*. */ -}; - -struct ovs_key_tcp { -	__be16 tcp_src; -	__be16 tcp_dst; -}; - -struct ovs_key_udp { -	__be16 udp_src; -	__be16 udp_dst; -}; - -struct ovs_key_icmp { -	__u8 icmp_type; -	__u8 icmp_code; -}; - -struct ovs_key_icmpv6 { -	__u8 icmpv6_type; -	__u8 icmpv6_code; -}; - -struct ovs_key_arp { -	__be32 arp_sip; -	__be32 arp_tip; -	__be16 arp_op; -	__u8   arp_sha[6]; -	__u8   arp_tha[6]; -}; - -struct ovs_key_nd { -	__u32 nd_target[4]; -	__u8  nd_sll[6]; -	__u8  nd_tll[6]; -}; - -/** - * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. - * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow - * key.  Always present in notifications.  Required for all requests (except - * dumps). - * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying - * the actions to take for packets that match the key.  Always present in - * notifications.  Required for %OVS_FLOW_CMD_NEW requests, optional for - * %OVS_FLOW_CMD_SET requests. - * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this - * flow.  Present in notifications if the stats would be nonzero.  Ignored in - * requests. - * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the - * TCP flags seen on packets in this flow.  Only present in notifications for - * TCP flows, and only if it would be nonzero.  Ignored in requests. - * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on - * the system monotonic clock, at which a packet was last processed for this - * flow.  Only present in notifications if a packet has been processed for this - * flow.  Ignored in requests. - * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the - * last-used time, accumulated TCP flags, and statistics for this flow. - * Otherwise ignored in requests.  Never present in notifications. - * - * These attributes follow the &struct ovs_header within the Generic Netlink - * payload for %OVS_FLOW_* commands. - */ -enum ovs_flow_attr { -	OVS_FLOW_ATTR_UNSPEC, -	OVS_FLOW_ATTR_KEY,       /* Sequence of OVS_KEY_ATTR_* attributes. */ -	OVS_FLOW_ATTR_ACTIONS,   /* Nested OVS_ACTION_ATTR_* attributes. */ -	OVS_FLOW_ATTR_STATS,     /* struct ovs_flow_stats. */ -	OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ -	OVS_FLOW_ATTR_USED,      /* u64 msecs last used in monotonic time. */ -	OVS_FLOW_ATTR_CLEAR,     /* Flag to clear stats, tcp_flags, used. */ -	__OVS_FLOW_ATTR_MAX -}; - -#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) - -/** - * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. - * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with - * @OVS_ACTION_ATTR_SAMPLE.  A value of 0 samples no packets, a value of - * %UINT32_MAX samples all packets and intermediate values sample intermediate - * fractions of packets. - * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. - * Actions are passed as nested attributes. - * - * Executes the specified actions with the given probability on a per-packet - * basis. - */ -enum ovs_sample_attr { -	OVS_SAMPLE_ATTR_UNSPEC, -	OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ -	OVS_SAMPLE_ATTR_ACTIONS,     /* Nested OVS_ACTION_ATTR_* attributes. */ -	__OVS_SAMPLE_ATTR_MAX, -}; - -#define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) - -/** - * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. - * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION - * message should be sent.  Required. - * @OVS_USERSPACE_ATTR_USERDATA: If present, its u64 argument is copied to the - * %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA, - */ -enum ovs_userspace_attr { -	OVS_USERSPACE_ATTR_UNSPEC, -	OVS_USERSPACE_ATTR_PID,	      /* u32 Netlink PID to receive upcalls. */ -	OVS_USERSPACE_ATTR_USERDATA,  /* u64 optional user-specified cookie. */ -	__OVS_USERSPACE_ATTR_MAX -}; - -#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) - -/** - * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. - * @vlan_tpid: Tag protocol identifier (TPID) to push. - * @vlan_tci: Tag control identifier (TCI) to push.  The CFI bit must be set - * (but it will not be set in the 802.1Q header that is pushed). - * - * The @vlan_tpid value is typically %ETH_P_8021Q.  The only acceptable TPID - * values are those that the kernel module also parses as 802.1Q headers, to - * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN - * from having surprising results. - */ -struct ovs_action_push_vlan { -	__be16 vlan_tpid;	/* 802.1Q TPID. */ -	__be16 vlan_tci;	/* 802.1Q TCI (VLAN ID and priority). */ -}; - -/** - * enum ovs_action_attr - Action types. - * - * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. - * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested - * %OVS_USERSPACE_ATTR_* attributes. - * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header.  The - * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its - * value. - * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the - * packet. - * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet. - * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in - * the nested %OVS_SAMPLE_ATTR_* attributes. - * - * Only a single header can be set with a single %OVS_ACTION_ATTR_SET.  Not all - * fields within a header are modifiable, e.g. the IPv4 protocol and fragment - * type may not be changed. - */ - -enum ovs_action_attr { -	OVS_ACTION_ATTR_UNSPEC, -	OVS_ACTION_ATTR_OUTPUT,	      /* u32 port number. */ -	OVS_ACTION_ATTR_USERSPACE,    /* Nested OVS_USERSPACE_ATTR_*. */ -	OVS_ACTION_ATTR_SET,          /* One nested OVS_KEY_ATTR_*. */ -	OVS_ACTION_ATTR_PUSH_VLAN,    /* struct ovs_action_push_vlan. */ -	OVS_ACTION_ATTR_POP_VLAN,     /* No argument. */ -	OVS_ACTION_ATTR_SAMPLE,       /* Nested OVS_SAMPLE_ATTR_*. */ -	__OVS_ACTION_ATTR_MAX -}; - -#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) +#include <uapi/linux/openvswitch.h>  #endif /* _LINUX_OPENVSWITCH_H */ diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 0e38e13eb24..e3dea75a078 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -149,7 +149,7 @@ static inline int page_cache_get_speculative(struct page *page)  {  	VM_BUG_ON(in_interrupt()); -#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU) +#ifdef CONFIG_TINY_RCU  # ifdef CONFIG_PREEMPT_COUNT  	VM_BUG_ON(!in_atomic());  # endif diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 9a22b5efb38..81b31613eb2 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h @@ -41,8 +41,37 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)  	return DEVICE_ACPI_HANDLE(dev);  } + +void acpi_pci_add_bus(struct pci_bus *bus); +void acpi_pci_remove_bus(struct pci_bus *bus); + +#ifdef	CONFIG_ACPI_PCI_SLOT +void acpi_pci_slot_init(void); +void acpi_pci_slot_enumerate(struct pci_bus *bus, acpi_handle handle); +void acpi_pci_slot_remove(struct pci_bus *bus); +#else +static inline void acpi_pci_slot_init(void) { } +static inline void acpi_pci_slot_enumerate(struct pci_bus *bus, +					   acpi_handle handle) { } +static inline void acpi_pci_slot_remove(struct pci_bus *bus) { }  #endif +#ifdef	CONFIG_HOTPLUG_PCI_ACPI +void acpiphp_init(void); +void acpiphp_enumerate_slots(struct pci_bus *bus, acpi_handle handle); +void acpiphp_remove_slots(struct pci_bus *bus); +#else +static inline void acpiphp_init(void) { } +static inline void acpiphp_enumerate_slots(struct pci_bus *bus, +					   acpi_handle handle) { } +static inline void acpiphp_remove_slots(struct pci_bus *bus) { } +#endif + +#else	/* CONFIG_ACPI */ +static inline void acpi_pci_add_bus(struct pci_bus *bus) { } +static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } +#endif	/* CONFIG_ACPI */ +  #ifdef CONFIG_ACPI_APEI  extern bool aer_acpi_firmware_first(void);  #else diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h index c8320144fe7..8af4610c2e4 100644 --- a/include/linux/pci-aspm.h +++ b/include/linux/pci-aspm.h @@ -23,14 +23,14 @@  #define PCIE_LINK_STATE_CLKPM	4  #ifdef CONFIG_PCIEASPM -extern void pcie_aspm_init_link_state(struct pci_dev *pdev); -extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); -extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); -extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev); -extern void pci_disable_link_state(struct pci_dev *pdev, int state); -extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state); -extern void pcie_clear_aspm(struct pci_bus *bus); -extern void pcie_no_aspm(void); +void pcie_aspm_init_link_state(struct pci_dev *pdev); +void pcie_aspm_exit_link_state(struct pci_dev *pdev); +void pcie_aspm_pm_state_change(struct pci_dev *pdev); +void pcie_aspm_powersave_config_link(struct pci_dev *pdev); +void pci_disable_link_state(struct pci_dev *pdev, int state); +void pci_disable_link_state_locked(struct pci_dev *pdev, int state); +void pcie_clear_aspm(struct pci_bus *bus); +void pcie_no_aspm(void);  #else  static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)  { @@ -56,8 +56,8 @@ static inline void pcie_no_aspm(void)  #endif  #ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ -extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); -extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev); +void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); +void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev);  #else  static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev)  { diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h index 7ef68724f0f..68bcefd7fca 100644 --- a/include/linux/pci-ats.h +++ b/include/linux/pci-ats.h @@ -14,9 +14,9 @@ struct pci_ats {  #ifdef CONFIG_PCI_ATS -extern int pci_enable_ats(struct pci_dev *dev, int ps); -extern void pci_disable_ats(struct pci_dev *dev); -extern int pci_ats_queue_depth(struct pci_dev *dev); +int pci_enable_ats(struct pci_dev *dev, int ps); +void pci_disable_ats(struct pci_dev *dev); +int pci_ats_queue_depth(struct pci_dev *dev);  /**   * pci_ats_enabled - query the ATS status @@ -54,12 +54,12 @@ static inline int pci_ats_enabled(struct pci_dev *dev)  #ifdef CONFIG_PCI_PRI -extern int  pci_enable_pri(struct pci_dev *pdev, u32 reqs); -extern void pci_disable_pri(struct pci_dev *pdev); -extern bool pci_pri_enabled(struct pci_dev *pdev); -extern int  pci_reset_pri(struct pci_dev *pdev); -extern bool pci_pri_stopped(struct pci_dev *pdev); -extern int  pci_pri_status(struct pci_dev *pdev); +int pci_enable_pri(struct pci_dev *pdev, u32 reqs); +void pci_disable_pri(struct pci_dev *pdev); +bool pci_pri_enabled(struct pci_dev *pdev); +int pci_reset_pri(struct pci_dev *pdev); +bool pci_pri_stopped(struct pci_dev *pdev); +int pci_pri_status(struct pci_dev *pdev);  #else /* CONFIG_PCI_PRI */ @@ -95,10 +95,10 @@ static inline int pci_pri_status(struct pci_dev *pdev)  #ifdef CONFIG_PCI_PASID -extern int pci_enable_pasid(struct pci_dev *pdev, int features); -extern void pci_disable_pasid(struct pci_dev *pdev); -extern int pci_pasid_features(struct pci_dev *pdev); -extern int pci_max_pasids(struct pci_dev *pdev); +int pci_enable_pasid(struct pci_dev *pdev, int features); +void pci_disable_pasid(struct pci_dev *pdev); +int pci_pasid_features(struct pci_dev *pdev); +int pci_max_pasids(struct pci_dev *pdev);  #else  /* CONFIG_PCI_PASID */ diff --git a/include/linux/pci.h b/include/linux/pci.h index 2461033a798..3a24e4ff324 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -35,6 +35,21 @@  /* Include the ID list */  #include <linux/pci_ids.h> +/* + * The PCI interface treats multi-function devices as independent + * devices.  The slot/function address of each device is encoded + * in a single byte as follows: + * + *	7:3 = slot + *	2:0 = function + * PCI_DEVFN(), PCI_SLOT(), and PCI_FUNC() are defined uapi/linux/pci.h + * In the interest of not exposing interfaces to user-space unnecessarily, + * the following kernel only defines are being added here. + */ +#define PCI_DEVID(bus, devfn)  ((((u16)bus) << 8) | devfn) +/* return bus from PCI devid = ((u16)bus_number) << 8) | devfn */ +#define PCI_BUS_NUM(x) (((x) >> 8) & 0xff) +  /* pci_slot represents a physical slot */  struct pci_slot {  	struct pci_bus *bus;		/* The bus this slot is on */ @@ -232,6 +247,8 @@ struct pci_dev {  	u8		revision;	/* PCI revision, low byte of class word */  	u8		hdr_type;	/* PCI header type (`multi' flag masked out) */  	u8		pcie_cap;	/* PCI-E capability offset */ +	u8		msi_cap;	/* MSI capability offset */ +	u8		msix_cap;	/* MSI-X capability offset */  	u8		pcie_mpss:3;	/* PCI-E Max Payload Size Supported */  	u8		rom_base_reg;	/* which config register controls the ROM */  	u8		pin;  		/* which interrupt pin this device uses */ @@ -249,8 +266,7 @@ struct pci_dev {  	pci_power_t     current_state;  /* Current operating state. In ACPI-speak,  					   this is D0-D3, D0 being fully functional,  					   and D3 being off. */ -	int		pm_cap;		/* PM capability offset in the -					   configuration space */ +	u8		pm_cap;		/* PM capability offset */  	unsigned int	pme_support:5;	/* Bitmask of states from which PME#  					   can be generated */  	unsigned int	pme_interrupt:1; @@ -348,7 +364,7 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)  	return dev;  } -extern struct pci_dev *alloc_pci_dev(void); +struct pci_dev *alloc_pci_dev(void);  #define	to_pci_dev(n) container_of(n, struct pci_dev, dev)  #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) @@ -504,10 +520,10 @@ struct pci_ops {   * ACPI needs to be able to access PCI config space before we've done a   * PCI bus scan and created pci_bus structures.   */ -extern int raw_pci_read(unsigned int domain, unsigned int bus, -			unsigned int devfn, int reg, int len, u32 *val); -extern int raw_pci_write(unsigned int domain, unsigned int bus, -			unsigned int devfn, int reg, int len, u32 val); +int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn, +		 int reg, int len, u32 *val); +int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn, +		  int reg, int len, u32 val);  struct pci_bus_region {  	resource_size_t start; @@ -658,7 +674,7 @@ struct pci_driver {  /* these external functions are only available when PCI support is enabled */  #ifdef CONFIG_PCI -extern void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss); +void pcie_bus_configure_settings(struct pci_bus *bus, u8 smpss);  enum pcie_bus_config_types {  	PCIE_BUS_TUNE_OFF, @@ -675,9 +691,11 @@ extern struct bus_type pci_bus_type;   * code, or pci core code. */  extern struct list_head pci_root_buses;	/* list of all known PCI buses */  /* Some device drivers need know if pci is initiated */ -extern int no_pci_devices(void); +int no_pci_devices(void);  void pcibios_resource_survey_bus(struct pci_bus *bus); +void pcibios_add_bus(struct pci_bus *bus); +void pcibios_remove_bus(struct pci_bus *bus);  void pcibios_fixup_bus(struct pci_bus *);  int __must_check pcibios_enable_device(struct pci_dev *, int mask);  /* Architecture specific versions may override this (weak) */ @@ -699,7 +717,7 @@ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,  void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,  			     struct pci_bus_region *region);  void pcibios_scan_specific_bus(int busn); -extern struct pci_bus *pci_find_bus(int domain, int busnr); +struct pci_bus *pci_find_bus(int domain, int busnr);  void pci_bus_add_devices(const struct pci_bus *bus);  struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,  				      struct pci_ops *ops, void *sysdata); @@ -732,14 +750,14 @@ struct resource *pci_find_parent_resource(const struct pci_dev *dev,  u8 pci_swizzle_interrupt_pin(const struct pci_dev *dev, u8 pin);  int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);  u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp); -extern struct pci_dev *pci_dev_get(struct pci_dev *dev); -extern void pci_dev_put(struct pci_dev *dev); -extern void pci_remove_bus(struct pci_bus *b); -extern void pci_stop_and_remove_bus_device(struct pci_dev *dev); +struct pci_dev *pci_dev_get(struct pci_dev *dev); +void pci_dev_put(struct pci_dev *dev); +void pci_remove_bus(struct pci_bus *b); +void pci_stop_and_remove_bus_device(struct pci_dev *dev);  void pci_stop_root_bus(struct pci_bus *bus);  void pci_remove_root_bus(struct pci_bus *bus);  void pci_setup_cardbus(struct pci_bus *bus); -extern void pci_sort_breadthfirst(void); +void pci_sort_breadthfirst(void);  #define dev_is_pci(d) ((d)->bus == &pci_bus_type)  #define dev_is_pf(d) ((dev_is_pci(d) ? to_pci_dev(d)->is_physfn : false))  #define dev_num_vf(d) ((dev_is_pci(d) ? pci_num_vf(to_pci_dev(d)) : 0)) @@ -916,6 +934,7 @@ void pci_disable_rom(struct pci_dev *pdev);  void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);  void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);  size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size); +void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size);  /* Power management related routines */  int pci_save_state(struct pci_dev *dev); @@ -1141,18 +1160,17 @@ static inline int pci_msi_enabled(void)  	return 0;  }  #else -extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); -extern int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec); -extern void pci_msi_shutdown(struct pci_dev *dev); -extern void pci_disable_msi(struct pci_dev *dev); -extern int pci_msix_table_size(struct pci_dev *dev); -extern int pci_enable_msix(struct pci_dev *dev, -	struct msix_entry *entries, int nvec); -extern void pci_msix_shutdown(struct pci_dev *dev); -extern void pci_disable_msix(struct pci_dev *dev); -extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); -extern void pci_restore_msi_state(struct pci_dev *dev); -extern int pci_msi_enabled(void); +int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); +int pci_enable_msi_block_auto(struct pci_dev *dev, unsigned int *maxvec); +void pci_msi_shutdown(struct pci_dev *dev); +void pci_disable_msi(struct pci_dev *dev); +int pci_msix_table_size(struct pci_dev *dev); +int pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, int nvec); +void pci_msix_shutdown(struct pci_dev *dev); +void pci_disable_msix(struct pci_dev *dev); +void msi_remove_pci_irq_vectors(struct pci_dev *dev); +void pci_restore_msi_state(struct pci_dev *dev); +int pci_msi_enabled(void);  #endif  #ifdef CONFIG_PCIEPORTBUS @@ -1167,8 +1185,8 @@ extern bool pcie_ports_auto;  static inline int pcie_aspm_enabled(void) { return 0; }  static inline bool pcie_aspm_support_enabled(void) { return false; }  #else -extern int pcie_aspm_enabled(void); -extern bool pcie_aspm_support_enabled(void); +int pcie_aspm_enabled(void); +bool pcie_aspm_support_enabled(void);  #endif  #ifdef CONFIG_PCIEAER @@ -1186,8 +1204,8 @@ static inline void pcie_set_ecrc_checking(struct pci_dev *dev)  }  static inline void pcie_ecrc_get_policy(char *str) {};  #else -extern void pcie_set_ecrc_checking(struct pci_dev *dev); -extern void pcie_ecrc_get_policy(char *str); +void pcie_set_ecrc_checking(struct pci_dev *dev); +void pcie_ecrc_get_policy(char *str);  #endif  #define pci_enable_msi(pdev)	pci_enable_msi_block(pdev, 1) @@ -1198,9 +1216,9 @@ int  ht_create_irq(struct pci_dev *dev, int idx);  void ht_destroy_irq(unsigned int irq);  #endif /* CONFIG_HT_IRQ */ -extern void pci_cfg_access_lock(struct pci_dev *dev); -extern bool pci_cfg_access_trylock(struct pci_dev *dev); -extern void pci_cfg_access_unlock(struct pci_dev *dev); +void pci_cfg_access_lock(struct pci_dev *dev); +bool pci_cfg_access_trylock(struct pci_dev *dev); +void pci_cfg_access_unlock(struct pci_dev *dev);  /*   * PCI domain support.  Sometimes called PCI segment (eg by ACPI), @@ -1225,7 +1243,7 @@ static inline int pci_proc_domain(struct pci_bus *bus)  /* some architectures require additional setup to direct VGA traffic */  typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,  		      unsigned int command_bits, u32 flags); -extern void pci_register_set_vga_state(arch_set_vga_state_t func); +void pci_register_set_vga_state(arch_set_vga_state_t func);  #else /* CONFIG_PCI is not enabled */ @@ -1627,8 +1645,8 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev,  int pcibios_add_device(struct pci_dev *dev);  #ifdef CONFIG_PCI_MMCONFIG -extern void __init pci_mmcfg_early_init(void); -extern void __init pci_mmcfg_late_init(void); +void __init pci_mmcfg_early_init(void); +void __init pci_mmcfg_late_init(void);  #else  static inline void pci_mmcfg_early_init(void) { }  static inline void pci_mmcfg_late_init(void) { } @@ -1639,12 +1657,13 @@ int pci_ext_cfg_avail(void);  void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);  #ifdef CONFIG_PCI_IOV -extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); -extern void pci_disable_sriov(struct pci_dev *dev); -extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); -extern int pci_num_vf(struct pci_dev *dev); -extern int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); -extern int pci_sriov_get_totalvfs(struct pci_dev *dev); +int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); +void pci_disable_sriov(struct pci_dev *dev); +irqreturn_t pci_sriov_migration(struct pci_dev *dev); +int pci_num_vf(struct pci_dev *dev); +int pci_vfs_assigned(struct pci_dev *dev); +int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); +int pci_sriov_get_totalvfs(struct pci_dev *dev);  #else  static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)  { @@ -1661,6 +1680,10 @@ static inline int pci_num_vf(struct pci_dev *dev)  {  	return 0;  } +static inline int pci_vfs_assigned(struct pci_dev *dev) +{ +	return 0; +}  static inline int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)  {  	return 0; @@ -1672,8 +1695,8 @@ static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)  #endif  #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) -extern void pci_hp_create_module_link(struct pci_slot *pci_slot); -extern void pci_hp_remove_module_link(struct pci_slot *pci_slot); +void pci_hp_create_module_link(struct pci_slot *pci_slot); +void pci_hp_remove_module_link(struct pci_slot *pci_slot);  #endif  /** @@ -1817,13 +1840,13 @@ int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,  /* PCI <-> OF binding helpers */  #ifdef CONFIG_OF  struct device_node; -extern void pci_set_of_node(struct pci_dev *dev); -extern void pci_release_of_node(struct pci_dev *dev); -extern void pci_set_bus_of_node(struct pci_bus *bus); -extern void pci_release_bus_of_node(struct pci_bus *bus); +void pci_set_of_node(struct pci_dev *dev); +void pci_release_of_node(struct pci_dev *dev); +void pci_set_bus_of_node(struct pci_bus *bus); +void pci_release_bus_of_node(struct pci_bus *bus);  /* Arch may override this (weak) */ -extern struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus); +struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus);  static inline struct device_node *  pci_device_to_OF_node(const struct pci_dev *pdev) diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index 45fc162cbdc..8db71dcd633 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h @@ -125,12 +125,12 @@ static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)  	return pci_slot_name(slot->pci_slot);  } -extern int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, -			     int nr, const char *name, -			     struct module *owner, const char *mod_name); -extern int pci_hp_deregister(struct hotplug_slot *slot); -extern int __must_check pci_hp_change_slot_info	(struct hotplug_slot *slot, -						 struct hotplug_slot_info *info); +int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus, int nr, +		      const char *name, struct module *owner, +		      const char *mod_name); +int pci_hp_deregister(struct hotplug_slot *slot); +int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot, +					 struct hotplug_slot_info *info);  /* use a define to avoid include chaining to get THIS_MODULE & friends */  #define pci_hp_register(slot, pbus, devnr, name) \ diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index f11c1c2609d..2b85c521f73 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -524,6 +524,8 @@  #define PCI_DEVICE_ID_AMD_15H_NB_F3	0x1603  #define PCI_DEVICE_ID_AMD_15H_NB_F4	0x1604  #define PCI_DEVICE_ID_AMD_15H_NB_F5	0x1605 +#define PCI_DEVICE_ID_AMD_16H_NB_F3	0x1533 +#define PCI_DEVICE_ID_AMD_16H_NB_F4	0x1534  #define PCI_DEVICE_ID_AMD_CNB17H_F3	0x1703  #define PCI_DEVICE_ID_AMD_LANCE		0x2000  #define PCI_DEVICE_ID_AMD_LANCE_HOME	0x2001 @@ -1604,6 +1606,7 @@  #define PCI_SUBDEVICE_ID_KEYSPAN_SX2	0x5334  #define PCI_VENDOR_ID_MARVELL		0x11ab +#define PCI_VENDOR_ID_MARVELL_EXT	0x1b4b  #define PCI_DEVICE_ID_MARVELL_GT64111	0x4146  #define PCI_DEVICE_ID_MARVELL_GT64260	0x6430  #define PCI_DEVICE_ID_MARVELL_MV64360	0x6460 diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h index e6f91b1406d..9572669eea9 100644 --- a/include/linux/pcieport_if.h +++ b/include/linux/pcieport_if.h @@ -62,7 +62,7 @@ struct pcie_port_service_driver {  #define to_service_driver(d) \  	container_of(d, struct pcie_port_service_driver, driver) -extern int pcie_port_service_register(struct pcie_port_service_driver *new); -extern void pcie_port_service_unregister(struct pcie_port_service_driver *new); +int pcie_port_service_register(struct pcie_port_service_driver *new); +void pcie_port_service_unregister(struct pcie_port_service_driver *new);  #endif /* _PCIEPORT_IF_H_ */ diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 1d795df6f4c..e0373d26c24 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -21,7 +21,6 @@   */  #ifdef CONFIG_PERF_EVENTS -# include <linux/cgroup.h>  # include <asm/perf_event.h>  # include <asm/local64.h>  #endif @@ -128,6 +127,7 @@ struct hw_perf_event {  			int		event_base_rdpmc;  			int		idx;  			int		last_cpu; +			int		flags;  			struct hw_perf_event_extra extra_reg;  			struct hw_perf_event_extra branch_reg; @@ -299,22 +299,7 @@ struct swevent_hlist {  #define PERF_ATTACH_GROUP	0x02  #define PERF_ATTACH_TASK	0x04 -#ifdef CONFIG_CGROUP_PERF -/* - * perf_cgroup_info keeps track of time_enabled for a cgroup. - * This is a per-cpu dynamically allocated data structure. - */ -struct perf_cgroup_info { -	u64				time; -	u64				timestamp; -}; - -struct perf_cgroup { -	struct				cgroup_subsys_state css; -	struct				perf_cgroup_info *info;	/* timing info, one per cpu */ -}; -#endif - +struct perf_cgroup;  struct ring_buffer;  /** @@ -583,11 +568,13 @@ struct perf_sample_data {  		u32	reserved;  	}				cpu_entry;  	u64				period; +	union  perf_mem_data_src	data_src;  	struct perf_callchain_entry	*callchain;  	struct perf_raw_record		*raw;  	struct perf_branch_stack	*br_stack;  	struct perf_regs_user		regs_user;  	u64				stack_user_size; +	u64				weight;  };  static inline void perf_sample_data_init(struct perf_sample_data *data, @@ -601,6 +588,8 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,  	data->regs_user.abi = PERF_SAMPLE_REGS_ABI_NONE;  	data->regs_user.regs = NULL;  	data->stack_user_size = 0; +	data->weight = 0; +	data->data_src.val = 0;  }  extern void perf_output_sample(struct perf_output_handle *handle, @@ -831,6 +820,7 @@ do {									\  struct perf_pmu_events_attr {  	struct device_attribute attr;  	u64 id; +	const char *event_str;  };  #define PMU_EVENT_ATTR(_name, _var, _id, _show)				\ diff --git a/include/linux/phy.h b/include/linux/phy.h index 33999adbf8c..9e11039dd7a 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -455,6 +455,14 @@ struct phy_driver {  	 */  	void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); +	/* Some devices (e.g. qnap TS-119P II) require PHY register changes to +	 * enable Wake on LAN, so set_wol is provided to be called in the +	 * ethernet driver's set_wol function. */ +	int (*set_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); + +	/* See set_wol, but for checking whether Wake on LAN is enabled. */ +	void (*get_wol)(struct phy_device *dev, struct ethtool_wolinfo *wol); +  	struct device_driver driver;  };  #define to_phy_driver(d) container_of(d, struct phy_driver, driver) @@ -560,6 +568,8 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable);  int phy_get_eee_err(struct phy_device *phydev);  int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data);  int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_eee *data); +int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol); +void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol);  int __init mdio_bus_init(void);  void mdio_bus_exit(void); diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index 215e5e3dda1..731e4ecee3b 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h @@ -13,7 +13,9 @@ struct pidmap {         void *page;  }; -#define PIDMAP_ENTRIES         ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8) +#define BITS_PER_PAGE		(PAGE_SIZE * 8) +#define BITS_PER_PAGE_MASK	(BITS_PER_PAGE-1) +#define PIDMAP_ENTRIES		((PID_MAX_LIMIT+BITS_PER_PAGE-1)/BITS_PER_PAGE)  struct bsd_acct_struct; @@ -28,6 +30,7 @@ struct pid_namespace {  	struct pid_namespace *parent;  #ifdef CONFIG_PROC_FS  	struct vfsmount *proc_mnt; +	struct dentry *proc_self;  #endif  #ifdef CONFIG_BSD_PROCESS_ACCT  	struct bsd_acct_struct *bacct; diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h index e7a720104a4..1ad4f31ef6b 100644 --- a/include/linux/pinctrl/pinconf.h +++ b/include/linux/pinctrl/pinconf.h @@ -14,6 +14,8 @@  #ifdef CONFIG_PINCONF +#include <linux/pinctrl/machine.h> +  struct pinctrl_dev;  struct seq_file; @@ -28,6 +30,7 @@ struct seq_file;   * @pin_config_set: configure an individual pin   * @pin_config_group_get: get configurations for an entire pin group   * @pin_config_group_set: configure all pins in a group + * @pin_config_group_dbg_set: optional debugfs to modify a pin configuration   * @pin_config_dbg_show: optional debugfs display hook that will provide   *	per-device info for a certain pin in debugfs   * @pin_config_group_dbg_show: optional debugfs display hook that will provide @@ -51,6 +54,9 @@ struct pinconf_ops {  	int (*pin_config_group_set) (struct pinctrl_dev *pctldev,  				     unsigned selector,  				     unsigned long config); +	int (*pin_config_dbg_parse_modify) (struct pinctrl_dev *pctldev, +					   const char *arg, +					   unsigned long *config);  	void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev,  				     struct seq_file *s,  				     unsigned offset); diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index 778804df293..2c2a9e8d857 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h @@ -118,9 +118,9 @@ struct pinctrl_desc {  	const char *name;  	struct pinctrl_pin_desc const *pins;  	unsigned int npins; -	struct pinctrl_ops *pctlops; -	struct pinmux_ops *pmxops; -	struct pinconf_ops *confops; +	const struct pinctrl_ops *pctlops; +	const struct pinmux_ops *pmxops; +	const struct pinconf_ops *confops;  	struct module *owner;  }; diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h index ad1a427b526..b8809fef61f 100644 --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h @@ -27,6 +27,7 @@ struct pipe_buffer {  /**   *	struct pipe_inode_info - a linux kernel pipe + *	@mutex: mutex protecting the whole thing   *	@wait: reader/writer wait point in case of empty/full pipe   *	@nrbufs: the number of non-empty pipe buffers in this pipe   *	@buffers: total number of buffers (should be a power of 2) @@ -34,26 +35,27 @@ struct pipe_buffer {   *	@tmp_page: cached released page   *	@readers: number of current readers of this pipe   *	@writers: number of current writers of this pipe + *	@files: number of struct file refering this pipe (protected by ->i_lock)   *	@waiting_writers: number of writers blocked waiting for room   *	@r_counter: reader counter   *	@w_counter: writer counter   *	@fasync_readers: reader side fasync   *	@fasync_writers: writer side fasync - *	@inode: inode this pipe is attached to   *	@bufs: the circular array of pipe buffers   **/  struct pipe_inode_info { +	struct mutex mutex;  	wait_queue_head_t wait;  	unsigned int nrbufs, curbuf, buffers;  	unsigned int readers;  	unsigned int writers; +	unsigned int files;  	unsigned int waiting_writers;  	unsigned int r_counter;  	unsigned int w_counter;  	struct page *tmp_page;  	struct fasync_struct *fasync_readers;  	struct fasync_struct *fasync_writers; -	struct inode *inode;  	struct pipe_buffer *bufs;  }; @@ -144,9 +146,8 @@ int pipe_proc_fn(struct ctl_table *, int, void __user *, size_t *, loff_t *);  /* Drop the inode semaphore and wait for a pipe event, atomically */  void pipe_wait(struct pipe_inode_info *pipe); -struct pipe_inode_info * alloc_pipe_info(struct inode * inode); -void free_pipe_info(struct inode * inode); -void __free_pipe_info(struct pipe_inode_info *); +struct pipe_inode_info *alloc_pipe_info(void); +void free_pipe_info(struct pipe_inode_info *);  /* Generic pipe buffer ops functions */  void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int); diff --git a/include/linux/platform_data/brcmfmac-sdio.h b/include/linux/platform_data/brcmfmac-sdio.h new file mode 100644 index 00000000000..1ade657d5fc --- /dev/null +++ b/include/linux/platform_data/brcmfmac-sdio.h @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2013 Broadcom Corporation + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LINUX_BRCMFMAC_PLATFORM_H +#define _LINUX_BRCMFMAC_PLATFORM_H + +/* + * Platform specific driver functions and data. Through the platform specific + * device data functions can be provided to help the brcmfmac driver to + * operate with the device in combination with the used platform. + * + * Use the platform data in the following (similar) way: + * + * +#include <brcmfmac_platform.h> + + +static void brcmfmac_power_on(void) +{ +} + +static void brcmfmac_power_off(void) +{ +} + +static void brcmfmac_reset(void) +{ +} + +static struct brcmfmac_sdio_platform_data brcmfmac_sdio_pdata = { +	.power_on		= brcmfmac_power_on, +	.power_off		= brcmfmac_power_off, +	.reset			= brcmfmac_reset +}; + +static struct platform_device brcmfmac_device = { +	.name			= BRCMFMAC_SDIO_PDATA_NAME, +	.id			= PLATFORM_DEVID_NONE, +	.dev.platform_data	= &brcmfmac_sdio_pdata +}; + +void __init brcmfmac_init_pdata(void) +{ +	brcmfmac_sdio_pdata.oob_irq_supported = true; +	brcmfmac_sdio_pdata.oob_irq_nr = gpio_to_irq(GPIO_BRCMF_SDIO_OOB); +	brcmfmac_sdio_pdata.oob_irq_flags = IORESOURCE_IRQ | +					    IORESOURCE_IRQ_HIGHLEVEL; +	platform_device_register(&brcmfmac_device); +} + * + * + * Note: the brcmfmac can be loaded as module or be statically built-in into + * the kernel. If built-in then do note that it uses module_init (and + * module_exit) routines which equal device_initcall. So if you intend to + * create a module with the platform specific data for the brcmfmac and have + * it built-in to the kernel then use a higher initcall then device_initcall + * (see init.h). If this is not done then brcmfmac will load without problems + * but will not pickup the platform data. + * + * When the driver does not "detect" platform driver data then it will continue + * without reporting anything and just assume there is no data needed. Which is + * probably true for most platforms. + * + * Explanation of the platform_data fields: + * + * drive_strength: is the preferred drive_strength to be used for the SDIO + * pins. If 0 then a default value will be used. This is the target drive + * strength, the exact drive strength which will be used depends on the + * capabilities of the device. + * + * oob_irq_supported: does the board have support for OOB interrupts. SDIO + * in-band interrupts are relatively slow and for having less overhead on + * interrupt processing an out of band interrupt can be used. If the HW + * supports this then enable this by setting this field to true and configure + * the oob related fields. + * + * oob_irq_nr, oob_irq_flags: the OOB interrupt information. The values are + * used for registering the irq using request_irq function. + * + * power_on: This function is called by the brcmfmac when the module gets + * loaded. This can be particularly useful for low power devices. The platform + * spcific routine may for example decide to power up the complete device. + * If there is no use-case for this function then provide NULL. + * + * power_off: This function is called by the brcmfmac when the module gets + * unloaded. At this point the device can be powered down or otherwise be reset. + * So if an actual power_off is not supported but reset is then reset the device + * when this function gets called. This can be particularly useful for low power + * devices. If there is no use-case for this function (either power-down or + * reset) then provide NULL. + * + * reset: This function can get called if the device communication broke down. + * This functionality is particularly useful in case of SDIO type devices. It is + * possible to reset a dongle via sdio data interface, but it requires that + * this is fully functional. This function is chip/module specific and this + * function should return only after the complete reset has completed. + */ + +#define BRCMFMAC_SDIO_PDATA_NAME	"brcmfmac_sdio" + +struct brcmfmac_sdio_platform_data { +	unsigned int drive_strength; +	bool oob_irq_supported; +	unsigned int oob_irq_nr; +	unsigned long oob_irq_flags; +	void (*power_on)(void); +	void (*power_off)(void); +	void (*reset)(void); +}; + +#endif /* _LINUX_BRCMFMAC_PLATFORM_H */ diff --git a/include/linux/platform_data/clk-lpss.h b/include/linux/platform_data/clk-lpss.h new file mode 100644 index 00000000000..528e73ce46d --- /dev/null +++ b/include/linux/platform_data/clk-lpss.h @@ -0,0 +1,18 @@ +/* + * Intel Low Power Subsystem clocks. + * + * Copyright (C) 2013, Intel Corporation + * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> + *          Rafael J. Wysocki <rafael.j.wysocki@intel.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __CLK_LPSS_H +#define __CLK_LPSS_H + +extern int lpt_clk_init(void); + +#endif /* __CLK_LPSS_H */ diff --git a/include/linux/platform_data/coda.h b/include/linux/platform_data/coda.h new file mode 100644 index 00000000000..6ad4410d9e2 --- /dev/null +++ b/include/linux/platform_data/coda.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2013 Philipp Zabel, Pengutronix + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ +#ifndef PLATFORM_CODA_H +#define PLATFORM_CODA_H + +struct device; + +struct coda_platform_data { +	struct device *iram_dev; +}; + +#endif diff --git a/include/linux/platform_data/cpsw.h b/include/linux/platform_data/cpsw.h index 798fb80b024..bb3cd58d71e 100644 --- a/include/linux/platform_data/cpsw.h +++ b/include/linux/platform_data/cpsw.h @@ -30,7 +30,7 @@ struct cpsw_platform_data {  	u32	channels;	/* number of cpdma channels (symmetric) */  	u32	slaves;		/* number of slave cpgmac ports */  	struct cpsw_slave_data	*slave_data; -	u32	cpts_active_slave; /* time stamping slave */ +	u32	active_slave; /* time stamping, ethtool and SIOCGMIIPHY slave */  	u32	cpts_clock_mult;  /* convert input clock ticks to nanoseconds */  	u32	cpts_clock_shift; /* convert input clock ticks to nanoseconds */  	u32	ale_entries;	/* ale table size */ diff --git a/include/linux/platform_data/dwc3-omap.h b/include/linux/platform_data/dwc3-omap.h index ada401244e0..1d36ca874cc 100644 --- a/include/linux/platform_data/dwc3-omap.h +++ b/include/linux/platform_data/dwc3-omap.h @@ -41,7 +41,3 @@ enum dwc3_omap_utmi_mode {  	DWC3_OMAP_UTMI_MODE_HW,  	DWC3_OMAP_UTMI_MODE_SW,  }; - -struct dwc3_omap_data { -	enum dwc3_omap_utmi_mode	utmi_mode; -}; diff --git a/include/linux/platform_data/emif_plat.h b/include/linux/platform_data/emif_plat.h index 03378ca8406..5c19a2a647c 100644 --- a/include/linux/platform_data/emif_plat.h +++ b/include/linux/platform_data/emif_plat.h @@ -40,6 +40,7 @@  /* Custom config requests */  #define EMIF_CUSTOM_CONFIG_LPMODE			0x00000001  #define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL	0x00000002 +#define EMIF_CUSTOM_CONFIG_EXTENDED_TEMP_PART		0x00000004  #ifndef __ASSEMBLY__  /** diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h index 20ee8b221db..ea3200527dd 100644 --- a/include/linux/platform_data/lp855x.h +++ b/include/linux/platform_data/lp855x.h @@ -69,11 +69,6 @@ enum lp855x_chip_id {  	LP8557,  }; -enum lp855x_brightness_ctrl_mode { -	PWM_BASED = 1, -	REGISTER_BASED, -}; -  enum lp8550_brighntess_source {  	LP8550_PWM_ONLY,  	LP8550_I2C_ONLY = 2, @@ -116,24 +111,18 @@ struct lp855x_rom_data {  /**   * struct lp855x_platform_data   * @name : Backlight driver name. If it is not defined, default name is set. - * @mode : brightness control by pwm or lp855x register   * @device_control : value of DEVICE CONTROL register   * @initial_brightness : initial value of backlight brightness   * @period_ns : platform specific pwm period value. unit is nano.  		Only valid when mode is PWM_BASED. - * @load_new_rom_data : -	0 : use default configuration data -	1 : update values of eeprom or eprom registers on loading driver   * @size_program : total size of lp855x_rom_data   * @rom_data : list of new eeprom/eprom registers   */  struct lp855x_platform_data { -	char *name; -	enum lp855x_brightness_ctrl_mode mode; +	const char *name;  	u8 device_control; -	int initial_brightness; +	u8 initial_brightness;  	unsigned int period_ns; -	u8 load_new_rom_data;  	int size_program;  	struct lp855x_rom_data *rom_data;  }; diff --git a/include/linux/platform_data/mv_usb.h b/include/linux/platform_data/mv_usb.h index 944b01dd103..98b7925f1a2 100644 --- a/include/linux/platform_data/mv_usb.h +++ b/include/linux/platform_data/mv_usb.h @@ -34,8 +34,6 @@ struct mv_usb_addon_irq {  };  struct mv_usb_platform_data { -	unsigned int		clknum; -	char			**clkname;  	struct mv_usb_addon_irq	*id;	/* Only valid for OTG. ID pin change*/  	struct mv_usb_addon_irq	*vbus;	/* valid for OTG/UDC. VBUS change*/ diff --git a/include/linux/platform_data/ntc_thermistor.h b/include/linux/platform_data/ntc_thermistor.h index 88734e871e3..c7285b57546 100644 --- a/include/linux/platform_data/ntc_thermistor.h +++ b/include/linux/platform_data/ntc_thermistor.h @@ -21,6 +21,8 @@  #ifndef _LINUX_NTC_H  #define _LINUX_NTC_H +struct iio_channel; +  enum ntc_thermistor_type {  	TYPE_NCPXXWB473,  	TYPE_NCPXXWL333, @@ -39,13 +41,17 @@ struct ntc_thermistor_platform_data {  	 * described at Documentation/hwmon/ntc_thermistor  	 *  	 * pullup/down_ohm: 0 for infinite / not-connected +	 * +	 * chan: iio_channel pointer to communicate with the ADC which the +	 * thermistor is using for conversion of the analog values.  	 */ -	int (*read_uV)(void); -	unsigned int pullup_uV; +	int (*read_uv)(struct ntc_thermistor_platform_data *); +	unsigned int pullup_uv;  	unsigned int pullup_ohm;  	unsigned int pulldown_ohm;  	enum { NTC_CONNECTED_POSITIVE, NTC_CONNECTED_GROUND } connect; +	struct iio_channel *chan;  	int (*read_ohm)(void);  }; diff --git a/include/linux/platform_data/serial-sccnxp.h b/include/linux/platform_data/serial-sccnxp.h index 215574d1e81..bdc510d0324 100644 --- a/include/linux/platform_data/serial-sccnxp.h +++ b/include/linux/platform_data/serial-sccnxp.h @@ -86,10 +86,6 @@ struct sccnxp_pdata {  	const u32		mctrl_cfg[SCCNXP_MAX_UARTS];  	/* Timer value for polling mode (usecs) */  	const unsigned int	poll_time_us; -	/* Called during startup */ -	void (*init)(void); -	/* Called before finish */ -	void (*exit)(void);  };  #endif diff --git a/include/linux/platform_data/si5351.h b/include/linux/platform_data/si5351.h new file mode 100644 index 00000000000..92dabcaf649 --- /dev/null +++ b/include/linux/platform_data/si5351.h @@ -0,0 +1,114 @@ +/* + * Si5351A/B/C programmable clock generator platform_data. + */ + +#ifndef __LINUX_PLATFORM_DATA_SI5351_H__ +#define __LINUX_PLATFORM_DATA_SI5351_H__ + +struct clk; + +/** + * enum si5351_variant - SiLabs Si5351 chip variant + * @SI5351_VARIANT_A: Si5351A (8 output clocks, XTAL input) + * @SI5351_VARIANT_A3: Si5351A MSOP10 (3 output clocks, XTAL input) + * @SI5351_VARIANT_B: Si5351B (8 output clocks, XTAL/VXCO input) + * @SI5351_VARIANT_C: Si5351C (8 output clocks, XTAL/CLKIN input) + */ +enum si5351_variant { +	SI5351_VARIANT_A = 1, +	SI5351_VARIANT_A3 = 2, +	SI5351_VARIANT_B = 3, +	SI5351_VARIANT_C = 4, +}; + +/** + * enum si5351_pll_src - Si5351 pll clock source + * @SI5351_PLL_SRC_DEFAULT: default, do not change eeprom config + * @SI5351_PLL_SRC_XTAL: pll source clock is XTAL input + * @SI5351_PLL_SRC_CLKIN: pll source clock is CLKIN input (Si5351C only) + */ +enum si5351_pll_src { +	SI5351_PLL_SRC_DEFAULT = 0, +	SI5351_PLL_SRC_XTAL = 1, +	SI5351_PLL_SRC_CLKIN = 2, +}; + +/** + * enum si5351_multisynth_src - Si5351 multisynth clock source + * @SI5351_MULTISYNTH_SRC_DEFAULT: default, do not change eeprom config + * @SI5351_MULTISYNTH_SRC_VCO0: multisynth source clock is VCO0 + * @SI5351_MULTISYNTH_SRC_VCO1: multisynth source clock is VCO1/VXCO + */ +enum si5351_multisynth_src { +	SI5351_MULTISYNTH_SRC_DEFAULT = 0, +	SI5351_MULTISYNTH_SRC_VCO0 = 1, +	SI5351_MULTISYNTH_SRC_VCO1 = 2, +}; + +/** + * enum si5351_clkout_src - Si5351 clock output clock source + * @SI5351_CLKOUT_SRC_DEFAULT: default, do not change eeprom config + * @SI5351_CLKOUT_SRC_MSYNTH_N: clkout N source clock is multisynth N + * @SI5351_CLKOUT_SRC_MSYNTH_0_4: clkout N source clock is multisynth 0 (N<4) + *                                or 4 (N>=4) + * @SI5351_CLKOUT_SRC_XTAL: clkout N source clock is XTAL + * @SI5351_CLKOUT_SRC_CLKIN: clkout N source clock is CLKIN (Si5351C only) + */ +enum si5351_clkout_src { +	SI5351_CLKOUT_SRC_DEFAULT = 0, +	SI5351_CLKOUT_SRC_MSYNTH_N = 1, +	SI5351_CLKOUT_SRC_MSYNTH_0_4 = 2, +	SI5351_CLKOUT_SRC_XTAL = 3, +	SI5351_CLKOUT_SRC_CLKIN = 4, +}; + +/** + * enum si5351_drive_strength - Si5351 clock output drive strength + * @SI5351_DRIVE_DEFAULT: default, do not change eeprom config + * @SI5351_DRIVE_2MA: 2mA clock output drive strength + * @SI5351_DRIVE_4MA: 4mA clock output drive strength + * @SI5351_DRIVE_6MA: 6mA clock output drive strength + * @SI5351_DRIVE_8MA: 8mA clock output drive strength + */ +enum si5351_drive_strength { +	SI5351_DRIVE_DEFAULT = 0, +	SI5351_DRIVE_2MA = 2, +	SI5351_DRIVE_4MA = 4, +	SI5351_DRIVE_6MA = 6, +	SI5351_DRIVE_8MA = 8, +}; + +/** + * struct si5351_clkout_config - Si5351 clock output configuration + * @clkout: clkout number + * @multisynth_src: multisynth source clock + * @clkout_src: clkout source clock + * @pll_master: if true, clkout can also change pll rate + * @drive: output drive strength + * @rate: initial clkout rate, or default if 0 + */ +struct si5351_clkout_config { +	enum si5351_multisynth_src multisynth_src; +	enum si5351_clkout_src clkout_src; +	enum si5351_drive_strength drive; +	bool pll_master; +	unsigned long rate; +}; + +/** + * struct si5351_platform_data - Platform data for the Si5351 clock driver + * @variant: Si5351 chip variant + * @clk_xtal: xtal input clock + * @clk_clkin: clkin input clock + * @pll_src: array of pll source clock setting + * @clkout: array of clkout configuration + */ +struct si5351_platform_data { +	enum si5351_variant variant; +	struct clk *clk_xtal; +	struct clk *clk_clkin; +	enum si5351_pll_src pll_src[2]; +	struct si5351_clkout_config clkout[8]; +}; + +#endif diff --git a/include/linux/platform_data/spi-s3c64xx.h b/include/linux/platform_data/spi-s3c64xx.h index ceba18d23a5..8447f634c7f 100644 --- a/include/linux/platform_data/spi-s3c64xx.h +++ b/include/linux/platform_data/spi-s3c64xx.h @@ -11,6 +11,8 @@  #ifndef __S3C64XX_PLAT_SPI_H  #define __S3C64XX_PLAT_SPI_H +#include <linux/dmaengine.h> +  struct platform_device;  /** @@ -38,6 +40,7 @@ struct s3c64xx_spi_info {  	int src_clk_nr;  	int num_cs;  	int (*cfg_gpio)(void); +	dma_filter_fn filter;  };  /** diff --git a/include/linux/platform_data/st1232_pdata.h b/include/linux/platform_data/st1232_pdata.h new file mode 100644 index 00000000000..cac3e7b4c45 --- /dev/null +++ b/include/linux/platform_data/st1232_pdata.h @@ -0,0 +1,13 @@ +#ifndef _LINUX_ST1232_PDATA_H +#define _LINUX_ST1232_PDATA_H + +/* + * Optional platform data + * + * Use this if you want the driver to drive the reset pin. + */ +struct st1232_pdata { +	int reset_gpio; +}; + +#endif diff --git a/include/linux/platform_data/usb-exynos.h b/include/linux/platform_data/usb-ohci-exynos.h index c256c595be5..c256c595be5 100644 --- a/include/linux/platform_data/usb-exynos.h +++ b/include/linux/platform_data/usb-ohci-exynos.h diff --git a/include/linux/platform_data/video-vt8500lcdfb.h b/include/linux/platform_data/video-vt8500lcdfb.h deleted file mode 100644 index 7f399c370fe..00000000000 --- a/include/linux/platform_data/video-vt8500lcdfb.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - *  VT8500/WM8505 Frame Buffer platform data definitions - * - *  Copyright (C) 2010 Ed Spiridonov <edo.rus@gmail.com> - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - */ - -#ifndef _VT8500FB_H -#define _VT8500FB_H - -#include <linux/fb.h> - -struct vt8500fb_platform_data { -	struct fb_videomode	mode; -	u32			xres_virtual; -	u32			yres_virtual; -	u32			bpp; -	unsigned long		video_mem_phys; -	void			*video_mem_virt; -	unsigned long		video_mem_len; -}; - -#endif /* _VT8500FB_H */ diff --git a/include/linux/platform_data/video_s3c.h b/include/linux/platform_data/video_s3c.h new file mode 100644 index 00000000000..48883995f47 --- /dev/null +++ b/include/linux/platform_data/video_s3c.h @@ -0,0 +1,54 @@ +#ifndef __PLATFORM_DATA_VIDEO_S3C +#define __PLATFORM_DATA_VIDEO_S3C + +/* S3C_FB_MAX_WIN + * Set to the maximum number of windows that any of the supported hardware + * can use. Since the platform data uses this for an array size, having it + * set to the maximum of any version of the hardware can do is safe. + */ +#define S3C_FB_MAX_WIN	(5) + +/** + * struct s3c_fb_pd_win - per window setup data + * @xres     : The window X size. + * @yres     : The window Y size. + * @virtual_x: The virtual X size. + * @virtual_y: The virtual Y size. + */ +struct s3c_fb_pd_win { +	unsigned short		default_bpp; +	unsigned short		max_bpp; +	unsigned short		xres; +	unsigned short		yres; +	unsigned short		virtual_x; +	unsigned short		virtual_y; +}; + +/** + * struct s3c_fb_platdata -  S3C driver platform specific information + * @setup_gpio: Setup the external GPIO pins to the right state to transfer + *		the data from the display system to the connected display + *		device. + * @vidcon0: The base vidcon0 values to control the panel data format. + * @vidcon1: The base vidcon1 values to control the panel data output. + * @vtiming: Video timing when connected to a RGB type panel. + * @win: The setup data for each hardware window, or NULL for unused. + * @display_mode: The LCD output display mode. + * + * The platform data supplies the video driver with all the information + * it requires to work with the display(s) attached to the machine. It + * controls the initial mode, the number of display windows (0 is always + * the base framebuffer) that are initialised etc. + * + */ +struct s3c_fb_platdata { +	void	(*setup_gpio)(void); + +	struct s3c_fb_pd_win	*win[S3C_FB_MAX_WIN]; +	struct fb_videomode     *vtiming; + +	u32			 vidcon0; +	u32			 vidcon1; +}; + +#endif diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index c082c71f722..9abf1db6aea 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -20,12 +20,12 @@  struct mfd_cell;  struct platform_device { -	const char	* name; +	const char	*name;  	int		id;  	bool		id_auto;  	struct device	dev;  	u32		num_resources; -	struct resource	* resource; +	struct resource	*resource;  	const struct platform_device_id	*id_entry; @@ -47,9 +47,12 @@ extern struct bus_type platform_bus_type;  extern struct device platform_bus;  extern void arch_setup_pdev_archdata(struct platform_device *); -extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); +extern struct resource *platform_get_resource(struct platform_device *, +					      unsigned int, unsigned int);  extern int platform_get_irq(struct platform_device *, unsigned int); -extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *); +extern struct resource *platform_get_resource_byname(struct platform_device *, +						     unsigned int, +						     const char *);  extern int platform_get_irq_byname(struct platform_device *, const char *);  extern int platform_add_devices(struct platform_device **, int); @@ -161,7 +164,8 @@ extern struct platform_device *platform_device_alloc(const char *name, int id);  extern int platform_device_add_resources(struct platform_device *pdev,  					 const struct resource *res,  					 unsigned int num); -extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size); +extern int platform_device_add_data(struct platform_device *pdev, +				    const void *data, size_t size);  extern int platform_device_add(struct platform_device *pdev);  extern void platform_device_del(struct platform_device *pdev);  extern void platform_device_put(struct platform_device *pdev); @@ -190,7 +194,8 @@ static inline void *platform_get_drvdata(const struct platform_device *pdev)  	return dev_get_drvdata(&pdev->dev);  } -static inline void platform_set_drvdata(struct platform_device *pdev, void *data) +static inline void platform_set_drvdata(struct platform_device *pdev, +					void *data)  {  	dev_set_drvdata(&pdev->dev, data);  } @@ -222,10 +227,10 @@ static void __exit __platform_driver##_exit(void) \  } \  module_exit(__platform_driver##_exit); -extern struct platform_device *platform_create_bundle(struct platform_driver *driver, -					int (*probe)(struct platform_device *), -					struct resource *res, unsigned int n_res, -					const void *data, size_t size); +extern struct platform_device *platform_create_bundle( +	struct platform_driver *driver, int (*probe)(struct platform_device *), +	struct resource *res, unsigned int n_res, +	const void *data, size_t size);  /* early platform driver interface */  struct early_platform_driver { diff --git a/include/linux/pm2301_charger.h b/include/linux/pm2301_charger.h index fc3f026922a..85c16defe11 100644 --- a/include/linux/pm2301_charger.h +++ b/include/linux/pm2301_charger.h @@ -48,7 +48,7 @@ struct pm2xxx_charger_platform_data {  	size_t num_supplicants;  	int i2c_bus;  	const char *label; -	int irq_number; +	int gpio_irq_number;  	unsigned int lpn_gpio;  	int irq_type;  }; diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 042058fdb0a..60bac697a91 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -55,6 +55,7 @@ struct cpu_timer_list {  /* POSIX.1b interval timer structure. */  struct k_itimer {  	struct list_head list;		/* free/ allocate list */ +	struct hlist_node t_hash;  	spinlock_t it_lock;  	clockid_t it_clock;		/* which timer type */  	timer_t it_id;			/* timer id */ diff --git a/include/linux/power/ab8500.h b/include/linux/power/ab8500.h new file mode 100644 index 00000000000..cdbb6c2a8c5 --- /dev/null +++ b/include/linux/power/ab8500.h @@ -0,0 +1,16 @@ +/* + * Copyright (C) ST-Ericsson 2013 + * Author: Hongbo Zhang <hongbo.zhang@linaro.com> + * License terms: GNU General Public License v2 + */ + +#ifndef PWR_AB8500_H +#define PWR_AB8500_H + +extern const struct abx500_res_to_temp ab8500_temp_tbl_a_thermistor[]; +extern const int ab8500_temp_tbl_a_size; + +extern const struct abx500_res_to_temp ab8500_temp_tbl_b_thermistor[]; +extern const int ab8500_temp_tbl_b_size; + +#endif /* PWR_AB8500_H */ diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 002a99f9633..3828cefb4f6 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -171,6 +171,12 @@ struct power_supply {  	char **supplied_to;  	size_t num_supplicants; +	char **supplied_from; +	size_t num_supplies; +#ifdef CONFIG_OF +	struct device_node *of_node; +#endif +  	int (*get_property)(struct power_supply *psy,  			    enum power_supply_property psp,  			    union power_supply_propval *val); diff --git a/include/linux/preempt.h b/include/linux/preempt.h index 5a710b9c578..87a03c746f1 100644 --- a/include/linux/preempt.h +++ b/include/linux/preempt.h @@ -93,14 +93,20 @@ do { \  #else /* !CONFIG_PREEMPT_COUNT */ -#define preempt_disable()		do { } while (0) -#define sched_preempt_enable_no_resched()	do { } while (0) -#define preempt_enable_no_resched()	do { } while (0) -#define preempt_enable()		do { } while (0) +/* + * Even if we don't have any preemption, we need preempt disable/enable + * to be barriers, so that we don't have things like get_user/put_user + * that can cause faults and scheduling migrate into our preempt-protected + * region. + */ +#define preempt_disable()		barrier() +#define sched_preempt_enable_no_resched()	barrier() +#define preempt_enable_no_resched()	barrier() +#define preempt_enable()		barrier() -#define preempt_disable_notrace()		do { } while (0) -#define preempt_enable_no_resched_notrace()	do { } while (0) -#define preempt_enable_notrace()		do { } while (0) +#define preempt_disable_notrace()		barrier() +#define preempt_enable_no_resched_notrace()	barrier() +#define preempt_enable_notrace()		barrier()  #endif /* CONFIG_PREEMPT_COUNT */ diff --git a/include/linux/printk.h b/include/linux/printk.h index 822171fcb1c..6af944ab38f 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -1,6 +1,7 @@  #ifndef __KERNEL_PRINTK__  #define __KERNEL_PRINTK__ +#include <stdarg.h>  #include <linux/init.h>  #include <linux/kern_levels.h> @@ -95,8 +96,14 @@ int no_printk(const char *fmt, ...)  	return 0;  } +#ifdef CONFIG_EARLY_PRINTK  extern asmlinkage __printf(1, 2)  void early_printk(const char *fmt, ...); +void early_vprintk(const char *fmt, va_list ap); +#else +static inline __printf(1, 2) __cold +void early_printk(const char *s, ...) { } +#endif  #ifdef CONFIG_PRINTK  asmlinkage __printf(5, 0) @@ -138,6 +145,9 @@ extern void wake_up_klogd(void);  void log_buf_kexec_setup(void);  void __init setup_log_buf(int early); +void dump_stack_set_arch_desc(const char *fmt, ...); +void dump_stack_print_info(const char *log_lvl); +void show_regs_print_info(const char *log_lvl);  #else  static inline __printf(1, 0)  int vprintk(const char *s, va_list args) @@ -175,6 +185,18 @@ static inline void log_buf_kexec_setup(void)  static inline void setup_log_buf(int early)  {  } + +static inline void dump_stack_set_arch_desc(const char *fmt, ...) +{ +} + +static inline void dump_stack_print_info(const char *log_lvl) +{ +} + +static inline void show_regs_print_info(const char *log_lvl) +{ +}  #endif  extern void dump_stack(void) __cold; diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index 8307f2f94d8..608e60a74c3 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -1,316 +1,79 @@ -#ifndef _LINUX_PROC_FS_H -#define _LINUX_PROC_FS_H - -#include <linux/slab.h> -#include <linux/fs.h> -#include <linux/spinlock.h> -#include <linux/magic.h> -#include <linux/atomic.h> - -struct net; -struct completion; -struct mm_struct; -  /*   * The proc filesystem constants/structures   */ +#ifndef _LINUX_PROC_FS_H +#define _LINUX_PROC_FS_H -/* - * Offset of the first process in the /proc root directory.. - */ -#define FIRST_PROCESS_ENTRY 256 - -/* Worst case buffer size needed for holding an integer. */ -#define PROC_NUMBUF 13 - -/* - * We always define these enumerators - */ - -enum { -	PROC_ROOT_INO		= 1, -	PROC_IPC_INIT_INO	= 0xEFFFFFFFU, -	PROC_UTS_INIT_INO	= 0xEFFFFFFEU, -	PROC_USER_INIT_INO	= 0xEFFFFFFDU, -	PROC_PID_INIT_INO	= 0xEFFFFFFCU, -}; - -/* - * This is not completely implemented yet. The idea is to - * create an in-memory tree (like the actual /proc filesystem - * tree) of these proc_dir_entries, so that we can dynamically - * add new files to /proc. - * - * The "next" pointer creates a linked list of one /proc directory, - * while parent/subdir create the directory structure (every - * /proc file has a parent, but "subdir" is NULL for all - * non-directory entries). - */ - -typedef	int (read_proc_t)(char *page, char **start, off_t off, -			  int count, int *eof, void *data); -typedef	int (write_proc_t)(struct file *file, const char __user *buffer, -			   unsigned long count, void *data); - -struct proc_dir_entry { -	unsigned int low_ino; -	umode_t mode; -	nlink_t nlink; -	kuid_t uid; -	kgid_t gid; -	loff_t size; -	const struct inode_operations *proc_iops; -	/* -	 * NULL ->proc_fops means "PDE is going away RSN" or -	 * "PDE is just created". In either case, e.g. ->read_proc won't be -	 * called because it's too late or too early, respectively. -	 * -	 * If you're allocating ->proc_fops dynamically, save a pointer -	 * somewhere. -	 */ -	const struct file_operations *proc_fops; -	struct proc_dir_entry *next, *parent, *subdir; -	void *data; -	read_proc_t *read_proc; -	write_proc_t *write_proc; -	atomic_t count;		/* use count */ -	int pde_users;	/* number of callers into module in progress */ -	struct completion *pde_unload_completion; -	struct list_head pde_openers;	/* who did ->open, but not ->release */ -	spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ -	u8 namelen; -	char name[]; -}; - -enum kcore_type { -	KCORE_TEXT, -	KCORE_VMALLOC, -	KCORE_RAM, -	KCORE_VMEMMAP, -	KCORE_OTHER, -}; - -struct kcore_list { -	struct list_head list; -	unsigned long addr; -	size_t size; -	int type; -}; +#include <linux/types.h> +#include <linux/fs.h> -struct vmcore { -	struct list_head list; -	unsigned long long paddr; -	unsigned long long size; -	loff_t offset; -}; +struct proc_dir_entry;  #ifdef CONFIG_PROC_FS  extern void proc_root_init(void); - -void proc_flush_task(struct task_struct *task); - -extern struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode, -						struct proc_dir_entry *parent); -struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, -				struct proc_dir_entry *parent, -				const struct file_operations *proc_fops, -				void *data); -extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); - -struct pid_namespace; - -extern int pid_ns_prepare_proc(struct pid_namespace *ns); -extern void pid_ns_release_proc(struct pid_namespace *ns); - -/* - * proc_tty.c - */ -struct tty_driver; -#ifdef CONFIG_TTY -extern void proc_tty_init(void); -#else -static inline void proc_tty_init(void) -{ } -#endif -extern void proc_tty_register_driver(struct tty_driver *driver); -extern void proc_tty_unregister_driver(struct tty_driver *driver); - -/* - * proc_devtree.c - */ -#ifdef CONFIG_PROC_DEVICETREE -struct device_node; -struct property; -extern void proc_device_tree_init(void); -extern void proc_device_tree_add_node(struct device_node *, struct proc_dir_entry *); -extern void proc_device_tree_add_prop(struct proc_dir_entry *pde, struct property *prop); -extern void proc_device_tree_remove_prop(struct proc_dir_entry *pde, -					 struct property *prop); -extern void proc_device_tree_update_prop(struct proc_dir_entry *pde, -					 struct property *newprop, -					 struct property *oldprop); -#endif /* CONFIG_PROC_DEVICETREE */ +extern void proc_flush_task(struct task_struct *);  extern struct proc_dir_entry *proc_symlink(const char *,  		struct proc_dir_entry *, const char *); -extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *); -extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, -			struct proc_dir_entry *parent); +extern struct proc_dir_entry *proc_mkdir(const char *, struct proc_dir_entry *); +extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t, +					      struct proc_dir_entry *, void *); +extern struct proc_dir_entry *proc_mkdir_mode(const char *, umode_t, +					      struct proc_dir_entry *); +  +extern struct proc_dir_entry *proc_create_data(const char *, umode_t, +					       struct proc_dir_entry *, +					       const struct file_operations *, +					       void *); -static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode, -	struct proc_dir_entry *parent, const struct file_operations *proc_fops) +static inline struct proc_dir_entry *proc_create( +	const char *name, umode_t mode, struct proc_dir_entry *parent, +	const struct file_operations *proc_fops)  {  	return proc_create_data(name, mode, parent, proc_fops, NULL);  } -static inline struct proc_dir_entry *create_proc_read_entry(const char *name, -	umode_t mode, struct proc_dir_entry *base,  -	read_proc_t *read_proc, void * data) -{ -	struct proc_dir_entry *res=create_proc_entry(name,mode,base); -	if (res) { -		res->read_proc=read_proc; -		res->data=data; -	} -	return res; -} -  -extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, -	struct proc_dir_entry *parent); - -extern struct file *proc_ns_fget(int fd); -extern bool proc_ns_inode(struct inode *inode); +extern void proc_set_size(struct proc_dir_entry *, loff_t); +extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); +extern void *PDE_DATA(const struct inode *); +extern void *proc_get_parent_data(const struct inode *); +extern void proc_remove(struct proc_dir_entry *); +extern void remove_proc_entry(const char *, struct proc_dir_entry *); +extern int remove_proc_subtree(const char *, struct proc_dir_entry *); -extern int proc_alloc_inum(unsigned int *pino); -extern void proc_free_inum(unsigned int inum); -#else +#else /* CONFIG_PROC_FS */  static inline void proc_flush_task(struct task_struct *task)  {  } -static inline struct proc_dir_entry *create_proc_entry(const char *name, -	umode_t mode, struct proc_dir_entry *parent) { return NULL; } - -#define proc_create(name, mode, parent, fops)  ({ (void)(mode), NULL; }) - -static inline struct proc_dir_entry *proc_create_data(const char *name, -	umode_t mode, struct proc_dir_entry *parent, -	const struct file_operations *proc_fops, void *data) -{ -	return NULL; -} -#define remove_proc_entry(name, parent) do {} while (0) -  static inline struct proc_dir_entry *proc_symlink(const char *name, -		struct proc_dir_entry *parent,const char *dest) {return NULL;} +		struct proc_dir_entry *parent,const char *dest) { return NULL;}  static inline struct proc_dir_entry *proc_mkdir(const char *name,  	struct proc_dir_entry *parent) {return NULL;} +static inline struct proc_dir_entry *proc_mkdir_data(const char *name, +	umode_t mode, struct proc_dir_entry *parent, void *data) { return NULL; }  static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,  	umode_t mode, struct proc_dir_entry *parent) { return NULL; } +#define proc_create(name, mode, parent, proc_fops) ({NULL;}) +#define proc_create_data(name, mode, parent, proc_fops, data) ({NULL;}) -static inline struct proc_dir_entry *create_proc_read_entry(const char *name, -	umode_t mode, struct proc_dir_entry *base,  -	read_proc_t *read_proc, void * data) { return NULL; } - -struct tty_driver; -static inline void proc_tty_register_driver(struct tty_driver *driver) {}; -static inline void proc_tty_unregister_driver(struct tty_driver *driver) {}; +static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} +static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} +static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;} +static inline void *proc_get_parent_data(const struct inode *inode) { BUG(); return NULL; } -static inline int pid_ns_prepare_proc(struct pid_namespace *ns) -{ -	return 0; -} - -static inline void pid_ns_release_proc(struct pid_namespace *ns) -{ -} - -static inline struct file *proc_ns_fget(int fd) -{ -	return ERR_PTR(-EINVAL); -} - -static inline bool proc_ns_inode(struct inode *inode) -{ -	return false; -} +static inline void proc_remove(struct proc_dir_entry *de) {} +#define remove_proc_entry(name, parent) do {} while (0) +static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; } -static inline int proc_alloc_inum(unsigned int *inum) -{ -	*inum = 1; -	return 0; -} -static inline void proc_free_inum(unsigned int inum) -{ -}  #endif /* CONFIG_PROC_FS */ -#if !defined(CONFIG_PROC_KCORE) -static inline void -kclist_add(struct kcore_list *new, void *addr, size_t size, int type) +static inline struct proc_dir_entry *proc_net_mkdir( +	struct net *net, const char *name, struct proc_dir_entry *parent)  { +	return proc_mkdir_data(name, 0, parent, net);  } -#else -extern void kclist_add(struct kcore_list *, void *, size_t, int type); -#endif - -struct nsproxy; -struct proc_ns_operations { -	const char *name; -	int type; -	void *(*get)(struct task_struct *task); -	void (*put)(void *ns); -	int (*install)(struct nsproxy *nsproxy, void *ns); -	unsigned int (*inum)(void *ns); -}; -extern const struct proc_ns_operations netns_operations; -extern const struct proc_ns_operations utsns_operations; -extern const struct proc_ns_operations ipcns_operations; -extern const struct proc_ns_operations pidns_operations; -extern const struct proc_ns_operations userns_operations; -extern const struct proc_ns_operations mntns_operations; - -union proc_op { -	int (*proc_get_link)(struct dentry *, struct path *); -	int (*proc_read)(struct task_struct *task, char *page); -	int (*proc_show)(struct seq_file *m, -		struct pid_namespace *ns, struct pid *pid, -		struct task_struct *task); -}; - -struct ctl_table_header; -struct ctl_table; - -struct proc_inode { -	struct pid *pid; -	int fd; -	union proc_op op; -	struct proc_dir_entry *pde; -	struct ctl_table_header *sysctl; -	struct ctl_table *sysctl_entry; -	void *ns; -	const struct proc_ns_operations *ns_ops; -	struct inode vfs_inode; -}; - -static inline struct proc_inode *PROC_I(const struct inode *inode) -{ -	return container_of(inode, struct proc_inode, vfs_inode); -} - -static inline struct proc_dir_entry *PDE(const struct inode *inode) -{ -	return PROC_I(inode)->pde; -} - -static inline struct net *PDE_NET(struct proc_dir_entry *pde) -{ -	return pde->parent->data; -} - -#include <linux/signal.h> -void render_sigset_t(struct seq_file *m, const char *header, sigset_t *set);  #endif /* _LINUX_PROC_FS_H */ diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h new file mode 100644 index 00000000000..34a1e105bef --- /dev/null +++ b/include/linux/proc_ns.h @@ -0,0 +1,74 @@ +/* + * procfs namespace bits + */ +#ifndef _LINUX_PROC_NS_H +#define _LINUX_PROC_NS_H + +struct pid_namespace; +struct nsproxy; + +struct proc_ns_operations { +	const char *name; +	int type; +	void *(*get)(struct task_struct *task); +	void (*put)(void *ns); +	int (*install)(struct nsproxy *nsproxy, void *ns); +	unsigned int (*inum)(void *ns); +}; + +struct proc_ns { +	void *ns; +	const struct proc_ns_operations *ns_ops; +}; + +extern const struct proc_ns_operations netns_operations; +extern const struct proc_ns_operations utsns_operations; +extern const struct proc_ns_operations ipcns_operations; +extern const struct proc_ns_operations pidns_operations; +extern const struct proc_ns_operations userns_operations; +extern const struct proc_ns_operations mntns_operations; + +/* + * We always define these enumerators + */ +enum { +	PROC_ROOT_INO		= 1, +	PROC_IPC_INIT_INO	= 0xEFFFFFFFU, +	PROC_UTS_INIT_INO	= 0xEFFFFFFEU, +	PROC_USER_INIT_INO	= 0xEFFFFFFDU, +	PROC_PID_INIT_INO	= 0xEFFFFFFCU, +}; + +#ifdef CONFIG_PROC_FS + +extern int pid_ns_prepare_proc(struct pid_namespace *ns); +extern void pid_ns_release_proc(struct pid_namespace *ns); +extern struct file *proc_ns_fget(int fd); +extern struct proc_ns *get_proc_ns(struct inode *); +extern int proc_alloc_inum(unsigned int *pino); +extern void proc_free_inum(unsigned int inum); +extern bool proc_ns_inode(struct inode *inode); + +#else /* CONFIG_PROC_FS */ + +static inline int pid_ns_prepare_proc(struct pid_namespace *ns) { return 0; } +static inline void pid_ns_release_proc(struct pid_namespace *ns) {} + +static inline struct file *proc_ns_fget(int fd) +{ +	return ERR_PTR(-EINVAL); +} + +static inline struct proc_ns *get_proc_ns(struct inode *inode) { return NULL; } + +static inline int proc_alloc_inum(unsigned int *inum) +{ +	*inum = 1; +	return 0; +} +static inline void proc_free_inum(unsigned int inum) {} +static inline bool proc_ns_inode(struct inode *inode) { return false; } + +#endif /* CONFIG_PROC_FS */ + +#endif /* _LINUX_PROC_NS_H */ diff --git a/include/linux/profile.h b/include/linux/profile.h index 21123902366..aaad3861beb 100644 --- a/include/linux/profile.h +++ b/include/linux/profile.h @@ -18,10 +18,10 @@ struct pt_regs;  struct notifier_block;  #if defined(CONFIG_PROFILING) && defined(CONFIG_PROC_FS) -void create_prof_cpu_mask(struct proc_dir_entry *de); +void create_prof_cpu_mask(void);  int create_proc_profile(void);  #else -static inline void create_prof_cpu_mask(struct proc_dir_entry *de) +static inline void create_prof_cpu_mask(void)  {  } diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h index 5bf5500db83..69e37c2d1ea 100644 --- a/include/linux/ramfs.h +++ b/include/linux/ramfs.h @@ -6,7 +6,13 @@ struct inode *ramfs_get_inode(struct super_block *sb, const struct inode *dir,  extern struct dentry *ramfs_mount(struct file_system_type *fs_type,  	 int flags, const char *dev_name, void *data); -#ifndef CONFIG_MMU +#ifdef CONFIG_MMU +static inline int +ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) +{ +	return 0; +} +#else  extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize);  extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,  						   unsigned long addr, diff --git a/include/linux/rculist_bl.h b/include/linux/rculist_bl.h index cf1244fbf3b..4f216c59e7d 100644 --- a/include/linux/rculist_bl.h +++ b/include/linux/rculist_bl.h @@ -20,7 +20,7 @@ static inline void hlist_bl_set_first_rcu(struct hlist_bl_head *h,  static inline struct hlist_bl_node *hlist_bl_first_rcu(struct hlist_bl_head *h)  {  	return (struct hlist_bl_node *) -		((unsigned long)rcu_dereference(h->first) & ~LIST_BL_LOCKMASK); +		((unsigned long)rcu_dereference_check(h->first, hlist_bl_is_locked(h)) & ~LIST_BL_LOCKMASK);  }  /** diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index b758ce17b30..9ed2c9a4de4 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -80,6 +80,7 @@ extern void do_trace_rcu_torture_read(char *rcutorturename,  #define UINT_CMP_LT(a, b)	(UINT_MAX / 2 < (a) - (b))  #define ULONG_CMP_GE(a, b)	(ULONG_MAX / 2 >= (a) - (b))  #define ULONG_CMP_LT(a, b)	(ULONG_MAX / 2 < (a) - (b)) +#define ulong2long(a)		(*(long *)(&(a)))  /* Exported common interfaces */ diff --git a/include/linux/regmap.h b/include/linux/regmap.h index bf77dfdabef..02d84e24b7c 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -389,6 +389,7 @@ int regmap_update_bits_check(struct regmap *map, unsigned int reg,  			     bool *change);  int regmap_get_val_bytes(struct regmap *map);  int regmap_async_complete(struct regmap *map); +bool regmap_can_raw_write(struct regmap *map);  int regcache_sync(struct regmap *map);  int regcache_sync_region(struct regmap *map, unsigned int min, diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h index 7bd73bbdfd1..7c5ff0c5577 100644 --- a/include/linux/regulator/ab8500.h +++ b/include/linux/regulator/ab8500.h @@ -5,11 +5,14 @@   *   * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson   *          Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson + *          Daniel Willerud <daniel.willerud@stericsson.com> for ST-Ericsson   */  #ifndef __LINUX_MFD_AB8500_REGULATOR_H  #define __LINUX_MFD_AB8500_REGULATOR_H +#include <linux/platform_device.h> +  /* AB8500 regulators */  enum ab8500_regulator_id {  	AB8500_LDO_AUX1, @@ -17,7 +20,6 @@ enum ab8500_regulator_id {  	AB8500_LDO_AUX3,  	AB8500_LDO_INTCORE,  	AB8500_LDO_TVOUT, -	AB8500_LDO_USB,  	AB8500_LDO_AUDIO,  	AB8500_LDO_ANAMIC1,  	AB8500_LDO_ANAMIC2, @@ -26,7 +28,28 @@ enum ab8500_regulator_id {  	AB8500_NUM_REGULATORS,  }; -/* AB9450 regulators */ +/* AB8505 regulators */ +enum ab8505_regulator_id { +	AB8505_LDO_AUX1, +	AB8505_LDO_AUX2, +	AB8505_LDO_AUX3, +	AB8505_LDO_AUX4, +	AB8505_LDO_AUX5, +	AB8505_LDO_AUX6, +	AB8505_LDO_INTCORE, +	AB8505_LDO_ADC, +	AB8505_LDO_USB, +	AB8505_LDO_AUDIO, +	AB8505_LDO_ANAMIC1, +	AB8505_LDO_ANAMIC2, +	AB8505_LDO_AUX8, +	AB8505_LDO_ANA, +	AB8505_SYSCLKREQ_2, +	AB8505_SYSCLKREQ_4, +	AB8505_NUM_REGULATORS, +}; + +/* AB9540 regulators */  enum ab9540_regulator_id {  	AB9540_LDO_AUX1,  	AB9540_LDO_AUX2, @@ -45,16 +68,39 @@ enum ab9540_regulator_id {  	AB9540_NUM_REGULATORS,  }; -/* AB8500 and AB9540 register initialization */ +/* AB8540 regulators */ +enum ab8540_regulator_id { +	AB8540_LDO_AUX1, +	AB8540_LDO_AUX2, +	AB8540_LDO_AUX3, +	AB8540_LDO_AUX4, +	AB8540_LDO_AUX5, +	AB8540_LDO_AUX6, +	AB8540_LDO_INTCORE, +	AB8540_LDO_TVOUT, +	AB8540_LDO_AUDIO, +	AB8540_LDO_ANAMIC1, +	AB8540_LDO_ANAMIC2, +	AB8540_LDO_DMIC, +	AB8540_LDO_ANA, +	AB8540_LDO_SDIO, +	AB8540_SYSCLKREQ_2, +	AB8540_SYSCLKREQ_4, +	AB8540_NUM_REGULATORS, +}; + +/* AB8500, AB8505, and AB9540 register initialization */  struct ab8500_regulator_reg_init {  	int id; +	u8 mask;  	u8 value;  }; -#define INIT_REGULATOR_REGISTER(_id, _value)	\ -	{					\ -		.id = _id,			\ -		.value = _value,		\ +#define INIT_REGULATOR_REGISTER(_id, _mask, _value)	\ +	{						\ +		.id = _id,				\ +		.mask = _mask,				\ +		.value = _value,			\  	}  /* AB8500 registers */ @@ -86,10 +132,58 @@ enum ab8500_regulator_reg {  	AB8500_REGUCTRL2SPARE,  	AB8500_REGUCTRLDISCH,  	AB8500_REGUCTRLDISCH2, -	AB8500_VSMPS1SEL1,  	AB8500_NUM_REGULATOR_REGISTERS,  }; +/* AB8505 registers */ +enum ab8505_regulator_reg { +	AB8505_REGUREQUESTCTRL1, +	AB8505_REGUREQUESTCTRL2, +	AB8505_REGUREQUESTCTRL3, +	AB8505_REGUREQUESTCTRL4, +	AB8505_REGUSYSCLKREQ1HPVALID1, +	AB8505_REGUSYSCLKREQ1HPVALID2, +	AB8505_REGUHWHPREQ1VALID1, +	AB8505_REGUHWHPREQ1VALID2, +	AB8505_REGUHWHPREQ2VALID1, +	AB8505_REGUHWHPREQ2VALID2, +	AB8505_REGUSWHPREQVALID1, +	AB8505_REGUSWHPREQVALID2, +	AB8505_REGUSYSCLKREQVALID1, +	AB8505_REGUSYSCLKREQVALID2, +	AB8505_REGUVAUX4REQVALID, +	AB8505_REGUMISC1, +	AB8505_VAUDIOSUPPLY, +	AB8505_REGUCTRL1VAMIC, +	AB8505_VSMPSAREGU, +	AB8505_VSMPSBREGU, +	AB8505_VSAFEREGU, /* NOTE! PRCMU register */ +	AB8505_VPLLVANAREGU, +	AB8505_EXTSUPPLYREGU, +	AB8505_VAUX12REGU, +	AB8505_VRF1VAUX3REGU, +	AB8505_VSMPSASEL1, +	AB8505_VSMPSASEL2, +	AB8505_VSMPSASEL3, +	AB8505_VSMPSBSEL1, +	AB8505_VSMPSBSEL2, +	AB8505_VSMPSBSEL3, +	AB8505_VSAFESEL1, /* NOTE! PRCMU register */ +	AB8505_VSAFESEL2, /* NOTE! PRCMU register */ +	AB8505_VSAFESEL3, /* NOTE! PRCMU register */ +	AB8505_VAUX1SEL, +	AB8505_VAUX2SEL, +	AB8505_VRF1VAUX3SEL, +	AB8505_VAUX4REQCTRL, +	AB8505_VAUX4REGU, +	AB8505_VAUX4SEL, +	AB8505_REGUCTRLDISCH, +	AB8505_REGUCTRLDISCH2, +	AB8505_REGUCTRLDISCH3, +	AB8505_CTRLVAUX5, +	AB8505_CTRLVAUX6, +	AB8505_NUM_REGULATOR_REGISTERS, +};  /* AB9540 registers */  enum ab9540_regulator_reg { @@ -139,4 +233,111 @@ enum ab9540_regulator_reg {  	AB9540_NUM_REGULATOR_REGISTERS,  }; +/* AB8540 registers */ +enum ab8540_regulator_reg { +	AB8540_REGUREQUESTCTRL1, +	AB8540_REGUREQUESTCTRL2, +	AB8540_REGUREQUESTCTRL3, +	AB8540_REGUREQUESTCTRL4, +	AB8540_REGUSYSCLKREQ1HPVALID1, +	AB8540_REGUSYSCLKREQ1HPVALID2, +	AB8540_REGUHWHPREQ1VALID1, +	AB8540_REGUHWHPREQ1VALID2, +	AB8540_REGUHWHPREQ2VALID1, +	AB8540_REGUHWHPREQ2VALID2, +	AB8540_REGUSWHPREQVALID1, +	AB8540_REGUSWHPREQVALID2, +	AB8540_REGUSYSCLKREQVALID1, +	AB8540_REGUSYSCLKREQVALID2, +	AB8540_REGUVAUX4REQVALID, +	AB8540_REGUVAUX5REQVALID, +	AB8540_REGUVAUX6REQVALID, +	AB8540_REGUVCLKBREQVALID, +	AB8540_REGUVRF1REQVALID, +	AB8540_REGUMISC1, +	AB8540_VAUDIOSUPPLY, +	AB8540_REGUCTRL1VAMIC, +	AB8540_VHSIC, +	AB8540_VSDIO, +	AB8540_VSMPS1REGU, +	AB8540_VSMPS2REGU, +	AB8540_VSMPS3REGU, +	AB8540_VPLLVANAREGU, +	AB8540_EXTSUPPLYREGU, +	AB8540_VAUX12REGU, +	AB8540_VRF1VAUX3REGU, +	AB8540_VSMPS1SEL1, +	AB8540_VSMPS1SEL2, +	AB8540_VSMPS1SEL3, +	AB8540_VSMPS2SEL1, +	AB8540_VSMPS2SEL2, +	AB8540_VSMPS2SEL3, +	AB8540_VSMPS3SEL1, +	AB8540_VSMPS3SEL2, +	AB8540_VAUX1SEL, +	AB8540_VAUX2SEL, +	AB8540_VRF1VAUX3SEL, +	AB8540_REGUCTRL2SPARE, +	AB8540_VAUX4REQCTRL, +	AB8540_VAUX4REGU, +	AB8540_VAUX4SEL, +	AB8540_VAUX5REQCTRL, +	AB8540_VAUX5REGU, +	AB8540_VAUX5SEL, +	AB8540_VAUX6REQCTRL, +	AB8540_VAUX6REGU, +	AB8540_VAUX6SEL, +	AB8540_VCLKBREQCTRL, +	AB8540_VCLKBREGU, +	AB8540_VCLKBSEL, +	AB8540_VRF1REQCTRL, +	AB8540_REGUCTRLDISCH, +	AB8540_REGUCTRLDISCH2, +	AB8540_REGUCTRLDISCH3, +	AB8540_REGUCTRLDISCH4, +	AB8540_VSIMSYSCLKCTRL, +	AB8540_VANAVPLLSEL, +	AB8540_NUM_REGULATOR_REGISTERS, +}; + +/* AB8500 external regulators */ +struct ab8500_ext_regulator_cfg { +	bool hwreq; /* requires hw mode or high power mode */ +}; + +enum ab8500_ext_regulator_id { +	AB8500_EXT_SUPPLY1, +	AB8500_EXT_SUPPLY2, +	AB8500_EXT_SUPPLY3, +	AB8500_NUM_EXT_REGULATORS, +}; + +/* AB8500 regulator platform data */ +struct ab8500_regulator_platform_data { +	int num_reg_init; +	struct ab8500_regulator_reg_init *reg_init; +	int num_regulator; +	struct regulator_init_data *regulator; +	int num_ext_regulator; +	struct regulator_init_data *ext_regulator; +}; + +#ifdef CONFIG_REGULATOR_AB8500_DEBUG +int ab8500_regulator_debug_init(struct platform_device *pdev); +int ab8500_regulator_debug_exit(struct platform_device *pdev); +#else +static inline int ab8500_regulator_debug_init(struct platform_device *pdev) +{ +	return 0; +} +static inline int ab8500_regulator_debug_exit(struct platform_device *pdev) +{ +	return 0; +} +#endif + +/* AB8500 external regulator functions. */ +int ab8500_ext_regulator_init(struct platform_device *pdev); +void ab8500_ext_regulator_exit(struct platform_device *pdev); +  #endif diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 7bc732ce6e5..145022a8308 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -141,18 +141,18 @@ void regulator_put(struct regulator *regulator);  void devm_regulator_put(struct regulator *regulator);  /* regulator output control and status */ -int regulator_enable(struct regulator *regulator); +int __must_check regulator_enable(struct regulator *regulator);  int regulator_disable(struct regulator *regulator);  int regulator_force_disable(struct regulator *regulator);  int regulator_is_enabled(struct regulator *regulator);  int regulator_disable_deferred(struct regulator *regulator, int ms); -int regulator_bulk_get(struct device *dev, int num_consumers, -		       struct regulator_bulk_data *consumers); -int devm_regulator_bulk_get(struct device *dev, int num_consumers, -			    struct regulator_bulk_data *consumers); -int regulator_bulk_enable(int num_consumers, -			  struct regulator_bulk_data *consumers); +int __must_check regulator_bulk_get(struct device *dev, int num_consumers, +				    struct regulator_bulk_data *consumers); +int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers, +					 struct regulator_bulk_data *consumers); +int __must_check regulator_bulk_enable(int num_consumers, +				       struct regulator_bulk_data *consumers);  int regulator_bulk_disable(int num_consumers,  			   struct regulator_bulk_data *consumers);  int regulator_bulk_force_disable(int num_consumers, diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 7df93f52db0..6700cc94bdd 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -22,6 +22,7 @@  struct regmap;  struct regulator_dev;  struct regulator_init_data; +struct regulator_enable_gpio;  enum regulator_status {  	REGULATOR_STATUS_OFF, @@ -199,6 +200,8 @@ enum regulator_type {   *                output when using regulator_set_voltage_sel_regmap   * @enable_reg: Register for control when using regmap enable/disable ops   * @enable_mask: Mask for control when using regmap enable/disable ops + * @enable_is_inverted: A flag to indicate set enable_mask bits to disable + *                      when using regulator_enable_regmap and friends APIs.   * @bypass_reg: Register for control when using regmap set_bypass   * @bypass_mask: Mask for control when using regmap set_bypass   * @@ -228,6 +231,7 @@ struct regulator_desc {  	unsigned int apply_bit;  	unsigned int enable_reg;  	unsigned int enable_mask; +	bool enable_is_inverted;  	unsigned int bypass_reg;  	unsigned int bypass_mask; @@ -302,8 +306,7 @@ struct regulator_dev {  	struct dentry *debugfs; -	int ena_gpio; -	unsigned int ena_gpio_invert:1; +	struct regulator_enable_gpio *ena_pin;  	unsigned int ena_gpio_state:1;  }; @@ -329,6 +332,8 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev,  				  int min_uV, int max_uV);  int regulator_map_voltage_iterate(struct regulator_dev *rdev,  				  int min_uV, int max_uV); +int regulator_map_voltage_ascend(struct regulator_dev *rdev, +				  int min_uV, int max_uV);  int regulator_get_voltage_sel_regmap(struct regulator_dev *rdev);  int regulator_set_voltage_sel_regmap(struct regulator_dev *rdev, unsigned sel);  int regulator_is_enabled_regmap(struct regulator_dev *rdev); diff --git a/include/linux/regulator/max8952.h b/include/linux/regulator/max8952.h index 45e42855ad0..4dbb63a1d4a 100644 --- a/include/linux/regulator/max8952.h +++ b/include/linux/regulator/max8952.h @@ -122,13 +122,13 @@ struct max8952_platform_data {  	int gpio_vid1;  	int gpio_en; -	u8 default_mode; -	u8 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */ +	u32 default_mode; +	u32 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */ -	u8 sync_freq; -	u8 ramp_speed; +	u32 sync_freq; +	u32 ramp_speed; -	struct regulator_init_data reg_data; +	struct regulator_init_data *reg_data;  }; diff --git a/include/linux/relay.h b/include/linux/relay.h index 91cacc34c15..d7c8359693c 100644 --- a/include/linux/relay.h +++ b/include/linux/relay.h @@ -20,9 +20,6 @@  #include <linux/poll.h>  #include <linux/kref.h> -/* Needs a _much_ better name... */ -#define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE) -  /*   * Tracks changes to rchan/rchan_buf structs   */ diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h index c23099413ad..96a509b6be0 100644 --- a/include/linux/res_counter.h +++ b/include/linux/res_counter.h @@ -13,7 +13,7 @@   * info about what this counter is.   */ -#include <linux/cgroup.h> +#include <linux/spinlock.h>  #include <linux/errno.h>  /* diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index 1342e69542f..d69cf637a15 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h @@ -4,6 +4,7 @@  #include <linux/kmemcheck.h>  #include <linux/mm.h>  #include <linux/seq_file.h> +#include <linux/poll.h>  struct ring_buffer;  struct ring_buffer_iter; @@ -96,6 +97,11 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k  	__ring_buffer_alloc((size), (flags), &__key);	\  }) +void ring_buffer_wait(struct ring_buffer *buffer, int cpu); +int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, +			  struct file *filp, poll_table *poll_table); + +  #define RING_BUFFER_ALL_CPUS -1  void ring_buffer_free(struct ring_buffer *buffer); diff --git a/include/linux/rtc.h b/include/linux/rtc.h index 580b24c8b8c..c2c28975293 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -133,7 +133,13 @@ extern struct rtc_device *rtc_device_register(const char *name,  					struct device *dev,  					const struct rtc_class_ops *ops,  					struct module *owner); +extern struct rtc_device *devm_rtc_device_register(struct device *dev, +					const char *name, +					const struct rtc_class_ops *ops, +					struct module *owner);  extern void rtc_device_unregister(struct rtc_device *rtc); +extern void devm_rtc_device_unregister(struct device *dev, +					struct rtc_device *rtc);  extern int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm);  extern int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm); diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 489dd7bb28e..f28544b2f9a 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -69,6 +69,15 @@ extern int ndo_dflt_fdb_dump(struct sk_buff *skb,  			     struct netlink_callback *cb,  			     struct net_device *dev,  			     int idx); +extern int ndo_dflt_fdb_add(struct ndmsg *ndm, +			    struct nlattr *tb[], +			    struct net_device *dev, +			    const unsigned char *addr, +			     u16 flags); +extern int ndo_dflt_fdb_del(struct ndmsg *ndm, +			    struct nlattr *tb[], +			    struct net_device *dev, +			    const unsigned char *addr);  extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,  				   struct net_device *dev, u16 mode); diff --git a/include/linux/sched.h b/include/linux/sched.h index d35d2b6ddbf..6f950048b6e 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -127,18 +127,6 @@ extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m);  extern void proc_sched_set_task(struct task_struct *p);  extern void  print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); -#else -static inline void -proc_sched_show_task(struct task_struct *p, struct seq_file *m) -{ -} -static inline void proc_sched_set_task(struct task_struct *p) -{ -} -static inline void -print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) -{ -}  #endif  /* @@ -163,9 +151,10 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)  #define TASK_DEAD		64  #define TASK_WAKEKILL		128  #define TASK_WAKING		256 -#define TASK_STATE_MAX		512 +#define TASK_PARKED		512 +#define TASK_STATE_MAX		1024 -#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKW" +#define TASK_STATE_TO_CHAR_STR "RSDTtZXxKWP"  extern char ___assert_task_state[1 - 2*!!(  		sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; @@ -320,7 +309,6 @@ extern signed long schedule_timeout_killable(signed long timeout);  extern signed long schedule_timeout_uninterruptible(signed long timeout);  asmlinkage void schedule(void);  extern void schedule_preempt_disabled(void); -extern int mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner);  struct nsproxy;  struct user_namespace; @@ -526,7 +514,8 @@ struct signal_struct {  	unsigned int		has_child_subreaper:1;  	/* POSIX.1b Interval Timers */ -	struct list_head posix_timers; +	int			posix_timer_id; +	struct list_head	posix_timers;  	/* ITIMER_REAL timer for the process */  	struct hrtimer real_timer; @@ -570,7 +559,7 @@ struct signal_struct {  	cputime_t utime, stime, cutime, cstime;  	cputime_t gtime;  	cputime_t cgtime; -#ifndef CONFIG_VIRT_CPU_ACCOUNTING +#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	struct cputime prev_cputime;  #endif  	unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; @@ -637,6 +626,7 @@ struct signal_struct {  #define SIGNAL_STOP_STOPPED	0x00000001 /* job control stop in effect */  #define SIGNAL_STOP_CONTINUED	0x00000002 /* SIGCONT since WCONTINUED reap */  #define SIGNAL_GROUP_EXIT	0x00000004 /* group exit in progress */ +#define SIGNAL_GROUP_COREDUMP	0x00000008 /* coredump in progress */  /*   * Pending notifications to parent.   */ @@ -768,31 +758,6 @@ enum cpu_idle_type {  };  /* - * Increase resolution of nice-level calculations for 64-bit architectures. - * The extra resolution improves shares distribution and load balancing of - * low-weight task groups (eg. nice +19 on an autogroup), deeper taskgroup - * hierarchies, especially on larger systems. This is not a user-visible change - * and does not change the user-interface for setting shares/weights. - * - * We increase resolution only if we have enough bits to allow this increased - * resolution (i.e. BITS_PER_LONG > 32). The costs for increasing resolution - * when BITS_PER_LONG <= 32 are pretty high and the returns do not justify the - * increased costs. - */ -#if 0 /* BITS_PER_LONG > 32 -- currently broken: it increases power usage under light load  */ -# define SCHED_LOAD_RESOLUTION	10 -# define scale_load(w)		((w) << SCHED_LOAD_RESOLUTION) -# define scale_load_down(w)	((w) >> SCHED_LOAD_RESOLUTION) -#else -# define SCHED_LOAD_RESOLUTION	0 -# define scale_load(w)		(w) -# define scale_load_down(w)	(w) -#endif - -#define SCHED_LOAD_SHIFT	(10 + SCHED_LOAD_RESOLUTION) -#define SCHED_LOAD_SCALE	(1L << SCHED_LOAD_SHIFT) - -/*   * Increase resolution of cpu_power calculations   */  #define SCHED_POWER_SHIFT	10 @@ -817,62 +782,6 @@ enum cpu_idle_type {  extern int __weak arch_sd_sibiling_asym_packing(void); -struct sched_group_power { -	atomic_t ref; -	/* -	 * CPU power of this group, SCHED_LOAD_SCALE being max power for a -	 * single CPU. -	 */ -	unsigned int power, power_orig; -	unsigned long next_update; -	/* -	 * Number of busy cpus in this group. -	 */ -	atomic_t nr_busy_cpus; - -	unsigned long cpumask[0]; /* iteration mask */ -}; - -struct sched_group { -	struct sched_group *next;	/* Must be a circular list */ -	atomic_t ref; - -	unsigned int group_weight; -	struct sched_group_power *sgp; - -	/* -	 * The CPUs this group covers. -	 * -	 * NOTE: this field is variable length. (Allocated dynamically -	 * by attaching extra space to the end of the structure, -	 * depending on how many CPUs the kernel has booted up with) -	 */ -	unsigned long cpumask[0]; -}; - -static inline struct cpumask *sched_group_cpus(struct sched_group *sg) -{ -	return to_cpumask(sg->cpumask); -} - -/* - * cpumask masking which cpus in the group are allowed to iterate up the domain - * tree. - */ -static inline struct cpumask *sched_group_mask(struct sched_group *sg) -{ -	return to_cpumask(sg->sgp->cpumask); -} - -/** - * group_first_cpu - Returns the first cpu in the cpumask of a sched_group. - * @group: The group whose first cpu is to be returned. - */ -static inline unsigned int group_first_cpu(struct sched_group *group) -{ -	return cpumask_first(sched_group_cpus(group)); -} -  struct sched_domain_attr {  	int relax_domain_level;  }; @@ -883,6 +792,8 @@ struct sched_domain_attr {  extern int sched_domain_level_max; +struct sched_group; +  struct sched_domain {  	/* These fields must be setup */  	struct sched_domain *parent;	/* top domain must be null terminated */ @@ -899,6 +810,8 @@ struct sched_domain {  	unsigned int wake_idx;  	unsigned int forkexec_idx;  	unsigned int smt_gain; + +	int nohz_idle;			/* NOHZ IDLE status */  	int flags;			/* See SD_* */  	int level; @@ -971,18 +884,6 @@ extern void partition_sched_domains(int ndoms_new, cpumask_var_t doms_new[],  cpumask_var_t *alloc_sched_domains(unsigned int ndoms);  void free_sched_domains(cpumask_var_t doms[], unsigned int ndoms); -/* Test a flag in parent sched domain */ -static inline int test_sd_parent(struct sched_domain *sd, int flag) -{ -	if (sd->parent && (sd->parent->flags & flag)) -		return 1; - -	return 0; -} - -unsigned long default_scale_freq_power(struct sched_domain *sd, int cpu); -unsigned long default_scale_smt_power(struct sched_domain *sd, int cpu); -  bool cpus_share_cache(int this_cpu, int that_cpu);  #else /* CONFIG_SMP */ @@ -1017,72 +918,6 @@ struct mempolicy;  struct pipe_inode_info;  struct uts_namespace; -struct rq; -struct sched_domain; - -/* - * wake flags - */ -#define WF_SYNC		0x01		/* waker goes to sleep after wakup */ -#define WF_FORK		0x02		/* child wakeup after fork */ -#define WF_MIGRATED	0x04		/* internal use, task got migrated */ - -#define ENQUEUE_WAKEUP		1 -#define ENQUEUE_HEAD		2 -#ifdef CONFIG_SMP -#define ENQUEUE_WAKING		4	/* sched_class::task_waking was called */ -#else -#define ENQUEUE_WAKING		0 -#endif - -#define DEQUEUE_SLEEP		1 - -struct sched_class { -	const struct sched_class *next; - -	void (*enqueue_task) (struct rq *rq, struct task_struct *p, int flags); -	void (*dequeue_task) (struct rq *rq, struct task_struct *p, int flags); -	void (*yield_task) (struct rq *rq); -	bool (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt); - -	void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int flags); - -	struct task_struct * (*pick_next_task) (struct rq *rq); -	void (*put_prev_task) (struct rq *rq, struct task_struct *p); - -#ifdef CONFIG_SMP -	int  (*select_task_rq)(struct task_struct *p, int sd_flag, int flags); -	void (*migrate_task_rq)(struct task_struct *p, int next_cpu); - -	void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); -	void (*post_schedule) (struct rq *this_rq); -	void (*task_waking) (struct task_struct *task); -	void (*task_woken) (struct rq *this_rq, struct task_struct *task); - -	void (*set_cpus_allowed)(struct task_struct *p, -				 const struct cpumask *newmask); - -	void (*rq_online)(struct rq *rq); -	void (*rq_offline)(struct rq *rq); -#endif - -	void (*set_curr_task) (struct rq *rq); -	void (*task_tick) (struct rq *rq, struct task_struct *p, int queued); -	void (*task_fork) (struct task_struct *p); - -	void (*switched_from) (struct rq *this_rq, struct task_struct *task); -	void (*switched_to) (struct rq *this_rq, struct task_struct *task); -	void (*prio_changed) (struct rq *this_rq, struct task_struct *task, -			     int oldprio); - -	unsigned int (*get_rr_interval) (struct rq *rq, -					 struct task_struct *task); - -#ifdef CONFIG_FAIR_GROUP_SCHED -	void (*task_move_group) (struct task_struct *p, int on_rq); -#endif -}; -  struct load_weight {  	unsigned long weight, inv_weight;  }; @@ -1274,8 +1109,10 @@ struct task_struct {  	int exit_code, exit_signal;  	int pdeath_signal;  /*  The signal sent when the parent dies  */  	unsigned int jobctl;	/* JOBCTL_*, siglock protected */ -	/* ??? */ + +	/* Used for emulating ABI behavior of previous Linux versions */  	unsigned int personality; +  	unsigned did_exec:1;  	unsigned in_execve:1;	/* Tell the LSMs that the process is doing an  				 * execve */ @@ -1327,7 +1164,7 @@ struct task_struct {  	cputime_t utime, stime, utimescaled, stimescaled;  	cputime_t gtime; -#ifndef CONFIG_VIRT_CPU_ACCOUNTING +#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE  	struct cputime prev_cputime;  #endif  #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN @@ -1793,7 +1630,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,  #define PF_SWAPWRITE	0x00800000	/* Allowed to write to swap */  #define PF_SPREAD_PAGE	0x01000000	/* Spread page cache over cpuset */  #define PF_SPREAD_SLAB	0x02000000	/* Spread some slab caches over cpuset */ -#define PF_THREAD_BOUND	0x04000000	/* Thread bound to specific cpu */ +#define PF_NO_SETAFFINITY 0x04000000	/* Userland is not allowed to meddle with cpus_allowed */  #define PF_MCE_EARLY    0x08000000      /* Early kill for mce process policy */  #define PF_MEMPOLICY	0x10000000	/* Non-default NUMA mempolicy */  #define PF_MUTEX_TESTER	0x20000000	/* Thread belongs to the rt mutex tester */ @@ -2412,27 +2249,18 @@ static inline void threadgroup_change_end(struct task_struct *tsk)   *   * Lock the threadgroup @tsk belongs to.  No new task is allowed to enter   * and member tasks aren't allowed to exit (as indicated by PF_EXITING) or - * perform exec.  This is useful for cases where the threadgroup needs to - * stay stable across blockable operations. + * change ->group_leader/pid.  This is useful for cases where the threadgroup + * needs to stay stable across blockable operations.   *   * fork and exit paths explicitly call threadgroup_change_{begin|end}() for   * synchronization.  While held, no new task will be added to threadgroup   * and no existing live task will have its PF_EXITING set.   * - * During exec, a task goes and puts its thread group through unusual - * changes.  After de-threading, exclusive access is assumed to resources - * which are usually shared by tasks in the same group - e.g. sighand may - * be replaced with a new one.  Also, the exec'ing task takes over group - * leader role including its pid.  Exclude these changes while locked by - * grabbing cred_guard_mutex which is used to synchronize exec path. + * de_thread() does threadgroup_change_{begin|end}() when a non-leader + * sub-thread becomes a new leader.   */  static inline void threadgroup_lock(struct task_struct *tsk)  { -	/* -	 * exec uses exit for de-threading nesting group_rwsem inside -	 * cred_guard_mutex. Grab cred_guard_mutex first. -	 */ -	mutex_lock(&tsk->signal->cred_guard_mutex);  	down_write(&tsk->signal->group_rwsem);  } @@ -2445,7 +2273,6 @@ static inline void threadgroup_lock(struct task_struct *tsk)  static inline void threadgroup_unlock(struct task_struct *tsk)  {  	up_write(&tsk->signal->group_rwsem); -	mutex_unlock(&tsk->signal->cred_guard_mutex);  }  #else  static inline void threadgroup_change_begin(struct task_struct *tsk) {} @@ -2622,6 +2449,47 @@ static inline int spin_needbreak(spinlock_t *lock)  }  /* + * Idle thread specific functions to determine the need_resched + * polling state. We have two versions, one based on TS_POLLING in + * thread_info.status and one based on TIF_POLLING_NRFLAG in + * thread_info.flags + */ +#ifdef TS_POLLING +static inline int tsk_is_polling(struct task_struct *p) +{ +	return task_thread_info(p)->status & TS_POLLING; +} +static inline void current_set_polling(void) +{ +	current_thread_info()->status |= TS_POLLING; +} + +static inline void current_clr_polling(void) +{ +	current_thread_info()->status &= ~TS_POLLING; +	smp_mb__after_clear_bit(); +} +#elif defined(TIF_POLLING_NRFLAG) +static inline int tsk_is_polling(struct task_struct *p) +{ +	return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG); +} +static inline void current_set_polling(void) +{ +	set_thread_flag(TIF_POLLING_NRFLAG); +} + +static inline void current_clr_polling(void) +{ +	clear_thread_flag(TIF_POLLING_NRFLAG); +} +#else +static inline int tsk_is_polling(struct task_struct *p) { return 0; } +static inline void current_set_polling(void) { } +static inline void current_clr_polling(void) { } +#endif + +/*   * Thread group CPU time accounting.   */  void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times); @@ -2681,28 +2549,7 @@ extern long sched_setaffinity(pid_t pid, const struct cpumask *new_mask);  extern long sched_getaffinity(pid_t pid, struct cpumask *mask);  #ifdef CONFIG_CGROUP_SCHED -  extern struct task_group root_task_group; - -extern struct task_group *sched_create_group(struct task_group *parent); -extern void sched_online_group(struct task_group *tg, -			       struct task_group *parent); -extern void sched_destroy_group(struct task_group *tg); -extern void sched_offline_group(struct task_group *tg); -extern void sched_move_task(struct task_struct *tsk); -#ifdef CONFIG_FAIR_GROUP_SCHED -extern int sched_group_set_shares(struct task_group *tg, unsigned long shares); -extern unsigned long sched_group_shares(struct task_group *tg); -#endif -#ifdef CONFIG_RT_GROUP_SCHED -extern int sched_group_set_rt_runtime(struct task_group *tg, -				      long rt_runtime_us); -extern long sched_group_rt_runtime(struct task_group *tg); -extern int sched_group_set_rt_period(struct task_group *tg, -				      long rt_period_us); -extern long sched_group_rt_period(struct task_group *tg); -extern int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk); -#endif  #endif /* CONFIG_CGROUP_SCHED */  extern int task_can_switch_user(struct user_struct *up, diff --git a/include/linux/sctp.h b/include/linux/sctp.h index c11a28706fa..3bfe8d6ee24 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h @@ -53,7 +53,9 @@  #include <linux/in.h>		/* We need in_addr.  */  #include <linux/in6.h>		/* We need in6_addr.  */ +#include <linux/skbuff.h> +#include <uapi/linux/sctp.h>  /* Section 3.1.  SCTP Common Header Format */  typedef struct sctphdr { @@ -63,14 +65,10 @@ typedef struct sctphdr {  	__le32 checksum;  } __packed sctp_sctphdr_t; -#ifdef __KERNEL__ -#include <linux/skbuff.h> -  static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)  {  	return (struct sctphdr *)skb_transport_header(skb);  } -#endif  /* Section 3.2.  Chunk Field Descriptions. */  typedef struct sctp_chunkhdr { diff --git a/include/linux/security.h b/include/linux/security.h index eee7478cda7..4686491852a 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -1012,6 +1012,10 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)   *	This hook can be used by the module to update any security state   *	associated with the TUN device's security structure.   *	@security pointer to the TUN devices's security structure. + * @skb_owned_by: + *	This hook sets the packet's owning sock. + *	@skb is the packet. + *	@sk the sock which owns the packet.   *   * Security hooks for XFRM operations.   * @@ -1436,7 +1440,7 @@ struct security_operations {  			     struct path *new_path);  	int (*sb_set_mnt_opts) (struct super_block *sb,  				struct security_mnt_opts *opts); -	void (*sb_clone_mnt_opts) (const struct super_block *oldsb, +	int (*sb_clone_mnt_opts) (const struct super_block *oldsb,  				   struct super_block *newsb);  	int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); @@ -1638,6 +1642,7 @@ struct security_operations {  	int (*tun_dev_attach_queue) (void *security);  	int (*tun_dev_attach) (struct sock *sk, void *security);  	int (*tun_dev_open) (void *security); +	void (*skb_owned_by) (struct sk_buff *skb, struct sock *sk);  #endif	/* CONFIG_SECURITY_NETWORK */  #ifdef CONFIG_SECURITY_NETWORK_XFRM @@ -1721,7 +1726,7 @@ int security_sb_mount(const char *dev_name, struct path *path,  int security_sb_umount(struct vfsmount *mnt, int flags);  int security_sb_pivotroot(struct path *old_path, struct path *new_path);  int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); -void security_sb_clone_mnt_opts(const struct super_block *oldsb, +int security_sb_clone_mnt_opts(const struct super_block *oldsb,  				struct super_block *newsb);  int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); @@ -2011,9 +2016,11 @@ static inline int security_sb_set_mnt_opts(struct super_block *sb,  	return 0;  } -static inline void security_sb_clone_mnt_opts(const struct super_block *oldsb, +static inline int security_sb_clone_mnt_opts(const struct super_block *oldsb,  					      struct super_block *newsb) -{ } +{ +	return 0; +}  static inline int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts)  { @@ -2588,6 +2595,8 @@ int security_tun_dev_attach_queue(void *security);  int security_tun_dev_attach(struct sock *sk, void *security);  int security_tun_dev_open(void *security); +void security_skb_owned_by(struct sk_buff *skb, struct sock *sk); +  #else	/* CONFIG_SECURITY_NETWORK */  static inline int security_unix_stream_connect(struct sock *sock,  					       struct sock *other, @@ -2779,6 +2788,11 @@ static inline int security_tun_dev_open(void *security)  {  	return 0;  } + +static inline void security_skb_owned_by(struct sk_buff *skb, struct sock *sk) +{ +} +  #endif	/* CONFIG_SECURITY_NETWORK */  #ifdef CONFIG_SECURITY_NETWORK_XFRM diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 68a04a343ca..2da29ac178f 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -123,6 +123,7 @@ static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask)  }  int single_open(struct file *, int (*)(struct seq_file *, void *), void *); +int single_open_size(struct file *, int (*)(struct seq_file *, void *), void *, size_t);  int single_release(struct inode *, struct file *);  void *__seq_open_private(struct file *, const struct seq_operations *, int);  int seq_open_private(struct file *, const struct seq_operations *, int); diff --git a/include/linux/serial_s3c.h b/include/linux/serial_s3c.h new file mode 100644 index 00000000000..907d9d1d56c --- /dev/null +++ b/include/linux/serial_s3c.h @@ -0,0 +1,260 @@ +/* + *  Internal header file for Samsung S3C2410 serial ports (UART0-2) + * + *  Copyright (C) 2002 Shane Nay (shane@minirl.com) + * + *  Additional defines, Copyright 2003 Simtec Electronics (linux@simtec.co.uk) + * + *  Adapted from: + * + *  Internal header file for MX1ADS serial ports (UART1 & 2) + * + *  Copyright (C) 2002 Shane Nay (shane@minirl.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA +*/ + +#ifndef __ASM_ARM_REGS_SERIAL_H +#define __ASM_ARM_REGS_SERIAL_H + +#define S3C2410_URXH	  (0x24) +#define S3C2410_UTXH	  (0x20) +#define S3C2410_ULCON	  (0x00) +#define S3C2410_UCON	  (0x04) +#define S3C2410_UFCON	  (0x08) +#define S3C2410_UMCON	  (0x0C) +#define S3C2410_UBRDIV	  (0x28) +#define S3C2410_UTRSTAT	  (0x10) +#define S3C2410_UERSTAT	  (0x14) +#define S3C2410_UFSTAT	  (0x18) +#define S3C2410_UMSTAT	  (0x1C) + +#define S3C2410_LCON_CFGMASK	  ((0xF<<3)|(0x3)) + +#define S3C2410_LCON_CS5	  (0x0) +#define S3C2410_LCON_CS6	  (0x1) +#define S3C2410_LCON_CS7	  (0x2) +#define S3C2410_LCON_CS8	  (0x3) +#define S3C2410_LCON_CSMASK	  (0x3) + +#define S3C2410_LCON_PNONE	  (0x0) +#define S3C2410_LCON_PEVEN	  (0x5 << 3) +#define S3C2410_LCON_PODD	  (0x4 << 3) +#define S3C2410_LCON_PMASK	  (0x7 << 3) + +#define S3C2410_LCON_STOPB	  (1<<2) +#define S3C2410_LCON_IRM          (1<<6) + +#define S3C2440_UCON_CLKMASK	  (3<<10) +#define S3C2440_UCON_CLKSHIFT	  (10) +#define S3C2440_UCON_PCLK	  (0<<10) +#define S3C2440_UCON_UCLK	  (1<<10) +#define S3C2440_UCON_PCLK2	  (2<<10) +#define S3C2440_UCON_FCLK	  (3<<10) +#define S3C2443_UCON_EPLL	  (3<<10) + +#define S3C6400_UCON_CLKMASK	(3<<10) +#define S3C6400_UCON_CLKSHIFT	(10) +#define S3C6400_UCON_PCLK	(0<<10) +#define S3C6400_UCON_PCLK2	(2<<10) +#define S3C6400_UCON_UCLK0	(1<<10) +#define S3C6400_UCON_UCLK1	(3<<10) + +#define S3C2440_UCON2_FCLK_EN	  (1<<15) +#define S3C2440_UCON0_DIVMASK	  (15 << 12) +#define S3C2440_UCON1_DIVMASK	  (15 << 12) +#define S3C2440_UCON2_DIVMASK	  (7 << 12) +#define S3C2440_UCON_DIVSHIFT	  (12) + +#define S3C2412_UCON_CLKMASK	(3<<10) +#define S3C2412_UCON_CLKSHIFT	(10) +#define S3C2412_UCON_UCLK	(1<<10) +#define S3C2412_UCON_USYSCLK	(3<<10) +#define S3C2412_UCON_PCLK	(0<<10) +#define S3C2412_UCON_PCLK2	(2<<10) + +#define S3C2410_UCON_CLKMASK	(1 << 10) +#define S3C2410_UCON_CLKSHIFT	(10) +#define S3C2410_UCON_UCLK	  (1<<10) +#define S3C2410_UCON_SBREAK	  (1<<4) + +#define S3C2410_UCON_TXILEVEL	  (1<<9) +#define S3C2410_UCON_RXILEVEL	  (1<<8) +#define S3C2410_UCON_TXIRQMODE	  (1<<2) +#define S3C2410_UCON_RXIRQMODE	  (1<<0) +#define S3C2410_UCON_RXFIFO_TOI	  (1<<7) +#define S3C2443_UCON_RXERR_IRQEN  (1<<6) +#define S3C2443_UCON_LOOPBACK	  (1<<5) + +#define S3C2410_UCON_DEFAULT	  (S3C2410_UCON_TXILEVEL  | \ +				   S3C2410_UCON_RXILEVEL  | \ +				   S3C2410_UCON_TXIRQMODE | \ +				   S3C2410_UCON_RXIRQMODE | \ +				   S3C2410_UCON_RXFIFO_TOI) + +#define S3C2410_UFCON_FIFOMODE	  (1<<0) +#define S3C2410_UFCON_TXTRIG0	  (0<<6) +#define S3C2410_UFCON_RXTRIG8	  (1<<4) +#define S3C2410_UFCON_RXTRIG12	  (2<<4) + +/* S3C2440 FIFO trigger levels */ +#define S3C2440_UFCON_RXTRIG1	  (0<<4) +#define S3C2440_UFCON_RXTRIG8	  (1<<4) +#define S3C2440_UFCON_RXTRIG16	  (2<<4) +#define S3C2440_UFCON_RXTRIG32	  (3<<4) + +#define S3C2440_UFCON_TXTRIG0	  (0<<6) +#define S3C2440_UFCON_TXTRIG16	  (1<<6) +#define S3C2440_UFCON_TXTRIG32	  (2<<6) +#define S3C2440_UFCON_TXTRIG48	  (3<<6) + +#define S3C2410_UFCON_RESETBOTH	  (3<<1) +#define S3C2410_UFCON_RESETTX	  (1<<2) +#define S3C2410_UFCON_RESETRX	  (1<<1) + +#define S3C2410_UFCON_DEFAULT	  (S3C2410_UFCON_FIFOMODE | \ +				   S3C2410_UFCON_TXTRIG0  | \ +				   S3C2410_UFCON_RXTRIG8 ) + +#define	S3C2410_UMCOM_AFC	  (1<<4) +#define	S3C2410_UMCOM_RTS_LOW	  (1<<0) + +#define S3C2412_UMCON_AFC_63	(0<<5)		/* same as s3c2443 */ +#define S3C2412_UMCON_AFC_56	(1<<5) +#define S3C2412_UMCON_AFC_48	(2<<5) +#define S3C2412_UMCON_AFC_40	(3<<5) +#define S3C2412_UMCON_AFC_32	(4<<5) +#define S3C2412_UMCON_AFC_24	(5<<5) +#define S3C2412_UMCON_AFC_16	(6<<5) +#define S3C2412_UMCON_AFC_8	(7<<5) + +#define S3C2410_UFSTAT_TXFULL	  (1<<9) +#define S3C2410_UFSTAT_RXFULL	  (1<<8) +#define S3C2410_UFSTAT_TXMASK	  (15<<4) +#define S3C2410_UFSTAT_TXSHIFT	  (4) +#define S3C2410_UFSTAT_RXMASK	  (15<<0) +#define S3C2410_UFSTAT_RXSHIFT	  (0) + +/* UFSTAT S3C2443 same as S3C2440 */ +#define S3C2440_UFSTAT_TXFULL	  (1<<14) +#define S3C2440_UFSTAT_RXFULL	  (1<<6) +#define S3C2440_UFSTAT_TXSHIFT	  (8) +#define S3C2440_UFSTAT_RXSHIFT	  (0) +#define S3C2440_UFSTAT_TXMASK	  (63<<8) +#define S3C2440_UFSTAT_RXMASK	  (63) + +#define S3C2410_UTRSTAT_TXE	  (1<<2) +#define S3C2410_UTRSTAT_TXFE	  (1<<1) +#define S3C2410_UTRSTAT_RXDR	  (1<<0) + +#define S3C2410_UERSTAT_OVERRUN	  (1<<0) +#define S3C2410_UERSTAT_FRAME	  (1<<2) +#define S3C2410_UERSTAT_BREAK	  (1<<3) +#define S3C2443_UERSTAT_PARITY	  (1<<1) + +#define S3C2410_UERSTAT_ANY	  (S3C2410_UERSTAT_OVERRUN | \ +				   S3C2410_UERSTAT_FRAME | \ +				   S3C2410_UERSTAT_BREAK) + +#define S3C2410_UMSTAT_CTS	  (1<<0) +#define S3C2410_UMSTAT_DeltaCTS	  (1<<2) + +#define S3C2443_DIVSLOT		  (0x2C) + +/* S3C64XX interrupt registers. */ +#define S3C64XX_UINTP		0x30 +#define S3C64XX_UINTSP		0x34 +#define S3C64XX_UINTM		0x38 + +#define S3C64XX_UINTM_RXD	(0) +#define S3C64XX_UINTM_TXD	(2) +#define S3C64XX_UINTM_RXD_MSK	(1 << S3C64XX_UINTM_RXD) +#define S3C64XX_UINTM_TXD_MSK	(1 << S3C64XX_UINTM_TXD) + +/* Following are specific to S5PV210 */ +#define S5PV210_UCON_CLKMASK	(1<<10) +#define S5PV210_UCON_CLKSHIFT	(10) +#define S5PV210_UCON_PCLK	(0<<10) +#define S5PV210_UCON_UCLK	(1<<10) + +#define S5PV210_UFCON_TXTRIG0	(0<<8) +#define S5PV210_UFCON_TXTRIG4	(1<<8) +#define S5PV210_UFCON_TXTRIG8	(2<<8) +#define S5PV210_UFCON_TXTRIG16	(3<<8) +#define S5PV210_UFCON_TXTRIG32	(4<<8) +#define S5PV210_UFCON_TXTRIG64	(5<<8) +#define S5PV210_UFCON_TXTRIG128 (6<<8) +#define S5PV210_UFCON_TXTRIG256 (7<<8) + +#define S5PV210_UFCON_RXTRIG1	(0<<4) +#define S5PV210_UFCON_RXTRIG4	(1<<4) +#define S5PV210_UFCON_RXTRIG8	(2<<4) +#define S5PV210_UFCON_RXTRIG16	(3<<4) +#define S5PV210_UFCON_RXTRIG32	(4<<4) +#define S5PV210_UFCON_RXTRIG64	(5<<4) +#define S5PV210_UFCON_RXTRIG128	(6<<4) +#define S5PV210_UFCON_RXTRIG256	(7<<4) + +#define S5PV210_UFSTAT_TXFULL	(1<<24) +#define S5PV210_UFSTAT_RXFULL	(1<<8) +#define S5PV210_UFSTAT_TXMASK	(255<<16) +#define S5PV210_UFSTAT_TXSHIFT	(16) +#define S5PV210_UFSTAT_RXMASK	(255<<0) +#define S5PV210_UFSTAT_RXSHIFT	(0) + +#define S3C2410_UCON_CLKSEL0	(1 << 0) +#define S3C2410_UCON_CLKSEL1	(1 << 1) +#define S3C2410_UCON_CLKSEL2	(1 << 2) +#define S3C2410_UCON_CLKSEL3	(1 << 3) + +/* Default values for s5pv210 UCON and UFCON uart registers */ +#define S5PV210_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\ +				 S3C2410_UCON_RXILEVEL |	\ +				 S3C2410_UCON_TXIRQMODE |	\ +				 S3C2410_UCON_RXIRQMODE |	\ +				 S3C2410_UCON_RXFIFO_TOI |	\ +				 S3C2443_UCON_RXERR_IRQEN) + +#define S5PV210_UFCON_DEFAULT	(S3C2410_UFCON_FIFOMODE |	\ +				 S5PV210_UFCON_TXTRIG4 |	\ +				 S5PV210_UFCON_RXTRIG4) + +#ifndef __ASSEMBLY__ + +/* configuration structure for per-machine configurations for the + * serial port + * + * the pointer is setup by the machine specific initialisation from the + * arch/arm/mach-s3c2410/ directory. +*/ + +struct s3c2410_uartcfg { +	unsigned char	   hwport;	 /* hardware port number */ +	unsigned char	   unused; +	unsigned short	   flags; +	upf_t		   uart_flags;	 /* default uart flags */ +	unsigned int	   clk_sel; + +	unsigned int	   has_fracval; + +	unsigned long	   ucon;	 /* value of ucon for port */ +	unsigned long	   ulcon;	 /* value of ulcon for port */ +	unsigned long	   ufcon;	 /* value of ufcon for port */ +}; + +#endif /* __ASSEMBLY__ */ + +#endif /* __ASM_ARM_REGS_SERIAL_H */ + diff --git a/include/linux/sh_eth.h b/include/linux/sh_eth.h index b17d765ded8..fc305713fc6 100644 --- a/include/linux/sh_eth.h +++ b/include/linux/sh_eth.h @@ -6,6 +6,7 @@  enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};  enum {  	SH_ETH_REG_GIGABIT, +	SH_ETH_REG_FAST_RCAR,  	SH_ETH_REG_FAST_SH4,  	SH_ETH_REG_FAST_SH3_SH2  }; diff --git a/include/linux/signal.h b/include/linux/signal.h index a2dcb94ea49..d897484730c 100644 --- a/include/linux/signal.h +++ b/include/linux/signal.h @@ -250,11 +250,11 @@ extern int show_unhandled_signals;  extern int sigsuspend(sigset_t *);  struct sigaction { -#ifndef __ARCH_HAS_ODD_SIGACTION +#ifndef __ARCH_HAS_IRIX_SIGACTION  	__sighandler_t	sa_handler;  	unsigned long	sa_flags;  #else -	unsigned long	sa_flags; +	unsigned int	sa_flags;  	__sighandler_t	sa_handler;  #endif  #ifdef __ARCH_HAS_SA_RESTORER @@ -434,4 +434,9 @@ void signals_init(void);  int restore_altstack(const stack_t __user *);  int __save_altstack(stack_t __user *, unsigned long); +#ifdef CONFIG_PROC_FS +struct seq_file; +extern void render_sigset_t(struct seq_file *, const char *, sigset_t *); +#endif +  #endif /* _LINUX_SIGNAL_H */ diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 441f5bfdab8..2e0ced1af3b 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -32,6 +32,7 @@  #include <linux/hrtimer.h>  #include <linux/dma-mapping.h>  #include <linux/netdev_features.h> +#include <net/flow_keys.h>  /* Don't change this without changing skb_csum_unnecessary! */  #define CHECKSUM_NONE 0 @@ -316,6 +317,8 @@ enum {  	SKB_GSO_FCOE = 1 << 5,  	SKB_GSO_GRE = 1 << 6, + +	SKB_GSO_UDP_TUNNEL = 1 << 7,  };  #if BITS_PER_LONG > 32 @@ -384,9 +387,11 @@ typedef unsigned char *sk_buff_data_t;   *	@secmark: security marking   *	@mark: Generic packet mark   *	@dropcount: total number of sk_receive_queue overflows + *	@vlan_proto: vlan encapsulation protocol   *	@vlan_tci: vlan tag control information   *	@inner_transport_header: Inner transport layer header (encapsulation)   *	@inner_network_header: Network layer header (encapsulation) + *	@inner_mac_header: Link layer header (encapsulation)   *	@transport_header: Transport layer header   *	@network_header: Network layer header   *	@mac_header: Link layer header @@ -461,6 +466,7 @@ struct sk_buff {  	__u32			rxhash; +	__be16			vlan_proto;  	__u16			vlan_tci;  #ifdef CONFIG_NET_SCHED @@ -505,6 +511,7 @@ struct sk_buff {  	sk_buff_data_t		inner_transport_header;  	sk_buff_data_t		inner_network_header; +	sk_buff_data_t		inner_mac_header;  	sk_buff_data_t		transport_header;  	sk_buff_data_t		network_header;  	sk_buff_data_t		mac_header; @@ -570,7 +577,40 @@ static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)  	skb->_skb_refdst = (unsigned long)dst;  } -extern void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst); +extern void __skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst, +				bool force); + +/** + * skb_dst_set_noref - sets skb dst, hopefully, without taking reference + * @skb: buffer + * @dst: dst entry + * + * Sets skb dst, assuming a reference was not taken on dst. + * If dst entry is cached, we do not take reference and dst_release + * will be avoided by refdst_drop. If dst entry is not cached, we take + * reference, so that last dst_release can destroy the dst immediately. + */ +static inline void skb_dst_set_noref(struct sk_buff *skb, struct dst_entry *dst) +{ +	__skb_dst_set_noref(skb, dst, false); +} + +/** + * skb_dst_set_noref_force - sets skb dst, without taking reference + * @skb: buffer + * @dst: dst entry + * + * Sets skb dst, assuming a reference was not taken on dst. + * No reference is taken and no dst_release will be called. While for + * cached dsts deferred reclaim is a basic feature, for entries that are + * not cached it is caller's job to guarantee that last dst_release for + * provided dst happens when nobody uses it, eg. after a RCU grace period. + */ +static inline void skb_dst_set_noref_force(struct sk_buff *skb, +					   struct dst_entry *dst) +{ +	__skb_dst_set_noref(skb, dst, true); +}  /**   * skb_dst_is_noref - Test if skb dst isn't refcounted @@ -611,6 +651,12 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,  	return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE);  } +extern struct sk_buff *__alloc_skb_head(gfp_t priority, int node); +static inline struct sk_buff *alloc_skb_head(gfp_t priority) +{ +	return __alloc_skb_head(priority, -1); +} +  extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);  extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);  extern struct sk_buff *skb_clone(struct sk_buff *skb, @@ -1471,6 +1517,7 @@ static inline void skb_reserve(struct sk_buff *skb, int len)  static inline void skb_reset_inner_headers(struct sk_buff *skb)  { +	skb->inner_mac_header = skb->mac_header;  	skb->inner_network_header = skb->network_header;  	skb->inner_transport_header = skb->transport_header;  } @@ -1516,6 +1563,22 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,  	skb->inner_network_header += offset;  } +static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) +{ +	return skb->head + skb->inner_mac_header; +} + +static inline void skb_reset_inner_mac_header(struct sk_buff *skb) +{ +	skb->inner_mac_header = skb->data - skb->head; +} + +static inline void skb_set_inner_mac_header(struct sk_buff *skb, +					    const int offset) +{ +	skb_reset_inner_mac_header(skb); +	skb->inner_mac_header += offset; +}  static inline bool skb_transport_header_was_set(const struct sk_buff *skb)  {  	return skb->transport_header != ~0U; @@ -1609,6 +1672,21 @@ static inline void skb_set_inner_network_header(struct sk_buff *skb,  	skb->inner_network_header = skb->data + offset;  } +static inline unsigned char *skb_inner_mac_header(const struct sk_buff *skb) +{ +	return skb->inner_mac_header; +} + +static inline void skb_reset_inner_mac_header(struct sk_buff *skb) +{ +	skb->inner_mac_header = skb->data; +} + +static inline void skb_set_inner_mac_header(struct sk_buff *skb, +						const int offset) +{ +	skb->inner_mac_header = skb->data + offset; +}  static inline bool skb_transport_header_was_set(const struct sk_buff *skb)  {  	return skb->transport_header != NULL; @@ -1666,6 +1744,19 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)  }  #endif /* NET_SKBUFF_DATA_USES_OFFSET */ +static inline void skb_probe_transport_header(struct sk_buff *skb, +					      const int offset_hint) +{ +	struct flow_keys keys; + +	if (skb_transport_header_was_set(skb)) +		return; +	else if (skb_flow_dissect(skb, &keys)) +		skb_set_transport_header(skb, keys.thoff); +	else +		skb_set_transport_header(skb, offset_hint); +} +  static inline void skb_mac_header_rebuild(struct sk_buff *skb)  {  	if (skb_mac_header_was_set(skb)) { @@ -2643,6 +2734,13 @@ static inline void nf_reset(struct sk_buff *skb)  #endif  } +static inline void nf_reset_trace(struct sk_buff *skb) +{ +#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) +	skb->nf_trace = 0; +#endif +} +  /* Note: This doesn't put any conntrack and bridge info in dst. */  static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)  { @@ -2804,6 +2902,8 @@ static inline void skb_checksum_none_assert(const struct sk_buff *skb)  bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); +u32 __skb_get_poff(const struct sk_buff *skb); +  /**   * skb_head_is_locked - Determine if the skb->head is locked down   * @skb: skb to check diff --git a/include/linux/smp.h b/include/linux/smp.h index 3e07a7df647..e6564c1dc55 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -20,7 +20,6 @@ struct call_single_data {  	smp_call_func_t func;  	void *info;  	u16 flags; -	u16 priv;  };  /* total number of cpus in this system (may exceed NR_CPUS) */ diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h index e8d702e0fd8..54f91d35e5f 100644 --- a/include/linux/sock_diag.h +++ b/include/linux/sock_diag.h @@ -1,6 +1,7 @@  #ifndef __SOCK_DIAG_H__  #define __SOCK_DIAG_H__ +#include <linux/user_namespace.h>  #include <uapi/linux/sock_diag.h>  struct sk_buff; @@ -22,5 +23,7 @@ int sock_diag_check_cookie(void *sk, __u32 *cookie);  void sock_diag_save_cookie(void *sk, __u32 *cookie);  int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr); +int sock_diag_put_filterinfo(struct user_namespace *user_ns, struct sock *sk, +			     struct sk_buff *skb, int attrtype);  #endif diff --git a/include/linux/socket.h b/include/linux/socket.h index 2b9f74b0ffe..428c37a1f95 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -298,6 +298,7 @@ struct ucred {  #define SOL_IUCV	277  #define SOL_CAIF	278  #define SOL_ALG		279 +#define SOL_NFC		280  /* IPX options */  #define IPX_TYPE	1 diff --git a/include/linux/spi/at86rf230.h b/include/linux/spi/at86rf230.h index b2b1afbb320..aa327a8105a 100644 --- a/include/linux/spi/at86rf230.h +++ b/include/linux/spi/at86rf230.h @@ -26,6 +26,20 @@ struct at86rf230_platform_data {  	int rstn;  	int slp_tr;  	int dig2; + +	/* Setting the irq_type will configure the driver to request +	 * the platform irq trigger type according to the given value +	 * and configure the interrupt polarity of the device to the +	 * corresponding polarity. +	 * +	 * Allowed values are: IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING, +	 *                     IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW +	 * +	 * Setting it to 0, the driver does not touch the trigger type +	 * configuration of the interrupt and sets the interrupt polarity +	 * of the device to high active (the default value). +	 */ +	int irq_type;  };  #endif diff --git a/include/linux/spi/spi-tegra.h b/include/linux/spi/spi-tegra.h deleted file mode 100644 index 786932c62ed..00000000000 --- a/include/linux/spi/spi-tegra.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * spi-tegra.h: SPI interface for Nvidia Tegra20 SLINK controller. - * - * Copyright (C) 2011 NVIDIA Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. - */ - -#ifndef _LINUX_SPI_TEGRA_H -#define _LINUX_SPI_TEGRA_H - -struct tegra_spi_platform_data { -	int dma_req_sel; -	unsigned int spi_max_frequency; -}; - -/* - * Controller data from device to pass some info like - * hw based chip select can be used or not and if yes - * then CS hold and setup time. - */ -struct tegra_spi_device_controller_data { -	bool is_hw_based_cs; -	int cs_setup_clk_count; -	int cs_hold_clk_count; -}; - -#endif /* _LINUX_SPI_TEGRA_H */ diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 38c2b925923..733eb5ee31c 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -228,6 +228,11 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)   *	every chipselect is connected to a slave.   * @dma_alignment: SPI controller constraint on DMA buffers alignment.   * @mode_bits: flags understood by this controller driver + * @bits_per_word_mask: A mask indicating which values of bits_per_word are + *	supported by the driver. Bit n indicates that a bits_per_word n+1 is + *	suported. If set, the SPI core will reject any transfer with an + *	unsupported bits_per_word. If not set, this value is simply ignored, + *	and it's up to the individual driver to perform any validation.   * @flags: other constraints relevant to this driver   * @bus_lock_spinlock: spinlock for SPI bus locking   * @bus_lock_mutex: mutex for SPI bus locking @@ -301,6 +306,9 @@ struct spi_master {  	/* spi_device.mode flags understood by this controller driver */  	u16			mode_bits; +	/* bitmask of supported bits_per_word for transfers */ +	u32			bits_per_word_mask; +  	/* other constraints relevant to this driver */  	u16			flags;  #define SPI_MASTER_HALF_DUPLEX	BIT(0)		/* can't do full duplex */ diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h index a26e2fb604e..e2369c167db 100644 --- a/include/linux/spinlock_up.h +++ b/include/linux/spinlock_up.h @@ -16,7 +16,10 @@   * In the debug case, 1 means unlocked, 0 means locked. (the values   * are inverted, to catch initialization bugs)   * - * No atomicity anywhere, we are on UP. + * No atomicity anywhere, we are on UP. However, we still need + * the compiler barriers, because we do not want the compiler to + * move potentially faulting instructions (notably user accesses) + * into the locked sequence, resulting in non-atomic execution.   */  #ifdef CONFIG_DEBUG_SPINLOCK @@ -25,6 +28,7 @@  static inline void arch_spin_lock(arch_spinlock_t *lock)  {  	lock->slock = 0; +	barrier();  }  static inline void @@ -32,6 +36,7 @@ arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags)  {  	local_irq_save(flags);  	lock->slock = 0; +	barrier();  }  static inline int arch_spin_trylock(arch_spinlock_t *lock) @@ -39,32 +44,34 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)  	char oldval = lock->slock;  	lock->slock = 0; +	barrier();  	return oldval > 0;  }  static inline void arch_spin_unlock(arch_spinlock_t *lock)  { +	barrier();  	lock->slock = 1;  }  /*   * Read-write spinlocks. No debug version.   */ -#define arch_read_lock(lock)		do { (void)(lock); } while (0) -#define arch_write_lock(lock)		do { (void)(lock); } while (0) -#define arch_read_trylock(lock)	({ (void)(lock); 1; }) -#define arch_write_trylock(lock)	({ (void)(lock); 1; }) -#define arch_read_unlock(lock)		do { (void)(lock); } while (0) -#define arch_write_unlock(lock)	do { (void)(lock); } while (0) +#define arch_read_lock(lock)		do { barrier(); (void)(lock); } while (0) +#define arch_write_lock(lock)		do { barrier(); (void)(lock); } while (0) +#define arch_read_trylock(lock)	({ barrier(); (void)(lock); 1; }) +#define arch_write_trylock(lock)	({ barrier(); (void)(lock); 1; }) +#define arch_read_unlock(lock)		do { barrier(); (void)(lock); } while (0) +#define arch_write_unlock(lock)	do { barrier(); (void)(lock); } while (0)  #else /* DEBUG_SPINLOCK */  #define arch_spin_is_locked(lock)	((void)(lock), 0)  /* for sched.c and kernel_lock.c: */ -# define arch_spin_lock(lock)		do { (void)(lock); } while (0) -# define arch_spin_lock_flags(lock, flags)	do { (void)(lock); } while (0) -# define arch_spin_unlock(lock)	do { (void)(lock); } while (0) -# define arch_spin_trylock(lock)	({ (void)(lock); 1; }) +# define arch_spin_lock(lock)		do { barrier(); (void)(lock); } while (0) +# define arch_spin_lock_flags(lock, flags)	do { barrier(); (void)(lock); } while (0) +# define arch_spin_unlock(lock)	do { barrier(); (void)(lock); } while (0) +# define arch_spin_trylock(lock)	({ barrier(); (void)(lock); 1; })  #endif /* DEBUG_SPINLOCK */  #define arch_spin_is_contended(lock)	(((void)(lock), 0)) diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 22958d68ecf..c64999fd166 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -26,9 +26,9 @@ struct ssb_sprom_core_pwr_info {  struct ssb_sprom {  	u8 revision; -	u8 il0mac[6];		/* MAC address for 802.11b/g */ -	u8 et0mac[6];		/* MAC address for Ethernet */ -	u8 et1mac[6];		/* MAC address for 802.11a */ +	u8 il0mac[6] __aligned(sizeof(u16));	/* MAC address for 802.11b/g */ +	u8 et0mac[6] __aligned(sizeof(u16));	/* MAC address for Ethernet */ +	u8 et1mac[6] __aligned(sizeof(u16));	/* MAC address for 802.11a */  	u8 et0phyaddr;		/* MII address for enet0 */  	u8 et1phyaddr;		/* MII address for enet1 */  	u8 et0mdcport;		/* MDIO for enet0 */ @@ -340,13 +340,61 @@ enum ssb_bustype {  #define SSB_BOARDVENDOR_DELL	0x1028	/* Dell */  #define SSB_BOARDVENDOR_HP	0x0E11	/* HP */  /* board_type */ +#define SSB_BOARD_BCM94301CB	0x0406 +#define SSB_BOARD_BCM94301MP	0x0407 +#define SSB_BOARD_BU4309	0x040A +#define SSB_BOARD_BCM94309CB	0x040B +#define SSB_BOARD_BCM4309MP	0x040C +#define SSB_BOARD_BU4306	0x0416  #define SSB_BOARD_BCM94306MP	0x0418  #define SSB_BOARD_BCM4309G	0x0421  #define SSB_BOARD_BCM4306CB	0x0417 -#define SSB_BOARD_BCM4309MP	0x040C +#define SSB_BOARD_BCM94306PC	0x0425	/* pcmcia 3.3v 4306 card */ +#define SSB_BOARD_BCM94306CBSG	0x042B	/* with SiGe PA */ +#define SSB_BOARD_PCSG94306	0x042D	/* with SiGe PA */ +#define SSB_BOARD_BU4704SD	0x042E	/* with sdram */ +#define SSB_BOARD_BCM94704AGR	0x042F	/* dual 11a/11g Router */ +#define SSB_BOARD_BCM94308MP	0x0430	/* 11a-only minipci */ +#define SSB_BOARD_BU4318	0x0447 +#define SSB_BOARD_CB4318	0x0448 +#define SSB_BOARD_MPG4318	0x0449  #define SSB_BOARD_MP4318	0x044A -#define SSB_BOARD_BU4306	0x0416 -#define SSB_BOARD_BU4309	0x040A +#define SSB_BOARD_SD4318	0x044B +#define SSB_BOARD_BCM94306P	0x044C	/* with SiGe */ +#define SSB_BOARD_BCM94303MP	0x044E +#define SSB_BOARD_BCM94306MPM	0x0450 +#define SSB_BOARD_BCM94306MPL	0x0453 +#define SSB_BOARD_PC4303	0x0454	/* pcmcia */ +#define SSB_BOARD_BCM94306MPLNA	0x0457 +#define SSB_BOARD_BCM94306MPH	0x045B +#define SSB_BOARD_BCM94306PCIV	0x045C +#define SSB_BOARD_BCM94318MPGH	0x0463 +#define SSB_BOARD_BU4311	0x0464 +#define SSB_BOARD_BCM94311MC	0x0465 +#define SSB_BOARD_BCM94311MCAG	0x0466 +/* 4321 boards */ +#define SSB_BOARD_BU4321	0x046B +#define SSB_BOARD_BU4321E	0x047C +#define SSB_BOARD_MP4321	0x046C +#define SSB_BOARD_CB2_4321	0x046D +#define SSB_BOARD_CB2_4321_AG	0x0066 +#define SSB_BOARD_MC4321	0x046E +/* 4325 boards */ +#define SSB_BOARD_BCM94325DEVBU	0x0490 +#define SSB_BOARD_BCM94325BGABU	0x0491 +#define SSB_BOARD_BCM94325SDGWB	0x0492 +#define SSB_BOARD_BCM94325SDGMDL	0x04AA +#define SSB_BOARD_BCM94325SDGMDL2	0x04C6 +#define SSB_BOARD_BCM94325SDGMDL3	0x04C9 +#define SSB_BOARD_BCM94325SDABGWBA	0x04E1 +/* 4322 boards */ +#define SSB_BOARD_BCM94322MC	0x04A4 +#define SSB_BOARD_BCM94322USB	0x04A8	/* dualband */ +#define SSB_BOARD_BCM94322HM	0x04B0 +#define SSB_BOARD_BCM94322USB2D	0x04Bf	/* single band discrete front end */ +/* 4312 boards */ +#define SSB_BOARD_BU4312	0x048A +#define SSB_BOARD_BCM4312MCGSG	0x04B5  /* chip_package */  #define SSB_CHIPPACK_BCM4712S	1	/* Small 200pin 4712 */  #define SSB_CHIPPACK_BCM4712M	2	/* Medium 225pin 4712 */ diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h index 9e492be5244..6fcfe99bd99 100644 --- a/include/linux/ssb/ssb_driver_chipcommon.h +++ b/include/linux/ssb/ssb_driver_chipcommon.h @@ -219,6 +219,7 @@  #define SSB_CHIPCO_PMU_CTL			0x0600 /* PMU control */  #define  SSB_CHIPCO_PMU_CTL_ILP_DIV		0xFFFF0000 /* ILP div mask */  #define  SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT	16 +#define  SSB_CHIPCO_PMU_CTL_PLL_UPD		0x00000400  #define  SSB_CHIPCO_PMU_CTL_NOILPONW		0x00000200 /* No ILP on wait */  #define  SSB_CHIPCO_PMU_CTL_HTREQEN		0x00000100 /* HT req enable */  #define  SSB_CHIPCO_PMU_CTL_ALPREQEN		0x00000080 /* ALP req enable */ @@ -667,5 +668,6 @@ enum ssb_pmu_ldo_volt_id {  void ssb_pmu_set_ldo_voltage(struct ssb_chipcommon *cc,  			     enum ssb_pmu_ldo_volt_id id, u32 voltage);  void ssb_pmu_set_ldo_paref(struct ssb_chipcommon *cc, bool on); +void ssb_pmu_spuravoid_pllupdate(struct ssb_chipcommon *cc, int spuravoid);  #endif /* LINUX_SSB_CHIPCO_H_ */ diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index 6ecfa02ddba..3a7256955b1 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h @@ -289,11 +289,11 @@  #define  SSB_SPROM4_ETHPHY_ET1A_SHIFT	5  #define  SSB_SPROM4_ETHPHY_ET0M		(1<<14)	/* MDIO for enet0 */  #define  SSB_SPROM4_ETHPHY_ET1M		(1<<15)	/* MDIO for enet1 */ -#define SSB_SPROM4_ANTAVAIL		0x005D  /* Antenna available bitfields */ -#define  SSB_SPROM4_ANTAVAIL_A		0x00FF	/* A-PHY bitfield */ -#define  SSB_SPROM4_ANTAVAIL_A_SHIFT	0 -#define  SSB_SPROM4_ANTAVAIL_BG		0xFF00	/* B-PHY and G-PHY bitfield */ -#define  SSB_SPROM4_ANTAVAIL_BG_SHIFT	8 +#define SSB_SPROM4_ANTAVAIL		0x005C  /* Antenna available bitfields */ +#define  SSB_SPROM4_ANTAVAIL_BG		0x00FF	/* B-PHY and G-PHY bitfield */ +#define  SSB_SPROM4_ANTAVAIL_BG_SHIFT	0 +#define  SSB_SPROM4_ANTAVAIL_A		0xFF00	/* A-PHY bitfield */ +#define  SSB_SPROM4_ANTAVAIL_A_SHIFT	8  #define SSB_SPROM4_AGAIN01		0x005E	/* Antenna Gain (in dBm Q5.2) */  #define  SSB_SPROM4_AGAIN0		0x00FF	/* Antenna 0 */  #define  SSB_SPROM4_AGAIN0_SHIFT	0 diff --git a/include/linux/ssbi.h b/include/linux/ssbi.h new file mode 100644 index 00000000000..44ef5da2147 --- /dev/null +++ b/include/linux/ssbi.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2010 Google, Inc. + * Copyright (c) 2011, Code Aurora Forum. All rights reserved. + * Author: Dima Zavin <dima@android.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#ifndef _LINUX_SSBI_H +#define _LINUX_SSBI_H + +#include <linux/types.h> + +struct ssbi_slave_info { +	const char	*name; +	void		*platform_data; +}; + +enum ssbi_controller_type { +	MSM_SBI_CTRL_SSBI = 0, +	MSM_SBI_CTRL_SSBI2, +	MSM_SBI_CTRL_PMIC_ARBITER, +}; + +struct ssbi_platform_data { +	struct ssbi_slave_info	slave; +	enum ssbi_controller_type controller_type; +}; + +int ssbi_write(struct device *dev, u16 addr, u8 *buf, int len); +int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len); +#endif diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index a3eb2f65b65..3eeee9672a4 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -13,4 +13,62 @@ enum string_size_units {  int string_get_size(u64 size, enum string_size_units units,  		    char *buf, int len); +#define UNESCAPE_SPACE		0x01 +#define UNESCAPE_OCTAL		0x02 +#define UNESCAPE_HEX		0x04 +#define UNESCAPE_SPECIAL	0x08 +#define UNESCAPE_ANY		\ +	(UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL) + +/** + * string_unescape - unquote characters in the given string + * @src:	source buffer (escaped) + * @dst:	destination buffer (unescaped) + * @size:	size of the destination buffer (0 to unlimit) + * @flags:	combination of the flags (bitwise OR): + *	%UNESCAPE_SPACE: + *		'\f' - form feed + *		'\n' - new line + *		'\r' - carriage return + *		'\t' - horizontal tab + *		'\v' - vertical tab + *	%UNESCAPE_OCTAL: + *		'\NNN' - byte with octal value NNN (1 to 3 digits) + *	%UNESCAPE_HEX: + *		'\xHH' - byte with hexadecimal value HH (1 to 2 digits) + *	%UNESCAPE_SPECIAL: + *		'\"' - double quote + *		'\\' - backslash + *		'\a' - alert (BEL) + *		'\e' - escape + *	%UNESCAPE_ANY: + *		all previous together + * + * Returns amount of characters processed to the destination buffer excluding + * trailing '\0'. + * + * Because the size of the output will be the same as or less than the size of + * the input, the transformation may be performed in place. + * + * Caller must provide valid source and destination pointers. Be aware that + * destination buffer will always be NULL-terminated. Source string must be + * NULL-terminated as well. + */ +int string_unescape(char *src, char *dst, size_t size, unsigned int flags); + +static inline int string_unescape_inplace(char *buf, unsigned int flags) +{ +	return string_unescape(buf, buf, 0, flags); +} + +static inline int string_unescape_any(char *src, char *dst, size_t size) +{ +	return string_unescape(src, dst, size, UNESCAPE_ANY); +} + +static inline int string_unescape_any_inplace(char *buf) +{ +	return string_unescape_any(buf, buf, 0); +} +  #endif diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index 58fda1c3c78..0dd00f4f681 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h @@ -22,6 +22,8 @@  /* size of the nodename buffer */  #define UNX_MAXNODENAME	32 +struct rpcsec_gss_info; +  /* Work around the lack of a VFS credential */  struct auth_cred {  	kuid_t	uid; @@ -103,6 +105,9 @@ struct rpc_authops {  	int			(*pipes_create)(struct rpc_auth *);  	void			(*pipes_destroy)(struct rpc_auth *);  	int			(*list_pseudoflavors)(rpc_authflavor_t *, int); +	rpc_authflavor_t	(*info2flavor)(struct rpcsec_gss_info *); +	int			(*flavor2info)(rpc_authflavor_t, +						struct rpcsec_gss_info *);  };  struct rpc_credops { @@ -137,6 +142,10 @@ int			rpcauth_register(const struct rpc_authops *);  int			rpcauth_unregister(const struct rpc_authops *);  struct rpc_auth *	rpcauth_create(rpc_authflavor_t, struct rpc_clnt *);  void			rpcauth_release(struct rpc_auth *); +rpc_authflavor_t	rpcauth_get_pseudoflavor(rpc_authflavor_t, +				struct rpcsec_gss_info *); +int			rpcauth_get_gssinfo(rpc_authflavor_t, +				struct rpcsec_gss_info *);  int			rpcauth_list_flavors(rpc_authflavor_t *, int);  struct rpc_cred *	rpcauth_lookup_credcache(struct rpc_auth *, struct auth_cred *, int);  void			rpcauth_init_cred(struct rpc_cred *, const struct auth_cred *, struct rpc_auth *, const struct rpc_credops *); diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 2cf4ffaa3cd..e7d492ce7c1 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -124,6 +124,7 @@ struct rpc_create_args {  #define RPC_CLNT_CREATE_NOPING		(1UL << 4)  #define RPC_CLNT_CREATE_DISCRTRY	(1UL << 5)  #define RPC_CLNT_CREATE_QUIET		(1UL << 6) +#define RPC_CLNT_CREATE_INFINITE_SLOTS	(1UL << 7)  struct rpc_clnt *rpc_create(struct rpc_create_args *args);  struct rpc_clnt	*rpc_bind_new_program(struct rpc_clnt *, diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h index a19e2547ae6..f32b7a47e13 100644 --- a/include/linux/sunrpc/gss_api.h +++ b/include/linux/sunrpc/gss_api.h @@ -25,10 +25,21 @@ struct gss_ctx {  #define GSS_C_NO_BUFFER		((struct xdr_netobj) 0)  #define GSS_C_NO_CONTEXT	((struct gss_ctx *) 0) -#define GSS_C_NULL_OID		((struct xdr_netobj) 0) +#define GSS_C_QOP_DEFAULT	(0)  /*XXX  arbitrary length - is this set somewhere? */  #define GSS_OID_MAX_LEN 32 +struct rpcsec_gss_oid { +	unsigned int	len; +	u8		data[GSS_OID_MAX_LEN]; +}; + +/* From RFC 3530 */ +struct rpcsec_gss_info { +	struct rpcsec_gss_oid	oid; +	u32			qop; +	u32			service; +};  /* gss-api prototypes; note that these are somewhat simplified versions of   * the prototypes specified in RFC 2744. */ @@ -58,12 +69,14 @@ u32 gss_unwrap(  u32 gss_delete_sec_context(  		struct gss_ctx		**ctx_id); -u32 gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 service); +rpc_authflavor_t gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 qop, +					u32 service);  u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor);  char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service);  struct pf_desc {  	u32	pseudoflavor; +	u32	qop;  	u32	service;  	char	*name;  	char	*auth_domain_name; @@ -76,7 +89,7 @@ struct pf_desc {  struct gss_api_mech {  	struct list_head	gm_list;  	struct module		*gm_owner; -	struct xdr_netobj	gm_oid; +	struct rpcsec_gss_oid	gm_oid;  	char			*gm_name;  	const struct gss_api_ops *gm_ops;  	/* pseudoflavors supported by this mechanism: */ @@ -117,9 +130,11 @@ struct gss_api_ops {  int gss_mech_register(struct gss_api_mech *);  void gss_mech_unregister(struct gss_api_mech *); -/* returns a mechanism descriptor given an OID, and increments the mechanism's - * reference count. */ -struct gss_api_mech * gss_mech_get_by_OID(struct xdr_netobj *); +/* Given a GSS security tuple, look up a pseudoflavor */ +rpc_authflavor_t gss_mech_info2flavor(struct rpcsec_gss_info *); + +/* Given a pseudoflavor, look up a GSS security tuple */ +int gss_mech_flavor2info(rpc_authflavor_t, struct rpcsec_gss_info *);  /* Returns a reference to a mechanism, given a name like "krb5" etc. */  struct gss_api_mech *gss_mech_get_by_name(const char *); @@ -130,9 +145,6 @@ struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);  /* Fill in an array with a list of supported pseudoflavors */  int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); -/* Just increments the mechanism's reference count and returns its input: */ -struct gss_api_mech * gss_mech_get(struct gss_api_mech *); -  /* For every successful gss_mech_get or gss_mech_get_by_* call there must be a   * corresponding call to gss_mech_put. */  void gss_mech_put(struct gss_api_mech *); diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 30834be0301..ff5392421cb 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -255,6 +255,8 @@ static inline int bc_prealloc(struct rpc_rqst *req)  }  #endif /* CONFIG_SUNRPC_BACKCHANNEL */ +#define XPRT_CREATE_INFINITE_SLOTS	(1U) +  struct xprt_create {  	int			ident;		/* XPRT_TRANSPORT identifier */  	struct net *		net; @@ -263,6 +265,7 @@ struct xprt_create {  	size_t			addrlen;  	const char		*servername;  	struct svc_xprt		*bc_xprt;	/* NFSv4.1 backchannel */ +	unsigned int		flags;  };  struct xprt_class { @@ -279,6 +282,7 @@ struct xprt_class {  struct rpc_xprt		*xprt_create_transport(struct xprt_create *args);  void			xprt_connect(struct rpc_task *task);  void			xprt_reserve(struct rpc_task *task); +void			xprt_retry_reserve(struct rpc_task *task);  int			xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task);  int			xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);  void			xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); @@ -334,6 +338,7 @@ int			xs_swapper(struct rpc_xprt *xprt, int enable);  #define XPRT_CLOSING		(6)  #define XPRT_CONNECTION_ABORT	(7)  #define XPRT_CONNECTION_CLOSE	(8) +#define XPRT_CONGESTED		(9)  static inline void xprt_set_connected(struct rpc_xprt *xprt)  { diff --git a/include/linux/swap.h b/include/linux/swap.h index 2818a123f3e..1701ce4be74 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -236,7 +236,7 @@ extern unsigned long nr_free_pagecache_pages(void);  extern void __lru_cache_add(struct page *, enum lru_list lru);  extern void lru_cache_add_lru(struct page *, enum lru_list lru);  extern void lru_add_page_tail(struct page *page, struct page *page_tail, -			      struct lruvec *lruvec); +			 struct lruvec *lruvec, struct list_head *head);  extern void activate_page(struct page *);  extern void mark_page_accessed(struct page *);  extern void lru_add_drain(void); @@ -330,6 +330,9 @@ static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)  /* linux/mm/page_io.c */  extern int swap_readpage(struct page *);  extern int swap_writepage(struct page *page, struct writeback_control *wbc); +extern void end_swap_bio_write(struct bio *bio, int err); +extern int __swap_writepage(struct page *page, struct writeback_control *wbc, +	void (*end_write_func)(struct bio *, int));  extern int swap_set_page_dirty(struct page *page);  extern void end_swap_bio_read(struct bio *bio, int err); @@ -343,8 +346,9 @@ extern struct address_space swapper_spaces[];  #define swap_address_space(entry) (&swapper_spaces[swp_type(entry)])  extern unsigned long total_swapcache_pages(void);  extern void show_swap_cache_info(void); -extern int add_to_swap(struct page *); +extern int add_to_swap(struct page *, struct list_head *list);  extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); +extern int __add_to_swap_cache(struct page *page, swp_entry_t entry);  extern void __delete_from_swap_cache(struct page *);  extern void delete_from_swap_cache(struct page *);  extern void free_page_and_swap_cache(struct page *); @@ -461,7 +465,7 @@ static inline struct page *lookup_swap_cache(swp_entry_t swp)  	return NULL;  } -static inline int add_to_swap(struct page *page) +static inline int add_to_swap(struct page *page, struct list_head *list)  {  	return 0;  } diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 2de42f9401d..a5ffd32642f 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h @@ -25,6 +25,7 @@ extern int swiotlb_force;  extern void swiotlb_init(int verbose);  int swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);  extern unsigned long swiotlb_nr_tbl(void); +unsigned long swiotlb_size_or_default(void);  extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);  /* diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 313a8e0a655..4147d700a29 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -78,49 +78,34 @@ struct sigaltstack;  #include <linux/key.h>  #include <trace/syscall.h> -#define __SC_DECL1(t1, a1)	t1 a1 -#define __SC_DECL2(t2, a2, ...) t2 a2, __SC_DECL1(__VA_ARGS__) -#define __SC_DECL3(t3, a3, ...) t3 a3, __SC_DECL2(__VA_ARGS__) -#define __SC_DECL4(t4, a4, ...) t4 a4, __SC_DECL3(__VA_ARGS__) -#define __SC_DECL5(t5, a5, ...) t5 a5, __SC_DECL4(__VA_ARGS__) -#define __SC_DECL6(t6, a6, ...) t6 a6, __SC_DECL5(__VA_ARGS__) - -#define __SC_LONG1(t1, a1) 	long a1 -#define __SC_LONG2(t2, a2, ...) long a2, __SC_LONG1(__VA_ARGS__) -#define __SC_LONG3(t3, a3, ...) long a3, __SC_LONG2(__VA_ARGS__) -#define __SC_LONG4(t4, a4, ...) long a4, __SC_LONG3(__VA_ARGS__) -#define __SC_LONG5(t5, a5, ...) long a5, __SC_LONG4(__VA_ARGS__) -#define __SC_LONG6(t6, a6, ...) long a6, __SC_LONG5(__VA_ARGS__) - -#define __SC_CAST1(t1, a1)	(t1) a1 -#define __SC_CAST2(t2, a2, ...) (t2) a2, __SC_CAST1(__VA_ARGS__) -#define __SC_CAST3(t3, a3, ...) (t3) a3, __SC_CAST2(__VA_ARGS__) -#define __SC_CAST4(t4, a4, ...) (t4) a4, __SC_CAST3(__VA_ARGS__) -#define __SC_CAST5(t5, a5, ...) (t5) a5, __SC_CAST4(__VA_ARGS__) -#define __SC_CAST6(t6, a6, ...) (t6) a6, __SC_CAST5(__VA_ARGS__) +/* + * __MAP - apply a macro to syscall arguments + * __MAP(n, m, t1, a1, t2, a2, ..., tn, an) will expand to + *    m(t1, a1), m(t2, a2), ..., m(tn, an) + * The first argument must be equal to the amount of type/name + * pairs given.  Note that this list of pairs (i.e. the arguments + * of __MAP starting at the third one) is in the same format as + * for SYSCALL_DEFINE<n>/COMPAT_SYSCALL_DEFINE<n> + */ +#define __MAP0(m,...) +#define __MAP1(m,t,a) m(t,a) +#define __MAP2(m,t,a,...) m(t,a), __MAP1(m,__VA_ARGS__) +#define __MAP3(m,t,a,...) m(t,a), __MAP2(m,__VA_ARGS__) +#define __MAP4(m,t,a,...) m(t,a), __MAP3(m,__VA_ARGS__) +#define __MAP5(m,t,a,...) m(t,a), __MAP4(m,__VA_ARGS__) +#define __MAP6(m,t,a,...) m(t,a), __MAP5(m,__VA_ARGS__) +#define __MAP(n,...) __MAP##n(__VA_ARGS__) -#define __SC_TEST(type)		BUILD_BUG_ON(sizeof(type) > sizeof(long)) -#define __SC_TEST1(t1, a1)	__SC_TEST(t1) -#define __SC_TEST2(t2, a2, ...)	__SC_TEST(t2); __SC_TEST1(__VA_ARGS__) -#define __SC_TEST3(t3, a3, ...)	__SC_TEST(t3); __SC_TEST2(__VA_ARGS__) -#define __SC_TEST4(t4, a4, ...)	__SC_TEST(t4); __SC_TEST3(__VA_ARGS__) -#define __SC_TEST5(t5, a5, ...)	__SC_TEST(t5); __SC_TEST4(__VA_ARGS__) -#define __SC_TEST6(t6, a6, ...)	__SC_TEST(t6); __SC_TEST5(__VA_ARGS__) +#define __SC_DECL(t, a)	t a +#define __TYPE_IS_LL(t) (__same_type((t)0, 0LL) || __same_type((t)0, 0ULL)) +#define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a +#define __SC_CAST(t, a)	(t) a +#define __SC_ARGS(t, a)	a +#define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long))  #ifdef CONFIG_FTRACE_SYSCALLS -#define __SC_STR_ADECL1(t, a)		#a -#define __SC_STR_ADECL2(t, a, ...)	#a, __SC_STR_ADECL1(__VA_ARGS__) -#define __SC_STR_ADECL3(t, a, ...)	#a, __SC_STR_ADECL2(__VA_ARGS__) -#define __SC_STR_ADECL4(t, a, ...)	#a, __SC_STR_ADECL3(__VA_ARGS__) -#define __SC_STR_ADECL5(t, a, ...)	#a, __SC_STR_ADECL4(__VA_ARGS__) -#define __SC_STR_ADECL6(t, a, ...)	#a, __SC_STR_ADECL5(__VA_ARGS__) - -#define __SC_STR_TDECL1(t, a)		#t -#define __SC_STR_TDECL2(t, a, ...)	#t, __SC_STR_TDECL1(__VA_ARGS__) -#define __SC_STR_TDECL3(t, a, ...)	#t, __SC_STR_TDECL2(__VA_ARGS__) -#define __SC_STR_TDECL4(t, a, ...)	#t, __SC_STR_TDECL3(__VA_ARGS__) -#define __SC_STR_TDECL5(t, a, ...)	#t, __SC_STR_TDECL4(__VA_ARGS__) -#define __SC_STR_TDECL6(t, a, ...)	#t, __SC_STR_TDECL5(__VA_ARGS__) +#define __SC_STR_ADECL(t, a)	#a +#define __SC_STR_TDECL(t, a)	#t  extern struct ftrace_event_class event_class_syscall_enter;  extern struct ftrace_event_class event_class_syscall_exit; @@ -155,7 +140,13 @@ extern struct trace_event_functions exit_syscall_print_funcs;  	  __attribute__((section("_ftrace_events")))			\  	*__event_exit_##sname = &event_exit_##sname; -#define SYSCALL_METADATA(sname, nb)				\ +#define SYSCALL_METADATA(sname, nb, ...)			\ +	static const char *types_##sname[] = {			\ +		__MAP(nb,__SC_STR_TDECL,__VA_ARGS__)		\ +	};							\ +	static const char *args_##sname[] = {			\ +		__MAP(nb,__SC_STR_ADECL,__VA_ARGS__)		\ +	};							\  	SYSCALL_TRACE_ENTER_EVENT(sname);			\  	SYSCALL_TRACE_EXIT_EVENT(sname);			\  	static struct syscall_metadata __used			\ @@ -163,8 +154,8 @@ extern struct trace_event_functions exit_syscall_print_funcs;  		.name 		= "sys"#sname,			\  		.syscall_nr	= -1,	/* Filled in at boot */	\  		.nb_args 	= nb,				\ -		.types		= types_##sname,		\ -		.args		= args_##sname,			\ +		.types		= nb ? types_##sname : NULL,	\ +		.args		= nb ? args_##sname : NULL,	\  		.enter_event	= &event_enter_##sname,		\  		.exit_event	= &event_exit_##sname,		\  		.enter_fields	= LIST_HEAD_INIT(__syscall_meta_##sname.enter_fields), \ @@ -172,26 +163,13 @@ extern struct trace_event_functions exit_syscall_print_funcs;  	static struct syscall_metadata __used			\  	  __attribute__((section("__syscalls_metadata")))	\  	 *__p_syscall_meta_##sname = &__syscall_meta_##sname; +#else +#define SYSCALL_METADATA(sname, nb, ...) +#endif  #define SYSCALL_DEFINE0(sname)					\ -	SYSCALL_TRACE_ENTER_EVENT(_##sname);			\ -	SYSCALL_TRACE_EXIT_EVENT(_##sname);			\ -	static struct syscall_metadata __used			\ -	  __syscall_meta__##sname = {				\ -		.name 		= "sys_"#sname,			\ -		.syscall_nr	= -1,	/* Filled in at boot */	\ -		.nb_args 	= 0,				\ -		.enter_event	= &event_enter__##sname,	\ -		.exit_event	= &event_exit__##sname,		\ -		.enter_fields	= LIST_HEAD_INIT(__syscall_meta__##sname.enter_fields), \ -	};							\ -	static struct syscall_metadata __used			\ -	  __attribute__((section("__syscalls_metadata")))	\ -	 *__p_syscall_meta_##sname = &__syscall_meta__##sname;	\ +	SYSCALL_METADATA(_##sname, 0);				\  	asmlinkage long sys_##sname(void) -#else -#define SYSCALL_DEFINE0(name)	   asmlinkage long sys_##name(void) -#endif  #define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)  #define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__) @@ -200,57 +178,23 @@ extern struct trace_event_functions exit_syscall_print_funcs;  #define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)  #define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__) -#ifdef CONFIG_PPC64 -#define SYSCALL_ALIAS(alias, name)					\ -	asm ("\t.globl " #alias "\n\t.set " #alias ", " #name "\n"	\ -	     "\t.globl ." #alias "\n\t.set ." #alias ", ." #name) -#else -#if defined(CONFIG_ALPHA) || defined(CONFIG_MIPS) -#define SYSCALL_ALIAS(alias, name)					\ -	asm ( #alias " = " #name "\n\t.globl " #alias) -#else -#define SYSCALL_ALIAS(alias, name)					\ -	asm ("\t.globl " #alias "\n\t.set " #alias ", " #name) -#endif -#endif - -#ifdef CONFIG_FTRACE_SYSCALLS  #define SYSCALL_DEFINEx(x, sname, ...)				\ -	static const char *types_##sname[] = {			\ -		__SC_STR_TDECL##x(__VA_ARGS__)			\ -	};							\ -	static const char *args_##sname[] = {			\ -		__SC_STR_ADECL##x(__VA_ARGS__)			\ -	};							\ -	SYSCALL_METADATA(sname, x);				\ +	SYSCALL_METADATA(sname, x, __VA_ARGS__)			\  	__SYSCALL_DEFINEx(x, sname, __VA_ARGS__) -#else -#define SYSCALL_DEFINEx(x, sname, ...)				\ -	__SYSCALL_DEFINEx(x, sname, __VA_ARGS__) -#endif - -#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS - -#define SYSCALL_DEFINE(name) static inline long SYSC_##name +#define __PROTECT(...) asmlinkage_protect(__VA_ARGS__)  #define __SYSCALL_DEFINEx(x, name, ...)					\ -	asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__));		\ -	static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__));	\ -	asmlinkage long SyS##name(__SC_LONG##x(__VA_ARGS__))		\ +	asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));	\ +	static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__));	\ +	asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__))	\  	{								\ -		__SC_TEST##x(__VA_ARGS__);				\ -		return (long) SYSC##name(__SC_CAST##x(__VA_ARGS__));	\ +		long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__));	\ +		__MAP(x,__SC_TEST,__VA_ARGS__);				\ +		__PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__));	\ +		return ret;						\  	}								\  	SYSCALL_ALIAS(sys##name, SyS##name);				\ -	static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__)) - -#else /* CONFIG_HAVE_SYSCALL_WRAPPERS */ - -#define SYSCALL_DEFINE(name) asmlinkage long sys_##name -#define __SYSCALL_DEFINEx(x, name, ...)					\ -	asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__)) - -#endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */ +	static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__))  asmlinkage long sys_time(time_t __user *tloc);  asmlinkage long sys_stime(time_t __user *tptr); @@ -694,7 +638,7 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf);  asmlinkage long sys_semget(key_t key, int nsems, int semflg);  asmlinkage long sys_semop(int semid, struct sembuf __user *sops,  				unsigned nsops); -asmlinkage long sys_semctl(int semid, int semnum, int cmd, union semun arg); +asmlinkage long sys_semctl(int semid, int semnum, int cmd, unsigned long arg);  asmlinkage long sys_semtimedop(int semid, struct sembuf __user *sops,  				unsigned nsops,  				const struct timespec __user *timeout); diff --git a/include/linux/tcp.h b/include/linux/tcp.h index f28408c07dc..5adbc33d1ab 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h @@ -90,9 +90,6 @@ struct tcp_options_received {  		sack_ok : 4,	/* SACK seen on SYN packet		*/  		snd_wscale : 4,	/* Window scaling received from sender	*/  		rcv_wscale : 4;	/* Window scaling to send to receiver	*/ -	u8	cookie_plus:6,	/* bytes in authenticator/cookie option	*/ -		cookie_out_never:1, -		cookie_in_always:1;  	u8	num_sacks;	/* Number of SACK blocks		*/  	u16	user_mss;	/* mss requested by user in ioctl	*/  	u16	mss_clamp;	/* Maximal mss, negotiated at connection setup */ @@ -102,7 +99,6 @@ static inline void tcp_clear_options(struct tcp_options_received *rx_opt)  {  	rx_opt->tstamp_ok = rx_opt->sack_ok = 0;  	rx_opt->wscale_ok = rx_opt->snd_wscale = 0; -	rx_opt->cookie_plus = 0;  }  /* This is the max number of SACKS that we'll generate and process. It's safe @@ -191,20 +187,19 @@ struct tcp_sock {  	u32	window_clamp;	/* Maximal window to advertise		*/  	u32	rcv_ssthresh;	/* Current window clamp			*/ -	u32	frto_highmark;	/* snd_nxt when RTO occurred */  	u16	advmss;		/* Advertised MSS			*/ -	u8	frto_counter;	/* Number of new acks after RTO */ +	u8	unused;  	u8	nonagle     : 4,/* Disable Nagle algorithm?             */  		thin_lto    : 1,/* Use linear timeouts for thin streams */  		thin_dupack : 1,/* Fast retransmit on first dupack      */  		repair      : 1, -		unused      : 1; +		frto        : 1;/* F-RTO (RFC5682) activated in CA_Loss */  	u8	repair_queue;  	u8	do_early_retrans:1,/* Enable RFC5827 early-retransmit  */ -		early_retrans_delayed:1, /* Delayed ER timer installed */  		syn_data:1,	/* SYN includes data */  		syn_fastopen:1,	/* SYN includes Fast Open option */  		syn_data_acked:1;/* data in SYN is acked by SYN-ACK */ +	u32	tlp_high_seq;	/* snd_nxt at the time of TLP retransmit. */  /* RTT measurement */  	u32	srtt;		/* smoothed round trip time << 3	*/ @@ -320,12 +315,6 @@ struct tcp_sock {  	struct tcp_md5sig_info	__rcu *md5sig_info;  #endif -	/* When the cookie options are generated and exchanged, then this -	 * object holds a reference to them (cookie_values->kref).  Also -	 * contains related tcp_cookie_transactions fields. -	 */ -	struct tcp_cookie_values  *cookie_values; -  /* TCP fastopen related information */  	struct tcp_fastopen_request *fastopen_req;  	/* fastopen_rsk points to request_sock that resulted in this big @@ -361,10 +350,6 @@ struct tcp_timewait_sock {  #ifdef CONFIG_TCP_MD5SIG  	struct tcp_md5sig_key	  *tw_md5_key;  #endif -	/* Few sockets in timewait have cookies; in that case, then this -	 * object holds a reference to them (tw_cookie_values->kref). -	 */ -	struct tcp_cookie_values  *tw_cookie_values;  };  static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) diff --git a/include/linux/time.h b/include/linux/time.h index d4835dfdf25..22d81b3c955 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -181,6 +181,9 @@ extern struct timespec timespec_trunc(struct timespec t, unsigned gran);  extern int timekeeping_valid_for_hres(void);  extern u64 timekeeping_max_deferment(void);  extern int timekeeping_inject_offset(struct timespec *ts); +extern s32 timekeeping_get_tai_offset(void); +extern void timekeeping_set_tai_offset(s32 tai_offset); +extern void timekeeping_clocktai(struct timespec *ts);  struct tms;  extern void do_sys_times(struct tms *); diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h index e1d558e237e..c1825eb436e 100644 --- a/include/linux/timekeeper_internal.h +++ b/include/linux/timekeeper_internal.h @@ -20,6 +20,8 @@ struct timekeeper {  	u32			shift;  	/* Number of clock cycles in one NTP interval. */  	cycle_t			cycle_interval; +	/* Last cycle value (also stored in clock->cycle_last) */ +	cycle_t			cycle_last;  	/* Number of clock shifted nano seconds in one NTP interval. */  	u64			xtime_interval;  	/* shifted nano seconds left over when rounding cycle_interval */ @@ -62,8 +64,11 @@ struct timekeeper {  	ktime_t			offs_boot;  	/* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */  	struct timespec		raw_time; -	/* Seqlock for all timekeeper values */ -	seqlock_t		lock; +	/* The current UTC to TAI offset in seconds */ +	s32			tai_offset; +	/* Offset clock monotonic -> clock tai */ +	ktime_t			offs_tai; +  };  static inline struct timespec tk_xtime(struct timekeeper *tk) diff --git a/include/linux/timex.h b/include/linux/timex.h index 5ec87c60b97..b3726e61368 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h @@ -125,9 +125,6 @@  extern unsigned long tick_usec;		/* USER_HZ period (usec) */  extern unsigned long tick_nsec;		/* SHIFTED_HZ period (nsec) */ -extern void ntp_init(void); -extern void ntp_clear(void); -  /* Required to safely shift negative values */  #define shift_right(x, s) ({	\  	__typeof__(x) __x = (x);	\ @@ -140,10 +137,6 @@ extern void ntp_clear(void);  #define NTP_INTERVAL_FREQ  (HZ)  #define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) -/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */ -extern u64 ntp_tick_length(void); - -extern int second_overflow(unsigned long secs);  extern int do_adjtimex(struct timex *);  extern void hardpps(const struct timespec *, const struct timespec *); diff --git a/include/linux/trace_clock.h b/include/linux/trace_clock.h index d563f37e1a1..1d7ca273927 100644 --- a/include/linux/trace_clock.h +++ b/include/linux/trace_clock.h @@ -16,6 +16,7 @@  extern u64 notrace trace_clock_local(void);  extern u64 notrace trace_clock(void); +extern u64 notrace trace_clock_jiffies(void);  extern u64 notrace trace_clock_global(void);  extern u64 notrace trace_clock_counter(void); diff --git a/include/linux/tty.h b/include/linux/tty.h index c75d886b030..7e92bd86a80 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -255,9 +255,9 @@ struct tty_struct {  	int count;  	struct winsize winsize;		/* termios mutex */  	unsigned char stopped:1, hw_stopped:1, flow_stopped:1, packet:1; -	unsigned char warned:1;  	unsigned char ctrl_status;	/* ctrl_lock */  	unsigned int receive_room;	/* Bytes free for queue */ +	int flow_change;  	struct tty_struct *link;  	struct fasync_struct *fasync; @@ -315,9 +315,25 @@ struct tty_file_private {  #define TTY_NO_WRITE_SPLIT 	17	/* Preserve write boundaries to driver */  #define TTY_HUPPED 		18	/* Post driver->hangup() */  #define TTY_HUPPING 		21	/* ->hangup() in progress */ +#define TTY_LDISC_HALTED	22	/* Line discipline is halted */  #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) +/* Values for tty->flow_change */ +#define TTY_THROTTLE_SAFE 1 +#define TTY_UNTHROTTLE_SAFE 2 + +static inline void __tty_set_flow_change(struct tty_struct *tty, int val) +{ +	tty->flow_change = val; +} + +static inline void tty_set_flow_change(struct tty_struct *tty, int val) +{ +	tty->flow_change = val; +	smp_mb(); +} +  #ifdef CONFIG_TTY  extern void console_init(void);  extern void tty_kref_put(struct tty_struct *tty); @@ -400,6 +416,8 @@ extern int tty_write_room(struct tty_struct *tty);  extern void tty_driver_flush_buffer(struct tty_struct *tty);  extern void tty_throttle(struct tty_struct *tty);  extern void tty_unthrottle(struct tty_struct *tty); +extern int tty_throttle_safe(struct tty_struct *tty); +extern int tty_unthrottle_safe(struct tty_struct *tty);  extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws);  extern void tty_driver_remove_tty(struct tty_driver *driver,  				  struct tty_struct *tty); @@ -419,13 +437,28 @@ extern void tty_flush_to_ldisc(struct tty_struct *tty);  extern void tty_buffer_free_all(struct tty_port *port);  extern void tty_buffer_flush(struct tty_struct *tty);  extern void tty_buffer_init(struct tty_port *port); -extern speed_t tty_get_baud_rate(struct tty_struct *tty);  extern speed_t tty_termios_baud_rate(struct ktermios *termios);  extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);  extern void tty_termios_encode_baud_rate(struct ktermios *termios,  						speed_t ibaud, speed_t obaud);  extern void tty_encode_baud_rate(struct tty_struct *tty,  						speed_t ibaud, speed_t obaud); + +/** + *	tty_get_baud_rate	-	get tty bit rates + *	@tty: tty to query + * + *	Returns the baud rate as an integer for this terminal. The + *	termios lock must be held by the caller and the terminal bit + *	flags may be updated. + * + *	Locking: none + */ +static inline speed_t tty_get_baud_rate(struct tty_struct *tty) +{ +	return tty_termios_baud_rate(&tty->termios); +} +  extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);  extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);  extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); @@ -502,6 +535,8 @@ extern int tty_port_carrier_raised(struct tty_port *port);  extern void tty_port_raise_dtr_rts(struct tty_port *port);  extern void tty_port_lower_dtr_rts(struct tty_port *port);  extern void tty_port_hangup(struct tty_port *port); +extern void tty_port_tty_hangup(struct tty_port *port, bool check_clocal); +extern void tty_port_tty_wakeup(struct tty_port *port);  extern int tty_port_block_til_ready(struct tty_port *port,  				struct tty_struct *tty, struct file *filp);  extern int tty_port_close_start(struct tty_port *port, @@ -526,8 +561,6 @@ extern void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty);  extern void tty_ldisc_init(struct tty_struct *tty);  extern void tty_ldisc_deinit(struct tty_struct *tty);  extern void tty_ldisc_begin(void); -/* This last one is just for the tty layer internals and shouldn't be used elsewhere */ -extern void tty_ldisc_enable(struct tty_struct *tty);  /* n_tty.c */ @@ -658,5 +691,12 @@ do {									\  	finish_wait(&wq, &__wait);					\  } while (0) +#ifdef CONFIG_PROC_FS +extern void proc_tty_register_driver(struct tty_driver *); +extern void proc_tty_unregister_driver(struct tty_driver *); +#else +static inline void proc_tty_register_driver(struct tty_driver *d) {} +static inline void proc_tty_unregister_driver(struct tty_driver *d) {} +#endif  #endif diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h index 455a0d7bf22..58390c73df8 100644 --- a/include/linux/tty_ldisc.h +++ b/include/linux/tty_ldisc.h @@ -9,89 +9,89 @@   *   * int	(*open)(struct tty_struct *);   * - * 	This function is called when the line discipline is associated - * 	with the tty.  The line discipline can use this as an - * 	opportunity to initialize any state needed by the ldisc routines. - *  + *	This function is called when the line discipline is associated + *	with the tty.  The line discipline can use this as an + *	opportunity to initialize any state needed by the ldisc routines. + *   * void	(*close)(struct tty_struct *);   *   *	This function is called when the line discipline is being - * 	shutdown, either because the tty is being closed or because - * 	the tty is being changed to use a new line discipline - *  + *	shutdown, either because the tty is being closed or because + *	the tty is being changed to use a new line discipline + *   * void	(*flush_buffer)(struct tty_struct *tty);   * - * 	This function instructs the line discipline to clear its - * 	buffers of any input characters it may have queued to be - * 	delivered to the user mode process. - *  + *	This function instructs the line discipline to clear its + *	buffers of any input characters it may have queued to be + *	delivered to the user mode process. + *   * ssize_t (*chars_in_buffer)(struct tty_struct *tty);   * - * 	This function returns the number of input characters the line + *	This function returns the number of input characters the line   *	discipline may have queued up to be delivered to the user mode   *	process. - *  + *   * ssize_t (*read)(struct tty_struct * tty, struct file * file,   *		   unsigned char * buf, size_t nr);   * - * 	This function is called when the user requests to read from - * 	the tty.  The line discipline will return whatever characters - * 	it has buffered up for the user.  If this function is not - * 	defined, the user will receive an EIO error. - *  + *	This function is called when the user requests to read from + *	the tty.  The line discipline will return whatever characters + *	it has buffered up for the user.  If this function is not + *	defined, the user will receive an EIO error. + *   * ssize_t (*write)(struct tty_struct * tty, struct file * file, - * 		    const unsigned char * buf, size_t nr); + *		    const unsigned char * buf, size_t nr); + * + *	This function is called when the user requests to write to the + *	tty.  The line discipline will deliver the characters to the + *	low-level tty device for transmission, optionally performing + *	some processing on the characters first.  If this function is + *	not defined, the user will receive an EIO error.   * - * 	This function is called when the user requests to write to the - * 	tty.  The line discipline will deliver the characters to the - * 	low-level tty device for transmission, optionally performing - * 	some processing on the characters first.  If this function is - * 	not defined, the user will receive an EIO error. - *    * int	(*ioctl)(struct tty_struct * tty, struct file * file, - * 		 unsigned int cmd, unsigned long arg); + *		 unsigned int cmd, unsigned long arg);   *   *	This function is called when the user requests an ioctl which - * 	is not handled by the tty layer or the low-level tty driver. - * 	It is intended for ioctls which affect line discpline - * 	operation.  Note that the search order for ioctls is (1) tty - * 	layer, (2) tty low-level driver, (3) line discpline.  So a - * 	low-level driver can "grab" an ioctl request before the line - * 	discpline has a chance to see it. - *  + *	is not handled by the tty layer or the low-level tty driver. + *	It is intended for ioctls which affect line discpline + *	operation.  Note that the search order for ioctls is (1) tty + *	layer, (2) tty low-level driver, (3) line discpline.  So a + *	low-level driver can "grab" an ioctl request before the line + *	discpline has a chance to see it. + *   * long	(*compat_ioctl)(struct tty_struct * tty, struct file * file, - * 		        unsigned int cmd, unsigned long arg); + *		        unsigned int cmd, unsigned long arg);   * - *      Process ioctl calls from 32-bit process on 64-bit system + *	Process ioctl calls from 32-bit process on 64-bit system   *   * void	(*set_termios)(struct tty_struct *tty, struct ktermios * old);   * - * 	This function notifies the line discpline that a change has - * 	been made to the termios structure. - *  + *	This function notifies the line discpline that a change has + *	been made to the termios structure. + *   * int	(*poll)(struct tty_struct * tty, struct file * file, - * 		  poll_table *wait); + *		  poll_table *wait);   * - * 	This function is called when a user attempts to select/poll on a - * 	tty device.  It is solely the responsibility of the line - * 	discipline to handle poll requests. + *	This function is called when a user attempts to select/poll on a + *	tty device.  It is solely the responsibility of the line + *	discipline to handle poll requests.   *   * void	(*receive_buf)(struct tty_struct *, const unsigned char *cp, - * 		       char *fp, int count); + *		       char *fp, int count); + * + *	This function is called by the low-level tty driver to send + *	characters received by the hardware to the line discpline for + *	processing.  <cp> is a pointer to the buffer of input + *	character received by the device.  <fp> is a pointer to a + *	pointer of flag bytes which indicate whether a character was + *	received with a parity error, etc.   * - * 	This function is called by the low-level tty driver to send - * 	characters received by the hardware to the line discpline for - * 	processing.  <cp> is a pointer to the buffer of input - * 	character received by the device.  <fp> is a pointer to a - * 	pointer of flag bytes which indicate whether a character was - * 	received with a parity error, etc. - *    * void	(*write_wakeup)(struct tty_struct *);   * - * 	This function is called by the low-level tty driver to signal - * 	that line discpline should try to send more characters to the - * 	low-level driver for transmission.  If the line discpline does - * 	not have any more data to send, it can just return. + *	This function is called by the low-level tty driver to signal + *	that line discpline should try to send more characters to the + *	low-level driver for transmission.  If the line discpline does + *	not have any more data to send, it can just return.   *   * int (*hangup)(struct tty_struct *)   * @@ -115,7 +115,7 @@ struct tty_ldisc_ops {  	char	*name;  	int	num;  	int	flags; -	 +  	/*  	 * The following routines are called from above.  	 */ @@ -123,19 +123,19 @@ struct tty_ldisc_ops {  	void	(*close)(struct tty_struct *);  	void	(*flush_buffer)(struct tty_struct *tty);  	ssize_t	(*chars_in_buffer)(struct tty_struct *tty); -	ssize_t	(*read)(struct tty_struct * tty, struct file * file, -			unsigned char __user * buf, size_t nr); -	ssize_t	(*write)(struct tty_struct * tty, struct file * file, -			 const unsigned char * buf, size_t nr);	 -	int	(*ioctl)(struct tty_struct * tty, struct file * file, +	ssize_t	(*read)(struct tty_struct *tty, struct file *file, +			unsigned char __user *buf, size_t nr); +	ssize_t	(*write)(struct tty_struct *tty, struct file *file, +			 const unsigned char *buf, size_t nr); +	int	(*ioctl)(struct tty_struct *tty, struct file *file,  			 unsigned int cmd, unsigned long arg); -	long	(*compat_ioctl)(struct tty_struct * tty, struct file * file, +	long	(*compat_ioctl)(struct tty_struct *tty, struct file *file,  				unsigned int cmd, unsigned long arg); -	void	(*set_termios)(struct tty_struct *tty, struct ktermios * old); +	void	(*set_termios)(struct tty_struct *tty, struct ktermios *old);  	unsigned int (*poll)(struct tty_struct *, struct file *,  			     struct poll_table_struct *);  	int	(*hangup)(struct tty_struct *tty); -	 +  	/*  	 * The following routines are called from below.  	 */ @@ -145,7 +145,7 @@ struct tty_ldisc_ops {  	void	(*dcd_change)(struct tty_struct *, unsigned int);  	struct  module *owner; -	 +  	int refcount;  }; diff --git a/include/linux/ucs2_string.h b/include/linux/ucs2_string.h new file mode 100644 index 00000000000..cbb20afdbc0 --- /dev/null +++ b/include/linux/ucs2_string.h @@ -0,0 +1,14 @@ +#ifndef _LINUX_UCS2_STRING_H_ +#define _LINUX_UCS2_STRING_H_ + +#include <linux/types.h>	/* for size_t */ +#include <linux/stddef.h>	/* for NULL */ + +typedef u16 ucs2_char_t; + +unsigned long ucs2_strnlen(const ucs2_char_t *s, size_t maxlength); +unsigned long ucs2_strlen(const ucs2_char_t *s); +unsigned long ucs2_strsize(const ucs2_char_t *data, unsigned long maxlength); +int ucs2_strncmp(const ucs2_char_t *a, const ucs2_char_t *b, size_t len); + +#endif /* _LINUX_UCS2_STRING_H_ */ diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h index 02b83db8e2c..06f28beed7c 100644 --- a/include/linux/uprobes.h +++ b/include/linux/uprobes.h @@ -38,6 +38,8 @@ struct inode;  #define UPROBE_HANDLER_REMOVE		1  #define UPROBE_HANDLER_MASK		1 +#define MAX_URETPROBE_DEPTH		64 +  enum uprobe_filter_ctx {  	UPROBE_FILTER_REGISTER,  	UPROBE_FILTER_UNREGISTER, @@ -46,6 +48,9 @@ enum uprobe_filter_ctx {  struct uprobe_consumer {  	int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); +	int (*ret_handler)(struct uprobe_consumer *self, +				unsigned long func, +				struct pt_regs *regs);  	bool (*filter)(struct uprobe_consumer *self,  				enum uprobe_filter_ctx ctx,  				struct mm_struct *mm); @@ -68,6 +73,8 @@ struct uprobe_task {  	enum uprobe_task_state		state;  	struct arch_uprobe_task		autask; +	struct return_instance		*return_instances; +	unsigned int			depth;  	struct uprobe			*active_uprobe;  	unsigned long			xol_vaddr; @@ -100,6 +107,7 @@ struct uprobes_state {  extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);  extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);  extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); +extern bool __weak is_trap_insn(uprobe_opcode_t *insn);  extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);  extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);  extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); diff --git a/include/linux/usb.h b/include/linux/usb.h index 4d22d0f6167..a0bee5a28d1 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -469,14 +469,12 @@ struct usb3_lpm_parameters {   * @lpm_capable: device supports LPM   * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM   * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled + * @usb3_lpm_enabled: USB3 hardware LPM enabled   * @string_langid: language ID for strings   * @product: iProduct string, if present (static)   * @manufacturer: iManufacturer string, if present (static)   * @serial: iSerialNumber string, if present (static)   * @filelist: usbfs files that are open to this device - * @usb_classdev: USB class device that was created for usbfs device - *	access from userspace - * @usbfs_dentry: usbfs dentry entry for the device   * @maxchild: number of ports if hub   * @quirks: quirks of the whole device   * @urbnum: number of URBs submitted for the whole device @@ -619,7 +617,7 @@ static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index)  #endif  /* USB autosuspend and autoresume */ -#ifdef CONFIG_USB_SUSPEND +#ifdef CONFIG_PM_RUNTIME  extern void usb_enable_autosuspend(struct usb_device *udev);  extern void usb_disable_autosuspend(struct usb_device *udev); @@ -978,7 +976,12 @@ struct usbdrv_wrap {   *	the "usbfs" filesystem.  This lets devices provide ways to   *	expose information to user space regardless of where they   *	do (or don't) show up otherwise in the filesystem. - * @suspend: Called when the device is going to be suspended by the system. + * @suspend: Called when the device is going to be suspended by the + *	system either from system sleep or runtime suspend context. The + *	return value will be ignored in system sleep context, so do NOT + *	try to continue using the device if suspend fails in this case. + *	Instead, let the resume or reset-resume routine recover from + *	the failure.   * @resume: Called when the device is being resumed by the system.   * @reset_resume: Called when the suspended device has been reset instead   *	of being resumed. diff --git a/include/linux/usb/cdc-wdm.h b/include/linux/usb/cdc-wdm.h index 719c332620f..0b3f4295c02 100644 --- a/include/linux/usb/cdc-wdm.h +++ b/include/linux/usb/cdc-wdm.h @@ -11,6 +11,8 @@  #ifndef __LINUX_USB_CDC_WDM_H  #define __LINUX_USB_CDC_WDM_H +#include <uapi/linux/usb/cdc-wdm.h> +  extern struct usb_driver *usb_cdc_wdm_register(struct usb_interface *intf,  					struct usb_endpoint_descriptor *ep,  					int bufsize, diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 9c210f2283d..27603bcbb9b 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -43,4 +43,13 @@   */  extern const char *usb_speed_string(enum usb_device_speed speed); + +/** + * usb_state_string - Returns human readable name for the state. + * @state: The state to return a human-readable name for. If it's not + *	any of the states devices in usb_device_state_string enum, + *	the string UNKNOWN will be returned. + */ +extern const char *usb_state_string(enum usb_device_state state); +  #endif /* __LINUX_USB_CH9_H */ diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 8860594d636..5e61589fc16 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -39,6 +39,7 @@  #include <linux/usb/ch9.h>  #include <linux/usb/gadget.h>  #include <linux/log2.h> +#include <linux/configfs.h>  /*   * USB function drivers should return USB_GADGET_DELAYED_STATUS if they @@ -464,6 +465,8 @@ struct usb_function_driver {  };  struct usb_function_instance { +	struct config_group group; +	struct list_head cfs_list;  	struct usb_function_driver *fd;  	void (*free_func_inst)(struct usb_function_instance *inst);  }; diff --git a/include/linux/usb/dwc3-omap.h b/include/linux/usb/dwc3-omap.h index 51eae14477f..5615f4d8272 100644 --- a/include/linux/usb/dwc3-omap.h +++ b/include/linux/usb/dwc3-omap.h @@ -19,11 +19,11 @@ enum omap_dwc3_vbus_id_status {  };  #if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE)) -extern void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status); +extern int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);  #else -static inline void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) +static inline int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)  { -	return; +	return -ENODEV;  }  #endif diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 2e297e80d59..c454a88abf2 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -482,6 +482,7 @@ struct usb_gadget_ops {   * @speed: Speed of current connection to USB host.   * @max_speed: Maximal speed the UDC can handle.  UDC must support this   *      and all slower speeds. + * @state: the state we are now (attached, suspended, configured, etc)   * @sg_supported: true if we can handle scatter-gather   * @is_otg: True if the USB device port uses a Mini-AB jack, so that the   *	gadget driver must provide a USB OTG descriptor. @@ -525,6 +526,7 @@ struct usb_gadget {  	struct list_head		ep_list;	/* of usb_ep */  	enum usb_device_speed		speed;  	enum usb_device_speed		max_speed; +	enum usb_device_state		state;  	unsigned			sg_supported:1;  	unsigned			is_otg:1;  	unsigned			is_a_peripheral:1; @@ -872,6 +874,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver);   */  int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); +extern int usb_add_gadget_udc_release(struct device *parent, +		struct usb_gadget *gadget, void (*release)(struct device *dev));  extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);  extern void usb_del_gadget_udc(struct usb_gadget *gadget);  extern int udc_attach_driver(const char *name, @@ -959,6 +963,13 @@ extern void usb_gadget_unmap_request(struct usb_gadget *gadget,  /*-------------------------------------------------------------------------*/ +/* utility to set gadget state properly */ + +extern void usb_gadget_set_state(struct usb_gadget *gadget, +		enum usb_device_state state); + +/*-------------------------------------------------------------------------*/ +  /* utility wrapping a simple endpoint selection policy */  extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, diff --git a/include/linux/usb/gadget_configfs.h b/include/linux/usb/gadget_configfs.h new file mode 100644 index 00000000000..d74c0ae989d --- /dev/null +++ b/include/linux/usb/gadget_configfs.h @@ -0,0 +1,110 @@ +#ifndef __GADGET_CONFIGFS__ +#define __GADGET_CONFIGFS__ + +#include <linux/configfs.h> + +int check_user_usb_string(const char *name, +		struct usb_gadget_strings *stringtab_dev); + +#define GS_STRINGS_W(__struct, __name)	\ +	static ssize_t __struct##_##__name##_store(struct __struct *gs, \ +		const char *page, size_t len)		\ +{							\ +	int ret;					\ +							\ +	ret = usb_string_copy(page, &gs->__name);	\ +	if (ret)					\ +		return ret;				\ +	return len;					\ +} + +#define GS_STRINGS_R(__struct, __name)	\ +	static ssize_t __struct##_##__name##_show(struct __struct *gs, \ +			char *page)	\ +{	\ +	return sprintf(page, "%s\n", gs->__name ?: "");	\ +} + +#define GS_STRING_ITEM_ATTR(struct_name, name)	\ +	static struct struct_name##_attribute struct_name##_##name = \ +		__CONFIGFS_ATTR(name,  S_IRUGO | S_IWUSR,		\ +				struct_name##_##name##_show,		\ +				struct_name##_##name##_store) + +#define GS_STRINGS_RW(struct_name, _name)	\ +	GS_STRINGS_R(struct_name, _name)	\ +	GS_STRINGS_W(struct_name, _name)	\ +	GS_STRING_ITEM_ATTR(struct_name, _name) + +#define USB_CONFIG_STRING_RW_OPS(struct_in)				\ +	CONFIGFS_ATTR_OPS(struct_in);					\ +									\ +static struct configfs_item_operations struct_in##_langid_item_ops = {	\ +	.release                = struct_in##_attr_release,		\ +	.show_attribute         = struct_in##_attr_show,		\ +	.store_attribute        = struct_in##_attr_store,		\ +};									\ +									\ +static struct config_item_type struct_in##_langid_type = {		\ +	.ct_item_ops	= &struct_in##_langid_item_ops,			\ +	.ct_attrs	= struct_in##_langid_attrs,			\ +	.ct_owner	= THIS_MODULE,					\ +} + +#define USB_CONFIG_STRINGS_LANG(struct_in, struct_member)	\ +	static struct config_group *struct_in##_strings_make(		\ +			struct config_group *group,			\ +			const char *name)				\ +	{								\ +	struct struct_member *gi;					\ +	struct struct_in *gs;						\ +	struct struct_in *new;						\ +	int langs = 0;							\ +	int ret;							\ +									\ +	new = kzalloc(sizeof(*new), GFP_KERNEL);			\ +	if (!new)							\ +		return ERR_PTR(-ENOMEM);				\ +									\ +	ret = check_user_usb_string(name, &new->stringtab_dev);		\ +	if (ret)							\ +		goto err;						\ +	config_group_init_type_name(&new->group, name,			\ +			&struct_in##_langid_type);			\ +									\ +	gi = container_of(group, struct struct_member, strings_group);	\ +	ret = -EEXIST;							\ +	list_for_each_entry(gs, &gi->string_list, list) {		\ +		if (gs->stringtab_dev.language == new->stringtab_dev.language) \ +			goto err;					\ +		langs++;						\ +	}								\ +	ret = -EOVERFLOW;						\ +	if (langs >= MAX_USB_STRING_LANGS)				\ +		goto err;						\ +									\ +	list_add_tail(&new->list, &gi->string_list);			\ +	return &new->group;						\ +err:									\ +	kfree(new);							\ +	return ERR_PTR(ret);						\ +}									\ +									\ +static void struct_in##_strings_drop(					\ +		struct config_group *group,				\ +		struct config_item *item)				\ +{									\ +	config_item_put(item);						\ +}									\ +									\ +static struct configfs_group_operations struct_in##_strings_ops = {	\ +	.make_group     = &struct_in##_strings_make,			\ +	.drop_item      = &struct_in##_strings_drop,			\ +};									\ +									\ +static struct config_item_type struct_in##_strings_type = {		\ +	.ct_group_ops   = &struct_in##_strings_ops,			\ +	.ct_owner       = THIS_MODULE,					\ +} + +#endif diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 59694b5e5e9..f5f5c7dfda9 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -84,7 +84,7 @@ struct usb_hcd {  	struct timer_list	rh_timer;	/* drives root-hub polling */  	struct urb		*status_urb;	/* the current status urb */ -#ifdef CONFIG_USB_SUSPEND +#ifdef CONFIG_PM_RUNTIME  	struct work_struct	wakeup_work;	/* for remote wakeup */  #endif @@ -593,14 +593,14 @@ extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg);  extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg);  #endif /* CONFIG_PM */ -#ifdef CONFIG_USB_SUSPEND +#ifdef CONFIG_PM_RUNTIME  extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd);  #else  static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd)  {  	return;  } -#endif /* CONFIG_USB_SUSPEND */ +#endif /* CONFIG_PM_RUNTIME */  /*-------------------------------------------------------------------------*/ diff --git a/include/linux/irqchip/sunxi.h b/include/linux/usb/musb-ux500.h index 1fe2c2260e2..1e2c7130f6e 100644 --- a/include/linux/irqchip/sunxi.h +++ b/include/linux/usb/musb-ux500.h @@ -1,7 +1,5 @@  /* - * Copyright 2012 Maxime Ripard - * - * Maxime Ripard <maxime.ripard@free-electrons.com> + * Copyright (C) 2013 ST-Ericsson AB   *   * This program is free software; you can redistribute it and/or modify   * it under the terms of the GNU General Public License as published by @@ -14,14 +12,20 @@   * GNU General Public License for more details.   */ -#ifndef __LINUX_IRQCHIP_SUNXI_H -#define __LINUX_IRQCHIP_SUNXI_H - -#include <asm/exception.h> - -extern void sunxi_init_irq(void); +#ifndef __MUSB_UX500_H__ +#define __MUSB_UX500_H__ -extern asmlinkage void __exception_irq_entry sunxi_handle_irq( -	struct pt_regs *regs); +enum ux500_musb_vbus_id_status { +	UX500_MUSB_NONE = 0, +	UX500_MUSB_VBUS, +	UX500_MUSB_ID, +	UX500_MUSB_CHARGER, +	UX500_MUSB_ENUMERATED, +	UX500_MUSB_RIDA, +	UX500_MUSB_RIDB, +	UX500_MUSB_RIDC, +	UX500_MUSB_PREPARE, +	UX500_MUSB_CLEAN, +}; -#endif +#endif	/* __MUSB_UX500_H__ */ diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h index 28884c71741..148d35171aa 100644 --- a/include/linux/usb/nop-usb-xceiv.h +++ b/include/linux/usb/nop-usb-xceiv.h @@ -5,6 +5,11 @@  struct nop_usb_xceiv_platform_data {  	enum usb_phy_type type; +	unsigned long clk_rate; + +	/* if set fails with -EPROBE_DEFER if can't get regulator */ +	unsigned int needs_vcc:1; +	unsigned int needs_reset:1;  };  #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index e8a5fe87c6b..291e01ba32e 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h @@ -36,14 +36,7 @@ struct usb_otg {  }; -#ifdef CONFIG_USB_OTG_UTILS -extern const char *otg_state_string(enum usb_otg_state state); -#else -static inline const char *otg_state_string(enum usb_otg_state state) -{ -	return NULL; -} -#endif +extern const char *usb_otg_state_string(enum usb_otg_state state);  /* Context: can sleep */  static inline int diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 15847cbdb51..6b5978f5763 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -91,6 +91,9 @@ struct usb_phy {  	int	(*init)(struct usb_phy *x);  	void	(*shutdown)(struct usb_phy *x); +	/* enable/disable VBUS */ +	int	(*set_vbus)(struct usb_phy *x, int on); +  	/* effective for B devices, ignored for A-peripheral */  	int	(*set_power)(struct usb_phy *x,  				unsigned mA); @@ -160,8 +163,26 @@ usb_phy_shutdown(struct usb_phy *x)  		x->shutdown(x);  } +static inline int +usb_phy_vbus_on(struct usb_phy *x) +{ +	if (!x->set_vbus) +		return 0; + +	return x->set_vbus(x, true); +} + +static inline int +usb_phy_vbus_off(struct usb_phy *x) +{ +	if (!x->set_vbus) +		return 0; + +	return x->set_vbus(x, false); +} +  /* for usb host and peripheral controller drivers */ -#ifdef CONFIG_USB_OTG_UTILS +#if IS_ENABLED(CONFIG_USB_PHY)  extern struct usb_phy *usb_get_phy(enum usb_phy_type type);  extern struct usb_phy *devm_usb_get_phy(struct device *dev,  	enum usb_phy_type type); @@ -176,29 +197,29 @@ extern int usb_bind_phy(const char *dev_name, u8 index,  #else  static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)  { -	return NULL; +	return ERR_PTR(-ENXIO);  }  static inline struct usb_phy *devm_usb_get_phy(struct device *dev,  	enum usb_phy_type type)  { -	return NULL; +	return ERR_PTR(-ENXIO);  }  static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)  { -	return NULL; +	return ERR_PTR(-ENXIO);  }  static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index)  { -	return NULL; +	return ERR_PTR(-ENXIO);  }  static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,  	const char *phandle, u8 index)  { -	return NULL; +	return ERR_PTR(-ENXIO);  }  static inline void usb_put_phy(struct usb_phy *x) diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index c5d36c65c33..e452ba6ec6b 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h @@ -62,14 +62,14 @@ struct renesas_usbhs_platform_callback {  	 * Hardware exit function for platform.  	 * it is called when driver was removed  	 */ -	void (*hardware_exit)(struct platform_device *pdev); +	int (*hardware_exit)(struct platform_device *pdev);  	/*  	 * option:  	 *  	 * for board specific clock control  	 */ -	void (*power_ctrl)(struct platform_device *pdev, +	int (*power_ctrl)(struct platform_device *pdev,  			   void __iomem *base, int enable);  	/* @@ -77,7 +77,7 @@ struct renesas_usbhs_platform_callback {  	 *  	 * Phy reset for platform  	 */ -	void (*phy_reset)(struct platform_device *pdev); +	int (*phy_reset)(struct platform_device *pdev);  	/*  	 * get USB ID function diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 1819b59aab2..b9b0f7b4e43 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -15,6 +15,7 @@  #include <linux/kref.h>  #include <linux/mutex.h> +#include <linux/serial.h>  #include <linux/sysrq.h>  #include <linux/kfifo.h> @@ -61,12 +62,12 @@   * @bulk_out_buffers: pointers to the bulk out buffers for this port   * @write_urbs: pointers to the bulk out urbs for this port   * @write_urbs_free: status bitmap the for bulk out urbs + * @icount: interrupt counters   * @tx_bytes: number of bytes currently in host stack queues   * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this   *	port.   * @flags: usb serial port flags   * @write_wait: a wait_queue_head_t used by the port. - * @delta_msr_wait: modem-status-change wait queue   * @work: work queue entry for the line discipline waking up.   * @throttled: nonzero if the read urb is inactive to throttle the device   * @throttle_req: nonzero if the tty wants to throttle us @@ -109,11 +110,11 @@ struct usb_serial_port {  	unsigned long		write_urbs_free;  	__u8			bulk_out_endpointAddress; +	struct async_icount	icount;  	int			tx_bytes;  	unsigned long		flags;  	wait_queue_head_t	write_wait; -	wait_queue_head_t	delta_msr_wait;  	struct work_struct	work;  	char			throttled;  	char			throttle_req; @@ -272,6 +273,7 @@ struct usb_serial_driver {  	int  (*tiocmget)(struct tty_struct *tty);  	int  (*tiocmset)(struct tty_struct *tty,  			 unsigned int set, unsigned int clear); +	int  (*tiocmiwait)(struct tty_struct *tty, unsigned long arg);  	int  (*get_icount)(struct tty_struct *tty,  			struct serial_icounter_struct *icount);  	/* Called by the tty layer for port level work. There may or may not @@ -329,8 +331,10 @@ extern void usb_serial_generic_read_bulk_callback(struct urb *urb);  extern void usb_serial_generic_write_bulk_callback(struct urb *urb);  extern void usb_serial_generic_throttle(struct tty_struct *tty);  extern void usb_serial_generic_unthrottle(struct tty_struct *tty); -extern void usb_serial_generic_disconnect(struct usb_serial *serial); -extern void usb_serial_generic_release(struct usb_serial *serial); +extern int usb_serial_generic_tiocmiwait(struct tty_struct *tty, +							unsigned long arg); +extern int usb_serial_generic_get_icount(struct tty_struct *tty, +					struct serial_icounter_struct *icount);  extern int usb_serial_generic_register(void);  extern void usb_serial_generic_deregister(void);  extern int usb_serial_generic_submit_read_urbs(struct usb_serial_port *port, diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h index 9ebebe90692..1b7519a8c0b 100644 --- a/include/linux/usb/tegra_usb_phy.h +++ b/include/linux/usb/tegra_usb_phy.h @@ -61,10 +61,14 @@ struct tegra_usb_phy {  	struct device *dev;  	bool is_legacy_phy;  	bool is_ulpi_phy; +	void (*set_pts)(struct usb_phy *x, u8 pts_val); +	void (*set_phcd)(struct usb_phy *x, bool enable);  };  struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, -	void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode); +	void __iomem *regs, void *config, enum tegra_usb_phy_mode phy_mode, +	void (*set_pts)(struct usb_phy *x, u8 pts_val), +	void (*set_phcd)(struct usb_phy *x, bool enable));  void tegra_usb_phy_preresume(struct usb_phy *phy); @@ -75,8 +79,4 @@ void tegra_ehci_phy_restore_start(struct usb_phy *phy,  void tegra_ehci_phy_restore_end(struct usb_phy *phy); -void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val); - -void tegra_ehci_set_phcd(struct usb_phy *x, bool enable); -  #endif /* __TEGRA_USB_PHY_H */ diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 0e5ac93bab1..da46327fca1 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -72,6 +72,7 @@ struct usbnet {  #		define EVENT_DEVICE_REPORT_IDLE	8  #		define EVENT_NO_RUNTIME_PM	9  #		define EVENT_RX_KILL	10 +#		define EVENT_LINK_CHANGE	11  };  static inline struct usb_driver *driver_of(struct usb_interface *intf) @@ -245,5 +246,6 @@ extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *);  extern int usbnet_nway_reset(struct net_device *net);  extern int usbnet_manage_power(struct usbnet *, int); +extern void usbnet_link_change(struct usbnet *, bool, bool);  #endif /* __LINUX_USB_USBNET_H */ diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h index 75818744ab5..ea7168a6808 100644 --- a/include/linux/vexpress.h +++ b/include/linux/vexpress.h @@ -115,9 +115,6 @@ unsigned __vexpress_get_site(struct device *dev, struct device_node *node);  void vexpress_sysreg_early_init(void __iomem *base);  void vexpress_sysreg_of_early_init(void); -void vexpress_power_off(void); -void vexpress_restart(char str, const char *cmd); -  /* Clocks */  struct clk *vexpress_osc_setup(struct device *dev); diff --git a/include/linux/virtio.h b/include/linux/virtio.h index ff6714e6d0f..2d7a5e04590 100644 --- a/include/linux/virtio.h +++ b/include/linux/virtio.h @@ -58,12 +58,6 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq);  unsigned int virtqueue_get_vring_size(struct virtqueue *vq); -/* FIXME: Obsolete accessor, but required for virtio_net merge. */ -static inline unsigned int virtqueue_get_queue_index(struct virtqueue *vq) -{ -	return vq->index; -} -  /**   * virtio_device - representation of a device using virtio   * @index: unique position on the virtio bus diff --git a/include/linux/vm_sockets.h b/include/linux/vm_sockets.h new file mode 100644 index 00000000000..0805eecba8f --- /dev/null +++ b/include/linux/vm_sockets.h @@ -0,0 +1,23 @@ +/* + * VMware vSockets Driver + * + * Copyright (C) 2007-2013 VMware, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation version 2 and no later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for + * more details. + */ + +#ifndef _VM_SOCKETS_H +#define _VM_SOCKETS_H + +#include <uapi/linux/vm_sockets.h> + +int vm_sockets_get_local_cid(void); + +#endif /* _VM_SOCKETS_H */ diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index 6071e911c7f..7d5773a99f2 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -3,7 +3,9 @@  #include <linux/spinlock.h>  #include <linux/init.h> +#include <linux/list.h>  #include <asm/page.h>		/* pgprot_t */ +#include <linux/rbtree.h>  struct vm_area_struct;		/* vma defining user mapping in mm_types.h */ @@ -35,6 +37,17 @@ struct vm_struct {  	const void		*caller;  }; +struct vmap_area { +	unsigned long va_start; +	unsigned long va_end; +	unsigned long flags; +	struct rb_node rb_node;         /* address sorted rbtree */ +	struct list_head list;          /* address sorted list */ +	struct list_head purge_list;    /* "lazy purge" list */ +	struct vm_struct *vm; +	struct rcu_head rcu_head; +}; +  /*   *	Highlevel APIs for driver use   */ @@ -130,8 +143,7 @@ extern long vwrite(char *buf, char *addr, unsigned long count);  /*   *	Internals.  Dont't use..   */ -extern rwlock_t vmlist_lock; -extern struct vm_struct *vmlist; +extern struct list_head vmap_area_list;  extern __init void vm_area_add_early(struct vm_struct *vm);  extern __init void vm_area_register_early(struct vm_struct *vm, size_t align); @@ -158,4 +170,22 @@ pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)  # endif  #endif +struct vmalloc_info { +	unsigned long   used; +	unsigned long   largest_chunk; +}; + +#ifdef CONFIG_MMU +#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START) +extern void get_vmalloc_info(struct vmalloc_info *vmi); +#else + +#define VMALLOC_TOTAL 0UL +#define get_vmalloc_info(vmi)			\ +do {						\ +	(vmi)->used = 0;			\ +	(vmi)->largest_chunk = 0;		\ +} while (0) +#endif +  #endif /* _LINUX_VMALLOC_H */ diff --git a/include/linux/vmpressure.h b/include/linux/vmpressure.h new file mode 100644 index 00000000000..76be077340e --- /dev/null +++ b/include/linux/vmpressure.h @@ -0,0 +1,47 @@ +#ifndef __LINUX_VMPRESSURE_H +#define __LINUX_VMPRESSURE_H + +#include <linux/mutex.h> +#include <linux/list.h> +#include <linux/workqueue.h> +#include <linux/gfp.h> +#include <linux/types.h> +#include <linux/cgroup.h> + +struct vmpressure { +	unsigned long scanned; +	unsigned long reclaimed; +	/* The lock is used to keep the scanned/reclaimed above in sync. */ +	struct mutex sr_lock; + +	/* The list of vmpressure_event structs. */ +	struct list_head events; +	/* Have to grab the lock on events traversal or modifications. */ +	struct mutex events_lock; + +	struct work_struct work; +}; + +struct mem_cgroup; + +#ifdef CONFIG_MEMCG +extern void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, +		       unsigned long scanned, unsigned long reclaimed); +extern void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, int prio); + +extern void vmpressure_init(struct vmpressure *vmpr); +extern struct vmpressure *memcg_to_vmpressure(struct mem_cgroup *memcg); +extern struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr); +extern struct vmpressure *css_to_vmpressure(struct cgroup_subsys_state *css); +extern int vmpressure_register_event(struct cgroup *cg, struct cftype *cft, +				     struct eventfd_ctx *eventfd, +				     const char *args); +extern void vmpressure_unregister_event(struct cgroup *cg, struct cftype *cft, +					struct eventfd_ctx *eventfd); +#else +static inline void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, +			      unsigned long scanned, unsigned long reclaimed) {} +static inline void vmpressure_prio(gfp_t gfp, struct mem_cgroup *memcg, +				   int prio) {} +#endif /* CONFIG_MEMCG */ +#endif /* __LINUX_VMPRESSURE_H */ diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 5fd71a7d0df..c586679b6fe 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -48,13 +48,8 @@ static inline void count_vm_events(enum vm_event_item item, long delta)  }  extern void all_vm_events(unsigned long *); -#ifdef CONFIG_HOTPLUG +  extern void vm_events_fold_cpu(int cpu); -#else -static inline void vm_events_fold_cpu(int cpu) -{ -} -#endif  #else diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 8afab27cdbc..623488fdc1f 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -11,6 +11,7 @@  #include <linux/lockdep.h>  #include <linux/threads.h>  #include <linux/atomic.h> +#include <linux/cpumask.h>  struct workqueue_struct; @@ -68,7 +69,7 @@ enum {  				  WORK_STRUCT_COLOR_BITS,  	/* data contains off-queue information when !WORK_STRUCT_PWQ */ -	WORK_OFFQ_FLAG_BASE	= WORK_STRUCT_FLAG_BITS, +	WORK_OFFQ_FLAG_BASE	= WORK_STRUCT_COLOR_SHIFT,  	WORK_OFFQ_CANCELING	= (1 << WORK_OFFQ_FLAG_BASE), @@ -91,6 +92,9 @@ enum {  	/* bit mask for work_busy() return values */  	WORK_BUSY_PENDING	= 1 << 0,  	WORK_BUSY_RUNNING	= 1 << 1, + +	/* maximum string length for set_worker_desc() */ +	WORKER_DESC_LEN		= 24,  };  struct work_struct { @@ -115,6 +119,20 @@ struct delayed_work {  	int cpu;  }; +/* + * A struct for workqueue attributes.  This can be used to change + * attributes of an unbound workqueue. + * + * Unlike other fields, ->no_numa isn't a property of a worker_pool.  It + * only modifies how apply_workqueue_attrs() select pools and thus doesn't + * participate in pool hash calculations or equality comparisons. + */ +struct workqueue_attrs { +	int			nice;		/* nice level */ +	cpumask_var_t		cpumask;	/* allowed CPUs */ +	bool			no_numa;	/* disable NUMA affinity */ +}; +  static inline struct delayed_work *to_delayed_work(struct work_struct *work)  {  	return container_of(work, struct delayed_work, work); @@ -283,9 +301,10 @@ enum {  	WQ_MEM_RECLAIM		= 1 << 3, /* may be used for memory reclaim */  	WQ_HIGHPRI		= 1 << 4, /* high priority */  	WQ_CPU_INTENSIVE	= 1 << 5, /* cpu instensive workqueue */ +	WQ_SYSFS		= 1 << 6, /* visible in sysfs, see wq_sysfs_register() */ -	WQ_DRAINING		= 1 << 6, /* internal: workqueue is draining */ -	WQ_RESCUER		= 1 << 7, /* internal: workqueue has rescuer */ +	__WQ_DRAINING		= 1 << 16, /* internal: workqueue is draining */ +	__WQ_ORDERED		= 1 << 17, /* internal: workqueue is ordered */  	WQ_MAX_ACTIVE		= 512,	  /* I like 512, better ideas? */  	WQ_MAX_UNBOUND_PER_CPU	= 4,	  /* 4 * #cpus for unbound wq */ @@ -388,7 +407,7 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,   * Pointer to the allocated workqueue on success, %NULL on failure.   */  #define alloc_ordered_workqueue(fmt, flags, args...)			\ -	alloc_workqueue(fmt, WQ_UNBOUND | (flags), 1, ##args) +	alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args)  #define create_workqueue(name)						\  	alloc_workqueue((name), WQ_MEM_RECLAIM, 1) @@ -399,30 +418,23 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,  extern void destroy_workqueue(struct workqueue_struct *wq); +struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask); +void free_workqueue_attrs(struct workqueue_attrs *attrs); +int apply_workqueue_attrs(struct workqueue_struct *wq, +			  const struct workqueue_attrs *attrs); +  extern bool queue_work_on(int cpu, struct workqueue_struct *wq,  			struct work_struct *work); -extern bool queue_work(struct workqueue_struct *wq, struct work_struct *work);  extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq,  			struct delayed_work *work, unsigned long delay); -extern bool queue_delayed_work(struct workqueue_struct *wq, -			struct delayed_work *work, unsigned long delay);  extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq,  			struct delayed_work *dwork, unsigned long delay); -extern bool mod_delayed_work(struct workqueue_struct *wq, -			struct delayed_work *dwork, unsigned long delay);  extern void flush_workqueue(struct workqueue_struct *wq);  extern void drain_workqueue(struct workqueue_struct *wq);  extern void flush_scheduled_work(void); -extern bool schedule_work_on(int cpu, struct work_struct *work); -extern bool schedule_work(struct work_struct *work); -extern bool schedule_delayed_work_on(int cpu, struct delayed_work *work, -				     unsigned long delay); -extern bool schedule_delayed_work(struct delayed_work *work, -				  unsigned long delay);  extern int schedule_on_each_cpu(work_func_t func); -extern int keventd_up(void);  int execute_in_process_context(work_func_t fn, struct execute_work *); @@ -435,8 +447,122 @@ extern bool cancel_delayed_work_sync(struct delayed_work *dwork);  extern void workqueue_set_max_active(struct workqueue_struct *wq,  				     int max_active); -extern bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq); +extern bool current_is_workqueue_rescuer(void); +extern bool workqueue_congested(int cpu, struct workqueue_struct *wq);  extern unsigned int work_busy(struct work_struct *work); +extern __printf(1, 2) void set_worker_desc(const char *fmt, ...); +extern void print_worker_info(const char *log_lvl, struct task_struct *task); + +/** + * queue_work - queue work on a workqueue + * @wq: workqueue to use + * @work: work to queue + * + * Returns %false if @work was already on a queue, %true otherwise. + * + * We queue the work to the CPU on which it was submitted, but if the CPU dies + * it can be processed by another CPU. + */ +static inline bool queue_work(struct workqueue_struct *wq, +			      struct work_struct *work) +{ +	return queue_work_on(WORK_CPU_UNBOUND, wq, work); +} + +/** + * queue_delayed_work - queue work on a workqueue after delay + * @wq: workqueue to use + * @dwork: delayable work to queue + * @delay: number of jiffies to wait before queueing + * + * Equivalent to queue_delayed_work_on() but tries to use the local CPU. + */ +static inline bool queue_delayed_work(struct workqueue_struct *wq, +				      struct delayed_work *dwork, +				      unsigned long delay) +{ +	return queue_delayed_work_on(WORK_CPU_UNBOUND, wq, dwork, delay); +} + +/** + * mod_delayed_work - modify delay of or queue a delayed work + * @wq: workqueue to use + * @dwork: work to queue + * @delay: number of jiffies to wait before queueing + * + * mod_delayed_work_on() on local CPU. + */ +static inline bool mod_delayed_work(struct workqueue_struct *wq, +				    struct delayed_work *dwork, +				    unsigned long delay) +{ +	return mod_delayed_work_on(WORK_CPU_UNBOUND, wq, dwork, delay); +} + +/** + * schedule_work_on - put work task on a specific cpu + * @cpu: cpu to put the work task on + * @work: job to be done + * + * This puts a job on a specific cpu + */ +static inline bool schedule_work_on(int cpu, struct work_struct *work) +{ +	return queue_work_on(cpu, system_wq, work); +} + +/** + * schedule_work - put work task in global workqueue + * @work: job to be done + * + * Returns %false if @work was already on the kernel-global workqueue and + * %true otherwise. + * + * This puts a job in the kernel-global workqueue if it was not already + * queued and leaves it in the same position on the kernel-global + * workqueue otherwise. + */ +static inline bool schedule_work(struct work_struct *work) +{ +	return queue_work(system_wq, work); +} + +/** + * schedule_delayed_work_on - queue work in global workqueue on CPU after delay + * @cpu: cpu to use + * @dwork: job to be done + * @delay: number of jiffies to wait + * + * After waiting for a given time this puts a job in the kernel-global + * workqueue on the specified CPU. + */ +static inline bool schedule_delayed_work_on(int cpu, struct delayed_work *dwork, +					    unsigned long delay) +{ +	return queue_delayed_work_on(cpu, system_wq, dwork, delay); +} + +/** + * schedule_delayed_work - put work task in global workqueue after delay + * @dwork: job to be done + * @delay: number of jiffies to wait or 0 for immediate execution + * + * After waiting for a given time this puts a job in the kernel-global + * workqueue. + */ +static inline bool schedule_delayed_work(struct delayed_work *dwork, +					 unsigned long delay) +{ +	return queue_delayed_work(system_wq, dwork, delay); +} + +/** + * keventd_up - is workqueue initialized yet? + */ +static inline bool keventd_up(void) +{ +	return system_wq != NULL; +}  /*   * Like above, but uses del_timer() instead of del_timer_sync(). This means, @@ -466,12 +592,12 @@ static inline bool __deprecated flush_delayed_work_sync(struct delayed_work *dwo  }  #ifndef CONFIG_SMP -static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) +static inline long work_on_cpu(int cpu, long (*fn)(void *), void *arg)  {  	return fn(arg);  }  #else -long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg); +long work_on_cpu(int cpu, long (*fn)(void *), void *arg);  #endif /* CONFIG_SMP */  #ifdef CONFIG_FREEZER @@ -480,4 +606,11 @@ extern bool freeze_workqueues_busy(void);  extern void thaw_workqueues(void);  #endif /* CONFIG_FREEZER */ +#ifdef CONFIG_SYSFS +int workqueue_sysfs_register(struct workqueue_struct *wq); +#else	/* CONFIG_SYSFS */ +static inline int workqueue_sysfs_register(struct workqueue_struct *wq) +{ return 0; } +#endif	/* CONFIG_SYSFS */ +  #endif diff --git a/include/media/davinci/dm355_ccdc.h b/include/media/davinci/dm355_ccdc.h index adf2fe4bf0b..c669a9fb75e 100644 --- a/include/media/davinci/dm355_ccdc.h +++ b/include/media/davinci/dm355_ccdc.h @@ -38,7 +38,7 @@ enum ccdc_sample_line {  	CCDC_SAMPLE_16LINES  }; -/* enum for Alaw gama width */ +/* enum for Alaw gamma width */  enum ccdc_gamma_width {  	CCDC_GAMMA_BITS_13_4,  	CCDC_GAMMA_BITS_12_3, @@ -97,8 +97,8 @@ enum ccdc_mfilt2 {  struct ccdc_a_law {  	/* Enable/disable A-Law */  	unsigned char enable; -	/* Gama Width Input */ -	enum ccdc_gamma_width gama_wd; +	/* Gamma Width Input */ +	enum ccdc_gamma_width gamma_wd;  };  /* structure for Black Clamping */ diff --git a/include/media/davinci/dm644x_ccdc.h b/include/media/davinci/dm644x_ccdc.h index 3e178eb52fb..852e96c4bb4 100644 --- a/include/media/davinci/dm644x_ccdc.h +++ b/include/media/davinci/dm644x_ccdc.h @@ -38,17 +38,23 @@ enum ccdc_sample_line {  	CCDC_SAMPLE_16LINES  }; -/* enum for Alaw gama width */ -enum ccdc_gama_width { -	CCDC_GAMMA_BITS_15_6, +/* enum for Alaw gamma width */ +enum ccdc_gamma_width { +	CCDC_GAMMA_BITS_15_6,	/* use bits 15-6 for gamma */  	CCDC_GAMMA_BITS_14_5,  	CCDC_GAMMA_BITS_13_4,  	CCDC_GAMMA_BITS_12_3,  	CCDC_GAMMA_BITS_11_2,  	CCDC_GAMMA_BITS_10_1, -	CCDC_GAMMA_BITS_09_0 +	CCDC_GAMMA_BITS_09_0	/* use bits 9-0 for gamma */  }; +/* returns the highest bit used for the gamma */ +static inline u8 ccdc_gamma_width_max_bit(enum ccdc_gamma_width width) +{ +	return 15 - width; +} +  enum ccdc_data_size {  	CCDC_DATA_16BITS,  	CCDC_DATA_15BITS, @@ -60,12 +66,18 @@ enum ccdc_data_size {  	CCDC_DATA_8BITS  }; +/* returns the highest bit used for this data size */ +static inline u8 ccdc_data_size_max_bit(enum ccdc_data_size sz) +{ +	return sz == CCDC_DATA_8BITS ? 7 : 15 - sz; +} +  /* structure for ALaw */  struct ccdc_a_law {  	/* Enable/disable A-Law */  	unsigned char enable; -	/* Gama Width Input */ -	enum ccdc_gama_width gama_wd; +	/* Gamma Width Input */ +	enum ccdc_gamma_width gamma_wd;  };  /* structure for Black Clamping */ diff --git a/include/media/davinci/vpbe.h b/include/media/davinci/vpbe.h index a7ca4884c46..57585c7004a 100644 --- a/include/media/davinci/vpbe.h +++ b/include/media/davinci/vpbe.h @@ -132,7 +132,7 @@ struct vpbe_device_ops {  			       struct v4l2_enum_dv_timings *timings_info);  	/* Set std at the output */ -	int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); +	int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id std_id);  	/* Get the current std at the output */  	int (*g_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); diff --git a/include/media/davinci/vpbe_types.h b/include/media/davinci/vpbe_types.h index 9b85396514b..05dbe0ba514 100644 --- a/include/media/davinci/vpbe_types.h +++ b/include/media/davinci/vpbe_types.h @@ -26,8 +26,7 @@ enum vpbe_version {  /* vpbe_timing_type - Timing types used in vpbe device */  enum vpbe_enc_timings_type {  	VPBE_ENC_STD = 0x1, -	VPBE_ENC_DV_PRESET = 0x2, -	VPBE_ENC_CUSTOM_TIMINGS = 0x4, +	VPBE_ENC_DV_TIMINGS = 0x4,  	/* Used when set timings through FB device interface */  	VPBE_ENC_TIMINGS_INVALID = 0x8,  }; diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h index f6caafc874c..3446af279fc 100644 --- a/include/media/media-devnode.h +++ b/include/media/media-devnode.h @@ -46,6 +46,7 @@ struct media_file_operations {  	ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);  	unsigned int (*poll) (struct file *, struct poll_table_struct *);  	long (*ioctl) (struct file *, unsigned int, unsigned long); +	long (*compat_ioctl) (struct file *, unsigned int, unsigned long);  	int (*open) (struct file *);  	int (*release) (struct file *);  }; diff --git a/include/media/mt9p031.h b/include/media/mt9p031.h index 0c97b19af29..b1e63f2b72b 100644 --- a/include/media/mt9p031.h +++ b/include/media/mt9p031.h @@ -5,13 +5,11 @@ struct v4l2_subdev;  /*   * struct mt9p031_platform_data - MT9P031 platform data - * @set_xclk: Clock frequency set callback   * @reset: Chip reset GPIO (set to -1 if not used)   * @ext_freq: Input clock frequency   * @target_freq: Pixel clock frequency   */  struct mt9p031_platform_data { -	int (*set_xclk)(struct v4l2_subdev *subdev, int hz);  	int reset;  	int ext_freq;  	int target_freq; diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h index 95842696857..c9d06d9f7e6 100644 --- a/include/media/omap3isp.h +++ b/include/media/omap3isp.h @@ -29,10 +29,6 @@  struct i2c_board_info;  struct isp_device; -#define ISP_XCLK_NONE			0 -#define ISP_XCLK_A			1 -#define ISP_XCLK_B			2 -  enum isp_interface_type {  	ISP_INTERFACE_PARALLEL,  	ISP_INTERFACE_CSI2A_PHY2, @@ -153,7 +149,13 @@ struct isp_v4l2_subdevs_group {  	} bus; /* gcc < 4.6.0 chokes on anonymous union initializers */  }; +struct isp_platform_xclk { +	const char *dev_id; +	const char *con_id; +}; +  struct isp_platform_data { +	struct isp_platform_xclk xclks[2];  	struct isp_v4l2_subdevs_group *subdevs;  	void (*set_constraints)(struct isp_device *isp, bool enable);  }; diff --git a/include/media/rc-core.h b/include/media/rc-core.h index f03445f3c76..06a75deff55 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -51,6 +51,7 @@ enum rc_driver_type {   * @driver_type: specifies if protocol decoding is done in hardware or software   * @idle: used to keep track of RX state   * @allowed_protos: bitmask with the supported RC_BIT_* protocols + * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols   * @scanmask: some hardware decoders are not capable of providing the full   *	scancode to the application. As this is a hardware limit, we can't do   *	anything with it. Yet, as the same keycode table can be used with other @@ -99,6 +100,7 @@ struct rc_dev {  	enum rc_driver_type		driver_type;  	bool				idle;  	u64				allowed_protos; +	u64				enabled_protocols;  	u32				scanmask;  	void				*priv;  	spinlock_t			keylock; diff --git a/include/media/rc-map.h b/include/media/rc-map.h index f74ee6f8971..5d5d3a30f04 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -172,6 +172,7 @@ void rc_map_init(void);  #define RC_MAP_RC5_TV                    "rc-rc5-tv"  #define RC_MAP_RC6_MCE                   "rc-rc6-mce"  #define RC_MAP_REAL_AUDIO_220_32_KEYS    "rc-real-audio-220-32-keys" +#define RC_MAP_REDDO                     "rc-reddo"  #define RC_MAP_SNAPSTREAM_FIREFLY        "rc-snapstream-firefly"  #define RC_MAP_STREAMZAP                 "rc-streamzap"  #define RC_MAP_TBS_NEC                   "rc-tbs-nec" diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h index 28f3590aa03..f50969025ef 100644 --- a/include/media/s5p_fimc.h +++ b/include/media/s5p_fimc.h @@ -13,6 +13,20 @@  #define S5P_FIMC_H_  #include <media/media-entity.h> +#include <media/v4l2-mediabus.h> + +/* + * Enumeration of data inputs to the camera subsystem. + */ +enum fimc_input { +	FIMC_INPUT_PARALLEL_0	= 1, +	FIMC_INPUT_PARALLEL_1, +	FIMC_INPUT_MIPI_CSI2_0	= 3, +	FIMC_INPUT_MIPI_CSI2_1, +	FIMC_INPUT_WRITEBACK_A	= 5, +	FIMC_INPUT_WRITEBACK_B, +	FIMC_INPUT_WRITEBACK_ISP = 5, +};  /*   * Enumeration of the FIMC data bus types. @@ -32,6 +46,20 @@ enum fimc_bus_type {  	FIMC_BUS_TYPE_ISP_WRITEBACK = FIMC_BUS_TYPE_LCD_WRITEBACK_B,  }; +#define fimc_input_is_parallel(x) ((x) == 1 || (x) == 2) +#define fimc_input_is_mipi_csi(x) ((x) == 3 || (x) == 4) + +/* + * The subdevices' group IDs. + */ +#define GRP_ID_SENSOR		(1 << 8) +#define GRP_ID_FIMC_IS_SENSOR	(1 << 9) +#define GRP_ID_WRITEBACK	(1 << 10) +#define GRP_ID_CSIS		(1 << 11) +#define GRP_ID_FIMC		(1 << 12) +#define GRP_ID_FLITE		(1 << 13) +#define GRP_ID_FIMC_IS		(1 << 14) +  struct i2c_board_info;  /** @@ -77,10 +105,46 @@ struct s5p_platform_fimc {   */  #define S5P_FIMC_TX_END_NOTIFY _IO('e', 0) +#define FIMC_MAX_PLANES	3 + +/** + * struct fimc_fmt - color format data structure + * @mbus_code: media bus pixel code, -1 if not applicable + * @name: format description + * @fourcc: fourcc code for this format, 0 if not applicable + * @color: the driver's private color format id + * @memplanes: number of physically non-contiguous data planes + * @colplanes: number of physically contiguous data planes + * @depth: per plane driver's private 'number of bits per pixel' + * @mdataplanes: bitmask indicating meta data plane(s), (1 << plane_no) + * @flags: flags indicating which operation mode format applies to + */ +struct fimc_fmt { +	enum v4l2_mbus_pixelcode mbus_code; +	char	*name; +	u32	fourcc; +	u32	color; +	u16	memplanes; +	u16	colplanes; +	u8	depth[FIMC_MAX_PLANES]; +	u16	mdataplanes; +	u16	flags; +#define FMT_FLAGS_CAM		(1 << 0) +#define FMT_FLAGS_M2M_IN	(1 << 1) +#define FMT_FLAGS_M2M_OUT	(1 << 2) +#define FMT_FLAGS_M2M		(1 << 1 | 1 << 2) +#define FMT_HAS_ALPHA		(1 << 3) +#define FMT_FLAGS_COMPRESSED	(1 << 4) +#define FMT_FLAGS_WRITEBACK	(1 << 5) +#define FMT_FLAGS_RAW_BAYER	(1 << 6) +#define FMT_FLAGS_YUV		(1 << 7) +}; +  enum fimc_subdev_index {  	IDX_SENSOR,  	IDX_CSIS,  	IDX_FLITE, +	IDX_IS_ISP,  	IDX_FIMC,  	IDX_MAX,  }; diff --git a/include/media/saa7115.h b/include/media/saa7115.h index bab21271959..407918625c8 100644 --- a/include/media/saa7115.h +++ b/include/media/saa7115.h @@ -21,6 +21,8 @@  #ifndef _SAA7115_H_  #define _SAA7115_H_ +/* s_routing inputs, outputs, and config */ +  /* SAA7111/3/4/5 HW inputs */  #define SAA7115_COMPOSITE0 0  #define SAA7115_COMPOSITE1 1 @@ -33,24 +35,34 @@  #define SAA7115_SVIDEO2    8  #define SAA7115_SVIDEO3    9 -/* SAA7115 v4l2_crystal_freq frequency values */ -#define SAA7115_FREQ_32_11_MHZ  32110000   /* 32.11 MHz crystal, SAA7114/5 only */ -#define SAA7115_FREQ_24_576_MHZ 24576000   /* 24.576 MHz crystal */ - -/* SAA7115 v4l2_crystal_freq audio clock control flags */ -#define SAA7115_FREQ_FL_UCGC   (1 << 0)	   /* SA 3A[7], UCGC, SAA7115 only */ -#define SAA7115_FREQ_FL_CGCDIV (1 << 1)	   /* SA 3A[6], CGCDIV, SAA7115 only */ -#define SAA7115_FREQ_FL_APLL   (1 << 2)	   /* SA 3A[3], APLL, SAA7114/5 only */ - +/* outputs */  #define SAA7115_IPORT_ON    	1  #define SAA7115_IPORT_OFF   	0 -/* SAA7111 specific output flags */ +/* SAA7111 specific outputs. */  #define SAA7111_VBI_BYPASS 	2  #define SAA7111_FMT_YUV422      0x00  #define SAA7111_FMT_RGB 	0x40  #define SAA7111_FMT_CCIR 	0x80  #define SAA7111_FMT_YUV411 	0xc0 +/* config flags */ +/* Register 0x85 should set bit 0 to 0 (it's 1 by default). This bit + * controls the IDQ signal polarity which is set to 'inverted' if the bit + * it 1 and to 'default' if it is 0. */ +#define SAA7115_IDQ_IS_DEFAULT  (1 << 0) + +/* s_crystal_freq values and flags */ + +/* SAA7115 v4l2_crystal_freq frequency values */ +#define SAA7115_FREQ_32_11_MHZ  32110000   /* 32.11 MHz crystal, SAA7114/5 only */ +#define SAA7115_FREQ_24_576_MHZ 24576000   /* 24.576 MHz crystal */ + +/* SAA7115 v4l2_crystal_freq audio clock control flags */ +#define SAA7115_FREQ_FL_UCGC         (1 << 0) /* SA 3A[7], UCGC, SAA7115 only */ +#define SAA7115_FREQ_FL_CGCDIV       (1 << 1) /* SA 3A[6], CGCDIV, SAA7115 only */ +#define SAA7115_FREQ_FL_APLL         (1 << 2) /* SA 3A[3], APLL, SAA7114/5 only */ +#define SAA7115_FREQ_FL_DOUBLE_ASCLK (1 << 3) /* SA 39, LRDIV, SAA7114/5 only */ +  #endif diff --git a/include/media/si476x.h b/include/media/si476x.h new file mode 100644 index 00000000000..e02e241e2d2 --- /dev/null +++ b/include/media/si476x.h @@ -0,0 +1,37 @@ +/* + * include/media/si476x.h -- Common definitions for si476x driver + * + * Copyright (C) 2012 Innovative Converged Devices(ICD) + * Copyright (C) 2013 Andrey Smirnov + * + * Author: Andrey Smirnov <andrew.smirnov@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * General Public License for more details. + * + */ + +#ifndef SI476X_H +#define SI476X_H + +#include <linux/types.h> +#include <linux/videodev2.h> + +#include <linux/mfd/si476x-reports.h> + +enum si476x_ctrl_id { +	V4L2_CID_SI476X_RSSI_THRESHOLD	= (V4L2_CID_USER_SI476X_BASE + 1), +	V4L2_CID_SI476X_SNR_THRESHOLD	= (V4L2_CID_USER_SI476X_BASE + 2), +	V4L2_CID_SI476X_MAX_TUNE_ERROR	= (V4L2_CID_USER_SI476X_BASE + 3), +	V4L2_CID_SI476X_HARMONICS_COUNT	= (V4L2_CID_USER_SI476X_BASE + 4), +	V4L2_CID_SI476X_DIVERSITY_MODE	= (V4L2_CID_USER_SI476X_BASE + 5), +	V4L2_CID_SI476X_INTERCHIP_LINK	= (V4L2_CID_USER_SI476X_BASE + 6), +}; + +#endif /* SI476X_H*/ diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 2cc70cf318b..ff77d08c30f 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h @@ -292,12 +292,17 @@ struct soc_camera_sense {  #define SOCAM_DATAWIDTH_8	SOCAM_DATAWIDTH(8)  #define SOCAM_DATAWIDTH_9	SOCAM_DATAWIDTH(9)  #define SOCAM_DATAWIDTH_10	SOCAM_DATAWIDTH(10) +#define SOCAM_DATAWIDTH_12	SOCAM_DATAWIDTH(12)  #define SOCAM_DATAWIDTH_15	SOCAM_DATAWIDTH(15)  #define SOCAM_DATAWIDTH_16	SOCAM_DATAWIDTH(16) +#define SOCAM_DATAWIDTH_18	SOCAM_DATAWIDTH(18) +#define SOCAM_DATAWIDTH_24	SOCAM_DATAWIDTH(24)  #define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \  			      SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \ -			      SOCAM_DATAWIDTH_15 | SOCAM_DATAWIDTH_16) +			      SOCAM_DATAWIDTH_12 | SOCAM_DATAWIDTH_15 | \ +			      SOCAM_DATAWIDTH_16 | SOCAM_DATAWIDTH_18 | \ +			      SOCAM_DATAWIDTH_24)  static inline void soc_camera_limit_side(int *start, int *length,  		unsigned int start_min, diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h index 0dc6f4625b9..d33f6d05969 100644 --- a/include/media/soc_mediabus.h +++ b/include/media/soc_mediabus.h @@ -26,6 +26,8 @@   * @SOC_MBUS_PACKING_VARIABLE:	compressed formats with variable packing   * @SOC_MBUS_PACKING_1_5X8:	used for packed YUV 4:2:0 formats, where 4   *				pixels occupy 6 bytes in RAM + * @SOC_MBUS_PACKING_EXTEND32:	sample width (e.g., 24 bits) has to be extended + *				to 32 bits   */  enum soc_mbus_packing {  	SOC_MBUS_PACKING_NONE, @@ -34,6 +36,7 @@ enum soc_mbus_packing {  	SOC_MBUS_PACKING_EXTEND16,  	SOC_MBUS_PACKING_VARIABLE,  	SOC_MBUS_PACKING_1_5X8, +	SOC_MBUS_PACKING_EXTEND32,  };  /** diff --git a/include/media/ths7303.h b/include/media/ths7303.h new file mode 100644 index 00000000000..980ec51d574 --- /dev/null +++ b/include/media/ths7303.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2013 Texas Instruments Inc + * + * Copyright 2013 Cisco Systems, Inc. and/or its affiliates. + * + * Contributors: + *     Hans Verkuil <hans.verkuil@cisco.com> + *     Lad, Prabhakar <prabhakar.lad@ti.com> + *     Martin Bugge <marbugge@cisco.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA + */ + +#ifndef THS7353_H +#define THS7353_H + +/** + * struct ths7303_platform_data - Platform dependent data + * @ch_1: Bias value for channel one. + * @ch_2: Bias value for channel two. + * @ch_3: Bias value for channel three. + * @init_enable: initalize on init. + */ +struct ths7303_platform_data { +	u8 ch_1; +	u8 ch_2; +	u8 ch_3; +	u8 init_enable; +}; + +#endif diff --git a/include/media/tuner.h b/include/media/tuner.h index 926aff9bdf6..b46ebb48fe7 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -138,6 +138,10 @@  #define TUNER_XC4000			87	/* Xceive Silicon Tuner */  #define TUNER_XC5000C			88	/* Xceive Silicon Tuner */ +#define TUNER_SONY_BTF_PG472Z		89	/* PAL+SECAM */ +#define TUNER_SONY_BTF_PK467Z		90	/* NTSC_JP */ +#define TUNER_SONY_BTF_PB463Z		91	/* NTSC */ +  /* tv card specific */  #define TDA9887_PRESENT 		(1<<0)  #define TDA9887_PORT1_INACTIVE 		(1<<1) @@ -188,7 +192,7 @@ struct tuner_setup {  	unsigned short	addr; 	/* I2C address */  	unsigned int	type;   /* Tuner type */  	unsigned int	mode_mask;  /* Allowed tuner modes */ -	unsigned int	config; /* configuraion for more complex tuners */ +	void		*config;    /* configuraion for more complex tuners */  	int (*tuner_callback) (void *dev, int component, int cmd, int arg);  }; diff --git a/include/media/uda1342.h b/include/media/uda1342.h new file mode 100644 index 00000000000..cd156403a36 --- /dev/null +++ b/include/media/uda1342.h @@ -0,0 +1,29 @@ +/* + * uda1342.h - definition for uda1342 inputs + * + * Copyright 2013 Cisco Systems, Inc. and/or its affiliates. All rights reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _UDA1342_H_ +#define _UDA1342_H_ + +/* The UDA1342 has 2 inputs */ + +#define UDA1342_IN1 1 +#define UDA1342_IN2 2 + +#endif diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index 4ee125bae71..c259b36bf1e 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h @@ -96,12 +96,20 @@ enum {  	/* module au0828 */  	V4L2_IDENT_AU0828 = 828, +	/* module bttv: ident 848 + 849 */ +	V4L2_IDENT_BT848 = 848, +	V4L2_IDENT_BT849 = 849, +  	/* module bt856: just ident 856 */  	V4L2_IDENT_BT856 = 856,  	/* module bt866: just ident 866 */  	V4L2_IDENT_BT866 = 866, +	/* module bttv: ident 878 + 879 */ +	V4L2_IDENT_BT878 = 878, +	V4L2_IDENT_BT879 = 879, +  	/* module ks0127: reserved range 1120-1129 */  	V4L2_IDENT_KS0122S = 1122,  	V4L2_IDENT_KS0127  = 1127, @@ -180,6 +188,9 @@ enum {  	/* module adv7343: just ident 7343 */  	V4L2_IDENT_ADV7343 = 7343, +	/* module ths7353: just ident 7353 */ +	V4L2_IDENT_THS7353 = 7353, +  	/* module adv7393: just ident 7393 */  	V4L2_IDENT_ADV7393 = 7393, diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index ec7c9c00b25..1d93c48cb37 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h @@ -201,7 +201,6 @@ void v4l_bound_align_image(unsigned int *w, unsigned int wmin,  			   unsigned int *h, unsigned int hmin,  			   unsigned int hmax, unsigned int halign,  			   unsigned int salign); -int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info);  struct v4l2_discrete_probe {  	const struct v4l2_frmsize_discrete	*sizes; diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index f00d42bc01a..7343a27fe81 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -259,7 +259,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,  		    s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags); -/** v4l2_ctrl_handler_init() - Initialize the control handler. +/** v4l2_ctrl_handler_init_class() - Initialize the control handler.    * @hdl:	The control handler.    * @nr_of_controls_hint: A hint of how many controls this handler is    *		expected to refer to. This is the total number, so including @@ -268,12 +268,35 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,    *		are allocated) or the control lookup becomes slower (not enough    *		buckets are allocated, so there are more slow list lookups).    *		It will always work, though. +  * @key:	Used by the lock validator if CONFIG_LOCKDEP is set. +  * @name:	Used by the lock validator if CONFIG_LOCKDEP is set.    *    * Returns an error if the buckets could not be allocated. This error will    * also be stored in @hdl->error. +  * +  * Never use this call directly, always use the v4l2_ctrl_handler_init +  * macro that hides the @key and @name arguments.    */ -int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl, -			   unsigned nr_of_controls_hint); +int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl, +				 unsigned nr_of_controls_hint, +				 struct lock_class_key *key, const char *name); + +#ifdef CONFIG_LOCKDEP +#define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint)		\ +(									\ +	({								\ +		static struct lock_class_key _key;			\ +		v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint,	\ +					&_key,				\ +					KBUILD_BASENAME ":"		\ +					__stringify(__LINE__) ":"	\ +					"(" #hdl ")->_lock");		\ +	})								\ +) +#else +#define v4l2_ctrl_handler_init(hdl, nr_of_controls_hint)		\ +	v4l2_ctrl_handler_init_class(hdl, nr_of_controls_hint, NULL, NULL) +#endif  /** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free    * the control list. diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index d61febfb166..c9b1593923f 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h @@ -190,4 +190,17 @@ v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev);  			##args);					\  }) +#define v4l2_device_has_op(v4l2_dev, o, f)				\ +({									\ +	struct v4l2_subdev *__sd;					\ +	bool __result = false;						\ +	list_for_each_entry(__sd, &(v4l2_dev)->subdevs, list) {		\ +		if (v4l2_subdev_has_op(__sd, o, f)) {			\ +			__result = true;				\ +			break;						\ +		}							\ +	}								\ +	__result;							\ +}) +  #endif diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 4118ad1324c..931652f0e2a 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -132,7 +132,7 @@ struct v4l2_ioctl_ops {  			ENUMSTD is handled by videodev.c  		 */  	int (*vidioc_g_std) (struct file *file, void *fh, v4l2_std_id *norm); -	int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id *norm); +	int (*vidioc_s_std) (struct file *file, void *fh, v4l2_std_id norm);  	int (*vidioc_querystd) (struct file *file, void *fh, v4l2_std_id *a);  		/* Input handling */ @@ -219,11 +219,11 @@ struct v4l2_ioctl_ops {  	int (*vidioc_g_tuner)          (struct file *file, void *fh,  					struct v4l2_tuner *a);  	int (*vidioc_s_tuner)          (struct file *file, void *fh, -					struct v4l2_tuner *a); +					const struct v4l2_tuner *a);  	int (*vidioc_g_frequency)      (struct file *file, void *fh,  					struct v4l2_frequency *a);  	int (*vidioc_s_frequency)      (struct file *file, void *fh, -					struct v4l2_frequency *a); +					const struct v4l2_frequency *a);  	int (*vidioc_enum_freq_bands) (struct file *file, void *fh,  				    struct v4l2_frequency_band *band); @@ -242,7 +242,10 @@ struct v4l2_ioctl_ops {  	int (*vidioc_g_register)       (struct file *file, void *fh,  					struct v4l2_dbg_register *reg);  	int (*vidioc_s_register)       (struct file *file, void *fh, -					struct v4l2_dbg_register *reg); +					const struct v4l2_dbg_register *reg); + +	int (*vidioc_g_chip_info)      (struct file *file, void *fh, +					struct v4l2_dbg_chip_info *chip);  #endif  	int (*vidioc_g_chip_ident)     (struct file *file, void *fh,  					struct v4l2_dbg_chip_ident *chip); @@ -254,15 +257,6 @@ struct v4l2_ioctl_ops {  					   struct v4l2_frmivalenum *fival);  	/* DV Timings IOCTLs */ -	int (*vidioc_enum_dv_presets) (struct file *file, void *fh, -				       struct v4l2_dv_enum_preset *preset); - -	int (*vidioc_s_dv_preset) (struct file *file, void *fh, -				   struct v4l2_dv_preset *preset); -	int (*vidioc_g_dv_preset) (struct file *file, void *fh, -				   struct v4l2_dv_preset *preset); -	int (*vidioc_query_dv_preset) (struct file *file, void *fh, -					struct v4l2_dv_preset *qpreset);  	int (*vidioc_s_dv_timings) (struct file *file, void *fh,  				    struct v4l2_dv_timings *timings);  	int (*vidioc_g_dv_timings) (struct file *file, void *fh, @@ -281,7 +275,7 @@ struct v4l2_ioctl_ops {  	/* For other private ioctls */  	long (*vidioc_default)	       (struct file *file, void *fh, -					bool valid_prio, int cmd, void *arg); +					bool valid_prio, unsigned int cmd, void *arg);  }; diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h new file mode 100644 index 00000000000..3a8a84124b4 --- /dev/null +++ b/include/media/v4l2-of.h @@ -0,0 +1,111 @@ +/* + * V4L2 OF binding parsing library + * + * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd. + * Author: Sylwester Nawrocki <s.nawrocki@samsung.com> + * + * Copyright (C) 2012 Renesas Electronics Corp. + * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + */ +#ifndef _V4L2_OF_H +#define _V4L2_OF_H + +#include <linux/list.h> +#include <linux/types.h> +#include <linux/errno.h> + +#include <media/v4l2-mediabus.h> + +struct device_node; + +/** + * struct v4l2_of_bus_mipi_csi2 - MIPI CSI-2 bus data structure + * @flags: media bus (V4L2_MBUS_*) flags + * @data_lanes: an array of physical data lane indexes + * @clock_lane: physical lane index of the clock lane + * @num_data_lanes: number of data lanes + */ +struct v4l2_of_bus_mipi_csi2 { +	unsigned int flags; +	unsigned char data_lanes[4]; +	unsigned char clock_lane; +	unsigned short num_data_lanes; +}; + +/** + * struct v4l2_of_bus_parallel - parallel data bus data structure + * @flags: media bus (V4L2_MBUS_*) flags + * @bus_width: bus width in bits + * @data_shift: data shift in bits + */ +struct v4l2_of_bus_parallel { +	unsigned int flags; +	unsigned char bus_width; +	unsigned char data_shift; +}; + +/** + * struct v4l2_of_endpoint - the endpoint data structure + * @port: identifier (value of reg property) of a port this endpoint belongs to + * @id: identifier (value of reg property) of this endpoint + * @local_node: pointer to device_node of this endpoint + * @remote: phandle to remote endpoint node + * @bus_type: bus type + * @bus: bus configuration data structure + * @head: list head for this structure + */ +struct v4l2_of_endpoint { +	unsigned int port; +	unsigned int id; +	const struct device_node *local_node; +	const __be32 *remote; +	enum v4l2_mbus_type bus_type; +	union { +		struct v4l2_of_bus_parallel parallel; +		struct v4l2_of_bus_mipi_csi2 mipi_csi2; +	} bus; +	struct list_head head; +}; + +#ifdef CONFIG_OF +void v4l2_of_parse_endpoint(const struct device_node *node, +				struct v4l2_of_endpoint *link); +struct device_node *v4l2_of_get_next_endpoint(const struct device_node *parent, +					struct device_node *previous); +struct device_node *v4l2_of_get_remote_port_parent( +					const struct device_node *node); +struct device_node *v4l2_of_get_remote_port(const struct device_node *node); +#else /* CONFIG_OF */ + +static inline int v4l2_of_parse_endpoint(const struct device_node *node, +					struct v4l2_of_endpoint *link) +{ +	return -ENOSYS; +} + +static inline struct device_node *v4l2_of_get_next_endpoint( +					const struct device_node *parent, +					struct device_node *previous) +{ +	return NULL; +} + +static inline struct device_node *v4l2_of_get_remote_port_parent( +					const struct device_node *node) +{ +	return NULL; +} + +static inline struct device_node *v4l2_of_get_remote_port( +					const struct device_node *node) +{ +	return NULL; +} + +#endif /* CONFIG_OF */ + +#endif /* _V4L2_OF_H */ diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index b137a5e1151..5298d678d0f 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -165,7 +165,7 @@ struct v4l2_subdev_core_ops {  	long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg);  #ifdef CONFIG_VIDEO_ADV_DEBUG  	int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); -	int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); +	int (*s_register)(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg);  #endif  	int (*s_power)(struct v4l2_subdev *sd, int on);  	int (*interrupt_service_routine)(struct v4l2_subdev *sd, @@ -191,10 +191,10 @@ struct v4l2_subdev_core_ops {   */  struct v4l2_subdev_tuner_ops {  	int (*s_radio)(struct v4l2_subdev *sd); -	int (*s_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); +	int (*s_frequency)(struct v4l2_subdev *sd, const struct v4l2_frequency *freq);  	int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);  	int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); -	int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); +	int (*s_tuner)(struct v4l2_subdev *sd, const struct v4l2_tuner *vt);  	int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);  	int (*s_modulator)(struct v4l2_subdev *sd, const struct v4l2_modulator *vm);  	int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); @@ -279,14 +279,6 @@ struct v4l2_mbus_frame_desc {     s_routing: see s_routing in audio_ops, except this version is for video  	devices. -   s_dv_preset: set dv (Digital Video) preset in the sub device. Similar to -	s_std() - -   g_dv_preset: get current dv (Digital Video) preset in the sub device. - -   query_dv_preset: query dv preset in the sub device. This is similar to -	querystd() -     s_dv_timings(): Set custom dv timings in the sub device. This is used  	when sub device is capable of setting detailed timing information  	in the hardware to generate/detect the video signal. @@ -331,14 +323,6 @@ struct v4l2_subdev_video_ops {  				struct v4l2_subdev_frame_interval *interval);  	int (*enum_framesizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize);  	int (*enum_frameintervals)(struct v4l2_subdev *sd, struct v4l2_frmivalenum *fival); -	int (*enum_dv_presets) (struct v4l2_subdev *sd, -			struct v4l2_dv_enum_preset *preset); -	int (*s_dv_preset)(struct v4l2_subdev *sd, -			struct v4l2_dv_preset *preset); -	int (*g_dv_preset)(struct v4l2_subdev *sd, -			struct v4l2_dv_preset *preset); -	int (*query_dv_preset)(struct v4l2_subdev *sd, -			struct v4l2_dv_preset *preset);  	int (*s_dv_timings)(struct v4l2_subdev *sd,  			struct v4l2_dv_timings *timings);  	int (*g_dv_timings)(struct v4l2_subdev *sd, @@ -687,4 +671,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,  	((!(sd) || !(sd)->v4l2_dev || !(sd)->v4l2_dev->notify) ? -ENODEV : \  	 (sd)->v4l2_dev->notify((sd), (notification), (arg))) +#define v4l2_subdev_has_op(sd, o, f) \ +	((sd)->ops->o && (sd)->ops->o->f) +  #endif diff --git a/include/media/videobuf-dma-contig.h b/include/media/videobuf-dma-contig.h index f473aeb86d3..f0ed82543d9 100644 --- a/include/media/videobuf-dma-contig.h +++ b/include/media/videobuf-dma-contig.h @@ -26,16 +26,6 @@ void videobuf_queue_dma_contig_init(struct videobuf_queue *q,  				    void *priv,  				    struct mutex *ext_lock); -void videobuf_queue_dma_contig_init_cached(struct videobuf_queue *q, -					   const struct videobuf_queue_ops *ops, -					   struct device *dev, -					   spinlock_t *irqlock, -					   enum v4l2_buf_type type, -					   enum v4l2_field field, -					   unsigned int msize, -					   void *priv, -					   struct mutex *ext_lock); -  dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf);  void videobuf_dma_contig_free(struct videobuf_queue *q,  			      struct videobuf_buffer *buf); diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 9cfd4ee9e56..d88a098d1af 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -27,7 +27,9 @@ struct vb2_fileio_data;   *		return NULL on failure or a pointer to allocator private,   *		per-buffer data on success; the returned private structure   *		will then be passed as buf_priv argument to other ops in this - *		structure + *		structure. Additional gfp_flags to use when allocating the + *		are also passed to this operation. These flags are from the + *		gfp_flags field of vb2_queue.   * @put:	inform the allocator that the buffer will no longer be used;   *		usually will result in the allocator freeing the buffer (if   *		no other users of this buffer are present); the buf_priv @@ -79,7 +81,7 @@ struct vb2_fileio_data;   *				  unmap_dmabuf.   */  struct vb2_mem_ops { -	void		*(*alloc)(void *alloc_ctx, unsigned long size); +	void		*(*alloc)(void *alloc_ctx, unsigned long size, gfp_t gfp_flags);  	void		(*put)(void *buf_priv);  	struct dma_buf *(*get_dmabuf)(void *buf_priv); @@ -302,6 +304,9 @@ struct v4l2_fh;   * @buf_struct_size: size of the driver-specific buffer structure;   *		"0" indicates the driver doesn't want to use a custom buffer   *		structure type, so sizeof(struct vb2_buffer) will is used + * @gfp_flags:	additional gfp flags used when allocating the buffers. + *		Typically this is 0, but it may be e.g. GFP_DMA or __GFP_DMA32 + *		to force the buffer allocation to a specific memory zone.   *   * @memory:	current memory type used   * @bufs:	videobuf buffer structures @@ -326,6 +331,8 @@ struct vb2_queue {  	const struct vb2_mem_ops	*mem_ops;  	void				*drv_priv;  	unsigned int			buf_struct_size; +	u32				timestamp_type; +	gfp_t				gfp_flags;  /* private: internal use only */  	enum v4l2_memory		memory; diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 40be2a0d8ae..84a6440f1f1 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -199,6 +199,7 @@ extern bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,  /* Device notifier */  extern int register_inet6addr_notifier(struct notifier_block *nb);  extern int unregister_inet6addr_notifier(struct notifier_block *nb); +extern int inet6addr_notifier_call_chain(unsigned long val, void *v);  extern void inet6_netconf_notify_devconf(struct net *net, int type, int ifindex,  					 struct ipv6_devconf *devconf); diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 0a996a3517e..dbdfd2b0f3b 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h @@ -29,7 +29,8 @@ struct unix_address {  struct unix_skb_parms {  	struct pid		*pid;		/* Skb credentials	*/ -	const struct cred	*cred; +	kuid_t			uid; +	kgid_t			gid;  	struct scm_fp_list	*fp;		/* Passed files		*/  #ifdef CONFIG_SECURITY_NETWORK  	u32			secid;		/* Security ID		*/ @@ -56,9 +57,10 @@ struct unix_sock {  	struct list_head	link;  	atomic_long_t		inflight;  	spinlock_t		lock; -	unsigned int		gc_candidate : 1; -	unsigned int		gc_maybe_cycle : 1;  	unsigned char		recursion_level; +	unsigned long		gc_flags; +#define UNIX_GC_CANDIDATE	0 +#define UNIX_GC_MAYBE_CYCLE	1  	struct socket_wq	peer_wq;  };  #define unix_sk(__sk) ((struct unix_sock *)__sk) diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 9531beee09b..10eb9b38901 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -193,11 +193,11 @@ static inline bool bdaddr_type_is_le(__u8 type)  #define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} })  /* Copy, swap, convert BD Address */ -static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2) +static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)  {  	return memcmp(ba1, ba2, sizeof(bdaddr_t));  } -static inline void bacpy(bdaddr_t *dst, bdaddr_t *src) +static inline void bacpy(bdaddr_t *dst, const bdaddr_t *src)  {  	memcpy(dst, src, sizeof(bdaddr_t));  } @@ -226,13 +226,12 @@ struct bt_sock_list {  	struct hlist_head head;  	rwlock_t          lock;  #ifdef CONFIG_PROC_FS -        struct file_operations   fops;          int (* custom_seq_show)(struct seq_file *, void *);  #endif  };  int  bt_sock_register(int proto, const struct net_proto_family *ops); -int  bt_sock_unregister(int proto); +void bt_sock_unregister(int proto);  void bt_sock_link(struct bt_sock_list *l, struct sock *s);  void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);  int  bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, @@ -260,12 +259,23 @@ struct l2cap_ctrl {  	__u8		retries;  }; +struct hci_dev; + +typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status); + +struct hci_req_ctrl { +	bool			start; +	u8			event; +	hci_req_complete_t	complete; +}; +  struct bt_skb_cb {  	__u8 pkt_type;  	__u8 incoming;  	__u16 expect;  	__u8 force_active;  	struct l2cap_ctrl control; +	struct hci_req_ctrl req;  };  #define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) @@ -319,7 +329,7 @@ extern void hci_sock_cleanup(void);  extern int bt_sysfs_init(void);  extern void bt_sysfs_cleanup(void); -extern int  bt_procfs_init(struct module* module, struct net *net, const char *name, +extern int  bt_procfs_init(struct net *net, const char *name,  			   struct bt_sock_list* sk_list,  			   int (* seq_show)(struct seq_file *, void *));  extern void bt_procfs_cleanup(struct net *net, const char *name); diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 7f12c25f1fc..e0512aaef4b 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -119,10 +119,16 @@ enum {  	HCI_CONNECTABLE,  	HCI_DISCOVERABLE,  	HCI_LINK_SECURITY, -	HCI_PENDING_CLASS,  	HCI_PERIODIC_INQ, +	HCI_FAST_CONNECTABLE,  }; +/* A mask for the flags that are supposed to remain when a reset happens + * or the HCI device is closed. + */ +#define HCI_PERSISTENT_MASK (BIT(HCI_LE_SCAN) | BIT(HCI_PERIODIC_INQ) | \ +			      BIT(HCI_FAST_CONNECTABLE)) +  /* HCI ioctl defines */  #define HCIDEVUP	_IOW('H', 201, int)  #define HCIDEVDOWN	_IOW('H', 202, int) @@ -881,12 +887,25 @@ struct hci_rp_read_data_block_size {  	__le16   num_blocks;  } __packed; +#define HCI_OP_READ_PAGE_SCAN_ACTIVITY	0x0c1b +struct hci_rp_read_page_scan_activity { +	__u8     status; +	__le16   interval; +	__le16   window; +} __packed; +  #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY	0x0c1c  struct hci_cp_write_page_scan_activity {  	__le16   interval;  	__le16   window;  } __packed; +#define HCI_OP_READ_PAGE_SCAN_TYPE	0x0c46 +struct hci_rp_read_page_scan_type { +	__u8     status; +	__u8     type; +} __packed; +  #define HCI_OP_WRITE_PAGE_SCAN_TYPE	0x0c47  	#define PAGE_SCAN_TYPE_STANDARD		0x00  	#define PAGE_SCAN_TYPE_INTERLACED	0x01 @@ -965,6 +984,9 @@ struct hci_cp_le_set_adv_data {  #define HCI_OP_LE_SET_ADV_ENABLE	0x200a +#define LE_SCAN_PASSIVE			0x00 +#define LE_SCAN_ACTIVE			0x01 +  #define HCI_OP_LE_SET_SCAN_PARAM	0x200b  struct hci_cp_le_set_scan_param {  	__u8    type; @@ -974,8 +996,10 @@ struct hci_cp_le_set_scan_param {  	__u8    filter_policy;  } __packed; -#define LE_SCANNING_DISABLED		0x00 -#define LE_SCANNING_ENABLED		0x01 +#define LE_SCAN_DISABLE			0x00 +#define LE_SCAN_ENABLE			0x01 +#define LE_SCAN_FILTER_DUP_DISABLE	0x00 +#define LE_SCAN_FILTER_DUP_ENABLE	0x01  #define HCI_OP_LE_SET_SCAN_ENABLE	0x200c  struct hci_cp_le_set_scan_enable { diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 90cf75afcb0..35a57cd1704 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -134,6 +134,8 @@ struct amp_assoc {  	__u8	data[HCI_MAX_AMP_ASSOC_SIZE];  }; +#define HCI_MAX_PAGES	3 +  #define NUM_REASSEMBLY 4  struct hci_dev {  	struct list_head list; @@ -151,8 +153,8 @@ struct hci_dev {  	__u8		dev_class[3];  	__u8		major_class;  	__u8		minor_class; -	__u8		features[8]; -	__u8		host_features[8]; +	__u8		max_page; +	__u8		features[HCI_MAX_PAGES][8];  	__u8		le_features[8];  	__u8		le_white_list_size;  	__u8		le_states[8]; @@ -165,6 +167,10 @@ struct hci_dev {  	__u16		voice_setting;  	__u8		io_capability;  	__s8		inq_tx_power; +	__u16		page_scan_interval; +	__u16		page_scan_window; +	__u8		page_scan_type; +  	__u16		devid_source;  	__u16		devid_vendor;  	__u16		devid_product; @@ -240,6 +246,7 @@ struct hci_dev {  	struct sk_buff_head	raw_q;  	struct sk_buff_head	cmd_q; +	struct sk_buff		*recv_evt;  	struct sk_buff		*sent_cmd;  	struct sk_buff		*reassembly[NUM_REASSEMBLY]; @@ -248,8 +255,6 @@ struct hci_dev {  	__u32			req_status;  	__u32			req_result; -	__u16			init_last_cmd; -  	struct list_head	mgmt_pending;  	struct discovery_state	discovery; @@ -266,8 +271,6 @@ struct hci_dev {  	struct hci_dev_stats	stat; -	struct sk_buff_head	driver_init; -  	atomic_t		promisc;  	struct dentry		*debugfs; @@ -290,6 +293,7 @@ struct hci_dev {  	int (*open)(struct hci_dev *hdev);  	int (*close)(struct hci_dev *hdev);  	int (*flush)(struct hci_dev *hdev); +	int (*setup)(struct hci_dev *hdev);  	int (*send)(struct sk_buff *skb);  	void (*notify)(struct hci_dev *hdev, unsigned int evt);  	int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg); @@ -311,7 +315,7 @@ struct hci_conn {  	bool		out;  	__u8		attempt;  	__u8		dev_class[3]; -	__u8		features[8]; +	__u8		features[HCI_MAX_PAGES][8];  	__u16		interval;  	__u16		pkt_type;  	__u16		link_policy; @@ -343,7 +347,6 @@ struct hci_conn {  	struct timer_list auto_accept_timer;  	struct device	dev; -	atomic_t	devref;  	struct hci_dev	*hdev;  	void		*l2cap_data; @@ -574,7 +577,7 @@ static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,  	return NULL;  } -void hci_acl_disconn(struct hci_conn *conn, __u8 reason); +void hci_disconnect(struct hci_conn *conn, __u8 reason);  void hci_setup_sync(struct hci_conn *conn, __u16 handle);  void hci_sco_setup(struct hci_conn *conn, __u8 status); @@ -582,7 +585,6 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);  int hci_conn_del(struct hci_conn *conn);  void hci_conn_hash_flush(struct hci_dev *hdev);  void hci_conn_check_pending(struct hci_dev *hdev); -void hci_conn_accept(struct hci_conn *conn, int mask);  struct hci_chan *hci_chan_create(struct hci_conn *conn);  void hci_chan_del(struct hci_chan *chan); @@ -599,8 +601,36 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role);  void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active); -void hci_conn_hold_device(struct hci_conn *conn); -void hci_conn_put_device(struct hci_conn *conn); +/* + * hci_conn_get() and hci_conn_put() are used to control the life-time of an + * "hci_conn" object. They do not guarantee that the hci_conn object is running, + * working or anything else. They just guarantee that the object is available + * and can be dereferenced. So you can use its locks, local variables and any + * other constant data. + * Before accessing runtime data, you _must_ lock the object and then check that + * it is still running. As soon as you release the locks, the connection might + * get dropped, though. + * + * On the other hand, hci_conn_hold() and hci_conn_drop() are used to control + * how long the underlying connection is held. So every channel that runs on the + * hci_conn object calls this to prevent the connection from disappearing. As + * long as you hold a device, you must also guarantee that you have a valid + * reference to the device via hci_conn_get() (or the initial reference from + * hci_conn_add()). + * The hold()/drop() ref-count is known to drop below 0 sometimes, which doesn't + * break because nobody cares for that. But this means, we cannot use + * _get()/_drop() in it, but require the caller to have a valid ref (FIXME). + */ + +static inline void hci_conn_get(struct hci_conn *conn) +{ +	get_device(&conn->dev); +} + +static inline void hci_conn_put(struct hci_conn *conn) +{ +	put_device(&conn->dev); +}  static inline void hci_conn_hold(struct hci_conn *conn)  { @@ -610,7 +640,7 @@ static inline void hci_conn_hold(struct hci_conn *conn)  	cancel_delayed_work(&conn->disc_work);  } -static inline void hci_conn_put(struct hci_conn *conn) +static inline void hci_conn_drop(struct hci_conn *conn)  {  	BT_DBG("hcon %p orig refcnt %d", conn, atomic_read(&conn->refcnt)); @@ -742,8 +772,6 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash,  								u8 *randomizer);  int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); -int hci_update_ad(struct hci_dev *hdev); -  void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);  int hci_recv_frame(struct sk_buff *skb); @@ -760,29 +788,29 @@ void hci_conn_del_sysfs(struct hci_conn *conn);  #define SET_HCIDEV_DEV(hdev, pdev) ((hdev)->dev.parent = (pdev))  /* ----- LMP capabilities ----- */ -#define lmp_encrypt_capable(dev)   ((dev)->features[0] & LMP_ENCRYPT) -#define lmp_rswitch_capable(dev)   ((dev)->features[0] & LMP_RSWITCH) -#define lmp_hold_capable(dev)      ((dev)->features[0] & LMP_HOLD) -#define lmp_sniff_capable(dev)     ((dev)->features[0] & LMP_SNIFF) -#define lmp_park_capable(dev)      ((dev)->features[1] & LMP_PARK) -#define lmp_inq_rssi_capable(dev)  ((dev)->features[3] & LMP_RSSI_INQ) -#define lmp_esco_capable(dev)      ((dev)->features[3] & LMP_ESCO) -#define lmp_bredr_capable(dev)     (!((dev)->features[4] & LMP_NO_BREDR)) -#define lmp_le_capable(dev)        ((dev)->features[4] & LMP_LE) -#define lmp_sniffsubr_capable(dev) ((dev)->features[5] & LMP_SNIFF_SUBR) -#define lmp_pause_enc_capable(dev) ((dev)->features[5] & LMP_PAUSE_ENC) -#define lmp_ext_inq_capable(dev)   ((dev)->features[6] & LMP_EXT_INQ) -#define lmp_le_br_capable(dev)     !!((dev)->features[6] & LMP_SIMUL_LE_BR) -#define lmp_ssp_capable(dev)       ((dev)->features[6] & LMP_SIMPLE_PAIR) -#define lmp_no_flush_capable(dev)  ((dev)->features[6] & LMP_NO_FLUSH) -#define lmp_lsto_capable(dev)      ((dev)->features[7] & LMP_LSTO) -#define lmp_inq_tx_pwr_capable(dev) ((dev)->features[7] & LMP_INQ_TX_PWR) -#define lmp_ext_feat_capable(dev)  ((dev)->features[7] & LMP_EXTFEATURES) +#define lmp_encrypt_capable(dev)   ((dev)->features[0][0] & LMP_ENCRYPT) +#define lmp_rswitch_capable(dev)   ((dev)->features[0][0] & LMP_RSWITCH) +#define lmp_hold_capable(dev)      ((dev)->features[0][0] & LMP_HOLD) +#define lmp_sniff_capable(dev)     ((dev)->features[0][0] & LMP_SNIFF) +#define lmp_park_capable(dev)      ((dev)->features[0][1] & LMP_PARK) +#define lmp_inq_rssi_capable(dev)  ((dev)->features[0][3] & LMP_RSSI_INQ) +#define lmp_esco_capable(dev)      ((dev)->features[0][3] & LMP_ESCO) +#define lmp_bredr_capable(dev)     (!((dev)->features[0][4] & LMP_NO_BREDR)) +#define lmp_le_capable(dev)        ((dev)->features[0][4] & LMP_LE) +#define lmp_sniffsubr_capable(dev) ((dev)->features[0][5] & LMP_SNIFF_SUBR) +#define lmp_pause_enc_capable(dev) ((dev)->features[0][5] & LMP_PAUSE_ENC) +#define lmp_ext_inq_capable(dev)   ((dev)->features[0][6] & LMP_EXT_INQ) +#define lmp_le_br_capable(dev)     (!!((dev)->features[0][6] & LMP_SIMUL_LE_BR)) +#define lmp_ssp_capable(dev)       ((dev)->features[0][6] & LMP_SIMPLE_PAIR) +#define lmp_no_flush_capable(dev)  ((dev)->features[0][6] & LMP_NO_FLUSH) +#define lmp_lsto_capable(dev)      ((dev)->features[0][7] & LMP_LSTO) +#define lmp_inq_tx_pwr_capable(dev) ((dev)->features[0][7] & LMP_INQ_TX_PWR) +#define lmp_ext_feat_capable(dev)  ((dev)->features[0][7] & LMP_EXTFEATURES)  /* ----- Extended LMP capabilities ----- */ -#define lmp_host_ssp_capable(dev)  ((dev)->host_features[0] & LMP_HOST_SSP) -#define lmp_host_le_capable(dev)   !!((dev)->host_features[0] & LMP_HOST_LE) -#define lmp_host_le_br_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE_BREDR) +#define lmp_host_ssp_capable(dev)  ((dev)->features[1][0] & LMP_HOST_SSP) +#define lmp_host_le_capable(dev)   (!!((dev)->features[1][0] & LMP_HOST_LE)) +#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))  /* returns true if at least one AMP active */  static inline bool hci_amp_capable(void) @@ -1041,7 +1069,31 @@ static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,  int hci_register_cb(struct hci_cb *hcb);  int hci_unregister_cb(struct hci_cb *hcb); -int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, void *param); +struct hci_request { +	struct hci_dev		*hdev; +	struct sk_buff_head	cmd_q; + +	/* If something goes wrong when building the HCI request, the error +	 * value is stored in this field. +	 */ +	int			err; +}; + +void hci_req_init(struct hci_request *req, struct hci_dev *hdev); +int hci_req_run(struct hci_request *req, hci_req_complete_t complete); +void hci_req_add(struct hci_request *req, u16 opcode, u32 plen, +		 const void *param); +void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, +		    const void *param, u8 event); +void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status); + +struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, +			       const void *param, u32 timeout); +struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, +				  const void *param, u8 event, u32 timeout); + +int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, +		 const void *param);  void hci_send_acl(struct hci_chan *chan, struct sk_buff *skb, __u16 flags);  void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb); @@ -1153,7 +1205,7 @@ struct hci_sec_filter {  #define hci_req_lock(d)		mutex_lock(&d->req_lock)  #define hci_req_unlock(d)	mutex_unlock(&d->req_lock) -void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result); +void hci_update_ad(struct hci_request *req);  void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,  					u16 latency, u16 to_multiplier); diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index cdd33021f83..fb94cf13c77 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h @@ -583,6 +583,14 @@ struct l2cap_conn {  	struct list_head	chan_l;  	struct mutex		chan_lock; +	struct kref		ref; +	struct list_head	users; +}; + +struct l2cap_user { +	struct list_head list; +	int (*probe) (struct l2cap_conn *conn, struct l2cap_user *user); +	void (*remove) (struct l2cap_conn *conn, struct l2cap_user *user);  };  #define L2CAP_INFO_CL_MTU_REQ_SENT	0x01 @@ -786,6 +794,7 @@ extern bool disable_ertm;  int l2cap_init_sockets(void);  void l2cap_cleanup_sockets(void); +bool l2cap_is_socket(struct socket *sock);  void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);  int __l2cap_wait_ack(struct sock *sk); @@ -812,4 +821,10 @@ void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,  		       u8 status);  void __l2cap_physical_cfm(struct l2cap_chan *chan, int result); +void l2cap_conn_get(struct l2cap_conn *conn); +void l2cap_conn_put(struct l2cap_conn *conn); + +int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user); +void l2cap_unregister_user(struct l2cap_conn *conn, struct l2cap_user *user); +  #endif /* __L2CAP_H */ diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index e2e3ecad100..7afd4199d6b 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h @@ -158,7 +158,6 @@ struct rfcomm_session {  	struct timer_list timer;  	unsigned long    state;  	unsigned long    flags; -	atomic_t         refcnt;  	int              initiator;  	/* Default DLC parameters */ @@ -276,11 +275,6 @@ static inline void rfcomm_dlc_unthrottle(struct rfcomm_dlc *d)  void   rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src,  								bdaddr_t *dst); -static inline void rfcomm_session_hold(struct rfcomm_session *s) -{ -	atomic_inc(&s->refcnt); -} -  /* ---- RFCOMM sockets ---- */  struct sockaddr_rc {  	sa_family_t	rc_family; diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h index ef2dd9438bb..028b754ae9b 100644 --- a/include/net/caif/caif_dev.h +++ b/include/net/caif/caif_dev.h @@ -1,6 +1,6 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Author:	Sjur Brendeland/ sjur.brandeland@stericsson.com + * Author:	Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/net/caif/caif_device.h b/include/net/caif/caif_device.h index d02f044adb8..d6e3c4267c8 100644 --- a/include/net/caif/caif_device.h +++ b/include/net/caif/caif_device.h @@ -1,6 +1,6 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Author:	Sjur Brendeland/ sjur.brandeland@stericsson.com + * Author:	Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h index bcb9cc3ce98..4795e817afe 100644 --- a/include/net/caif/caif_hsi.h +++ b/include/net/caif/caif_hsi.h @@ -1,6 +1,5 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Contact: Sjur Brendeland / sjur.brandeland@stericsson.com   * Author:  Daniel Martensson / daniel.martensson@stericsson.com   *	    Dmitry.Tarnyagin  / dmitry.tarnyagin@stericsson.com   * License terms: GNU General Public License (GPL) version 2 diff --git a/include/net/caif/caif_layer.h b/include/net/caif/caif_layer.h index 0f3a39125f9..94e5ed64dc6 100644 --- a/include/net/caif/caif_layer.h +++ b/include/net/caif/caif_layer.h @@ -1,6 +1,6 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Author:	Sjur Brendeland / sjur.brandeland@stericsson.com + * Author:	Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/net/caif/caif_shm.h b/include/net/caif/caif_shm.h deleted file mode 100644 index 5bcce55438c..00000000000 --- a/include/net/caif/caif_shm.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) ST-Ericsson AB 2010 - * Contact: Sjur Brendeland / sjur.brandeland@stericsson.com - * Author: Amarnath Revanna / amarnath.bangalore.revanna@stericsson.com - * License terms: GNU General Public License (GPL) version 2 - */ - -#ifndef CAIF_SHM_H_ -#define CAIF_SHM_H_ - -struct shmdev_layer { -	u32 shm_base_addr; -	u32 shm_total_sz; -	u32 shm_id; -	u32 shm_loopback; -	void *hmbx; -	int (*pshmdev_mbxsend) (u32 shm_id, u32 mbx_msg); -	int (*pshmdev_mbxsetup) (void *pshmdrv_cb, -				struct shmdev_layer *pshm_dev, void *pshm_drv); -	struct net_device *pshm_netdev; -}; - -extern int caif_shmcore_probe(struct shmdev_layer *pshm_dev); -extern void caif_shmcore_remove(struct net_device *pshm_netdev); - -#endif diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h index 90b4ff8bad8..70bfd017581 100644 --- a/include/net/caif/cfcnfg.h +++ b/include/net/caif/cfcnfg.h @@ -1,6 +1,6 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * Author:	Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h index 9e5425b4a1d..f2ae33d23ba 100644 --- a/include/net/caif/cfctrl.h +++ b/include/net/caif/cfctrl.h @@ -1,6 +1,6 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * Author:	Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/net/caif/cffrml.h b/include/net/caif/cffrml.h index afac1a48cce..a06e33fbaa8 100644 --- a/include/net/caif/cffrml.h +++ b/include/net/caif/cffrml.h @@ -1,6 +1,6 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * Author:	Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/net/caif/cfmuxl.h b/include/net/caif/cfmuxl.h index 5847a196b8a..752999572f2 100644 --- a/include/net/caif/cfmuxl.h +++ b/include/net/caif/cfmuxl.h @@ -1,6 +1,6 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * Author:	Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h index 83a89ba3005..1c1ad46250d 100644 --- a/include/net/caif/cfpkt.h +++ b/include/net/caif/cfpkt.h @@ -1,6 +1,6 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * Author:	Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/net/caif/cfserl.h b/include/net/caif/cfserl.h index f121299a342..b5b020f3c72 100644 --- a/include/net/caif/cfserl.h +++ b/include/net/caif/cfserl.h @@ -1,6 +1,6 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * Author:	Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h index 0f590524184..cd47705c2cc 100644 --- a/include/net/caif/cfsrvl.h +++ b/include/net/caif/cfsrvl.h @@ -1,6 +1,6 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Author:	Sjur Brendeland/sjur.brandeland@stericsson.com + * Author:	Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index d581c6de5d6..26b5b692c22 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -611,22 +611,10 @@ struct cfg80211_ap_settings {  };  /** - * enum plink_action - actions to perform in mesh peers - * - * @PLINK_ACTION_INVALID: action 0 is reserved - * @PLINK_ACTION_OPEN: start mesh peer link establishment - * @PLINK_ACTION_BLOCK: block traffic from this mesh peer - */ -enum plink_actions { -	PLINK_ACTION_INVALID, -	PLINK_ACTION_OPEN, -	PLINK_ACTION_BLOCK, -}; - -/**   * enum station_parameters_apply_mask - station parameter values to apply   * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)   * @STATION_PARAM_APPLY_CAPABILITY: apply new capability + * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state   *   * Not all station parameters have in-band "no change" signalling,   * for those that don't these flags will are used. @@ -634,6 +622,7 @@ enum plink_actions {  enum station_parameters_apply_mask {  	STATION_PARAM_APPLY_UAPSD = BIT(0),  	STATION_PARAM_APPLY_CAPABILITY = BIT(1), +	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),  };  /** @@ -669,7 +658,7 @@ enum station_parameters_apply_mask {   * @ext_capab_len: number of extended capabilities   */  struct station_parameters { -	u8 *supported_rates; +	const u8 *supported_rates;  	struct net_device *vlan;  	u32 sta_flags_mask, sta_flags_set;  	u32 sta_modify_mask; @@ -678,17 +667,60 @@ struct station_parameters {  	u8 supported_rates_len;  	u8 plink_action;  	u8 plink_state; -	struct ieee80211_ht_cap *ht_capa; -	struct ieee80211_vht_cap *vht_capa; +	const struct ieee80211_ht_cap *ht_capa; +	const struct ieee80211_vht_cap *vht_capa;  	u8 uapsd_queues;  	u8 max_sp;  	enum nl80211_mesh_power_mode local_pm;  	u16 capability; -	u8 *ext_capab; +	const u8 *ext_capab;  	u8 ext_capab_len;  };  /** + * enum cfg80211_station_type - the type of station being modified + * @CFG80211_STA_AP_CLIENT: client of an AP interface + * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has + *	the AP MLME in the device + * @CFG80211_STA_AP_STA: AP station on managed interface + * @CFG80211_STA_IBSS: IBSS station + * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry + *	while TDLS setup is in progress, it moves out of this state when + *	being marked authorized; use this only if TDLS with external setup is + *	supported/used) + * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active + *	entry that is operating, has been marked authorized by userspace) + * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed) + * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed) + */ +enum cfg80211_station_type { +	CFG80211_STA_AP_CLIENT, +	CFG80211_STA_AP_MLME_CLIENT, +	CFG80211_STA_AP_STA, +	CFG80211_STA_IBSS, +	CFG80211_STA_TDLS_PEER_SETUP, +	CFG80211_STA_TDLS_PEER_ACTIVE, +	CFG80211_STA_MESH_PEER_KERNEL, +	CFG80211_STA_MESH_PEER_USER, +}; + +/** + * cfg80211_check_station_change - validate parameter changes + * @wiphy: the wiphy this operates on + * @params: the new parameters for a station + * @statype: the type of station being modified + * + * Utility function for the @change_station driver method. Call this function + * with the appropriate station type looking up the station (and checking that + * it exists). It will verify whether the station change is acceptable, and if + * not will return an error code. Note that it may modify the parameters for + * backward compatibility reasons, so don't use them before calling this. + */ +int cfg80211_check_station_change(struct wiphy *wiphy, +				  struct station_parameters *params, +				  enum cfg80211_station_type statype); + +/**   * enum station_info_flags - station information flags   *   * Used by the driver to indicate which info in &struct station_info @@ -1119,6 +1151,7 @@ struct mesh_config {   * @ie_len: length of vendor information elements   * @is_authenticated: this mesh requires authentication   * @is_secure: this mesh uses security + * @user_mpm: userspace handles all MPM functions   * @dtim_period: DTIM period to use   * @beacon_interval: beacon interval to use   * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] @@ -1136,6 +1169,7 @@ struct mesh_setup {  	u8 ie_len;  	bool is_authenticated;  	bool is_secure; +	bool user_mpm;  	u8 dtim_period;  	u16 beacon_interval;  	int mcast_rate[IEEE80211_NUM_BANDS]; @@ -1398,9 +1432,11 @@ struct cfg80211_auth_request {   * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.   *   * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n) + * @ASSOC_REQ_DISABLE_VHT:  Disable VHT   */  enum cfg80211_assoc_req_flags {  	ASSOC_REQ_DISABLE_HT		= BIT(0), +	ASSOC_REQ_DISABLE_VHT		= BIT(1),  };  /** @@ -1422,6 +1458,8 @@ enum cfg80211_assoc_req_flags {   * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask   *   will be used in ht_capa.  Un-supported values will be ignored.   * @ht_capa_mask:  The bits of ht_capa which are to be used. + * @vht_capa: VHT capability override + * @vht_capa_mask: VHT capability mask indicating which fields to use   */  struct cfg80211_assoc_request {  	struct cfg80211_bss *bss; @@ -1432,6 +1470,7 @@ struct cfg80211_assoc_request {  	u32 flags;  	struct ieee80211_ht_cap ht_capa;  	struct ieee80211_ht_cap ht_capa_mask; +	struct ieee80211_vht_cap vht_capa, vht_capa_mask;  };  /** @@ -1542,6 +1581,8 @@ struct cfg80211_ibss_params {   * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask   *   will be used in ht_capa.  Un-supported values will be ignored.   * @ht_capa_mask:  The bits of ht_capa which are to be used. + * @vht_capa:  VHT Capability overrides + * @vht_capa_mask: The bits of vht_capa which are to be used.   */  struct cfg80211_connect_params {  	struct ieee80211_channel *channel; @@ -1560,6 +1601,8 @@ struct cfg80211_connect_params {  	int bg_scan_period;  	struct ieee80211_ht_cap ht_capa;  	struct ieee80211_ht_cap ht_capa_mask; +	struct ieee80211_vht_cap vht_capa; +	struct ieee80211_vht_cap vht_capa_mask;  };  /** @@ -1722,6 +1765,21 @@ struct cfg80211_gtk_rekey_data {  };  /** + * struct cfg80211_update_ft_ies_params - FT IE Information + * + * This structure provides information needed to update the fast transition IE + * + * @md: The Mobility Domain ID, 2 Octet value + * @ie: Fast Transition IEs + * @ie_len: Length of ft_ie in octets + */ +struct cfg80211_update_ft_ies_params { +	u16 md; +	const u8 *ie; +	size_t ie_len; +}; + +/**   * struct cfg80211_ops - backend description for wireless configuration   *   * This struct is registered by fullmac card drivers and/or wireless stacks @@ -1781,9 +1839,8 @@ struct cfg80211_gtk_rekey_data {   * @change_station: Modify a given station. Note that flags changes are not much   *	validated in cfg80211, in particular the auth/assoc/authorized flags   *	might come to the driver in invalid combinations -- make sure to check - *	them, also against the existing state! Also, supported_rates changes are - *	not checked in station mode -- drivers need to reject (or ignore) them - *	for anything but TDLS peers. + *	them, also against the existing state! Drivers must call + *	cfg80211_check_station_change() to validate the information.   * @get_station: get station information for the station identified by @mac   * @dump_station: dump station callback -- resume dump at index @idx   * @@ -1941,6 +1998,16 @@ struct cfg80211_gtk_rekey_data {   *	advertise the support for MAC based ACL have to implement this callback.   *   * @start_radar_detection: Start radar detection in the driver. + * + * @update_ft_ies: Provide updated Fast BSS Transition information to the + *	driver. If the SME is in the driver/firmware, this information can be + *	used in building Authentication and Reassociation Request frames. + * + * @crit_proto_start: Indicates a critical protocol needs more link reliability + *	for a given duration (milliseconds). The protocol is provided so the + *	driver can take the most appropriate actions. + * @crit_proto_stop: Indicates critical protocol no longer needs increased link + *	reliability. This operation can not fail.   */  struct cfg80211_ops {  	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); @@ -2168,6 +2235,14 @@ struct cfg80211_ops {  	int	(*start_radar_detection)(struct wiphy *wiphy,  					 struct net_device *dev,  					 struct cfg80211_chan_def *chandef); +	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev, +				 struct cfg80211_update_ft_ies_params *ftie); +	int	(*crit_proto_start)(struct wiphy *wiphy, +				    struct wireless_dev *wdev, +				    enum nl80211_crit_proto_id protocol, +				    u16 duration); +	void	(*crit_proto_stop)(struct wiphy *wiphy, +				   struct wireless_dev *wdev);  };  /* @@ -2485,6 +2560,8 @@ struct wiphy_wowlan_support {   * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.   * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.   *	If null, then none can be over-ridden. + * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden. + *	If null, then none can be over-ridden.   *   * @max_acl_mac_addrs: Maximum number of MAC addresses that the device   *	supports for ACL. @@ -2593,6 +2670,7 @@ struct wiphy {  	struct dentry *debugfsdir;  	const struct ieee80211_ht_cap *ht_capa_mod_mask; +	const struct ieee80211_vht_cap *vht_capa_mod_mask;  #ifdef CONFIG_NET_NS  	/* the network namespace this phy lives in currently */ @@ -3958,6 +4036,17 @@ bool cfg80211_reg_can_beacon(struct wiphy *wiphy,  void cfg80211_ch_switch_notify(struct net_device *dev,  			       struct cfg80211_chan_def *chandef); +/** + * ieee80211_operating_class_to_band - convert operating class to band + * + * @operating_class: the operating class to convert + * @band: band pointer to fill + * + * Returns %true if the conversion was successful, %false otherwise. + */ +bool ieee80211_operating_class_to_band(u8 operating_class, +				       enum ieee80211_band *band); +  /*   * cfg80211_tdls_oper_request - request userspace to perform TDLS operation   * @dev: the device on which the operation is requested @@ -4002,6 +4091,30 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate);  void cfg80211_unregister_wdev(struct wireless_dev *wdev);  /** + * struct cfg80211_ft_event - FT Information Elements + * @ies: FT IEs + * @ies_len: length of the FT IE in bytes + * @target_ap: target AP's MAC address + * @ric_ies: RIC IE + * @ric_ies_len: length of the RIC IE in bytes + */ +struct cfg80211_ft_event_params { +	const u8 *ies; +	size_t ies_len; +	const u8 *target_ap; +	const u8 *ric_ies; +	size_t ric_ies_len; +}; + +/** + * cfg80211_ft_event - notify userspace about FT IE and RIC IE + * @netdev: network device + * @ft_event: IE information + */ +void cfg80211_ft_event(struct net_device *netdev, +		       struct cfg80211_ft_event_params *ft_event); + +/**   * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer   * @ies: the input IE buffer   * @len: the input length @@ -4036,6 +4149,17 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,  				   struct cfg80211_wowlan_wakeup *wakeup,  				   gfp_t gfp); +/** + * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver. + * + * @wdev: the wireless device for which critical protocol is stopped. + * + * This function can be called by the driver to indicate it has reverted + * operation back to normal. One reason could be that the duration given + * by .crit_proto_start() has expired. + */ +void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp); +  /* Logging, debugging and troubleshooting/diagnostic helpers. */  /* wiphy_printk helpers, similar to dev_printk */ diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h index 2581638f4a3..0fee0617fb7 100644 --- a/include/net/cls_cgroup.h +++ b/include/net/cls_cgroup.h @@ -24,7 +24,7 @@ struct cgroup_cls_state  	u32 classid;  }; -extern void sock_update_classid(struct sock *sk, struct task_struct *task); +extern void sock_update_classid(struct sock *sk);  #if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)  static inline u32 task_cls_classid(struct task_struct *p) @@ -61,7 +61,7 @@ static inline u32 task_cls_classid(struct task_struct *p)  }  #endif  #else /* !CGROUP_NET_CLS_CGROUP */ -static inline void sock_update_classid(struct sock *sk, struct task_struct *task) +static inline void sock_update_classid(struct sock *sk)  {  } diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h index 1ee9d4bda30..74004af31c4 100644 --- a/include/net/dn_fib.h +++ b/include/net/dn_fib.h @@ -1,24 +1,9 @@  #ifndef _NET_DN_FIB_H  #define _NET_DN_FIB_H -/* WARNING: The ordering of these elements must match ordering - *          of RTA_* rtnetlink attribute numbers. - */ -struct dn_kern_rta { -        void            *rta_dst; -        void            *rta_src; -        int             *rta_iif; -        int             *rta_oif; -        void            *rta_gw; -        u32             *rta_priority; -        void            *rta_prefsrc; -        struct rtattr   *rta_mx; -        struct rtattr   *rta_mp; -        unsigned char   *rta_protoinfo; -        u32             *rta_flow; -        struct rta_cacheinfo *rta_ci; -	struct rta_session *rta_sess; -}; +#include <linux/netlink.h> + +extern const struct nla_policy rtm_dn_policy[];  struct dn_fib_res {  	struct fib_rule *r; @@ -93,10 +78,10 @@ struct dn_fib_table {  	u32 n;  	int (*insert)(struct dn_fib_table *t, struct rtmsg *r,  -			struct dn_kern_rta *rta, struct nlmsghdr *n,  +			struct nlattr *attrs[], struct nlmsghdr *n,  			struct netlink_skb_parms *req);  	int (*delete)(struct dn_fib_table *t, struct rtmsg *r, -			struct dn_kern_rta *rta, struct nlmsghdr *n, +			struct nlattr *attrs[], struct nlmsghdr *n,  			struct netlink_skb_parms *req);  	int (*lookup)(struct dn_fib_table *t, const struct flowidn *fld,  			struct dn_fib_res *res); @@ -116,13 +101,12 @@ extern void dn_fib_cleanup(void);  extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd,   			unsigned long arg);  extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r,  -				struct dn_kern_rta *rta,  +				struct nlattr *attrs[],  				const struct nlmsghdr *nlh, int *errp);  extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi,   			const struct flowidn *fld,  			struct dn_fib_res *res);  extern void dn_fib_release_info(struct dn_fib_info *fi); -extern __le16 dn_fib_get_attr16(struct rtattr *attr, int attrlen, int type);  extern void dn_fib_flush(void);  extern void dn_fib_select_multipath(const struct flowidn *fld,  					struct dn_fib_res *res); diff --git a/include/net/firewire.h b/include/net/firewire.h new file mode 100644 index 00000000000..31bcbfe7a22 --- /dev/null +++ b/include/net/firewire.h @@ -0,0 +1,25 @@ +#ifndef _NET_FIREWIRE_H +#define _NET_FIREWIRE_H + +/* Pseudo L2 address */ +#define FWNET_ALEN	16 +union fwnet_hwaddr { +	u8 u[FWNET_ALEN]; +	/* "Hardware address" defined in RFC2734/RF3146 */ +	struct { +		__be64 uniq_id;		/* EUI-64			*/ +		u8 max_rec;		/* max packet size		*/ +		u8 sspd;		/* max speed			*/ +		__be16 fifo_hi;		/* hi 16bits of FIFO addr	*/ +		__be32 fifo_lo;		/* lo 32bits of FIFO addr	*/ +	} __packed uc; +}; + +/* Pseudo L2 Header */ +#define FWNET_HLEN	18 +struct fwnet_header { +	u8 h_dest[FWNET_ALEN];	/* destination address */ +	__be16 h_proto;		/* packet type ID field */ +} __packed; + +#endif diff --git a/include/net/genetlink.h b/include/net/genetlink.h index bdfbe68c1c3..93024a47e0e 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h @@ -50,6 +50,7 @@ struct genl_family {  	unsigned int		version;  	unsigned int		maxattr;  	bool			netnsok; +	bool			parallel_ops;  	int			(*pre_doit)(struct genl_ops *ops,  					    struct sk_buff *skb,  					    struct genl_info *info); diff --git a/include/net/gre.h b/include/net/gre.h index 82665474bcb..9f03a390c82 100644 --- a/include/net/gre.h +++ b/include/net/gre.h @@ -2,6 +2,7 @@  #define __LINUX_GRE_H  #include <linux/skbuff.h> +#include <net/ip_tunnels.h>  #define GREPROTO_CISCO		0  #define GREPROTO_PPTP		1 @@ -12,7 +13,57 @@ struct gre_protocol {  	void (*err_handler)(struct sk_buff *skb, u32 info);  }; +struct gre_base_hdr { +	__be16 flags; +	__be16 protocol; +}; +#define GRE_HEADER_SECTION 4 +  int gre_add_protocol(const struct gre_protocol *proto, u8 version);  int gre_del_protocol(const struct gre_protocol *proto, u8 version); +static inline __be16 gre_flags_to_tnl_flags(__be16 flags) +{ +	__be16 tflags = 0; + +	if (flags & GRE_CSUM) +		tflags |= TUNNEL_CSUM; +	if (flags & GRE_ROUTING) +		tflags |= TUNNEL_ROUTING; +	if (flags & GRE_KEY) +		tflags |= TUNNEL_KEY; +	if (flags & GRE_SEQ) +		tflags |= TUNNEL_SEQ; +	if (flags & GRE_STRICT) +		tflags |= TUNNEL_STRICT; +	if (flags & GRE_REC) +		tflags |= TUNNEL_REC; +	if (flags & GRE_VERSION) +		tflags |= TUNNEL_VERSION; + +	return tflags; +} + +static inline __be16 tnl_flags_to_gre_flags(__be16 tflags) +{ +	__be16 flags = 0; + +	if (tflags & TUNNEL_CSUM) +		flags |= GRE_CSUM; +	if (tflags & TUNNEL_ROUTING) +		flags |= GRE_ROUTING; +	if (tflags & TUNNEL_KEY) +		flags |= GRE_KEY; +	if (tflags & TUNNEL_SEQ) +		flags |= GRE_SEQ; +	if (tflags & TUNNEL_STRICT) +		flags |= GRE_STRICT; +	if (tflags & TUNNEL_REC) +		flags |= GRE_REC; +	if (tflags & TUNNEL_VERSION) +		flags |= GRE_VERSION; + +	return flags; +} +  #endif diff --git a/include/net/ieee802154_netdev.h b/include/net/ieee802154_netdev.h index d104c882fc2..8196d5d4035 100644 --- a/include/net/ieee802154_netdev.h +++ b/include/net/ieee802154_netdev.h @@ -85,6 +85,8 @@ struct wpan_phy;   * Use wpan_wpy_put to put that reference.   */  struct ieee802154_mlme_ops { +	/* The following fields are optional (can be NULL). */ +  	int (*assoc_req)(struct net_device *dev,  			struct ieee802154_addr *addr,  			u8 channel, u8 page, u8 cap); @@ -101,6 +103,8 @@ struct ieee802154_mlme_ops {  	int (*scan_req)(struct net_device *dev,  			u8 type, u32 channels, u8 page, u8 duration); +	/* The fields below are required. */ +  	struct wpan_phy *(*get_phy)(const struct net_device *dev);  	/* @@ -110,7 +114,6 @@ struct ieee802154_mlme_ops {  	u16 (*get_pan_id)(const struct net_device *dev);  	u16 (*get_short_addr)(const struct net_device *dev);  	u8 (*get_dsn)(const struct net_device *dev); -	u8 (*get_bsn)(const struct net_device *dev);  };  /* The IEEE 802.15.4 standard defines 2 type of the devices: diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index 93563221d29..100fb8cec17 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h @@ -71,6 +71,8 @@ struct inet6_ifaddr {  	struct inet6_ifaddr	*ifpub;  	int			regen_count;  #endif +	bool			tokenized; +  	struct rcu_head		rcu;  }; @@ -187,6 +189,8 @@ struct inet6_dev {  	struct list_head	tempaddr_list;  #endif +	struct in6_addr		token; +  	struct neigh_parms	*nd_parms;  	struct inet6_dev	*next;  	struct ipv6_devconf	cnf; diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 183292722f6..de2c78529af 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h @@ -133,6 +133,8 @@ struct inet_connection_sock {  #define ICSK_TIME_RETRANS	1	/* Retransmit timer */  #define ICSK_TIME_DACK		2	/* Delayed ack timer */  #define ICSK_TIME_PROBE0	3	/* Zero window probe timer */ +#define ICSK_TIME_EARLY_RETRANS 4	/* Early retransmit timer */ +#define ICSK_TIME_LOSS_PROBE	5	/* Tail loss probe timer */  static inline struct inet_connection_sock *inet_csk(const struct sock *sk)  { @@ -222,7 +224,8 @@ static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what,  		when = max_when;  	} -	if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0) { +	if (what == ICSK_TIME_RETRANS || what == ICSK_TIME_PROBE0 || +	    what == ICSK_TIME_EARLY_RETRANS || what ==  ICSK_TIME_LOSS_PROBE) {  		icsk->icsk_pending = what;  		icsk->icsk_timeout = jiffies + when;  		sk_reset_timer(sk, &icsk->icsk_retransmit_timer, icsk->icsk_timeout); diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 0a1dcc2fa2f..4182c9be8bb 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h @@ -41,7 +41,7 @@ struct inet_frag_queue {  	struct netns_frags	*net;  }; -#define INETFRAGS_HASHSZ		64 +#define INETFRAGS_HASHSZ	1024  /* averaged:   * max_depth = default ipfrag_high_thresh / INETFRAGS_HASHSZ / @@ -50,10 +50,16 @@ struct inet_frag_queue {   */  #define INETFRAGS_MAXDEPTH		128 +struct inet_frag_bucket { +	struct hlist_head	chain; +	spinlock_t		chain_lock; +}; +  struct inet_frags { -	struct hlist_head	hash[INETFRAGS_HASHSZ]; +	struct inet_frag_bucket	hash[INETFRAGS_HASHSZ];  	/* This rwlock is a global lock (seperate per IPv4, IPv6 and  	 * netfilter). Important to keep this on a seperate cacheline. +	 * Its primarily a rebuild protection rwlock.  	 */  	rwlock_t		lock ____cacheline_aligned_in_smp;  	int			secret_interval; @@ -143,6 +149,7 @@ static inline void inet_frag_lru_del(struct inet_frag_queue *q)  {  	spin_lock(&q->net->lru_lock);  	list_del(&q->lru_list); +	q->net->nqueues--;  	spin_unlock(&q->net->lru_lock);  } @@ -151,6 +158,19 @@ static inline void inet_frag_lru_add(struct netns_frags *nf,  {  	spin_lock(&nf->lru_lock);  	list_add_tail(&q->lru_list, &nf->lru_list); +	q->net->nqueues++;  	spin_unlock(&nf->lru_lock);  } + +/* RFC 3168 support : + * We want to check ECN values of all fragments, do detect invalid combinations. + * In ipq->ecn, we store the OR value of each ip4_frag_ecn() fragment value. + */ +#define	IPFRAG_ECN_NOT_ECT	0x01 /* one frag had ECN_NOT_ECT */ +#define	IPFRAG_ECN_ECT_1	0x02 /* one frag had ECN_ECT_1 */ +#define	IPFRAG_ECN_ECT_0	0x04 /* one frag had ECN_ECT_0 */ +#define	IPFRAG_ECN_CE		0x08 /* one frag had ECN_CE */ + +extern const u8 ip_frag_ecn_table[16]; +  #endif diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h index e03047f7090..4da5de10d1d 100644 --- a/include/net/ip6_tunnel.h +++ b/include/net/ip6_tunnel.h @@ -3,6 +3,7 @@  #include <linux/ipv6.h>  #include <linux/netdevice.h> +#include <linux/if_tunnel.h>  #include <linux/ip6_tunnel.h>  #define IP6TUNNEL_ERR_TIMEO (30*HZ) @@ -68,4 +69,24 @@ __u16 ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw);  __u32 ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,  			     const struct in6_addr *raddr); +static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev) +{ +	struct net_device_stats *stats = &dev->stats; +	int pkt_len, err; + +	nf_reset(skb); +	pkt_len = skb->len; +	err = ip6_local_out(skb); + +	if (net_xmit_eval(err) == 0) { +		struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); +		u64_stats_update_begin(&tstats->syncp); +		tstats->tx_bytes += pkt_len; +		tstats->tx_packets++; +		u64_stats_update_end(&tstats->syncp); +	} else { +		stats->tx_errors++; +		stats->tx_aborted_errors++; +	} +}  #endif diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h new file mode 100644 index 00000000000..4b6f0b28f41 --- /dev/null +++ b/include/net/ip_tunnels.h @@ -0,0 +1,177 @@ +#ifndef __NET_IP_TUNNELS_H +#define __NET_IP_TUNNELS_H 1 + +#include <linux/if_tunnel.h> +#include <linux/netdevice.h> +#include <linux/skbuff.h> +#include <linux/types.h> +#include <linux/u64_stats_sync.h> +#include <net/dsfield.h> +#include <net/gro_cells.h> +#include <net/inet_ecn.h> +#include <net/ip.h> +#include <net/rtnetlink.h> + +#if IS_ENABLED(CONFIG_IPV6) +#include <net/ipv6.h> +#include <net/ip6_fib.h> +#include <net/ip6_route.h> +#endif + +/* Keep error state on tunnel for 30 sec */ +#define IPTUNNEL_ERR_TIMEO	(30*HZ) + +/* 6rd prefix/relay information */ +#ifdef CONFIG_IPV6_SIT_6RD +struct ip_tunnel_6rd_parm { +	struct in6_addr		prefix; +	__be32			relay_prefix; +	u16			prefixlen; +	u16			relay_prefixlen; +}; +#endif + +struct ip_tunnel_prl_entry { +	struct ip_tunnel_prl_entry __rcu *next; +	__be32				addr; +	u16				flags; +	struct rcu_head			rcu_head; +}; + +struct ip_tunnel { +	struct ip_tunnel __rcu	*next; +	struct hlist_node hash_node; +	struct net_device	*dev; + +	int		err_count;	/* Number of arrived ICMP errors */ +	unsigned long	err_time;	/* Time when the last ICMP error +					 * arrived */ + +	/* These four fields used only by GRE */ +	__u32		i_seqno;	/* The last seen seqno	*/ +	__u32		o_seqno;	/* The last output seqno */ +	int		hlen;		/* Precalculated header length */ +	int		mlink; + +	struct ip_tunnel_parm parms; + +	/* for SIT */ +#ifdef CONFIG_IPV6_SIT_6RD +	struct ip_tunnel_6rd_parm ip6rd; +#endif +	struct ip_tunnel_prl_entry __rcu *prl;	/* potential router list */ +	unsigned int		prl_count;	/* # of entries in PRL */ +	int			ip_tnl_net_id; +	struct gro_cells	gro_cells; +}; + +#define TUNNEL_CSUM	__cpu_to_be16(0x01) +#define TUNNEL_ROUTING	__cpu_to_be16(0x02) +#define TUNNEL_KEY	__cpu_to_be16(0x04) +#define TUNNEL_SEQ	__cpu_to_be16(0x08) +#define TUNNEL_STRICT	__cpu_to_be16(0x10) +#define TUNNEL_REC	__cpu_to_be16(0x20) +#define TUNNEL_VERSION	__cpu_to_be16(0x40) +#define TUNNEL_NO_KEY	__cpu_to_be16(0x80) + +struct tnl_ptk_info { +	__be16 flags; +	__be16 proto; +	__be32 key; +	__be32 seq; +}; + +#define PACKET_RCVD	0 +#define PACKET_REJECT	1 + +#define IP_TNL_HASH_BITS   10 +#define IP_TNL_HASH_SIZE   (1 << IP_TNL_HASH_BITS) + +struct ip_tunnel_net { +	struct hlist_head *tunnels; +	struct net_device *fb_tunnel_dev; +}; + +int ip_tunnel_init(struct net_device *dev); +void ip_tunnel_uninit(struct net_device *dev); +void  ip_tunnel_dellink(struct net_device *dev, struct list_head *head); +int __net_init ip_tunnel_init_net(struct net *net, int ip_tnl_net_id, +				  struct rtnl_link_ops *ops, char *devname); + +void __net_exit ip_tunnel_delete_net(struct ip_tunnel_net *itn); + +void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev, +		    const struct iphdr *tnl_params); +int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); +int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu); + +struct rtnl_link_stats64 *ip_tunnel_get_stats64(struct net_device *dev, +						struct rtnl_link_stats64 *tot); +struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn, +				   int link, __be16 flags, +				   __be32 remote, __be32 local, +				   __be32 key); + +int ip_tunnel_rcv(struct ip_tunnel *tunnel, struct sk_buff *skb, +		  const struct tnl_ptk_info *tpi, bool log_ecn_error); +int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[], +			 struct ip_tunnel_parm *p); +int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[], +		      struct ip_tunnel_parm *p); +void ip_tunnel_setup(struct net_device *dev, int net_id); + +/* Extract dsfield from inner protocol */ +static inline u8 ip_tunnel_get_dsfield(const struct iphdr *iph, +				       const struct sk_buff *skb) +{ +	if (skb->protocol == htons(ETH_P_IP)) +		return iph->tos; +	else if (skb->protocol == htons(ETH_P_IPV6)) +		return ipv6_get_dsfield((const struct ipv6hdr *)iph); +	else +		return 0; +} + +/* Propogate ECN bits out */ +static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, +				     const struct sk_buff *skb) +{ +	u8 inner = ip_tunnel_get_dsfield(iph, skb); + +	return INET_ECN_encapsulate(tos, inner); +} + +static inline void tunnel_ip_select_ident(struct sk_buff *skb, +					  const struct iphdr  *old_iph, +					  struct dst_entry *dst) +{ +	struct iphdr *iph = ip_hdr(skb); + +	/* Use inner packet iph-id if possible. */ +	if (skb->protocol == htons(ETH_P_IP) && old_iph->id) +		iph->id	= old_iph->id; +	else +		__ip_select_ident(iph, dst, +				  (skb_shinfo(skb)->gso_segs ?: 1) - 1); +} + +static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev) +{ +	int err; +	int pkt_len = skb->len - skb_transport_offset(skb); +	struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); + +	nf_reset(skb); + +	err = ip_local_out(skb); +	if (likely(net_xmit_eval(err) == 0)) { +		u64_stats_update_begin(&tstats->syncp); +		tstats->tx_bytes += pkt_len; +		tstats->tx_packets++; +		u64_stats_update_end(&tstats->syncp); +	} else { +		dev->stats.tx_errors++; +		dev->stats.tx_aborted_errors++; +	} +} +#endif /* __NET_IP_TUNNELS_H */ diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index fce8e6b66d5..4c062ccff9a 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h @@ -233,6 +233,21 @@ static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst,  	dst->ip = src->ip;  } +static inline void ip_vs_addr_set(int af, union nf_inet_addr *dst, +				  const union nf_inet_addr *src) +{ +#ifdef CONFIG_IP_VS_IPV6 +	if (af == AF_INET6) { +		dst->in6 = src->in6; +		return; +	} +#endif +	dst->ip = src->ip; +	dst->all[1] = 0; +	dst->all[2] = 0; +	dst->all[3] = 0; +} +  static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a,  				   const union nf_inet_addr *b)  { @@ -344,8 +359,6 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,  #define LeaveFunction(level)   do {} while (0)  #endif -#define	IP_VS_WAIT_WHILE(expr)	while (expr) { cpu_relax(); } -  /*   *      The port number of FTP service (in network order). @@ -459,7 +472,7 @@ struct ip_vs_estimator {  struct ip_vs_stats {  	struct ip_vs_stats_user	ustats;		/* statistics */  	struct ip_vs_estimator	est;		/* estimator */ -	struct ip_vs_cpu_stats	*cpustats;	/* per cpu counters */ +	struct ip_vs_cpu_stats __percpu	*cpustats;	/* per cpu counters */  	spinlock_t		lock;		/* spin lock */  	struct ip_vs_stats_user	ustats0;	/* reset values */  }; @@ -566,20 +579,19 @@ struct ip_vs_conn_param {   */  struct ip_vs_conn {  	struct hlist_node	c_list;         /* hashed list heads */ -#ifdef CONFIG_NET_NS -	struct net              *net;           /* Name space */ -#endif  	/* Protocol, addresses and port numbers */ -	u16                     af;             /* address family */  	__be16                  cport; -	__be16                  vport;  	__be16                  dport; -	__u32                   fwmark;         /* Fire wall mark from skb */ +	__be16                  vport; +	u16			af;		/* address family */  	union nf_inet_addr      caddr;          /* client address */  	union nf_inet_addr      vaddr;          /* virtual address */  	union nf_inet_addr      daddr;          /* destination address */  	volatile __u32          flags;          /* status flags */  	__u16                   protocol;       /* Which protocol (TCP/UDP) */ +#ifdef CONFIG_NET_NS +	struct net              *net;           /* Name space */ +#endif  	/* counter and timer */  	atomic_t		refcnt;		/* reference count */ @@ -593,6 +605,7 @@ struct ip_vs_conn {  						 * state transition triggerd  						 * synchronization  						 */ +	__u32			fwmark;		/* Fire wall mark from skb */  	unsigned long		sync_endtime;	/* jiffies + sent_retries */  	/* Control members */ @@ -620,6 +633,8 @@ struct ip_vs_conn {  	const struct ip_vs_pe	*pe;  	char			*pe_data;  	__u8			pe_data_len; + +	struct rcu_head		rcu_head;  };  /* @@ -663,7 +678,7 @@ struct ip_vs_service_user_kern {  	u16			af;  	u16			protocol;  	union nf_inet_addr	addr;		/* virtual ip address */ -	u16			port; +	__be16			port;  	u32			fwmark;		/* firwall mark of service */  	/* virtual service options */ @@ -671,14 +686,14 @@ struct ip_vs_service_user_kern {  	char			*pe_name;  	unsigned int		flags;		/* virtual service flags */  	unsigned int		timeout;	/* persistent timeout in sec */ -	u32			netmask;	/* persistent netmask */ +	__be32			netmask;	/* persistent netmask or plen */  };  struct ip_vs_dest_user_kern {  	/* destination server address */  	union nf_inet_addr	addr; -	u16			port; +	__be16			port;  	/* real server options */  	unsigned int		conn_flags;	/* connection flags */ @@ -695,10 +710,9 @@ struct ip_vs_dest_user_kern {   *	and the forwarding entries   */  struct ip_vs_service { -	struct list_head	s_list;   /* for normal service table */ -	struct list_head	f_list;   /* for fwmark-based service table */ +	struct hlist_node	s_list;   /* for normal service table */ +	struct hlist_node	f_list;   /* for fwmark-based service table */  	atomic_t		refcnt;   /* reference counter */ -	atomic_t		usecnt;   /* use counter */  	u16			af;       /* address family */  	__u16			protocol; /* which protocol (TCP/UDP) */ @@ -707,31 +721,41 @@ struct ip_vs_service {  	__u32                   fwmark;   /* firewall mark of the service */  	unsigned int		flags;	  /* service status flags */  	unsigned int		timeout;  /* persistent timeout in ticks */ -	__be32			netmask;  /* grouping granularity */ +	__be32			netmask;  /* grouping granularity, mask/plen */  	struct net		*net;  	struct list_head	destinations;  /* real server d-linked list */  	__u32			num_dests;     /* number of servers */  	struct ip_vs_stats      stats;         /* statistics for the service */ -	struct ip_vs_app	*inc;	  /* bind conns to this app inc */  	/* for scheduling */ -	struct ip_vs_scheduler	*scheduler;    /* bound scheduler object */ -	rwlock_t		sched_lock;    /* lock sched_data */ +	struct ip_vs_scheduler __rcu *scheduler; /* bound scheduler object */ +	spinlock_t		sched_lock;    /* lock sched_data */  	void			*sched_data;   /* scheduler application data */  	/* alternate persistence engine */ -	struct ip_vs_pe		*pe; +	struct ip_vs_pe __rcu	*pe; + +	struct rcu_head		rcu_head;  }; +/* Information for cached dst */ +struct ip_vs_dest_dst { +	struct dst_entry	*dst_cache;	/* destination cache entry */ +	u32			dst_cookie; +	union nf_inet_addr	dst_saddr; +	struct rcu_head		rcu_head; +}; +/* In grace period after removing */ +#define IP_VS_DEST_STATE_REMOVING	0x01  /*   *	The real server destination forwarding entry   *	with ip address, port number, and so on.   */  struct ip_vs_dest {  	struct list_head	n_list;   /* for the dests in the service */ -	struct list_head	d_list;   /* for table with all the dests */ +	struct hlist_node	d_list;   /* for table with all the dests */  	u16			af;		/* address family */  	__be16			port;		/* port number of the server */ @@ -742,6 +766,7 @@ struct ip_vs_dest {  	atomic_t		refcnt;		/* reference counter */  	struct ip_vs_stats      stats;          /* statistics */ +	unsigned long		state;		/* state flags */  	/* connection counters and thresholds */  	atomic_t		activeconns;	/* active connections */ @@ -752,10 +777,7 @@ struct ip_vs_dest {  	/* for destination cache */  	spinlock_t		dst_lock;	/* lock of dst_cache */ -	struct dst_entry	*dst_cache;	/* destination cache entry */ -	u32			dst_rtos;	/* RT_TOS(tos) for dst */ -	u32			dst_cookie; -	union nf_inet_addr	dst_saddr; +	struct ip_vs_dest_dst __rcu *dest_dst;	/* cached dst info */  	/* for virtual service */  	struct ip_vs_service	*svc;		/* service it belongs to */ @@ -763,6 +785,10 @@ struct ip_vs_dest {  	__be16			vport;		/* virtual port number */  	union nf_inet_addr	vaddr;		/* virtual IP address */  	__u32			vfwmark;	/* firewall mark of service */ + +	struct list_head	t_list;		/* in dest_trash */ +	struct rcu_head		rcu_head; +	unsigned int		in_rs_table:1;	/* we are in rs_table */  }; @@ -778,9 +804,13 @@ struct ip_vs_scheduler {  	/* scheduler initializing service */  	int (*init_service)(struct ip_vs_service *svc);  	/* scheduling service finish */ -	int (*done_service)(struct ip_vs_service *svc); -	/* scheduler updating service */ -	int (*update_service)(struct ip_vs_service *svc); +	void (*done_service)(struct ip_vs_service *svc); +	/* dest is linked */ +	int (*add_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest); +	/* dest is unlinked */ +	int (*del_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest); +	/* dest is updated */ +	int (*upd_dest)(struct ip_vs_service *svc, struct ip_vs_dest *dest);  	/* selecting a server from the given service */  	struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc, @@ -819,6 +849,7 @@ struct ip_vs_app {  	struct ip_vs_app	*app;		/* its real application */  	__be16			port;		/* port number in net order */  	atomic_t		usecnt;		/* usage counter */ +	struct rcu_head		rcu_head;  	/*  	 * output hook: Process packet in inout direction, diff set for TCP. @@ -881,6 +912,9 @@ struct ipvs_master_sync_state {  	struct netns_ipvs	*ipvs;  }; +/* How much time to keep dests in trash */ +#define IP_VS_DEST_TRASH_PERIOD		(120 * HZ) +  /* IPVS in network namespace */  struct netns_ipvs {  	int			gen;		/* Generation */ @@ -892,7 +926,7 @@ struct netns_ipvs {  	#define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)  	#define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1) -	struct list_head	rs_table[IP_VS_RTAB_SIZE]; +	struct hlist_head	rs_table[IP_VS_RTAB_SIZE];  	/* ip_vs_app */  	struct list_head	app_list;  	/* ip_vs_proto */ @@ -904,7 +938,6 @@ struct netns_ipvs {  	#define	TCP_APP_TAB_SIZE	(1 << TCP_APP_TAB_BITS)  	#define	TCP_APP_TAB_MASK	(TCP_APP_TAB_SIZE - 1)  	struct list_head	tcp_apps[TCP_APP_TAB_SIZE]; -	spinlock_t		tcp_app_lock;  #endif  	/* ip_vs_proto_udp */  #ifdef CONFIG_IP_VS_PROTO_UDP @@ -912,7 +945,6 @@ struct netns_ipvs {  	#define	UDP_APP_TAB_SIZE	(1 << UDP_APP_TAB_BITS)  	#define	UDP_APP_TAB_MASK	(UDP_APP_TAB_SIZE - 1)  	struct list_head	udp_apps[UDP_APP_TAB_SIZE]; -	spinlock_t		udp_app_lock;  #endif  	/* ip_vs_proto_sctp */  #ifdef CONFIG_IP_VS_PROTO_SCTP @@ -921,7 +953,6 @@ struct netns_ipvs {  	#define SCTP_APP_TAB_MASK	(SCTP_APP_TAB_SIZE - 1)  	/* Hash table for SCTP application incarnations	 */  	struct list_head	sctp_apps[SCTP_APP_TAB_SIZE]; -	spinlock_t		sctp_app_lock;  #endif  	/* ip_vs_conn */  	atomic_t		conn_count;      /*  connection counter */ @@ -931,9 +962,10 @@ struct netns_ipvs {  	int			num_services;    /* no of virtual services */ -	rwlock_t		rs_lock;         /* real services table */  	/* Trash for destinations */  	struct list_head	dest_trash; +	spinlock_t		dest_trash_lock; +	struct timer_list	dest_trash_timer; /* expiration timer */  	/* Service counters */  	atomic_t		ftpsvc_counter;  	atomic_t		nullsvc_counter; @@ -1181,9 +1213,19 @@ struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb,  					     const struct ip_vs_iphdr *iph,  					     int inverse); +/* Get reference to gain full access to conn. + * By default, RCU read-side critical sections have access only to + * conn fields and its PE data, see ip_vs_conn_rcu_free() for reference. + */ +static inline bool __ip_vs_conn_get(struct ip_vs_conn *cp) +{ +	return atomic_inc_not_zero(&cp->refcnt); +} +  /* put back the conn without restarting its timer */  static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)  { +	smp_mb__before_atomic_dec();  	atomic_dec(&cp->refcnt);  }  extern void ip_vs_conn_put(struct ip_vs_conn *cp); @@ -1298,8 +1340,6 @@ extern void ip_vs_app_inc_put(struct ip_vs_app *inc);  extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb);  extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); -void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe); -void ip_vs_unbind_pe(struct ip_vs_service *svc);  int register_ip_vs_pe(struct ip_vs_pe *pe);  int unregister_ip_vs_pe(struct ip_vs_pe *pe);  struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); @@ -1346,7 +1386,8 @@ extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);  extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);  extern int ip_vs_bind_scheduler(struct ip_vs_service *svc,  				struct ip_vs_scheduler *scheduler); -extern int ip_vs_unbind_scheduler(struct ip_vs_service *svc); +extern void ip_vs_unbind_scheduler(struct ip_vs_service *svc, +				   struct ip_vs_scheduler *sched);  extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);  extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);  extern struct ip_vs_conn * @@ -1366,17 +1407,12 @@ extern struct ip_vs_stats ip_vs_stats;  extern int sysctl_ip_vs_sync_ver;  extern struct ip_vs_service * -ip_vs_service_get(struct net *net, int af, __u32 fwmark, __u16 protocol, +ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol,  		  const union nf_inet_addr *vaddr, __be16 vport); -static inline void ip_vs_service_put(struct ip_vs_service *svc) -{ -	atomic_dec(&svc->usecnt); -} - -extern struct ip_vs_dest * -ip_vs_lookup_real_service(struct net *net, int af, __u16 protocol, -			  const union nf_inet_addr *daddr, __be16 dport); +extern bool +ip_vs_has_real_service(struct net *net, int af, __u16 protocol, +		       const union nf_inet_addr *daddr, __be16 dport);  extern int ip_vs_use_count_inc(void);  extern void ip_vs_use_count_dec(void); @@ -1388,8 +1424,18 @@ extern struct ip_vs_dest *  ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr,  		__be16 dport, const union nf_inet_addr *vaddr, __be16 vport,  		__u16 protocol, __u32 fwmark, __u32 flags); -extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); +extern void ip_vs_try_bind_dest(struct ip_vs_conn *cp); +static inline void ip_vs_dest_hold(struct ip_vs_dest *dest) +{ +	atomic_inc(&dest->refcnt); +} + +static inline void ip_vs_dest_put(struct ip_vs_dest *dest) +{ +	smp_mb__before_atomic_dec(); +	atomic_dec(&dest->refcnt); +}  /*   *      IPVS sync daemon data and function prototypes @@ -1428,7 +1474,7 @@ extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,  extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,  			   struct ip_vs_protocol *pp, int offset,  			   unsigned int hooknum, struct ip_vs_iphdr *iph); -extern void ip_vs_dst_reset(struct ip_vs_dest *dest); +extern void ip_vs_dest_dst_rcu_free(struct rcu_head *head);  #ifdef CONFIG_IP_VS_IPV6  extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, diff --git a/include/net/ipip.h b/include/net/ipip.h deleted file mode 100644 index 982141c1520..00000000000 --- a/include/net/ipip.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef __NET_IPIP_H -#define __NET_IPIP_H 1 - -#include <linux/if_tunnel.h> -#include <net/gro_cells.h> -#include <net/ip.h> - -/* Keep error state on tunnel for 30 sec */ -#define IPTUNNEL_ERR_TIMEO	(30*HZ) - -/* 6rd prefix/relay information */ -struct ip_tunnel_6rd_parm { -	struct in6_addr		prefix; -	__be32			relay_prefix; -	u16			prefixlen; -	u16			relay_prefixlen; -}; - -struct ip_tunnel { -	struct ip_tunnel __rcu	*next; -	struct net_device	*dev; - -	int			err_count;	/* Number of arrived ICMP errors */ -	unsigned long		err_time;	/* Time when the last ICMP error arrived */ - -	/* These four fields used only by GRE */ -	__u32			i_seqno;	/* The last seen seqno	*/ -	__u32			o_seqno;	/* The last output seqno */ -	int			hlen;		/* Precalculated GRE header length */ -	int			mlink; - -	struct ip_tunnel_parm	parms; - -	/* for SIT */ -#ifdef CONFIG_IPV6_SIT_6RD -	struct ip_tunnel_6rd_parm	ip6rd; -#endif -	struct ip_tunnel_prl_entry __rcu *prl;		/* potential router list */ -	unsigned int			prl_count;	/* # of entries in PRL */ - -	struct gro_cells		gro_cells; -}; - -struct ip_tunnel_prl_entry { -	struct ip_tunnel_prl_entry __rcu *next; -	__be32				addr; -	u16				flags; -	struct rcu_head			rcu_head; -}; - -static inline void iptunnel_xmit(struct sk_buff *skb, struct net_device *dev) -{ -	int err; -	struct iphdr *iph = ip_hdr(skb); -	int pkt_len = skb->len - skb_transport_offset(skb); -	struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats); - -	nf_reset(skb); -	skb->ip_summed = CHECKSUM_NONE; -	ip_select_ident(iph, skb_dst(skb), NULL); - -	err = ip_local_out(skb); -	if (likely(net_xmit_eval(err) == 0)) { -		u64_stats_update_begin(&tstats->syncp); -		tstats->tx_bytes += pkt_len; -		tstats->tx_packets++; -		u64_stats_update_end(&tstats->syncp); -	} else { -		dev->stats.tx_errors++; -		dev->stats.tx_aborted_errors++; -	} -} - -static inline void tunnel_ip_select_ident(struct sk_buff *skb, -					  const struct iphdr  *old_iph, -					  struct dst_entry *dst) -{ -	struct iphdr *iph = ip_hdr(skb); - -	/* Use inner packet iph-id if possible. */ -	if (skb->protocol == htons(ETH_P_IP) && old_iph->id) -		iph->id	= old_iph->id; -	else -		__ip_select_ident(iph, dst, -				  (skb_shinfo(skb)->gso_segs ?: 1) - 1); -} -#endif diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 64d12e77719..0810aa57c78 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -217,7 +217,7 @@ struct ipv6_txoptions {  };  struct ip6_flowlabel { -	struct ip6_flowlabel	*next; +	struct ip6_flowlabel __rcu *next;  	__be32			label;  	atomic_t		users;  	struct in6_addr		dst; @@ -238,9 +238,9 @@ struct ip6_flowlabel {  #define IPV6_FLOWLABEL_MASK	cpu_to_be32(0x000FFFFF)  struct ipv6_fl_socklist { -	struct ipv6_fl_socklist	*next; -	struct ip6_flowlabel	*fl; -	struct rcu_head		rcu; +	struct ipv6_fl_socklist	__rcu	*next; +	struct ip6_flowlabel		*fl; +	struct rcu_head			rcu;  };  extern struct ip6_flowlabel	*fl6_sock_lookup(struct sock *sk, __be32 label); @@ -320,6 +320,18 @@ static inline int ipv6_addr_src_scope(const struct in6_addr *addr)  	return __ipv6_addr_src_scope(__ipv6_addr_type(addr));  } +static inline bool __ipv6_addr_needs_scope_id(int type) +{ +	return type & IPV6_ADDR_LINKLOCAL || +	       (type & IPV6_ADDR_MULTICAST && +		(type & (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL))); +} + +static inline __u32 ipv6_iface_scope_id(const struct in6_addr *addr, int iface) +{ +	return __ipv6_addr_needs_scope_id(__ipv6_addr_type(addr)) ? iface : 0; +} +  static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2)  {  	return memcmp(a1, a2, sizeof(struct in6_addr)); @@ -466,6 +478,7 @@ struct ip6_create_arg {  	u32 user;  	const struct in6_addr *src;  	const struct in6_addr *dst; +	u8 ecn;  };  void ip6_frag_init(struct inet_frag_queue *q, void *a); @@ -485,6 +498,7 @@ struct frag_queue {  	int			iif;  	unsigned int		csum;  	__u16			nhoffset; +	u8			ecn;  };  void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq, diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h index f74109144d3..f132924cc9d 100644 --- a/include/net/irda/irlmp.h +++ b/include/net/irda/irlmp.h @@ -256,7 +256,8 @@ static inline __u32 irlmp_get_daddr(const struct lsap_cb *self)  	return (self && self->lap) ? self->lap->daddr : 0;  } -extern const char *irlmp_reasons[]; +const char *irlmp_reason_str(LM_REASON reason); +  extern int sysctl_discovery_timeout;  extern int sysctl_discovery_slots;  extern int sysctl_discovery; diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h index cc7c1973238..714cc9a54a4 100644 --- a/include/net/iucv/af_iucv.h +++ b/include/net/iucv/af_iucv.h @@ -130,6 +130,14 @@ struct iucv_sock {  					       enum iucv_tx_notify n);  }; +struct iucv_skb_cb { +	u32	class;		/* target class of message */ +	u32	tag;		/* tag associated with message */ +	u32	offset;		/* offset for skb receival */ +}; + +#define IUCV_SKB_CB(__skb)	((struct iucv_skb_cb *)&((__skb)->cb[0])) +  /* iucv socket options (SOL_IUCV) */  #define SO_IPRMDATA_MSG	0x0080		/* send/recv IPRM_DATA msgs */  #define SO_MSGLIMIT	0x1000		/* get/set IUCV MSGLIMIT */ diff --git a/include/net/lib80211.h b/include/net/lib80211.h index d178c26a555..be95b926280 100644 --- a/include/net/lib80211.h +++ b/include/net/lib80211.h @@ -30,6 +30,8 @@  #include <linux/skbuff.h>  #include <linux/ieee80211.h>  #include <linux/timer.h> +#include <linux/seq_file.h> +  /* print_ssid() is intended to be used in debug (and possibly error)   * messages. It should never be used for passing ssid to user space. */  const char *print_ssid(char *buf, const char *ssid, u8 ssid_len); @@ -75,7 +77,7 @@ struct lib80211_crypto_ops {  	/* procfs handler for printing out key information and possible  	 * statistics */ -	char *(*print_stats) (char *p, void *priv); +	void (*print_stats) (struct seq_file *m, void *priv);  	/* Crypto specific flag get/set for configuration settings */  	unsigned long (*get_flags) (void *priv); diff --git a/include/net/mac80211.h b/include/net/mac80211.h index f7eba1300d8..04c2d4670dc 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -93,9 +93,11 @@ struct device;   * enum ieee80211_max_queues - maximum number of queues   *   * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. + * @IEEE80211_MAX_QUEUE_MAP: bitmap with maximum queues set   */  enum ieee80211_max_queues {  	IEEE80211_MAX_QUEUES =		16, +	IEEE80211_MAX_QUEUE_MAP =	BIT(IEEE80211_MAX_QUEUES) - 1,  };  #define IEEE80211_INVAL_HW_QUEUE	0xff @@ -126,6 +128,7 @@ enum ieee80211_ac_numbers {   *	2^n-1 in the range 1..32767]   * @cw_max: maximum contention window [like @cw_min]   * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled + * @acm: is mandatory admission control required for the access category   * @uapsd: is U-APSD mode enabled for the queue   */  struct ieee80211_tx_queue_params { @@ -133,6 +136,7 @@ struct ieee80211_tx_queue_params {  	u16 cw_min;  	u16 cw_max;  	u8 aifs; +	bool acm;  	bool uapsd;  }; @@ -207,7 +211,7 @@ struct ieee80211_chanctx_conf {   * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note   *	that it is only ever disabled for station mode.   * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. - * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) + * @BSS_CHANGED_SSID: SSID changed for this BSS (AP and IBSS mode)   * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)   * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)   * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface @@ -324,12 +328,11 @@ enum ieee80211_rssi_event {   *	your driver/device needs to do.   * @ps: power-save mode (STA only). This flag is NOT affected by   *	offchannel/dynamic_ps operations. - * @ssid: The SSID of the current vif. Only valid in AP-mode. + * @ssid: The SSID of the current vif. Valid in AP and IBSS mode.   * @ssid_len: Length of SSID given in @ssid.   * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.   * @txpower: TX power in dBm - * @p2p_ctwindow: P2P CTWindow, only for P2P client interfaces - * @p2p_oppps: P2P opportunistic PS is enabled + * @p2p_noa_attr: P2P NoA attribute for P2P powersave   */  struct ieee80211_bss_conf {  	const u8 *bssid; @@ -363,8 +366,7 @@ struct ieee80211_bss_conf {  	size_t ssid_len;  	bool hidden_ssid;  	int txpower; -	u8 p2p_ctwindow; -	bool p2p_oppps; +	struct ieee80211_p2p_noa_attr p2p_noa_attr;  };  /** @@ -561,6 +563,9 @@ enum mac80211_rate_control_flags {  /* maximum number of rate stages */  #define IEEE80211_TX_MAX_RATES	4 +/* maximum number of rate table entries */ +#define IEEE80211_TX_RATE_TABLE_SIZE	4 +  /**   * struct ieee80211_tx_rate - rate selection/status   * @@ -601,8 +606,8 @@ static inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *rate,  					  u8 mcs, u8 nss)  {  	WARN_ON(mcs & ~0xF); -	WARN_ON(nss & ~0x7); -	rate->idx = (nss << 4) | mcs; +	WARN_ON((nss - 1) & ~0x7); +	rate->idx = ((nss - 1) << 4) | mcs;  }  static inline u8 @@ -614,7 +619,7 @@ ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *rate)  static inline u8  ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate)  { -	return rate->idx >> 4; +	return (rate->idx >> 4) + 1;  }  /** @@ -655,7 +660,11 @@ struct ieee80211_tx_info {  					struct ieee80211_tx_rate rates[  						IEEE80211_TX_MAX_RATES];  					s8 rts_cts_rate_idx; -					/* 3 bytes free */ +					u8 use_rts:1; +					u8 use_cts_prot:1; +					u8 short_preamble:1; +					u8 skip_table:1; +					/* 2 bytes free */  				};  				/* only needed before rate control */  				unsigned long jiffies; @@ -676,6 +685,8 @@ struct ieee80211_tx_info {  		struct {  			struct ieee80211_tx_rate driver_rates[  				IEEE80211_TX_MAX_RATES]; +			u8 pad[4]; +  			void *rate_driver_data[  				IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];  		}; @@ -974,8 +985,7 @@ enum ieee80211_smps_mode {   * @power_level: requested transmit power (in dBm), backward compatibility   *	value only that is set to the minimum of all interfaces   * - * @channel: the channel to tune to - * @channel_type: the channel (HT) type + * @chandef: the channel definition to tune to   * @radar_enabled: whether radar detection is enabled   *   * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame @@ -1001,8 +1011,7 @@ struct ieee80211_conf {  	u8 long_frame_max_tx_count, short_frame_max_tx_count; -	struct ieee80211_channel *channel; -	enum nl80211_channel_type channel_type; +	struct cfg80211_chan_def chandef;  	bool radar_enabled;  	enum ieee80211_smps_mode smps_mode;  }; @@ -1019,13 +1028,13 @@ struct ieee80211_conf {   *	the driver passed into mac80211.   * @block_tx: Indicates whether transmission must be blocked before the   *	scheduled channel switch, as indicated by the AP. - * @channel: the new channel to switch to + * @chandef: the new channel to switch to   * @count: the number of TBTT's until the channel switch event   */  struct ieee80211_channel_switch {  	u64 timestamp;  	bool block_tx; -	struct ieee80211_channel *channel; +	struct cfg80211_chan_def chandef;  	u8 count;  }; @@ -1067,6 +1076,9 @@ enum ieee80211_vif_flags {   *	path needing to access it; even though the netdev carrier will always   *	be off when it is %NULL there can still be races and packets could be   *	processed after it switches back to %NULL. + * @debugfs_dir: debugfs dentry, can be used by drivers to create own per + *      interface debug files. Note that it will be NULL for the virtual + *	monitor interface (if that is requested.)   * @drv_priv: data area for driver use, will always be aligned to   *	sizeof(void *).   */ @@ -1083,6 +1095,10 @@ struct ieee80211_vif {  	u32 driver_flags; +#ifdef CONFIG_MAC80211_DEBUGFS +	struct dentry *debugfs_dir; +#endif +  	/* must be last */  	u8 drv_priv[0] __aligned(sizeof(void *));  }; @@ -1101,8 +1117,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)   * These flags are used for communication about keys between the driver   * and mac80211, with the @flags parameter of &struct ieee80211_key_conf.   * - * @IEEE80211_KEY_FLAG_WMM_STA: Set by mac80211, this flag indicates - *	that the STA this key will be used with could be using QoS.   * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the   *	driver to indicate that it requires IV generation for this   *	particular key. @@ -1127,7 +1141,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)   *	%IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.   */  enum ieee80211_key_flags { -	IEEE80211_KEY_FLAG_WMM_STA	= 1<<0,  	IEEE80211_KEY_FLAG_GENERATE_IV	= 1<<1,  	IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,  	IEEE80211_KEY_FLAG_PAIRWISE	= 1<<3, @@ -1219,6 +1232,24 @@ enum ieee80211_sta_rx_bandwidth {  };  /** + * struct ieee80211_sta_rates - station rate selection table + * + * @rcu_head: RCU head used for freeing the table on update + * @rates: transmit rates/flags to be used by default. + *	Overriding entries per-packet is possible by using cb tx control. + */ +struct ieee80211_sta_rates { +	struct rcu_head rcu_head; +	struct { +		s8 idx; +		u8 count; +		u8 count_cts; +		u8 count_rts; +		u16 flags; +	} rate[IEEE80211_TX_RATE_TABLE_SIZE]; +}; + +/**   * struct ieee80211_sta - station table entry   *   * A station table entry represents a station we are possibly @@ -1231,9 +1262,8 @@ enum ieee80211_sta_rx_bandwidth {   * @addr: MAC address   * @aid: AID we assigned to the station if we're an AP   * @supp_rates: Bitmap of supported rates (per band) - * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities - * @vht_cap: VHT capabilities of this STA; Not restricting any capabilities - * 	of remote STA. Taking as is. + * @ht_cap: HT capabilities of this STA; restricted to our own capabilities + * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities   * @wme: indicates whether the STA supports WME. Only valid during AP-mode.   * @drv_priv: data area for driver use, will always be aligned to   *	sizeof(void *), size is determined in hw information. @@ -1246,6 +1276,7 @@ enum ieee80211_sta_rx_bandwidth {   *	notifications and capabilities. The value is only valid after   *	the station moves to associated state.   * @smps_mode: current SMPS mode (off, static or dynamic) + * @tx_rates: rate control selection table   */  struct ieee80211_sta {  	u32 supp_rates[IEEE80211_NUM_BANDS]; @@ -1259,6 +1290,7 @@ struct ieee80211_sta {  	u8 rx_nss;  	enum ieee80211_sta_rx_bandwidth bandwidth;  	enum ieee80211_smps_mode smps_mode; +	struct ieee80211_sta_rates __rcu *rates;  	/* must be last */  	u8 drv_priv[0] __aligned(sizeof(void *)); @@ -1414,6 +1446,9 @@ struct ieee80211_tx_control {   *	for different virtual interfaces. See the doc section on HW queue   *	control for more details.   * + * @IEEE80211_HW_SUPPORTS_RC_TABLE: The driver supports using a rate + *	selection table provided by the rate control algorithm. + *   * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any   *	P2P Interface. This will be honoured even if more than one interface   *	is supported. @@ -1446,6 +1481,7 @@ enum ieee80211_hw_flags {  	IEEE80211_HW_SUPPORTS_PER_STA_GTK		= 1<<21,  	IEEE80211_HW_AP_LINK_PS				= 1<<22,  	IEEE80211_HW_TX_AMPDU_SETUP_IN_HW		= 1<<23, +	IEEE80211_HW_SUPPORTS_RC_TABLE			= 1<<24,  	IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF		= 1<<25,  	IEEE80211_HW_TIMING_BEACON_ONLY			= 1<<26,  }; @@ -1531,6 +1567,17 @@ enum ieee80211_hw_flags {   * @netdev_features: netdev features to be set in each netdev created   *	from this HW. Note only HW checksum features are currently   *	compatible with mac80211. Other feature bits will be rejected. + * + * @uapsd_queues: This bitmap is included in (re)association frame to indicate + *	for each access category if it is uAPSD trigger-enabled and delivery- + *	enabled. Use IEEE80211_WMM_IE_STA_QOSINFO_AC_* to set this bitmap. + *	Each bit corresponds to different AC. Value '1' in specific bit means + *	that corresponding AC is both trigger- and delivery-enabled. '0' means + *	neither enabled. + * + * @uapsd_max_sp_len: maximum number of total buffered frames the WMM AP may + *	deliver to a WMM STA during any Service Period triggered by the WMM STA. + *	Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct values.   */  struct ieee80211_hw {  	struct ieee80211_conf conf; @@ -1556,6 +1603,8 @@ struct ieee80211_hw {  	u8 radiotap_mcs_details;  	u16 radiotap_vht_details;  	netdev_features_t netdev_features; +	u8 uapsd_queues; +	u8 uapsd_max_sp_len;  };  /** @@ -1950,14 +1999,14 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);   * filter those response frames except in the case of frames that   * are buffered in the driver -- those must remain buffered to avoid   * reordering. Because it is possible that no frames are released - * in this case, the driver must call ieee80211_sta_eosp_irqsafe() + * in this case, the driver must call ieee80211_sta_eosp()   * to indicate to mac80211 that the service period ended anyway.   *   * Finally, if frames from multiple TIDs are released from mac80211   * but the driver might reorder them, it must clear & set the flags   * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP)   * and also take care of the EOSP and MORE_DATA bits in the frame. - * The driver may also use ieee80211_sta_eosp_irqsafe() in this case. + * The driver may also use ieee80211_sta_eosp() in this case.   */  /** @@ -2135,6 +2184,24 @@ enum ieee80211_rate_control_changed {  };  /** + * enum ieee80211_roc_type - remain on channel type + * + * With the support for multi channel contexts and multi channel operations, + * remain on channel operations might be limited/deferred/aborted by other + * flows/operations which have higher priority (and vise versa). + * Specifying the ROC type can be used by devices to prioritize the ROC + * operations compared to other operations/flows. + * + * @IEEE80211_ROC_TYPE_NORMAL: There are no special requirements for this ROC. + * @IEEE80211_ROC_TYPE_MGMT_TX: The remain on channel request is required + *	for sending managment frames offchannel. + */ +enum ieee80211_roc_type { +	IEEE80211_ROC_TYPE_NORMAL = 0, +	IEEE80211_ROC_TYPE_MGMT_TX, +}; + +/**   * struct ieee80211_ops - callbacks from mac80211 to the driver   *   * This structure contains various callbacks that the driver may @@ -2212,18 +2279,6 @@ enum ieee80211_rate_control_changed {   *	MAC address of the device going away.   *	Hence, this callback must be implemented. It can sleep.   * - * @add_interface_debugfs: Drivers can use this callback to add debugfs files - *	when a vif is added to mac80211. This callback and - *	@remove_interface_debugfs should be within a CONFIG_MAC80211_DEBUGFS - *	conditional. @remove_interface_debugfs must be provided for cleanup. - *	This callback can sleep. - * - * @remove_interface_debugfs: Remove the debugfs files which were added using - *	@add_interface_debugfs. This callback must remove all debugfs entries - *	that were added because mac80211 only removes interface debugfs when the - *	interface is destroyed, not when it is removed from the driver. - *	This callback can sleep. - *   * @config: Handler for configuration requests. IEEE 802.11 code calls this   *	function to change hardware configuration, e.g., channel.   *	This function should never fail but returns a negative error code @@ -2245,6 +2300,9 @@ enum ieee80211_rate_control_changed {   *	See the section "Frame filtering" for more information.   *	This callback must be implemented and can sleep.   * + * @set_multicast_list: Configure the device's interface specific RX multicast + *	filter. This callback is optional. This callback must be atomic. + *   * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit   * 	must be set or cleared for a given STA. Must be atomic.   * @@ -2426,8 +2484,11 @@ enum ieee80211_rate_control_changed {   * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep.   *   * @flush: Flush all pending frames from the hardware queue, making sure - *	that the hardware queues are empty. If the parameter @drop is set - *	to %true, pending frames may be dropped. The callback can sleep. + *	that the hardware queues are empty. The @queues parameter is a bitmap + *	of queues to flush, which is useful if different virtual interfaces + *	use different hardware queues; it may also indicate all queues. + *	If the parameter @drop is set to %true, pending frames may be dropped. + *	The callback can sleep.   *   * @channel_switch: Drivers that need (or want) to offload the channel   *	switch operation for CSAs received from the AP may implement this @@ -2492,7 +2553,7 @@ enum ieee80211_rate_control_changed {   *	setting the EOSP flag in the QoS header of the frames. Also, when the   *	service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP   *	on the last frame in the SP. Alternatively, it may call the function - *	ieee80211_sta_eosp_irqsafe() to inform mac80211 of the end of the SP. + *	ieee80211_sta_eosp() to inform mac80211 of the end of the SP.   *	This callback must be atomic.   * @allow_buffered_frames: Prepare device to allow the given number of frames   *	to go out to the given station. The frames will be sent by mac80211 @@ -2503,7 +2564,7 @@ enum ieee80211_rate_control_changed {   *	them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag   *	on the last frame and clear it on all others and also handle the EOSP   *	bit in the QoS header correctly. Alternatively, it can also call the - *	ieee80211_sta_eosp_irqsafe() function. + *	ieee80211_sta_eosp() function.   *	The @tids parameter is a bitmap and tells the driver which TIDs the   *	frames will be on; it will at most have two bits set.   *	This callback must be atomic. @@ -2591,6 +2652,10 @@ struct ieee80211_ops {  				 unsigned int changed_flags,  				 unsigned int *total_flags,  				 u64 multicast); +	void (*set_multicast_list)(struct ieee80211_hw *hw, +				   struct ieee80211_vif *vif, bool allmulti, +				   struct netdev_hw_addr_list *mc_list); +  	int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,  		       bool set);  	int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, @@ -2637,12 +2702,6 @@ struct ieee80211_ops {  				   struct ieee80211_vif *vif,  				   struct ieee80211_sta *sta,  				   struct dentry *dir); -	void (*add_interface_debugfs)(struct ieee80211_hw *hw, -				      struct ieee80211_vif *vif, -				      struct dentry *dir); -	void (*remove_interface_debugfs)(struct ieee80211_hw *hw, -					 struct ieee80211_vif *vif, -					 struct dentry *dir);  #endif  	void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,  			enum sta_notify_cmd, struct ieee80211_sta *sta); @@ -2677,7 +2736,7 @@ struct ieee80211_ops {  			     struct netlink_callback *cb,  			     void *data, int len);  #endif -	void (*flush)(struct ieee80211_hw *hw, bool drop); +	void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop);  	void (*channel_switch)(struct ieee80211_hw *hw,  			       struct ieee80211_channel_switch *ch_switch);  	int (*napi_poll)(struct ieee80211_hw *hw, int budget); @@ -2687,7 +2746,8 @@ struct ieee80211_ops {  	int (*remain_on_channel)(struct ieee80211_hw *hw,  				 struct ieee80211_vif *vif,  				 struct ieee80211_channel *chan, -				 int duration); +				 int duration, +				 enum ieee80211_roc_type type);  	int (*cancel_remain_on_channel)(struct ieee80211_hw *hw);  	int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);  	void (*get_ringparam)(struct ieee80211_hw *hw, @@ -3108,6 +3168,25 @@ void ieee80211_sta_set_buffered(struct ieee80211_sta *sta,  				u8 tid, bool buffered);  /** + * ieee80211_get_tx_rates - get the selected transmit rates for a packet + * + * Call this function in a driver with per-packet rate selection support + * to combine the rate info in the packet tx info with the most recent + * rate selection table for the station entry. + * + * @vif: &struct ieee80211_vif pointer from the add_interface callback. + * @sta: the receiver station to which this packet is sent. + * @skb: the frame to be transmitted. + * @dest: buffer for extracted rate/retry information + * @max_rates: maximum number of rates to fetch + */ +void ieee80211_get_tx_rates(struct ieee80211_vif *vif, +			    struct ieee80211_sta *sta, +			    struct sk_buff *skb, +			    struct ieee80211_tx_rate *dest, +			    int max_rates); + +/**   * ieee80211_tx_status - transmit status callback   *   * Call this function for all transmitted frames after they have been @@ -3842,14 +3921,17 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,   * %IEEE80211_TX_STATUS_EOSP bit and call this function instead.   * This applies for PS-Poll as well as uAPSD.   * - * Note that there is no non-_irqsafe version right now as - * it wasn't needed, but just like _tx_status() and _rx() - * must not be mixed in irqsafe/non-irqsafe versions, this - * function must not be mixed with those either. Use the - * all irqsafe, or all non-irqsafe, don't mix! If you need - * the non-irqsafe version of this, you need to add it. + * Note that just like with _tx_status() and _rx() drivers must + * not mix calls to irqsafe/non-irqsafe versions, this function + * must not be mixed with those either. Use the all irqsafe, or + * all non-irqsafe, don't mix! + * + * NB: the _irqsafe version of this function doesn't exist, no + *     driver needs it right now. Don't call this function if + *     you'd need the _irqsafe version, look at the git history + *     and restore the _irqsafe version!   */ -void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta); +void ieee80211_sta_eosp(struct ieee80211_sta *pubsta);  /**   * ieee80211_iter_keys - iterate keys programmed into the device @@ -4079,7 +4161,7 @@ void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);   *	(deprecated; this will be removed once drivers get updated to use   *	rate_idx_mask)   * @rate_idx_mask: user-requested (legacy) rate mask - * @rate_idx_mcs_mask: user-requested MCS rate mask + * @rate_idx_mcs_mask: user-requested MCS rate mask (NULL if not in use)   * @bss: whether this frame is sent out in AP or IBSS mode   */  struct ieee80211_tx_rate_control { @@ -4091,7 +4173,7 @@ struct ieee80211_tx_rate_control {  	bool rts, short_preamble;  	u8 max_rate_idx;  	u32 rate_idx_mask; -	u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]; +	u8 *rate_idx_mcs_mask;  	bool bss;  }; @@ -4180,37 +4262,55 @@ bool rate_usable_index_exists(struct ieee80211_supported_band *sband,  	return false;  } +/** + * rate_control_set_rates - pass the sta rate selection to mac80211/driver + * + * When not doing a rate control probe to test rates, rate control should pass + * its rate selection to mac80211. If the driver supports receiving a station + * rate table, it will use it to ensure that frames are always sent based on + * the most recent rate control module decision. + * + * @hw: pointer as obtained from ieee80211_alloc_hw() + * @pubsta: &struct ieee80211_sta pointer to the target destination. + * @rates: new tx rate set to be used for this station. + */ +int rate_control_set_rates(struct ieee80211_hw *hw, +			   struct ieee80211_sta *pubsta, +			   struct ieee80211_sta_rates *rates); +  int ieee80211_rate_control_register(struct rate_control_ops *ops);  void ieee80211_rate_control_unregister(struct rate_control_ops *ops);  static inline bool  conf_is_ht20(struct ieee80211_conf *conf)  { -	return conf->channel_type == NL80211_CHAN_HT20; +	return conf->chandef.width == NL80211_CHAN_WIDTH_20;  }  static inline bool  conf_is_ht40_minus(struct ieee80211_conf *conf)  { -	return conf->channel_type == NL80211_CHAN_HT40MINUS; +	return conf->chandef.width == NL80211_CHAN_WIDTH_40 && +	       conf->chandef.center_freq1 < conf->chandef.chan->center_freq;  }  static inline bool  conf_is_ht40_plus(struct ieee80211_conf *conf)  { -	return conf->channel_type == NL80211_CHAN_HT40PLUS; +	return conf->chandef.width == NL80211_CHAN_WIDTH_40 && +	       conf->chandef.center_freq1 > conf->chandef.chan->center_freq;  }  static inline bool  conf_is_ht40(struct ieee80211_conf *conf)  { -	return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf); +	return conf->chandef.width == NL80211_CHAN_WIDTH_40;  }  static inline bool  conf_is_ht(struct ieee80211_conf *conf)  { -	return conf->channel_type != NL80211_CHAN_NO_HT; +	return conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT;  }  static inline enum nl80211_iftype diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index de644bcd861..b1769782748 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -17,6 +17,7 @@  #include <net/netns/ipv6.h>  #include <net/netns/sctp.h>  #include <net/netns/dccp.h> +#include <net/netns/netfilter.h>  #include <net/netns/x_tables.h>  #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)  #include <net/netns/conntrack.h> @@ -94,6 +95,7 @@ struct net {  	struct netns_dccp	dccp;  #endif  #ifdef CONFIG_NETFILTER +	struct netns_nf		nf;  	struct netns_xt		xt;  #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)  	struct netns_ct		ct; diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index caca0c4d6b4..644d9c223d2 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -184,7 +184,7 @@ extern int nf_conntrack_hash_check_insert(struct nf_conn *ct);  extern void nf_ct_delete_from_lists(struct nf_conn *ct);  extern void nf_ct_dying_timeout(struct nf_conn *ct); -extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report); +extern void nf_conntrack_flush_report(struct net *net, u32 portid, int report);  extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,  			      unsigned int nhoff, u_int16_t l3num, diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index 930275fa2ea..fb2b6234e93 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h @@ -27,6 +27,7 @@ extern unsigned int nf_conntrack_in(struct net *net,  extern int nf_conntrack_init_net(struct net *net);  extern void nf_conntrack_cleanup_net(struct net *net); +extern void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list);  extern int nf_conntrack_proto_pernet_init(struct net *net);  extern void nf_conntrack_proto_pernet_fini(struct net *net); diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index cbbae7621e2..3f3aecbc863 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h @@ -88,7 +88,7 @@ nf_ct_find_expectation(struct net *net, u16 zone,  		       const struct nf_conntrack_tuple *tuple);  void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp, -				u32 pid, int report); +				u32 portid, int report);  static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp)  {  	nf_ct_unlink_expect_report(exp, 0, 0); @@ -106,7 +106,7 @@ void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,  		       u_int8_t, const __be16 *, const __be16 *);  void nf_ct_expect_put(struct nf_conntrack_expect *exp);  int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,  -				u32 pid, int report); +				u32 portid, int report);  static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect)  {  	return nf_ct_expect_related_report(expect, 0, 0); diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h index e991bd0a27a..31f1fb9eb78 100644 --- a/include/net/netfilter/nf_log.h +++ b/include/net/netfilter/nf_log.h @@ -49,12 +49,18 @@ struct nf_logger {  int nf_log_register(u_int8_t pf, struct nf_logger *logger);  void nf_log_unregister(struct nf_logger *logger); -int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger); -void nf_log_unbind_pf(u_int8_t pf); +void nf_log_set(struct net *net, u_int8_t pf, +		const struct nf_logger *logger); +void nf_log_unset(struct net *net, const struct nf_logger *logger); + +int nf_log_bind_pf(struct net *net, u_int8_t pf, +		   const struct nf_logger *logger); +void nf_log_unbind_pf(struct net *net, u_int8_t pf);  /* Calls the registered backend logging function */ -__printf(7, 8) -void nf_log_packet(u_int8_t pf, +__printf(8, 9) +void nf_log_packet(struct net *net, +		   u_int8_t pf,  		   unsigned int hooknum,  		   const struct sk_buff *skb,  		   const struct net_device *in, diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h index fb1c0be38b6..aaba4bbcdda 100644 --- a/include/net/netfilter/nf_queue.h +++ b/include/net/netfilter/nf_queue.h @@ -9,10 +9,13 @@ struct nf_queue_entry {  	struct nf_hook_ops	*elem;  	u_int8_t		pf; +	u16			size; /* sizeof(entry) + saved route keys */  	unsigned int		hook;  	struct net_device	*indev;  	struct net_device	*outdev;  	int			(*okfn)(struct sk_buff *); + +	/* extra space to store route keys */  };  #define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry)) @@ -27,4 +30,7 @@ void nf_register_queue_handler(const struct nf_queue_handler *qh);  void nf_unregister_queue_handler(void);  extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); +bool nf_queue_entry_get_refs(struct nf_queue_entry *entry); +void nf_queue_entry_release_refs(struct nf_queue_entry *entry); +  #endif /* _NF_QUEUE_H */ diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 1242f371718..005e2c2e39a 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -71,6 +71,7 @@ struct netns_ipv6 {  	struct fib_rules_ops	*mr6_rules_ops;  #endif  #endif +	atomic_t		dev_addr_genid;  };  #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) diff --git a/include/net/netns/netfilter.h b/include/net/netns/netfilter.h new file mode 100644 index 00000000000..88740024ccf --- /dev/null +++ b/include/net/netns/netfilter.h @@ -0,0 +1,18 @@ +#ifndef __NETNS_NETFILTER_H +#define __NETNS_NETFILTER_H + +#include <linux/proc_fs.h> +#include <linux/netfilter.h> + +struct nf_logger; + +struct netns_nf { +#if defined CONFIG_PROC_FS +	struct proc_dir_entry *proc_netfilter; +#endif +	const struct nf_logger __rcu *nf_loggers[NFPROTO_NUMPROTO]; +#ifdef CONFIG_SYSCTL +	struct ctl_table_header *nf_log_dir_header; +#endif +}; +#endif diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h index 1d04b6f0fbd..50ab8c26ab5 100644 --- a/include/net/netprio_cgroup.h +++ b/include/net/netprio_cgroup.h @@ -29,7 +29,7 @@ struct cgroup_netprio_state {  	struct cgroup_subsys_state css;  }; -extern void sock_update_netprioidx(struct sock *sk, struct task_struct *task); +extern void sock_update_netprioidx(struct sock *sk);  #if IS_BUILTIN(CONFIG_NETPRIO_CGROUP) @@ -68,7 +68,7 @@ static inline u32 task_netprioidx(struct task_struct *p)  	return 0;  } -#define sock_update_netprioidx(sk, task) +#define sock_update_netprioidx(sk)  #endif /* CONFIG_NETPRIO_CGROUP */ diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index 87a6417fc93..5eb80bb3cbb 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h @@ -122,6 +122,8 @@ struct nfc_dev {  	bool shutting_down; +	struct rfkill *rfkill; +  	struct nfc_ops *ops;  };  #define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev) diff --git a/include/net/request_sock.h b/include/net/request_sock.h index a51dbd17c2d..59795e42c8b 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h @@ -27,19 +27,13 @@ struct sk_buff;  struct dst_entry;  struct proto; -/* empty to "strongly type" an otherwise void parameter. - */ -struct request_values { -}; -  struct request_sock_ops {  	int		family;  	int		obj_size;  	struct kmem_cache	*slab;  	char		*slab_name;  	int		(*rtx_syn_ack)(struct sock *sk, -				       struct request_sock *req, -				       struct request_values *rvp); +				       struct request_sock *req);  	void		(*send_ack)(struct sock *sk, struct sk_buff *skb,  				    struct request_sock *req);  	void		(*send_reset)(struct sock *sk, @@ -54,7 +48,7 @@ extern int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req);  /* struct request_sock - mini sock to represent a connection request   */  struct request_sock { -	struct request_sock		*dl_next; /* Must be first member! */ +	struct request_sock		*dl_next;  	u16				mss;  	u8				num_retrans; /* number of retransmits */  	u8				cookie_ts:1; /* syncookie: encode tcpopts in timestamp */ diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index 5a15fabd6a7..702664833a5 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h @@ -4,7 +4,7 @@  #include <linux/rtnetlink.h>  #include <net/netlink.h> -typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); +typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *);  typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);  typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *); diff --git a/include/net/scm.h b/include/net/scm.h index 975cca01048..8de2d37d207 100644 --- a/include/net/scm.h +++ b/include/net/scm.h @@ -26,7 +26,6 @@ struct scm_fp_list {  struct scm_cookie {  	struct pid		*pid;		/* Skb credentials */ -	const struct cred	*cred;  	struct scm_fp_list	*fp;		/* Passed files		*/  	struct scm_creds	creds;		/* Skb credentials	*/  #ifdef CONFIG_SECURITY_NETWORK @@ -51,23 +50,18 @@ static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_co  #endif /* CONFIG_SECURITY_NETWORK */  static __inline__ void scm_set_cred(struct scm_cookie *scm, -				    struct pid *pid, const struct cred *cred) +				    struct pid *pid, kuid_t uid, kgid_t gid)  {  	scm->pid  = get_pid(pid); -	scm->cred = cred ? get_cred(cred) : NULL;  	scm->creds.pid = pid_vnr(pid); -	scm->creds.uid = cred ? cred->euid : INVALID_UID; -	scm->creds.gid = cred ? cred->egid : INVALID_GID; +	scm->creds.uid = uid; +	scm->creds.gid = gid;  }  static __inline__ void scm_destroy_cred(struct scm_cookie *scm)  {  	put_pid(scm->pid);  	scm->pid  = NULL; - -	if (scm->cred) -		put_cred(scm->cred); -	scm->cred = NULL;  }  static __inline__ void scm_destroy(struct scm_cookie *scm) @@ -81,8 +75,10 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,  			       struct scm_cookie *scm, bool forcecreds)  {  	memset(scm, 0, sizeof(*scm)); +	scm->creds.uid = INVALID_UID; +	scm->creds.gid = INVALID_GID;  	if (forcecreds) -		scm_set_cred(scm, task_tgid(current), current_cred()); +		scm_set_cred(scm, task_tgid(current), current_uid(), current_gid());  	unix_get_peersec_dgram(sock, scm);  	if (msg->msg_controllen <= 0)  		return 0; diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h index befc8d2a1b9..5a2110d3176 100644 --- a/include/net/sctp/checksum.h +++ b/include/net/sctp/checksum.h @@ -77,7 +77,7 @@ static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)  	return sctp_crc32c(crc32, buffer, length);  } -static inline __le32 sctp_end_cksum(__be32 crc32) +static inline __le32 sctp_end_cksum(__u32 crc32)  {  	return cpu_to_le32(~crc32);  } diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index a7dd5c50df7..ca50e0751e4 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h @@ -49,7 +49,6 @@  #include <linux/sctp.h>  #include <linux/ipv6.h> /* For ipv6hdr. */ -#include <net/sctp/user.h>  #include <net/tcp_states.h>  /* For TCP states used in sctp_sock_state_t */  /* Value used for stream negotiation. */ diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index df85a0c0f2d..cd89510eab2 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -576,7 +576,7 @@ for (pos = chunk->subh.fwdtsn_hdr->skip;\  #define WORD_ROUND(s) (((s)+3)&~3)  /* Make a new instance of type.  */ -#define t_new(type, flags)	(type *)kzalloc(sizeof(type), flags) +#define t_new(type, flags)	kzalloc(sizeof(type), flags)  /* Compare two timevals.  */  #define tv_lt(s, t) \ diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 0e0f9d2322e..1bd4c4144fe 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -399,7 +399,6 @@ struct sctp_stream {  struct sctp_ssnmap {  	struct sctp_stream in;  	struct sctp_stream out; -	int malloced;  };  struct sctp_ssnmap *sctp_ssnmap_new(__u16 in, __u16 out, @@ -715,8 +714,7 @@ struct sctp_packet {  	    has_sack:1,		/* This packet contains a SACK chunk. */  	    has_auth:1,		/* This packet contains an AUTH chunk */  	    has_data:1,		/* This packet contains at least 1 DATA chunk */ -	    ipfragok:1,		/* So let ip fragment this packet */ -	    malloced:1;		/* Is it malloced? */ +	    ipfragok:1;		/* So let ip fragment this packet */  };  struct sctp_packet *sctp_packet_init(struct sctp_packet *, @@ -780,10 +778,7 @@ struct sctp_transport {  		hb_sent:1,  		/* Is the Path MTU update pending on this tranport */ -		pmtu_pending:1, - -		/* Is this structure kfree()able? */ -		malloced:1; +		pmtu_pending:1;  	/* Has this transport moved the ctsn since we last sacked */  	__u32 sack_generation; @@ -992,8 +987,6 @@ struct sctp_inq {  	 * messages.  	 */  	struct work_struct immediate; - -	int malloced;	     /* Is this structure kfree()able?	*/  };  void sctp_inq_init(struct sctp_inq *); @@ -1062,9 +1055,6 @@ struct sctp_outq {  	/* Is this structure empty?  */  	char empty; - -	/* Are we kfree()able? */ -	char malloced;  };  void sctp_outq_init(struct sctp_association *, struct sctp_outq *); @@ -1102,8 +1092,6 @@ struct sctp_bind_addr {  	 *	peer(s) in INIT and INIT ACK chunks.  	 */  	struct list_head address_list; - -	int malloced;	     /* Are we kfree()able?  */  };  void sctp_bind_addr_init(struct sctp_bind_addr *, __u16 port); @@ -1174,11 +1162,9 @@ struct sctp_ep_common {  	/* Some fields to help us manage this object.  	 *   refcnt   - Reference count access to this object.  	 *   dead     - Do not attempt to use this object. -	 *   malloced - Do we need to kfree this object?  	 */  	atomic_t    refcnt; -	char	    dead; -	char	    malloced; +	bool	    dead;  	/* What socket does this endpoint belong to?  */  	struct sock *sk; diff --git a/include/net/sctp/ulpqueue.h b/include/net/sctp/ulpqueue.h index ff1b8ba73ab..00e50ba3f24 100644 --- a/include/net/sctp/ulpqueue.h +++ b/include/net/sctp/ulpqueue.h @@ -49,7 +49,6 @@  /* A structure to carry information to the ULP (e.g. Sockets API) */  struct sctp_ulpq { -	char malloced;  	char pd_mode;  	struct sctp_association *asoc;  	struct sk_buff_head reasm; diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h index c2e542b27a5..6ca975bebd3 100644 --- a/include/net/secure_seq.h +++ b/include/net/secure_seq.h @@ -3,6 +3,7 @@  #include <linux/types.h> +extern void net_secret_init(void);  extern __u32 secure_ip_id(__be32 daddr);  extern __u32 secure_ipv6_id(const __be32 daddr[4]);  extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); diff --git a/include/net/sock.h b/include/net/sock.h index 14f6e9d19dc..5c97b0fc562 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -667,6 +667,7 @@ enum sock_flags {  		     * user-space instead.  		     */  	SOCK_FILTER_LOCKED, /* Filter cannot be changed anymore */ +	SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */  };  static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) @@ -2158,10 +2159,9 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,   * @sk:		socket sending this packet   * @tx_flags:	filled with instructions for time stamping   * - * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if - * parameters are invalid. + * Currently only depends on SOCK_TIMESTAMPING* flags.   */ -extern int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); +extern void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);  /**   * sk_eat_skb - Release a skb if it is no longer needed diff --git a/include/net/tcp.h b/include/net/tcp.h index cf0694d4ad6..5bba80fbd1d 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -179,7 +179,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);  #define TCPOPT_SACK             5       /* SACK Block */  #define TCPOPT_TIMESTAMP	8	/* Better RTT estimations/PAWS */  #define TCPOPT_MD5SIG		19	/* MD5 Signature (RFC2385) */ -#define TCPOPT_COOKIE		253	/* Cookie extension (experimental) */  #define TCPOPT_EXP		254	/* Experimental */  /* Magic number to be after the option value for sharing TCP   * experimental options. See draft-ietf-tcpm-experimental-options-00.txt @@ -273,7 +272,6 @@ extern int sysctl_tcp_app_win;  extern int sysctl_tcp_adv_win_scale;  extern int sysctl_tcp_tw_reuse;  extern int sysctl_tcp_frto; -extern int sysctl_tcp_frto_response;  extern int sysctl_tcp_low_latency;  extern int sysctl_tcp_dma_copybreak;  extern int sysctl_tcp_nometrics_save; @@ -284,7 +282,6 @@ extern int sysctl_tcp_base_mss;  extern int sysctl_tcp_workaround_signed_windows;  extern int sysctl_tcp_slow_start_after_idle;  extern int sysctl_tcp_max_ssthresh; -extern int sysctl_tcp_cookie_size;  extern int sysctl_tcp_thin_linear_timeouts;  extern int sysctl_tcp_thin_dupack;  extern int sysctl_tcp_early_retrans; @@ -373,6 +370,7 @@ extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,  extern int tcp_sendpage(struct sock *sk, struct page *page, int offset,  			size_t size, int flags);  extern void tcp_release_cb(struct sock *sk); +extern void tcp_wfree(struct sk_buff *skb);  extern void tcp_write_timer_handler(struct sock *sk);  extern void tcp_delack_timer_handler(struct sock *sk);  extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); @@ -425,8 +423,6 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,  				   bool fastopen);  extern int tcp_child_process(struct sock *parent, struct sock *child,  			     struct sk_buff *skb); -extern bool tcp_use_frto(struct sock *sk); -extern void tcp_enter_frto(struct sock *sk);  extern void tcp_enter_loss(struct sock *sk, int how);  extern void tcp_clear_retrans(struct tcp_sock *tp);  extern void tcp_update_metrics(struct sock *sk); @@ -454,7 +450,7 @@ extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req);  extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,  		       size_t len, int nonblock, int flags, int *addr_len);  extern void tcp_parse_options(const struct sk_buff *skb, -			      struct tcp_options_received *opt_rx, const u8 **hvpp, +			      struct tcp_options_received *opt_rx,  			      int estab, struct tcp_fastopen_cookie *foc);  extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); @@ -476,7 +472,6 @@ extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr,  extern int tcp_connect(struct sock *sk);  extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,  					struct request_sock *req, -					struct request_values *rvp,  					struct tcp_fastopen_cookie *foc);  extern int tcp_disconnect(struct sock *sk, int flags); @@ -543,6 +538,8 @@ extern bool tcp_syn_flood_action(struct sock *sk,  extern void tcp_push_one(struct sock *, unsigned int mss_now);  extern void tcp_send_ack(struct sock *sk);  extern void tcp_send_delayed_ack(struct sock *sk); +extern void tcp_send_loss_probe(struct sock *sk); +extern bool tcp_schedule_loss_probe(struct sock *sk);  /* tcp_input.c */  extern void tcp_cwnd_application_limited(struct sock *sk); @@ -756,7 +753,6 @@ enum tcp_ca_event {  	CA_EVENT_TX_START,	/* first transmit when no packets in flight */  	CA_EVENT_CWND_RESTART,	/* congestion window restart */  	CA_EVENT_COMPLETE_CWR,	/* end of congestion recovery */ -	CA_EVENT_FRTO,		/* fast recovery timeout */  	CA_EVENT_LOSS,		/* loss timeout */  	CA_EVENT_FAST_ACK,	/* in sequence ack */  	CA_EVENT_SLOW_ACK,	/* other ack */ @@ -873,8 +869,8 @@ static inline void tcp_enable_fack(struct tcp_sock *tp)  static inline void tcp_enable_early_retrans(struct tcp_sock *tp)  {  	tp->do_early_retrans = sysctl_tcp_early_retrans && -		!sysctl_tcp_thin_dupack && sysctl_tcp_reordering == 3; -	tp->early_retrans_delayed = 0; +		sysctl_tcp_early_retrans < 4 && !sysctl_tcp_thin_dupack && +		sysctl_tcp_reordering == 3;  }  static inline void tcp_disable_early_retrans(struct tcp_sock *tp) @@ -1030,50 +1026,7 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)  #endif  } -/* Packet is added to VJ-style prequeue for processing in process - * context, if a reader task is waiting. Apparently, this exciting - * idea (VJ's mail "Re: query about TCP header on tcp-ip" of 07 Sep 93) - * failed somewhere. Latency? Burstiness? Well, at least now we will - * see, why it failed. 8)8)				  --ANK - * - * NOTE: is this not too big to inline? - */ -static inline bool tcp_prequeue(struct sock *sk, struct sk_buff *skb) -{ -	struct tcp_sock *tp = tcp_sk(sk); - -	if (sysctl_tcp_low_latency || !tp->ucopy.task) -		return false; - -	if (skb->len <= tcp_hdrlen(skb) && -	    skb_queue_len(&tp->ucopy.prequeue) == 0) -		return false; - -	__skb_queue_tail(&tp->ucopy.prequeue, skb); -	tp->ucopy.memory += skb->truesize; -	if (tp->ucopy.memory > sk->sk_rcvbuf) { -		struct sk_buff *skb1; - -		BUG_ON(sock_owned_by_user(sk)); - -		while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { -			sk_backlog_rcv(sk, skb1); -			NET_INC_STATS_BH(sock_net(sk), -					 LINUX_MIB_TCPPREQUEUEDROPPED); -		} - -		tp->ucopy.memory = 0; -	} else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { -		wake_up_interruptible_sync_poll(sk_sleep(sk), -					   POLLIN | POLLRDNORM | POLLRDBAND); -		if (!inet_csk_ack_scheduled(sk)) -			inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, -						  (3 * tcp_rto_min(sk)) / 4, -						  TCP_RTO_MAX); -	} -	return true; -} - +extern bool tcp_prequeue(struct sock *sk, struct sk_buff *skb);  #undef STATE_TRACE @@ -1630,91 +1583,6 @@ struct tcp_request_sock_ops {  #endif  }; -/* Using SHA1 for now, define some constants. - */ -#define COOKIE_DIGEST_WORDS (SHA_DIGEST_WORDS) -#define COOKIE_MESSAGE_WORDS (SHA_MESSAGE_BYTES / 4) -#define COOKIE_WORKSPACE_WORDS (COOKIE_DIGEST_WORDS + COOKIE_MESSAGE_WORDS) - -extern int tcp_cookie_generator(u32 *bakery); - -/** - *	struct tcp_cookie_values - each socket needs extra space for the - *	cookies, together with (optional) space for any SYN data. - * - *	A tcp_sock contains a pointer to the current value, and this is - *	cloned to the tcp_timewait_sock. - * - * @cookie_pair:	variable data from the option exchange. - * - * @cookie_desired:	user specified tcpct_cookie_desired.  Zero - *			indicates default (sysctl_tcp_cookie_size). - *			After cookie sent, remembers size of cookie. - *			Range 0, TCP_COOKIE_MIN to TCP_COOKIE_MAX. - * - * @s_data_desired:	user specified tcpct_s_data_desired.  When the - *			constant payload is specified (@s_data_constant), - *			holds its length instead. - *			Range 0 to TCP_MSS_DESIRED. - * - * @s_data_payload:	constant data that is to be included in the - *			payload of SYN or SYNACK segments when the - *			cookie option is present. - */ -struct tcp_cookie_values { -	struct kref	kref; -	u8		cookie_pair[TCP_COOKIE_PAIR_SIZE]; -	u8		cookie_pair_size; -	u8		cookie_desired; -	u16		s_data_desired:11, -			s_data_constant:1, -			s_data_in:1, -			s_data_out:1, -			s_data_unused:2; -	u8		s_data_payload[0]; -}; - -static inline void tcp_cookie_values_release(struct kref *kref) -{ -	kfree(container_of(kref, struct tcp_cookie_values, kref)); -} - -/* The length of constant payload data.  Note that s_data_desired is - * overloaded, depending on s_data_constant: either the length of constant - * data (returned here) or the limit on variable data. - */ -static inline int tcp_s_data_size(const struct tcp_sock *tp) -{ -	return (tp->cookie_values != NULL && tp->cookie_values->s_data_constant) -		? tp->cookie_values->s_data_desired -		: 0; -} - -/** - *	struct tcp_extend_values - tcp_ipv?.c to tcp_output.c workspace. - * - *	As tcp_request_sock has already been extended in other places, the - *	only remaining method is to pass stack values along as function - *	parameters.  These parameters are not needed after sending SYNACK. - * - * @cookie_bakery:	cryptographic secret and message workspace. - * - * @cookie_plus:	bytes in authenticator/cookie option, copied from - *			struct tcp_options_received (above). - */ -struct tcp_extend_values { -	struct request_values		rv; -	u32				cookie_bakery[COOKIE_WORKSPACE_WORDS]; -	u8				cookie_plus:6, -					cookie_out_never:1, -					cookie_in_always:1; -}; - -static inline struct tcp_extend_values *tcp_xv(struct request_values *rvp) -{ -	return (struct tcp_extend_values *)rvp; -} -  extern void tcp_v4_init(void);  extern void tcp_init(void); diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 24c8886fd96..ae16531d0d3 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -162,6 +162,7 @@ struct xfrm_state {  		xfrm_address_t	saddr;  		int		header_len;  		int		trailer_len; +		u32		extra_flags;  	} props;  	struct xfrm_lifetime_cfg lft; diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 3bbbd78e143..2d56e428506 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -65,6 +65,18 @@ struct pcmcia_driver {  int pcmcia_register_driver(struct pcmcia_driver *driver);  void pcmcia_unregister_driver(struct pcmcia_driver *driver); +/** + * module_pcmcia_driver() - Helper macro for registering a pcmcia driver + * @__pcmcia_driver: pcmcia_driver struct + * + * Helper macro for pcmcia drivers which do not do anything special in module + * init/exit. This eliminates a lot of boilerplate. Each module may only use + * this macro once, and calling it replaces module_init() and module_exit(). + */ +#define module_pcmcia_driver(__pcmcia_driver) \ +	module_driver(__pcmcia_driver, pcmcia_register_driver, \ +			pcmcia_unregister_driver) +  /* for struct resource * array embedded in struct pcmcia_device */  enum {  	PCMCIA_IOPORT_0, diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild deleted file mode 100644 index 562ff9d591b..00000000000 --- a/include/scsi/Kbuild +++ /dev/null @@ -1 +0,0 @@ -header-y += fc/ diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h index 917741bb8e1..fe7f06c86f6 100644 --- a/include/scsi/iscsi_if.h +++ b/include/scsi/iscsi_if.h @@ -63,6 +63,12 @@ enum iscsi_uevent_e {  	ISCSI_UEVENT_PING		= UEVENT_BASE + 22,  	ISCSI_UEVENT_GET_CHAP		= UEVENT_BASE + 23,  	ISCSI_UEVENT_DELETE_CHAP	= UEVENT_BASE + 24, +	ISCSI_UEVENT_SET_FLASHNODE_PARAMS	= UEVENT_BASE + 25, +	ISCSI_UEVENT_NEW_FLASHNODE	= UEVENT_BASE + 26, +	ISCSI_UEVENT_DEL_FLASHNODE	= UEVENT_BASE + 27, +	ISCSI_UEVENT_LOGIN_FLASHNODE	= UEVENT_BASE + 28, +	ISCSI_UEVENT_LOGOUT_FLASHNODE	= UEVENT_BASE + 29, +	ISCSI_UEVENT_LOGOUT_FLASHNODE_SID	= UEVENT_BASE + 30,  	/* up events */  	ISCSI_KEVENT_RECV_PDU		= KEVENT_BASE + 1, @@ -210,6 +216,31 @@ struct iscsi_uevent {  		       uint32_t        host_no;  		       uint16_t        chap_tbl_idx;  		} delete_chap; +		struct msg_set_flashnode_param { +			uint32_t	host_no; +			uint32_t	flashnode_idx; +			uint32_t	count; +		} set_flashnode; +		struct msg_new_flashnode { +			uint32_t	host_no; +			uint32_t	len; +		} new_flashnode; +		struct msg_del_flashnode { +			uint32_t	host_no; +			uint32_t	flashnode_idx; +		} del_flashnode; +		struct msg_login_flashnode { +			uint32_t	host_no; +			uint32_t	flashnode_idx; +		} login_flashnode; +		struct msg_logout_flashnode { +			uint32_t	host_no; +			uint32_t	flashnode_idx; +		} logout_flashnode; +		struct msg_logout_flashnode_sid { +			uint32_t	host_no; +			uint32_t	sid; +		} logout_flashnode_sid;  	} u;  	union {  		/* messages k -> u */ @@ -267,6 +298,9 @@ struct iscsi_uevent {  						   with each ping request */  			uint32_t        data_size;  		} ping_comp; +		struct msg_new_flashnode_ret { +			uint32_t	flashnode_idx; +		} new_flashnode_ret;  	} r;  } __attribute__ ((aligned (sizeof(uint64_t)))); @@ -274,6 +308,7 @@ enum iscsi_param_type {  	ISCSI_PARAM,		/* iscsi_param (session, conn, target, LU) */  	ISCSI_HOST_PARAM,	/* iscsi_host_param */  	ISCSI_NET_PARAM,	/* iscsi_net_param */ +	ISCSI_FLASHNODE_PARAM,	/* iscsi_flashnode_param */  };  struct iscsi_iface_param_info { @@ -469,6 +504,88 @@ enum iscsi_host_param {  	ISCSI_HOST_PARAM_MAX,  }; +/* portal type */ +#define PORTAL_TYPE_IPV4	"ipv4" +#define PORTAL_TYPE_IPV6	"ipv6" + +/* iSCSI Flash Target params */ +enum iscsi_flashnode_param { +	ISCSI_FLASHNODE_IS_FW_ASSIGNED_IPV6, +	ISCSI_FLASHNODE_PORTAL_TYPE, +	ISCSI_FLASHNODE_AUTO_SND_TGT_DISABLE, +	ISCSI_FLASHNODE_DISCOVERY_SESS, +	ISCSI_FLASHNODE_ENTRY_EN, +	ISCSI_FLASHNODE_HDR_DGST_EN, +	ISCSI_FLASHNODE_DATA_DGST_EN, +	ISCSI_FLASHNODE_IMM_DATA_EN, +	ISCSI_FLASHNODE_INITIAL_R2T_EN, +	ISCSI_FLASHNODE_DATASEQ_INORDER, +	ISCSI_FLASHNODE_PDU_INORDER, +	ISCSI_FLASHNODE_CHAP_AUTH_EN, +	ISCSI_FLASHNODE_SNACK_REQ_EN, +	ISCSI_FLASHNODE_DISCOVERY_LOGOUT_EN, +	ISCSI_FLASHNODE_BIDI_CHAP_EN, +	/* make authentication for discovery sessions optional */ +	ISCSI_FLASHNODE_DISCOVERY_AUTH_OPTIONAL, +	ISCSI_FLASHNODE_ERL, +	ISCSI_FLASHNODE_TCP_TIMESTAMP_STAT, +	ISCSI_FLASHNODE_TCP_NAGLE_DISABLE, +	ISCSI_FLASHNODE_TCP_WSF_DISABLE, +	ISCSI_FLASHNODE_TCP_TIMER_SCALE, +	ISCSI_FLASHNODE_TCP_TIMESTAMP_EN, +	ISCSI_FLASHNODE_IP_FRAG_DISABLE, +	ISCSI_FLASHNODE_MAX_RECV_DLENGTH, +	ISCSI_FLASHNODE_MAX_XMIT_DLENGTH, +	ISCSI_FLASHNODE_FIRST_BURST, +	ISCSI_FLASHNODE_DEF_TIME2WAIT, +	ISCSI_FLASHNODE_DEF_TIME2RETAIN, +	ISCSI_FLASHNODE_MAX_R2T, +	ISCSI_FLASHNODE_KEEPALIVE_TMO, +	ISCSI_FLASHNODE_ISID, +	ISCSI_FLASHNODE_TSID, +	ISCSI_FLASHNODE_PORT, +	ISCSI_FLASHNODE_MAX_BURST, +	ISCSI_FLASHNODE_DEF_TASKMGMT_TMO, +	ISCSI_FLASHNODE_IPADDR, +	ISCSI_FLASHNODE_ALIAS, +	ISCSI_FLASHNODE_REDIRECT_IPADDR, +	ISCSI_FLASHNODE_MAX_SEGMENT_SIZE, +	ISCSI_FLASHNODE_LOCAL_PORT, +	ISCSI_FLASHNODE_IPV4_TOS, +	ISCSI_FLASHNODE_IPV6_TC, +	ISCSI_FLASHNODE_IPV6_FLOW_LABEL, +	ISCSI_FLASHNODE_NAME, +	ISCSI_FLASHNODE_TPGT, +	ISCSI_FLASHNODE_LINK_LOCAL_IPV6, +	ISCSI_FLASHNODE_DISCOVERY_PARENT_IDX, +	ISCSI_FLASHNODE_DISCOVERY_PARENT_TYPE, +	ISCSI_FLASHNODE_TCP_XMIT_WSF, +	ISCSI_FLASHNODE_TCP_RECV_WSF, +	ISCSI_FLASHNODE_CHAP_IN_IDX, +	ISCSI_FLASHNODE_CHAP_OUT_IDX, +	ISCSI_FLASHNODE_USERNAME, +	ISCSI_FLASHNODE_USERNAME_IN, +	ISCSI_FLASHNODE_PASSWORD, +	ISCSI_FLASHNODE_PASSWORD_IN, +	ISCSI_FLASHNODE_STATSN, +	ISCSI_FLASHNODE_EXP_STATSN, +	ISCSI_FLASHNODE_IS_BOOT_TGT, + +	ISCSI_FLASHNODE_MAX, +}; + +struct iscsi_flashnode_param_info { +	uint32_t len;		/* Actual length of the param */ +	uint16_t param;		/* iscsi param value */ +	uint8_t value[0];	/* length sized value follows */ +} __packed; + +enum iscsi_discovery_parent_type { +	ISCSI_DISC_PARENT_UNKNOWN	= 0x1, +	ISCSI_DISC_PARENT_SENDTGT	= 0x2, +	ISCSI_DISC_PARENT_ISNS		= 0x3, +}; +  /* iSCSI port Speed */  enum iscsi_port_speed {  	ISCSI_PORT_SPEED_UNKNOWN	= 0x1, diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 399162b50a8..e1379b4e8fa 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h @@ -1074,7 +1074,8 @@ void fc_rport_terminate_io(struct fc_rport *);  /*   * DISCOVERY LAYER   *****************************/ -int fc_disc_init(struct fc_lport *); +void fc_disc_init(struct fc_lport *); +void fc_disc_config(struct fc_lport *, void *);  static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc)  { diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 6e33386a389..09c041e6c35 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -427,6 +427,7 @@ extern void iscsi_complete_scsi_task(struct iscsi_task *task,   */  extern void iscsi_pool_free(struct iscsi_pool *);  extern int iscsi_pool_init(struct iscsi_pool *, int, void ***, int); +extern int iscsi_switch_str_param(char **, char *);  /*   * inline functions to deal with padding. diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 2b6956e9853..75524357221 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -6,6 +6,7 @@  #include <linux/types.h>  #include <linux/workqueue.h>  #include <linux/mutex.h> +#include <linux/seq_file.h>  #include <scsi/scsi.h>  struct request_queue; @@ -340,7 +341,8 @@ struct scsi_host_template {  	 *  	 * Status: OBSOLETE  	 */ -	int (*proc_info)(struct Scsi_Host *, char *, char **, off_t, int, int); +	int (*show_info)(struct seq_file *, struct Scsi_Host *); +	int (*write_info)(struct Scsi_Host *, char *, int);  	/*  	 * This is an optional routine that allows the transport to become @@ -375,7 +377,7 @@ struct scsi_host_template {  	/*  	 * Used to store the procfs directory if a driver implements the -	 * proc_info method. +	 * show_info method.  	 */  	struct proc_dir_entry *proc_dir; diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 53f0b361d66..4a58cca2ecc 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -39,6 +39,8 @@ struct iscsi_task;  struct sockaddr;  struct iscsi_iface;  struct bsg_job; +struct iscsi_bus_flash_session; +struct iscsi_bus_flash_conn;  /**   * struct iscsi_transport - iSCSI Transport template @@ -150,6 +152,19 @@ struct iscsi_transport {  	int (*get_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx,  			 uint32_t *num_entries, char *buf);  	int (*delete_chap) (struct Scsi_Host *shost, uint16_t chap_tbl_idx); +	int (*get_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess, +				    int param, char *buf); +	int (*set_flashnode_param) (struct iscsi_bus_flash_session *fnode_sess, +				    struct iscsi_bus_flash_conn *fnode_conn, +				    void *data, int len); +	int (*new_flashnode) (struct Scsi_Host *shost, const char *buf, +			      int len); +	int (*del_flashnode) (struct iscsi_bus_flash_session *fnode_sess); +	int (*login_flashnode) (struct iscsi_bus_flash_session *fnode_sess, +				struct iscsi_bus_flash_conn *fnode_conn); +	int (*logout_flashnode) (struct iscsi_bus_flash_session *fnode_sess, +				 struct iscsi_bus_flash_conn *fnode_conn); +	int (*logout_flashnode_sid) (struct iscsi_cls_session *cls_sess);  };  /* @@ -286,6 +301,112 @@ struct iscsi_iface {  #define iscsi_iface_to_shost(_iface) \  	dev_to_shost(_iface->dev.parent) + +struct iscsi_bus_flash_conn { +	struct list_head conn_list;	/* item in connlist */ +	void *dd_data;			/* LLD private data */ +	struct iscsi_transport *transport; +	struct device dev;		/* sysfs transport/container device */ +	/* iscsi connection parameters */ +	uint32_t		exp_statsn; +	uint32_t		statsn; +	unsigned		max_recv_dlength; /* initiator_max_recv_dsl*/ +	unsigned		max_xmit_dlength; /* target_max_recv_dsl */ +	unsigned		max_segment_size; +	unsigned		tcp_xmit_wsf; +	unsigned		tcp_recv_wsf; +	int			hdrdgst_en; +	int			datadgst_en; +	int			port; +	char			*ipaddress; +	char			*link_local_ipv6_addr; +	char			*redirect_ipaddr; +	uint16_t		keepalive_timeout; +	uint16_t		local_port; +	uint8_t			snack_req_en; +	/* tcp timestamp negotiation status */ +	uint8_t			tcp_timestamp_stat; +	uint8_t			tcp_nagle_disable; +	/* tcp window scale factor */ +	uint8_t			tcp_wsf_disable; +	uint8_t			tcp_timer_scale; +	uint8_t			tcp_timestamp_en; +	uint8_t			ipv4_tos; +	uint8_t			ipv6_traffic_class; +	uint8_t			ipv6_flow_label; +	uint8_t			fragment_disable; +	/* Link local IPv6 address is assigned by firmware or driver */ +	uint8_t			is_fw_assigned_ipv6; +}; + +#define iscsi_dev_to_flash_conn(_dev) \ +	container_of(_dev, struct iscsi_bus_flash_conn, dev) + +#define iscsi_flash_conn_to_flash_session(_conn) \ +	iscsi_dev_to_flash_session(_conn->dev.parent) + +#define ISID_SIZE 6 + +struct iscsi_bus_flash_session { +	struct list_head sess_list;		/* item in session_list */ +	struct iscsi_transport *transport; +	unsigned int target_id; +	int flash_state;	/* persistent or non-persistent */ +	void *dd_data;				/* LLD private data */ +	struct device dev;	/* sysfs transport/container device */ +	/* iscsi session parameters */ +	unsigned		first_burst; +	unsigned		max_burst; +	unsigned short		max_r2t; +	int			default_taskmgmt_timeout; +	int			initial_r2t_en; +	int			imm_data_en; +	int			time2wait; +	int			time2retain; +	int			pdu_inorder_en; +	int			dataseq_inorder_en; +	int			erl; +	int			tpgt; +	char			*username; +	char			*username_in; +	char			*password; +	char			*password_in; +	char			*targetname; +	char			*targetalias; +	char			*portal_type; +	uint16_t		tsid; +	uint16_t		chap_in_idx; +	uint16_t		chap_out_idx; +	/* index of iSCSI discovery session if the entry is +	 * discovered by iSCSI discovery session +	 */ +	uint16_t		discovery_parent_idx; +	/* indicates if discovery was done through iSNS discovery service +	 * or through sendTarget */ +	uint16_t		discovery_parent_type; +	/* Firmware auto sendtarget discovery disable */ +	uint8_t			auto_snd_tgt_disable; +	uint8_t			discovery_sess; +	/* indicates if this flashnode entry is enabled or disabled */ +	uint8_t			entry_state; +	uint8_t			chap_auth_en; +	/* enables firmware to auto logout the discovery session on discovery +	 * completion +	 */ +	uint8_t			discovery_logout_en; +	uint8_t			bidi_chap_en; +	/* makes authentication for discovery session optional */ +	uint8_t			discovery_auth_optional; +	uint8_t			isid[ISID_SIZE]; +	uint8_t			is_boot_target; +}; + +#define iscsi_dev_to_flash_session(_dev) \ +	container_of(_dev, struct iscsi_bus_flash_session, dev) + +#define iscsi_flash_session_to_shost(_session) \ +	dev_to_shost(_session->dev.parent) +  /*   * session and connection functions that can be used by HW iSCSI LLDs   */ @@ -330,4 +451,34 @@ extern char *iscsi_get_port_speed_name(struct Scsi_Host *shost);  extern char *iscsi_get_port_state_name(struct Scsi_Host *shost);  extern int iscsi_is_session_dev(const struct device *dev); +extern char *iscsi_get_discovery_parent_name(int parent_type); +extern struct device * +iscsi_find_flashnode(struct Scsi_Host *shost, void *data, +		     int (*fn)(struct device *dev, void *data)); + +extern struct iscsi_bus_flash_session * +iscsi_create_flashnode_sess(struct Scsi_Host *shost, int index, +			    struct iscsi_transport *transport, int dd_size); + +extern struct iscsi_bus_flash_conn * +iscsi_create_flashnode_conn(struct Scsi_Host *shost, +			    struct iscsi_bus_flash_session *fnode_sess, +			    struct iscsi_transport *transport, int dd_size); + +extern void +iscsi_destroy_flashnode_sess(struct iscsi_bus_flash_session *fnode_sess); + +extern void iscsi_destroy_all_flashnode(struct Scsi_Host *shost); +extern int iscsi_flashnode_bus_match(struct device *dev, +				     struct device_driver *drv); +extern int iscsi_is_flashnode_conn_dev(struct device *dev, void *data); + +extern struct device * +iscsi_find_flashnode_sess(struct Scsi_Host *shost, void *data, +			  int (*fn)(struct device *dev, void *data)); + +extern struct device * +iscsi_find_flashnode_conn(struct iscsi_bus_flash_session *fnode_sess, +			  void *data, +			  int (*fn)(struct device *dev, void *data));  #endif diff --git a/include/sound/max98090.h b/include/sound/max98090.h index 95efb13f847..95efb13f847 100755..100644 --- a/include/sound/max98090.h +++ b/include/sound/max98090.h diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 45c1981c9ca..5ec42dbd230 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -867,7 +867,7 @@ int snd_pcm_format_physical_width(snd_pcm_format_t format);		/* in bits */  ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);  const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format);  int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); -snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); +snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsigned, int big_endian);  void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops);  void snd_pcm_set_sync(struct snd_pcm_substream *substream); diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index e1ef63d4a5c..44a30b10868 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -488,6 +488,7 @@ struct snd_soc_dapm_path {  	/* status */  	u32 connect:1;	/* source and sink widgets are connected */  	u32 walked:1;	/* path has been walked */ +	u32 walking:1;  /* path is in the process of being walked */  	u32 weak:1;	/* path ignored for power management */  	int (*connected)(struct snd_soc_dapm_widget *source, diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h new file mode 100644 index 00000000000..23a87d0cd72 --- /dev/null +++ b/include/target/iscsi/iscsi_transport.h @@ -0,0 +1,83 @@ +#include <linux/module.h> +#include <linux/list.h> +#include "../../../drivers/target/iscsi/iscsi_target_core.h" + +struct iscsit_transport { +#define ISCSIT_TRANSPORT_NAME	16 +	char name[ISCSIT_TRANSPORT_NAME]; +	int transport_type; +	struct module *owner; +	struct list_head t_node; +	int (*iscsit_setup_np)(struct iscsi_np *, struct __kernel_sockaddr_storage *); +	int (*iscsit_accept_np)(struct iscsi_np *, struct iscsi_conn *); +	void (*iscsit_free_np)(struct iscsi_np *); +	void (*iscsit_free_conn)(struct iscsi_conn *); +	struct iscsi_cmd *(*iscsit_alloc_cmd)(struct iscsi_conn *, gfp_t); +	int (*iscsit_get_login_rx)(struct iscsi_conn *, struct iscsi_login *); +	int (*iscsit_put_login_tx)(struct iscsi_conn *, struct iscsi_login *, u32); +	int (*iscsit_immediate_queue)(struct iscsi_conn *, struct iscsi_cmd *, int); +	int (*iscsit_response_queue)(struct iscsi_conn *, struct iscsi_cmd *, int); +	int (*iscsit_get_dataout)(struct iscsi_conn *, struct iscsi_cmd *, bool); +	int (*iscsit_queue_data_in)(struct iscsi_conn *, struct iscsi_cmd *); +	int (*iscsit_queue_status)(struct iscsi_conn *, struct iscsi_cmd *); +}; + +/* + * From iscsi_target_transport.c + */ + +extern int iscsit_register_transport(struct iscsit_transport *); +extern void iscsit_unregister_transport(struct iscsit_transport *); +extern struct iscsit_transport *iscsit_get_transport(int); +extern void iscsit_put_transport(struct iscsit_transport *); + +/* + * From iscsi_target.c + */ +extern int iscsit_add_reject_from_cmd(u8, int, int, unsigned char *, +				struct iscsi_cmd *); +extern int iscsit_setup_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *, +				unsigned char *); +extern void iscsit_set_unsoliticed_dataout(struct iscsi_cmd *); +extern int iscsit_process_scsi_cmd(struct iscsi_conn *, struct iscsi_cmd *, +				struct iscsi_scsi_req *); +extern int iscsit_check_dataout_hdr(struct iscsi_conn *, unsigned char *, +				struct iscsi_cmd **); +extern int iscsit_check_dataout_payload(struct iscsi_cmd *, struct iscsi_data *, +				bool); +extern int iscsit_handle_nop_out(struct iscsi_conn *, struct iscsi_cmd *, +				unsigned char *); +extern int iscsit_handle_logout_cmd(struct iscsi_conn *, struct iscsi_cmd *, +				unsigned char *); +extern int iscsit_handle_task_mgt_cmd(struct iscsi_conn *, struct iscsi_cmd *, +				unsigned char *); +extern void iscsit_build_rsp_pdu(struct iscsi_cmd *, struct iscsi_conn *, +				bool, struct iscsi_scsi_rsp *); +extern void iscsit_build_nopin_rsp(struct iscsi_cmd *, struct iscsi_conn *, +				struct iscsi_nopin *, bool); +extern void iscsit_build_task_mgt_rsp(struct iscsi_cmd *, struct iscsi_conn *, +				struct iscsi_tm_rsp *); +extern void iscsit_build_reject(struct iscsi_cmd *, struct iscsi_conn *, +				struct iscsi_reject *); +extern int iscsit_build_logout_rsp(struct iscsi_cmd *, struct iscsi_conn *, +				struct iscsi_logout_rsp *); +extern int iscsit_logout_post_handler(struct iscsi_cmd *, struct iscsi_conn *); +/* + * From iscsi_target_device.c + */ +extern void iscsit_increment_maxcmdsn(struct iscsi_cmd *, struct iscsi_session *); +/* + * From iscsi_target_erl1.c + */ +extern void iscsit_stop_dataout_timer(struct iscsi_cmd *); + +/* + * From iscsi_target_tmr.c + */ +extern int iscsit_tmr_post_handler(struct iscsi_cmd *, struct iscsi_conn *); + +/* + * From iscsi_target_util.c + */ +extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t); +extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *, __be32); diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index b128c20770b..ffa2696d64d 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h @@ -60,6 +60,10 @@ sense_reason_t	sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops);  u32	sbc_get_device_rev(struct se_device *dev);  u32	sbc_get_device_type(struct se_device *dev);  sector_t	sbc_get_write_same_sectors(struct se_cmd *cmd); +sense_reason_t sbc_execute_unmap(struct se_cmd *cmd, +	sense_reason_t (*do_unmap_fn)(struct se_cmd *cmd, void *priv, +				      sector_t lba, sector_t nolb), +	void *priv);  void	transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);  int	transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index aaa1ee6ab39..ba3471b73c0 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h @@ -120,7 +120,7 @@ bool	transport_wait_for_tasks(struct se_cmd *);  int	transport_check_aborted_status(struct se_cmd *, int);  int	transport_send_check_condition_and_sense(struct se_cmd *,  		sense_reason_t, int); - +int	target_get_sess_cmd(struct se_session *, struct se_cmd *, bool);  int	target_put_sess_cmd(struct se_session *, struct se_cmd *);  void	target_sess_cmd_list_set_waiting(struct se_session *);  void	target_wait_for_sess_cmds(struct se_session *, int); diff --git a/include/trace/events/block.h b/include/trace/events/block.h index 9961726523d..9c1467357b0 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h @@ -257,6 +257,7 @@ TRACE_EVENT(block_bio_bounce,  /**   * block_bio_complete - completed all work on the block operation + * @q: queue holding the block operation   * @bio: block operation completed   * @error: io error value   * @@ -265,9 +266,9 @@ TRACE_EVENT(block_bio_bounce,   */  TRACE_EVENT(block_bio_complete, -	TP_PROTO(struct bio *bio, int error), +	TP_PROTO(struct request_queue *q, struct bio *bio, int error), -	TP_ARGS(bio, error), +	TP_ARGS(q, bio, error),  	TP_STRUCT__entry(  		__field( dev_t,		dev		) @@ -278,8 +279,7 @@ TRACE_EVENT(block_bio_complete,  	),  	TP_fast_assign( -		__entry->dev		= bio->bi_bdev ? -					  bio->bi_bdev->bd_dev : 0; +		__entry->dev		= bio->bi_bdev->bd_dev;  		__entry->sector		= bio->bi_sector;  		__entry->nr_sector	= bio->bi_size >> 9;  		__entry->error		= error; diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index 4ee47100385..d0e686402df 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h @@ -257,15 +257,7 @@ DECLARE_EVENT_CLASS(ext4__write_end,  		  __entry->pos, __entry->len, __entry->copied)  ); -DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end, - -	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, -		 unsigned int copied), - -	TP_ARGS(inode, pos, len, copied) -); - -DEFINE_EVENT(ext4__write_end, ext4_writeback_write_end, +DEFINE_EVENT(ext4__write_end, ext4_write_end,  	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,  		 unsigned int copied), @@ -1956,7 +1948,7 @@ TRACE_EVENT(ext4_remove_blocks,  		__entry->to		= to;  		__entry->partial	= partial_cluster;  		__entry->ee_pblk	= ext4_ext_pblock(ex); -		__entry->ee_lblk	= cpu_to_le32(ex->ee_block); +		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);  		__entry->ee_len		= ext4_ext_get_actual_len(ex);  	), @@ -2060,7 +2052,7 @@ TRACE_EVENT(ext4_ext_remove_space,  TRACE_EVENT(ext4_ext_remove_space_done,  	TP_PROTO(struct inode *inode, ext4_lblk_t start, int depth, -		ext4_lblk_t partial, unsigned short eh_entries), +		ext4_lblk_t partial, __le16 eh_entries),  	TP_ARGS(inode, start, depth, partial, eh_entries), @@ -2079,7 +2071,7 @@ TRACE_EVENT(ext4_ext_remove_space_done,  		__entry->start		= start;  		__entry->depth		= depth;  		__entry->partial	= partial; -		__entry->eh_entries	= eh_entries; +		__entry->eh_entries	= le16_to_cpu(eh_entries);  	),  	TP_printk("dev %d,%d ino %lu since %u depth %d partial %u " diff --git a/include/trace/events/filemap.h b/include/trace/events/filemap.h new file mode 100644 index 00000000000..0421f49a20f --- /dev/null +++ b/include/trace/events/filemap.h @@ -0,0 +1,58 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM filemap + +#if !defined(_TRACE_FILEMAP_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_FILEMAP_H + +#include <linux/types.h> +#include <linux/tracepoint.h> +#include <linux/mm.h> +#include <linux/memcontrol.h> +#include <linux/device.h> +#include <linux/kdev_t.h> + +DECLARE_EVENT_CLASS(mm_filemap_op_page_cache, + +	TP_PROTO(struct page *page), + +	TP_ARGS(page), + +	TP_STRUCT__entry( +		__field(struct page *, page) +		__field(unsigned long, i_ino) +		__field(unsigned long, index) +		__field(dev_t, s_dev) +	), + +	TP_fast_assign( +		__entry->page = page; +		__entry->i_ino = page->mapping->host->i_ino; +		__entry->index = page->index; +		if (page->mapping->host->i_sb) +			__entry->s_dev = page->mapping->host->i_sb->s_dev; +		else +			__entry->s_dev = page->mapping->host->i_rdev; +	), + +	TP_printk("dev %d:%d ino %lx page=%p pfn=%lu ofs=%lu", +		MAJOR(__entry->s_dev), MINOR(__entry->s_dev), +		__entry->i_ino, +		__entry->page, +		page_to_pfn(__entry->page), +		__entry->index << PAGE_SHIFT) +); + +DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_delete_from_page_cache, +	TP_PROTO(struct page *page), +	TP_ARGS(page) +	); + +DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_add_to_page_cache, +	TP_PROTO(struct page *page), +	TP_ARGS(page) +	); + +#endif /* _TRACE_FILEMAP_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h index 070df49e4a1..c1d1f3eb242 100644 --- a/include/trace/events/jbd2.h +++ b/include/trace/events/jbd2.h @@ -358,6 +358,27 @@ TRACE_EVENT(jbd2_write_superblock,  		  MINOR(__entry->dev), __entry->write_op)  ); +TRACE_EVENT(jbd2_lock_buffer_stall, + +	TP_PROTO(dev_t dev, unsigned long stall_ms), + +	TP_ARGS(dev, stall_ms), + +	TP_STRUCT__entry( +		__field(        dev_t, dev	) +		__field(unsigned long, stall_ms	) +	), + +	TP_fast_assign( +		__entry->dev		= dev; +		__entry->stall_ms	= stall_ms; +	), + +	TP_printk("dev %d,%d stall_ms %lu", +		MAJOR(__entry->dev), MINOR(__entry->dev), +		__entry->stall_ms) +); +  #endif /* _TRACE_JBD2_H */  /* This part must be outside protection */ diff --git a/include/trace/events/printk.h b/include/trace/events/printk.h index 94ec79cc011..c008bc99f9f 100644 --- a/include/trace/events/printk.h +++ b/include/trace/events/printk.h @@ -6,31 +6,18 @@  #include <linux/tracepoint.h> -TRACE_EVENT_CONDITION(console, -	TP_PROTO(const char *log_buf, unsigned start, unsigned end, -		 unsigned log_buf_len), +TRACE_EVENT(console, +	TP_PROTO(const char *text, size_t len), -	TP_ARGS(log_buf, start, end, log_buf_len), - -	TP_CONDITION(start != end), +	TP_ARGS(text, len),  	TP_STRUCT__entry( -		__dynamic_array(char, msg, end - start + 1) +		__dynamic_array(char, msg, len + 1)  	),  	TP_fast_assign( -		if ((start & (log_buf_len - 1)) > (end & (log_buf_len - 1))) { -			memcpy(__get_dynamic_array(msg), -			       log_buf + (start & (log_buf_len - 1)), -			       log_buf_len - (start & (log_buf_len - 1))); -			memcpy((char *)__get_dynamic_array(msg) + -			       log_buf_len - (start & (log_buf_len - 1)), -			       log_buf, end & (log_buf_len - 1)); -		} else -			memcpy(__get_dynamic_array(msg), -			       log_buf + (start & (log_buf_len - 1)), -			       end - start); -		((char *)__get_dynamic_array(msg))[end - start] = 0; +		memcpy(__get_dynamic_array(msg), text, len); +		((char *)__get_dynamic_array(msg))[len] = 0;  	),  	TP_printk("%s", __get_str(msg)) diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h index 1918e832da4..59ebcc89f14 100644 --- a/include/trace/events/rcu.h +++ b/include/trace/events/rcu.h @@ -72,6 +72,58 @@ TRACE_EVENT(rcu_grace_period,  );  /* + * Tracepoint for future grace-period events, including those for no-callbacks + * CPUs.  The caller should pull the data from the rcu_node structure, + * other than rcuname, which comes from the rcu_state structure, and event, + * which is one of the following: + * + * "Startleaf": Request a nocb grace period based on leaf-node data. + * "Startedleaf": Leaf-node start proved sufficient. + * "Startedleafroot": Leaf-node start proved sufficient after checking root. + * "Startedroot": Requested a nocb grace period based on root-node data. + * "StartWait": Start waiting for the requested grace period. + * "ResumeWait": Resume waiting after signal. + * "EndWait": Complete wait. + * "Cleanup": Clean up rcu_node structure after previous GP. + * "CleanupMore": Clean up, and another no-CB GP is needed. + */ +TRACE_EVENT(rcu_future_grace_period, + +	TP_PROTO(char *rcuname, unsigned long gpnum, unsigned long completed, +		 unsigned long c, u8 level, int grplo, int grphi, +		 char *gpevent), + +	TP_ARGS(rcuname, gpnum, completed, c, level, grplo, grphi, gpevent), + +	TP_STRUCT__entry( +		__field(char *, rcuname) +		__field(unsigned long, gpnum) +		__field(unsigned long, completed) +		__field(unsigned long, c) +		__field(u8, level) +		__field(int, grplo) +		__field(int, grphi) +		__field(char *, gpevent) +	), + +	TP_fast_assign( +		__entry->rcuname = rcuname; +		__entry->gpnum = gpnum; +		__entry->completed = completed; +		__entry->c = c; +		__entry->level = level; +		__entry->grplo = grplo; +		__entry->grphi = grphi; +		__entry->gpevent = gpevent; +	), + +	TP_printk("%s %lu %lu %lu %u %d %d %s", +		  __entry->rcuname, __entry->gpnum, __entry->completed, +		  __entry->c, __entry->level, __entry->grplo, __entry->grphi, +		  __entry->gpevent) +); + +/*   * Tracepoint for grace-period-initialization events.  These are   * distinguished by the type of RCU, the new grace-period number, the   * rcu_node structure level, the starting and ending CPU covered by the @@ -601,6 +653,9 @@ TRACE_EVENT(rcu_barrier,  #define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)  #define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \  				    qsmask) do { } while (0) +#define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \ +				      level, grplo, grphi, event) \ +				      do { } while (0)  #define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)  #define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)  #define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \ diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h index 41a7dbd570e..a43a2f67bd8 100644 --- a/include/trace/events/regmap.h +++ b/include/trace/events/regmap.h @@ -175,6 +175,54 @@ DEFINE_EVENT(regmap_bool, regmap_cache_bypass,  ); +DECLARE_EVENT_CLASS(regmap_async, + +	TP_PROTO(struct device *dev), + +	TP_ARGS(dev), + +	TP_STRUCT__entry( +		__string(	name,		dev_name(dev)	) +	), + +	TP_fast_assign( +		__assign_str(name, dev_name(dev)); +	), + +	TP_printk("%s", __get_str(name)) +); + +DEFINE_EVENT(regmap_block, regmap_async_write_start, + +	TP_PROTO(struct device *dev, unsigned int reg, int count), + +	TP_ARGS(dev, reg, count) +); + +DEFINE_EVENT(regmap_async, regmap_async_io_complete, + +	TP_PROTO(struct device *dev), + +	TP_ARGS(dev) + +); + +DEFINE_EVENT(regmap_async, regmap_async_complete_start, + +	TP_PROTO(struct device *dev), + +	TP_ARGS(dev) + +); + +DEFINE_EVENT(regmap_async, regmap_async_complete_done, + +	TP_PROTO(struct device *dev), + +	TP_ARGS(dev) + +); +  #endif /* _TRACE_REGMAP_H */  /* This part must be outside protection */ diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 5a8671e8a67..e5586caff67 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -147,7 +147,7 @@ TRACE_EVENT(sched_switch,  		  __print_flags(__entry->prev_state & (TASK_STATE_MAX-1), "|",  				{ 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" },  				{ 16, "Z" }, { 32, "X" }, { 64, "x" }, -				{ 128, "W" }) : "R", +				{ 128, "K" }, { 256, "W" }, { 512, "P" }) : "R",  		__entry->prev_state & TASK_STATE_MAX ? "+" : "",  		__entry->next_comm, __entry->next_pid, __entry->next_prio)  ); diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h index 425bcfe56c6..8d219470624 100644 --- a/include/trace/events/timer.h +++ b/include/trace/events/timer.h @@ -123,7 +123,7 @@ DEFINE_EVENT(timer_class, timer_cancel,  /**   * hrtimer_init - called when the hrtimer is initialized - * @timer:	pointer to struct hrtimer + * @hrtimer:	pointer to struct hrtimer   * @clockid:	the hrtimers clock   * @mode:	the hrtimers mode   */ @@ -155,7 +155,7 @@ TRACE_EVENT(hrtimer_init,  /**   * hrtimer_start - called when the hrtimer is started - * @timer: pointer to struct hrtimer + * @hrtimer: pointer to struct hrtimer   */  TRACE_EVENT(hrtimer_start, @@ -186,8 +186,8 @@ TRACE_EVENT(hrtimer_start,  );  /** - * htimmer_expire_entry - called immediately before the hrtimer callback - * @timer:	pointer to struct hrtimer + * hrtimer_expire_entry - called immediately before the hrtimer callback + * @hrtimer:	pointer to struct hrtimer   * @now:	pointer to variable which contains current time of the   *		timers base.   * @@ -234,7 +234,7 @@ DECLARE_EVENT_CLASS(hrtimer_class,  /**   * hrtimer_expire_exit - called immediately after the hrtimer callback returns - * @timer:	pointer to struct hrtimer + * @hrtimer:	pointer to struct hrtimer   *   * When used in combination with the hrtimer_expire_entry tracepoint we can   * determine the runtime of the callback function. diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 40dc5e8fe34..19edd7facaa 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h @@ -227,29 +227,18 @@ static notrace enum print_line_t					\  ftrace_raw_output_##call(struct trace_iterator *iter, int flags,	\  			 struct trace_event *trace_event)		\  {									\ -	struct ftrace_event_call *event;				\  	struct trace_seq *s = &iter->seq;				\ +	struct trace_seq __maybe_unused *p = &iter->tmp_seq;		\  	struct ftrace_raw_##call *field;				\ -	struct trace_entry *entry;					\ -	struct trace_seq *p = &iter->tmp_seq;				\  	int ret;							\  									\ -	event = container_of(trace_event, struct ftrace_event_call,	\ -			     event);					\ -									\ -	entry = iter->ent;						\ -									\ -	if (entry->type != event->event.type) {				\ -		WARN_ON_ONCE(1);					\ -		return TRACE_TYPE_UNHANDLED;				\ -	}								\ -									\ -	field = (typeof(field))entry;					\ +	field = (typeof(field))iter->ent;				\  									\ -	trace_seq_init(p);						\ -	ret = trace_seq_printf(s, "%s: ", event->name);			\ +	ret = ftrace_raw_output_prep(iter, trace_event);		\  	if (ret)							\ -		ret = trace_seq_printf(s, print);			\ +		return ret;						\ +									\ +	ret = trace_seq_printf(s, print);				\  	if (!ret)							\  		return TRACE_TYPE_PARTIAL_LINE;				\  									\ @@ -335,7 +324,7 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = {	\  #undef DECLARE_EVENT_CLASS  #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print)	\ -static int notrace							\ +static int notrace __init						\  ftrace_define_fields_##call(struct ftrace_event_call *event_call)	\  {									\  	struct ftrace_raw_##call field;					\ @@ -414,7 +403,8 @@ static inline notrace int ftrace_get_offsets_##call(			\   *   * static void ftrace_raw_event_<call>(void *__data, proto)   * { - *	struct ftrace_event_call *event_call = __data; + *	struct ftrace_event_file *ftrace_file = __data; + *	struct ftrace_event_call *event_call = ftrace_file->event_call;   *	struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;   *	struct ring_buffer_event *event;   *	struct ftrace_raw_<call> *entry; <-- defined in stage 1 @@ -423,12 +413,16 @@ static inline notrace int ftrace_get_offsets_##call(			\   *	int __data_size;   *	int pc;   * + *	if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT, + *		     &ftrace_file->flags)) + *		return; + *   *	local_save_flags(irq_flags);   *	pc = preempt_count();   *   *	__data_size = ftrace_get_offsets_<call>(&__data_offsets, args);   * - *	event = trace_current_buffer_lock_reserve(&buffer, + *	event = trace_event_buffer_lock_reserve(&buffer, ftrace_file,   *				  event_<call>->event.type,   *				  sizeof(*entry) + __data_size,   *				  irq_flags, pc); @@ -440,7 +434,7 @@ static inline notrace int ftrace_get_offsets_##call(			\   *			   __array macros.   *   *	if (!filter_current_check_discard(buffer, event_call, entry, event)) - *		trace_current_buffer_unlock_commit(buffer, + *		trace_nowake_buffer_unlock_commit(buffer,   *						   event, irq_flags, pc);   * }   * @@ -518,7 +512,8 @@ static inline notrace int ftrace_get_offsets_##call(			\  static notrace void							\  ftrace_raw_event_##call(void *__data, proto)				\  {									\ -	struct ftrace_event_call *event_call = __data;			\ +	struct ftrace_event_file *ftrace_file = __data;			\ +	struct ftrace_event_call *event_call = ftrace_file->event_call;	\  	struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\  	struct ring_buffer_event *event;				\  	struct ftrace_raw_##call *entry;				\ @@ -527,12 +522,16 @@ ftrace_raw_event_##call(void *__data, proto)				\  	int __data_size;						\  	int pc;								\  									\ +	if (test_bit(FTRACE_EVENT_FL_SOFT_DISABLED_BIT,			\ +		     &ftrace_file->flags))				\ +		return;							\ +									\  	local_save_flags(irq_flags);					\  	pc = preempt_count();						\  									\  	__data_size = ftrace_get_offsets_##call(&__data_offsets, args); \  									\ -	event = trace_current_buffer_lock_reserve(&buffer,		\ +	event = trace_event_buffer_lock_reserve(&buffer, ftrace_file,	\  				 event_call->event.type,		\  				 sizeof(*entry) + __data_size,		\  				 irq_flags, pc);			\ @@ -581,7 +580,7 @@ static inline void ftrace_test_probe_##call(void)			\  #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)	\  _TRACE_PERF_PROTO(call, PARAMS(proto));					\  static const char print_fmt_##call[] = print;				\ -static struct ftrace_event_class __used event_class_##call = {		\ +static struct ftrace_event_class __used __refdata event_class_##call = { \  	.system			= __stringify(TRACE_SYSTEM),		\  	.define_fields		= ftrace_define_fields_##call,		\  	.fields			= LIST_HEAD_INIT(event_class_##call.fields),\ @@ -705,5 +704,3 @@ static inline void perf_test_probe_##call(void)				\  #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)  #endif /* CONFIG_PERF_EVENTS */ -#undef _TRACE_PROFILE_INIT - diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h index 4ef3acbba5d..c5d2e3a1cf6 100644 --- a/include/uapi/asm-generic/socket.h +++ b/include/uapi/asm-generic/socket.h @@ -74,4 +74,6 @@  #define SO_LOCK_FILTER		44 +#define SO_SELECT_ERR_QUEUE	45 +  #endif /* __ASM_GENERIC_SOCKET_H */ diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index 5c8a1d25e21..ab5d4992e56 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild @@ -285,6 +285,7 @@ header-y += nvram.h  header-y += omap3isp.h  header-y += omapfb.h  header-y += oom.h +header-y += openvswitch.h  header-y += packet_diag.h  header-y += param.h  header-y += parport.h @@ -331,6 +332,7 @@ header-y += rtnetlink.h  header-y += scc.h  header-y += sched.h  header-y += screen_info.h +header-y += sctp.h  header-y += sdla.h  header-y += seccomp.h  header-y += securebits.h diff --git a/include/uapi/linux/caif/caif_socket.h b/include/uapi/linux/caif/caif_socket.h index 3f3bac6af7b..586e9f98184 100644 --- a/include/uapi/linux/caif/caif_socket.h +++ b/include/uapi/linux/caif/caif_socket.h @@ -1,7 +1,7 @@  /* 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 + * Author:	 Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/uapi/linux/caif/if_caif.h b/include/uapi/linux/caif/if_caif.h index 5e7eed4edf5..7618aabe8c6 100644 --- a/include/uapi/linux/caif/if_caif.h +++ b/include/uapi/linux/caif/if_caif.h @@ -1,6 +1,6 @@  /*   * Copyright (C) ST-Ericsson AB 2010 - * Author:	Sjur Brendeland/ sjur.brandeland@stericsson.com + * Author:	Sjur Brendeland   * License terms: GNU General Public License (GPL) version 2   */ diff --git a/include/uapi/linux/cn_proc.h b/include/uapi/linux/cn_proc.h index 0d7b49973bb..f6c271035bb 100644 --- a/include/uapi/linux/cn_proc.h +++ b/include/uapi/linux/cn_proc.h @@ -56,7 +56,9 @@ struct proc_event {  		PROC_EVENT_PTRACE = 0x00000100,  		PROC_EVENT_COMM = 0x00000200,  		/* "next" should be 0x00000400 */ -		/* "last" is the last process event: exit */ +		/* "last" is the last process event: exit, +		 * while "next to last" is coredumping event */ +		PROC_EVENT_COREDUMP = 0x40000000,  		PROC_EVENT_EXIT = 0x80000000  	} what;  	__u32 cpu; @@ -110,11 +112,17 @@ struct proc_event {  			char           comm[16];  		} comm; +		struct coredump_proc_event { +			__kernel_pid_t process_pid; +			__kernel_pid_t process_tgid; +		} coredump; +  		struct exit_proc_event {  			__kernel_pid_t process_pid;  			__kernel_pid_t process_tgid;  			__u32 exit_code, exit_signal;  		} exit; +  	} event_data;  }; diff --git a/include/uapi/linux/connector.h b/include/uapi/linux/connector.h index 8761a0349c7..4cb283505e4 100644 --- a/include/uapi/linux/connector.h +++ b/include/uapi/linux/connector.h @@ -44,8 +44,11 @@  #define CN_VAL_DRBD			0x1  #define CN_KVP_IDX			0x9	/* HyperV KVP */  #define CN_KVP_VAL			0x1	/* queries from the kernel */ +#define CN_VSS_IDX			0xA     /* HyperV VSS */ +#define CN_VSS_VAL			0x1     /* queries from the kernel */ -#define CN_NETLINK_USERS		10	/* Highest index + 1 */ + +#define CN_NETLINK_USERS		11	/* Highest index + 1 */  /*   * Maximum connector's message size. diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h index b2a9ad8cafd..b4fb650d9d4 100644 --- a/include/uapi/linux/dvb/dmx.h +++ b/include/uapi/linux/dvb/dmx.h @@ -51,7 +51,7 @@ typedef enum  } dmx_input_t; -typedef enum +typedef enum dmx_ts_pes  {  	DMX_PES_AUDIO0,  	DMX_PES_VIDEO0, diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index 8072d352b98..ef6103bf1f9 100644 --- a/include/uapi/linux/elf.h +++ b/include/uapi/linux/elf.h @@ -397,6 +397,7 @@ typedef struct elf64_shdr {  #define NT_ARM_HW_WATCH	0x403		/* ARM hardware watchpoint registers */  #define NT_METAG_CBUF	0x500		/* Metag catch buffer registers */  #define NT_METAG_RPIPE	0x501		/* Metag read pipeline state */ +#define NT_METAG_TLS	0x502		/* Metag TLS pointer */  /* Note header in a PT_NOTE section */ diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h index 9cfde694109..8eb9ccaa5b4 100644 --- a/include/uapi/linux/filter.h +++ b/include/uapi/linux/filter.h @@ -129,7 +129,8 @@ struct sock_fprog {	/* Required for SO_ATTACH_FILTER. */  #define SKF_AD_ALU_XOR_X	40  #define SKF_AD_VLAN_TAG	44  #define SKF_AD_VLAN_TAG_PRESENT 48 -#define SKF_AD_MAX	52 +#define SKF_AD_PAY_OFFSET	52 +#define SKF_AD_MAX	56  #define SKF_NET_OFF   (-0x100000)  #define SKF_LL_OFF    (-0x200000) diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index c7fc1e6517c..a4ed56cf0ea 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -88,7 +88,6 @@ struct inodes_stat_t {  #define MS_STRICTATIME	(1<<24) /* Always perform atime updates */  /* These sb flags are internal to the kernel */ -#define MS_SNAP_STABLE	(1<<27) /* Snapshot pages during writeback, if needed */  #define MS_NOSEC	(1<<28)  #define MS_BORN		(1<<29)  #define MS_ACTIVE	(1<<30) diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index 4c43b444879..706d035fa74 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -95,15 +95,10 @@  #ifndef _LINUX_FUSE_H  #define _LINUX_FUSE_H -#ifdef __linux__ +#ifdef __KERNEL__  #include <linux/types.h>  #else  #include <stdint.h> -#define __u64 uint64_t -#define __s64 int64_t -#define __u32 uint32_t -#define __s32 int32_t -#define __u16 uint16_t  #endif  /* @@ -139,42 +134,42 @@     userspace works under 64bit kernels */  struct fuse_attr { -	__u64	ino; -	__u64	size; -	__u64	blocks; -	__u64	atime; -	__u64	mtime; -	__u64	ctime; -	__u32	atimensec; -	__u32	mtimensec; -	__u32	ctimensec; -	__u32	mode; -	__u32	nlink; -	__u32	uid; -	__u32	gid; -	__u32	rdev; -	__u32	blksize; -	__u32	padding; +	uint64_t	ino; +	uint64_t	size; +	uint64_t	blocks; +	uint64_t	atime; +	uint64_t	mtime; +	uint64_t	ctime; +	uint32_t	atimensec; +	uint32_t	mtimensec; +	uint32_t	ctimensec; +	uint32_t	mode; +	uint32_t	nlink; +	uint32_t	uid; +	uint32_t	gid; +	uint32_t	rdev; +	uint32_t	blksize; +	uint32_t	padding;  };  struct fuse_kstatfs { -	__u64	blocks; -	__u64	bfree; -	__u64	bavail; -	__u64	files; -	__u64	ffree; -	__u32	bsize; -	__u32	namelen; -	__u32	frsize; -	__u32	padding; -	__u32	spare[6]; +	uint64_t	blocks; +	uint64_t	bfree; +	uint64_t	bavail; +	uint64_t	files; +	uint64_t	ffree; +	uint32_t	bsize; +	uint32_t	namelen; +	uint32_t	frsize; +	uint32_t	padding; +	uint32_t	spare[6];  };  struct fuse_file_lock { -	__u64	start; -	__u64	end; -	__u32	type; -	__u32	pid; /* tgid */ +	uint64_t	start; +	uint64_t	end; +	uint32_t	type; +	uint32_t	pid; /* tgid */  };  /** @@ -364,143 +359,143 @@ enum fuse_notify_code {  #define FUSE_COMPAT_ENTRY_OUT_SIZE 120  struct fuse_entry_out { -	__u64	nodeid;		/* Inode ID */ -	__u64	generation;	/* Inode generation: nodeid:gen must -				   be unique for the fs's lifetime */ -	__u64	entry_valid;	/* Cache timeout for the name */ -	__u64	attr_valid;	/* Cache timeout for the attributes */ -	__u32	entry_valid_nsec; -	__u32	attr_valid_nsec; +	uint64_t	nodeid;		/* Inode ID */ +	uint64_t	generation;	/* Inode generation: nodeid:gen must +					   be unique for the fs's lifetime */ +	uint64_t	entry_valid;	/* Cache timeout for the name */ +	uint64_t	attr_valid;	/* Cache timeout for the attributes */ +	uint32_t	entry_valid_nsec; +	uint32_t	attr_valid_nsec;  	struct fuse_attr attr;  };  struct fuse_forget_in { -	__u64	nlookup; +	uint64_t	nlookup;  };  struct fuse_forget_one { -	__u64	nodeid; -	__u64	nlookup; +	uint64_t	nodeid; +	uint64_t	nlookup;  };  struct fuse_batch_forget_in { -	__u32	count; -	__u32	dummy; +	uint32_t	count; +	uint32_t	dummy;  };  struct fuse_getattr_in { -	__u32	getattr_flags; -	__u32	dummy; -	__u64	fh; +	uint32_t	getattr_flags; +	uint32_t	dummy; +	uint64_t	fh;  };  #define FUSE_COMPAT_ATTR_OUT_SIZE 96  struct fuse_attr_out { -	__u64	attr_valid;	/* Cache timeout for the attributes */ -	__u32	attr_valid_nsec; -	__u32	dummy; +	uint64_t	attr_valid;	/* Cache timeout for the attributes */ +	uint32_t	attr_valid_nsec; +	uint32_t	dummy;  	struct fuse_attr attr;  };  #define FUSE_COMPAT_MKNOD_IN_SIZE 8  struct fuse_mknod_in { -	__u32	mode; -	__u32	rdev; -	__u32	umask; -	__u32	padding; +	uint32_t	mode; +	uint32_t	rdev; +	uint32_t	umask; +	uint32_t	padding;  };  struct fuse_mkdir_in { -	__u32	mode; -	__u32	umask; +	uint32_t	mode; +	uint32_t	umask;  };  struct fuse_rename_in { -	__u64	newdir; +	uint64_t	newdir;  };  struct fuse_link_in { -	__u64	oldnodeid; +	uint64_t	oldnodeid;  };  struct fuse_setattr_in { -	__u32	valid; -	__u32	padding; -	__u64	fh; -	__u64	size; -	__u64	lock_owner; -	__u64	atime; -	__u64	mtime; -	__u64	unused2; -	__u32	atimensec; -	__u32	mtimensec; -	__u32	unused3; -	__u32	mode; -	__u32	unused4; -	__u32	uid; -	__u32	gid; -	__u32	unused5; +	uint32_t	valid; +	uint32_t	padding; +	uint64_t	fh; +	uint64_t	size; +	uint64_t	lock_owner; +	uint64_t	atime; +	uint64_t	mtime; +	uint64_t	unused2; +	uint32_t	atimensec; +	uint32_t	mtimensec; +	uint32_t	unused3; +	uint32_t	mode; +	uint32_t	unused4; +	uint32_t	uid; +	uint32_t	gid; +	uint32_t	unused5;  };  struct fuse_open_in { -	__u32	flags; -	__u32	unused; +	uint32_t	flags; +	uint32_t	unused;  };  struct fuse_create_in { -	__u32	flags; -	__u32	mode; -	__u32	umask; -	__u32	padding; +	uint32_t	flags; +	uint32_t	mode; +	uint32_t	umask; +	uint32_t	padding;  };  struct fuse_open_out { -	__u64	fh; -	__u32	open_flags; -	__u32	padding; +	uint64_t	fh; +	uint32_t	open_flags; +	uint32_t	padding;  };  struct fuse_release_in { -	__u64	fh; -	__u32	flags; -	__u32	release_flags; -	__u64	lock_owner; +	uint64_t	fh; +	uint32_t	flags; +	uint32_t	release_flags; +	uint64_t	lock_owner;  };  struct fuse_flush_in { -	__u64	fh; -	__u32	unused; -	__u32	padding; -	__u64	lock_owner; +	uint64_t	fh; +	uint32_t	unused; +	uint32_t	padding; +	uint64_t	lock_owner;  };  struct fuse_read_in { -	__u64	fh; -	__u64	offset; -	__u32	size; -	__u32	read_flags; -	__u64	lock_owner; -	__u32	flags; -	__u32	padding; +	uint64_t	fh; +	uint64_t	offset; +	uint32_t	size; +	uint32_t	read_flags; +	uint64_t	lock_owner; +	uint32_t	flags; +	uint32_t	padding;  };  #define FUSE_COMPAT_WRITE_IN_SIZE 24  struct fuse_write_in { -	__u64	fh; -	__u64	offset; -	__u32	size; -	__u32	write_flags; -	__u64	lock_owner; -	__u32	flags; -	__u32	padding; +	uint64_t	fh; +	uint64_t	offset; +	uint32_t	size; +	uint32_t	write_flags; +	uint64_t	lock_owner; +	uint32_t	flags; +	uint32_t	padding;  };  struct fuse_write_out { -	__u32	size; -	__u32	padding; +	uint32_t	size; +	uint32_t	padding;  };  #define FUSE_COMPAT_STATFS_SIZE 48 @@ -510,32 +505,32 @@ struct fuse_statfs_out {  };  struct fuse_fsync_in { -	__u64	fh; -	__u32	fsync_flags; -	__u32	padding; +	uint64_t	fh; +	uint32_t	fsync_flags; +	uint32_t	padding;  };  struct fuse_setxattr_in { -	__u32	size; -	__u32	flags; +	uint32_t	size; +	uint32_t	flags;  };  struct fuse_getxattr_in { -	__u32	size; -	__u32	padding; +	uint32_t	size; +	uint32_t	padding;  };  struct fuse_getxattr_out { -	__u32	size; -	__u32	padding; +	uint32_t	size; +	uint32_t	padding;  };  struct fuse_lk_in { -	__u64	fh; -	__u64	owner; +	uint64_t	fh; +	uint64_t	owner;  	struct fuse_file_lock lk; -	__u32	lk_flags; -	__u32	padding; +	uint32_t	lk_flags; +	uint32_t	padding;  };  struct fuse_lk_out { @@ -543,134 +538,135 @@ struct fuse_lk_out {  };  struct fuse_access_in { -	__u32	mask; -	__u32	padding; +	uint32_t	mask; +	uint32_t	padding;  };  struct fuse_init_in { -	__u32	major; -	__u32	minor; -	__u32	max_readahead; -	__u32	flags; +	uint32_t	major; +	uint32_t	minor; +	uint32_t	max_readahead; +	uint32_t	flags;  };  struct fuse_init_out { -	__u32	major; -	__u32	minor; -	__u32	max_readahead; -	__u32	flags; -	__u16   max_background; -	__u16   congestion_threshold; -	__u32	max_write; +	uint32_t	major; +	uint32_t	minor; +	uint32_t	max_readahead; +	uint32_t	flags; +	uint16_t	max_background; +	uint16_t	congestion_threshold; +	uint32_t	max_write;  };  #define CUSE_INIT_INFO_MAX 4096  struct cuse_init_in { -	__u32	major; -	__u32	minor; -	__u32	unused; -	__u32	flags; +	uint32_t	major; +	uint32_t	minor; +	uint32_t	unused; +	uint32_t	flags;  };  struct cuse_init_out { -	__u32	major; -	__u32	minor; -	__u32	unused; -	__u32	flags; -	__u32	max_read; -	__u32	max_write; -	__u32	dev_major;		/* chardev major */ -	__u32	dev_minor;		/* chardev minor */ -	__u32	spare[10]; +	uint32_t	major; +	uint32_t	minor; +	uint32_t	unused; +	uint32_t	flags; +	uint32_t	max_read; +	uint32_t	max_write; +	uint32_t	dev_major;		/* chardev major */ +	uint32_t	dev_minor;		/* chardev minor */ +	uint32_t	spare[10];  };  struct fuse_interrupt_in { -	__u64	unique; +	uint64_t	unique;  };  struct fuse_bmap_in { -	__u64	block; -	__u32	blocksize; -	__u32	padding; +	uint64_t	block; +	uint32_t	blocksize; +	uint32_t	padding;  };  struct fuse_bmap_out { -	__u64	block; +	uint64_t	block;  };  struct fuse_ioctl_in { -	__u64	fh; -	__u32	flags; -	__u32	cmd; -	__u64	arg; -	__u32	in_size; -	__u32	out_size; +	uint64_t	fh; +	uint32_t	flags; +	uint32_t	cmd; +	uint64_t	arg; +	uint32_t	in_size; +	uint32_t	out_size;  };  struct fuse_ioctl_iovec { -	__u64	base; -	__u64	len; +	uint64_t	base; +	uint64_t	len;  };  struct fuse_ioctl_out { -	__s32	result; -	__u32	flags; -	__u32	in_iovs; -	__u32	out_iovs; +	int32_t		result; +	uint32_t	flags; +	uint32_t	in_iovs; +	uint32_t	out_iovs;  };  struct fuse_poll_in { -	__u64	fh; -	__u64	kh; -	__u32	flags; -	__u32   events; +	uint64_t	fh; +	uint64_t	kh; +	uint32_t	flags; +	uint32_t	events;  };  struct fuse_poll_out { -	__u32	revents; -	__u32	padding; +	uint32_t	revents; +	uint32_t	padding;  };  struct fuse_notify_poll_wakeup_out { -	__u64	kh; +	uint64_t	kh;  };  struct fuse_fallocate_in { -	__u64	fh; -	__u64	offset; -	__u64	length; -	__u32	mode; -	__u32	padding; +	uint64_t	fh; +	uint64_t	offset; +	uint64_t	length; +	uint32_t	mode; +	uint32_t	padding;  };  struct fuse_in_header { -	__u32	len; -	__u32	opcode; -	__u64	unique; -	__u64	nodeid; -	__u32	uid; -	__u32	gid; -	__u32	pid; -	__u32	padding; +	uint32_t	len; +	uint32_t	opcode; +	uint64_t	unique; +	uint64_t	nodeid; +	uint32_t	uid; +	uint32_t	gid; +	uint32_t	pid; +	uint32_t	padding;  };  struct fuse_out_header { -	__u32	len; -	__s32	error; -	__u64	unique; +	uint32_t	len; +	int32_t		error; +	uint64_t	unique;  };  struct fuse_dirent { -	__u64	ino; -	__u64	off; -	__u32	namelen; -	__u32	type; +	uint64_t	ino; +	uint64_t	off; +	uint32_t	namelen; +	uint32_t	type;  	char name[];  };  #define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) -#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) +#define FUSE_DIRENT_ALIGN(x) \ +	(((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))  #define FUSE_DIRENT_SIZE(d) \  	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) @@ -685,47 +681,47 @@ struct fuse_direntplus {  	FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)  struct fuse_notify_inval_inode_out { -	__u64	ino; -	__s64	off; -	__s64	len; +	uint64_t	ino; +	int64_t		off; +	int64_t		len;  };  struct fuse_notify_inval_entry_out { -	__u64	parent; -	__u32	namelen; -	__u32	padding; +	uint64_t	parent; +	uint32_t	namelen; +	uint32_t	padding;  };  struct fuse_notify_delete_out { -	__u64	parent; -	__u64	child; -	__u32	namelen; -	__u32	padding; +	uint64_t	parent; +	uint64_t	child; +	uint32_t	namelen; +	uint32_t	padding;  };  struct fuse_notify_store_out { -	__u64	nodeid; -	__u64	offset; -	__u32	size; -	__u32	padding; +	uint64_t	nodeid; +	uint64_t	offset; +	uint32_t	size; +	uint32_t	padding;  };  struct fuse_notify_retrieve_out { -	__u64	notify_unique; -	__u64	nodeid; -	__u64	offset; -	__u32	size; -	__u32	padding; +	uint64_t	notify_unique; +	uint64_t	nodeid; +	uint64_t	offset; +	uint32_t	size; +	uint32_t	padding;  };  /* Matches the size of fuse_write_in */  struct fuse_notify_retrieve_in { -	__u64	dummy1; -	__u64	offset; -	__u32	size; -	__u32	dummy2; -	__u64	dummy3; -	__u64	dummy4; +	uint64_t	dummy1; +	uint64_t	offset; +	uint32_t	size; +	uint32_t	dummy2; +	uint64_t	dummy3; +	uint64_t	dummy4;  };  #endif /* _LINUX_FUSE_H */ diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h index 798032d0111..ade07f1c491 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h @@ -94,6 +94,9 @@  #define ETH_P_EDSA	0xDADA		/* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */  #define ETH_P_AF_IUCV   0xFBFB		/* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */ +#define ETH_P_802_3_MIN	0x0600		/* If the value in the ethernet type is less than this value +					 * then the frame is Ethernet II. Else it is 802.3 */ +  /*   *	Non DIX types. Won't clash for 1500 types.   */ diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index c4edfe11f1f..b05823cae78 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -201,6 +201,7 @@ enum {  	IFLA_INET6_MCAST,	/* MC things. What of them?	*/  	IFLA_INET6_CACHEINFO,	/* time values and max reasm size */  	IFLA_INET6_ICMP6STATS,	/* statistics (icmpv6)		*/ +	IFLA_INET6_TOKEN,	/* device token			*/  	__IFLA_INET6_MAX  }; @@ -249,6 +250,7 @@ enum {  	IFLA_VLAN_FLAGS,  	IFLA_VLAN_EGRESS_QOS,  	IFLA_VLAN_INGRESS_QOS, +	IFLA_VLAN_PROTOCOL,  	__IFLA_VLAN_MAX,  }; @@ -295,7 +297,7 @@ enum macvlan_mode {  enum {  	IFLA_VXLAN_UNSPEC,  	IFLA_VXLAN_ID, -	IFLA_VXLAN_GROUP, +	IFLA_VXLAN_GROUP,	/* group or remote address */  	IFLA_VXLAN_LINK,  	IFLA_VXLAN_LOCAL,  	IFLA_VXLAN_TTL, @@ -303,11 +305,12 @@ enum {  	IFLA_VXLAN_LEARNING,  	IFLA_VXLAN_AGEING,  	IFLA_VXLAN_LIMIT, -	IFLA_VXLAN_PORT_RANGE, +	IFLA_VXLAN_PORT_RANGE,	/* source port */  	IFLA_VXLAN_PROXY,  	IFLA_VXLAN_RSC,  	IFLA_VXLAN_L2MISS,  	IFLA_VXLAN_L3MISS, +	IFLA_VXLAN_PORT,	/* destination port */  	__IFLA_VXLAN_MAX  };  #define IFLA_VXLAN_MAX	(__IFLA_VXLAN_MAX - 1) diff --git a/include/uapi/linux/if_packet.h b/include/uapi/linux/if_packet.h index f9a60375f0d..b950c02030c 100644 --- a/include/uapi/linux/if_packet.h +++ b/include/uapi/linux/if_packet.h @@ -55,6 +55,8 @@ struct sockaddr_ll {  #define PACKET_FANOUT_HASH		0  #define PACKET_FANOUT_LB		1  #define PACKET_FANOUT_CPU		2 +#define PACKET_FANOUT_ROLLOVER		3 +#define PACKET_FANOUT_FLAG_ROLLOVER	0x1000  #define PACKET_FANOUT_FLAG_DEFRAG	0x8000  struct tpacket_stats { @@ -84,19 +86,24 @@ struct tpacket_auxdata {  };  /* Rx ring - header status */ -#define TP_STATUS_KERNEL	0x0 -#define TP_STATUS_USER		0x1 -#define TP_STATUS_COPY		0x2 -#define TP_STATUS_LOSING	0x4 -#define TP_STATUS_CSUMNOTREADY	0x8 -#define TP_STATUS_VLAN_VALID   0x10 /* auxdata has valid tp_vlan_tci */ -#define TP_STATUS_BLK_TMO	0x20 +#define TP_STATUS_KERNEL	      0 +#define TP_STATUS_USER		(1 << 0) +#define TP_STATUS_COPY		(1 << 1) +#define TP_STATUS_LOSING	(1 << 2) +#define TP_STATUS_CSUMNOTREADY	(1 << 3) +#define TP_STATUS_VLAN_VALID	(1 << 4) /* auxdata has valid tp_vlan_tci */ +#define TP_STATUS_BLK_TMO	(1 << 5)  /* Tx ring - header status */ -#define TP_STATUS_AVAILABLE	0x0 -#define TP_STATUS_SEND_REQUEST	0x1 -#define TP_STATUS_SENDING	0x2 -#define TP_STATUS_WRONG_FORMAT	0x4 +#define TP_STATUS_AVAILABLE	      0 +#define TP_STATUS_SEND_REQUEST	(1 << 0) +#define TP_STATUS_SENDING	(1 << 1) +#define TP_STATUS_WRONG_FORMAT	(1 << 2) + +/* Rx and Tx ring - header status */ +#define TP_STATUS_TS_SOFTWARE		(1 << 29) +#define TP_STATUS_TS_SYS_HARDWARE	(1 << 30) +#define TP_STATUS_TS_RAW_HARDWARE	(1 << 31)  /* Rx ring - feature request bits */  #define TP_FT_REQ_FILL_RXHASH	0x1 diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index 935119c698a..4649ee35b60 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h @@ -702,6 +702,11 @@ struct input_keymap_entry {  #define KEY_CAMERA_LEFT		0x219  #define KEY_CAMERA_RIGHT	0x21a +#define KEY_ATTENDANT_ON	0x21b +#define KEY_ATTENDANT_OFF	0x21c +#define KEY_ATTENDANT_TOGGLE	0x21d	/* Attendant call on or off */ +#define KEY_LIGHTS_TOGGLE	0x21e	/* Reading light on or off */ +  #define BTN_TRIGGER_HAPPY		0x2c0  #define BTN_TRIGGER_HAPPY1		0x2c0  #define BTN_TRIGGER_HAPPY2		0x2c1 diff --git a/include/uapi/linux/ip_vs.h b/include/uapi/linux/ip_vs.h index 8a2d438dc49..a24537725e8 100644 --- a/include/uapi/linux/ip_vs.h +++ b/include/uapi/linux/ip_vs.h @@ -280,8 +280,8 @@ struct ip_vs_daemon_user {  #define IPVS_GENL_VERSION	0x1  struct ip_vs_flags { -	__be32 flags; -	__be32 mask; +	__u32 flags; +	__u32 mask;  };  /* Generic Netlink command attributes */ diff --git a/include/uapi/linux/magic.h b/include/uapi/linux/magic.h index 873e086ce3a..249df3720be 100644 --- a/include/uapi/linux/magic.h +++ b/include/uapi/linux/magic.h @@ -11,6 +11,7 @@  #define DEBUGFS_MAGIC          0x64626720  #define SECURITYFS_MAGIC	0x73636673  #define SELINUX_MAGIC		0xf97cff8c +#define SMACK_MAGIC		0x43415d53	/* "SMAC" */  #define RAMFS_MAGIC		0x858458f6	/* some random number */  #define TMPFS_MAGIC		0x01021994  #define HUGETLBFS_MAGIC 	0x958458f6	/* some random number */ diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index 0ef883327de..ed49574ad75 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -56,6 +56,8 @@ struct media_device_info {  #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR	(MEDIA_ENT_T_V4L2_SUBDEV + 1)  #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH	(MEDIA_ENT_T_V4L2_SUBDEV + 2)  #define MEDIA_ENT_T_V4L2_SUBDEV_LENS	(MEDIA_ENT_T_V4L2_SUBDEV + 3) +/* A converter of analogue video to its digital representation. */ +#define MEDIA_ENT_T_V4L2_SUBDEV_DECODER	(MEDIA_ENT_T_V4L2_SUBDEV + 4)  #define MEDIA_ENT_FL_DEFAULT		(1 << 0) diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h index adb068c53c4..f175212420a 100644 --- a/include/uapi/linux/neighbour.h +++ b/include/uapi/linux/neighbour.h @@ -21,6 +21,9 @@ enum {  	NDA_CACHEINFO,  	NDA_PROBES,  	NDA_VLAN, +	NDA_PORT, +	NDA_VNI, +	NDA_IFINDEX,  	__NDA_MAX  }; diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h index fbee42807a1..8024cdf13b7 100644 --- a/include/uapi/linux/netfilter/ipset/ip_set.h +++ b/include/uapi/linux/netfilter/ipset/ip_set.h @@ -108,6 +108,8 @@ enum {  	IPSET_ATTR_CIDR2,  	IPSET_ATTR_IP2_TO,  	IPSET_ATTR_IFACE, +	IPSET_ATTR_BYTES, +	IPSET_ATTR_PACKETS,  	__IPSET_ATTR_ADT_MAX,  };  #define IPSET_ATTR_ADT_MAX	(__IPSET_ATTR_ADT_MAX - 1) @@ -137,12 +139,13 @@ enum ipset_errno {  	IPSET_ERR_REFERENCED,  	IPSET_ERR_IPADDR_IPV4,  	IPSET_ERR_IPADDR_IPV6, +	IPSET_ERR_COUNTER,  	/* Type specific error codes */  	IPSET_ERR_TYPE_SPECIFIC = 4352,  }; -/* Flags at command level */ +/* Flags at command level or match/target flags, lower half of cmdattrs*/  enum ipset_cmd_flags {  	IPSET_FLAG_BIT_EXIST	= 0,  	IPSET_FLAG_EXIST	= (1 << IPSET_FLAG_BIT_EXIST), @@ -150,10 +153,20 @@ enum ipset_cmd_flags {  	IPSET_FLAG_LIST_SETNAME	= (1 << IPSET_FLAG_BIT_LIST_SETNAME),  	IPSET_FLAG_BIT_LIST_HEADER = 2,  	IPSET_FLAG_LIST_HEADER	= (1 << IPSET_FLAG_BIT_LIST_HEADER), -	IPSET_FLAG_CMD_MAX = 15,	/* Lower half */ +	IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE = 3, +	IPSET_FLAG_SKIP_COUNTER_UPDATE = +		(1 << IPSET_FLAG_BIT_SKIP_COUNTER_UPDATE), +	IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE = 4, +	IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE = +		(1 << IPSET_FLAG_BIT_SKIP_SUBCOUNTER_UPDATE), +	IPSET_FLAG_BIT_MATCH_COUNTERS = 5, +	IPSET_FLAG_MATCH_COUNTERS = (1 << IPSET_FLAG_BIT_MATCH_COUNTERS), +	IPSET_FLAG_BIT_RETURN_NOMATCH = 7, +	IPSET_FLAG_RETURN_NOMATCH = (1 << IPSET_FLAG_BIT_RETURN_NOMATCH), +	IPSET_FLAG_CMD_MAX = 15,  }; -/* Flags at CADT attribute level */ +/* Flags at CADT attribute level, upper half of cmdattrs */  enum ipset_cadt_flags {  	IPSET_FLAG_BIT_BEFORE	= 0,  	IPSET_FLAG_BEFORE	= (1 << IPSET_FLAG_BIT_BEFORE), @@ -161,7 +174,9 @@ enum ipset_cadt_flags {  	IPSET_FLAG_PHYSDEV	= (1 << IPSET_FLAG_BIT_PHYSDEV),  	IPSET_FLAG_BIT_NOMATCH	= 2,  	IPSET_FLAG_NOMATCH	= (1 << IPSET_FLAG_BIT_NOMATCH), -	IPSET_FLAG_CADT_MAX	= 15,	/* Upper half */ +	IPSET_FLAG_BIT_WITH_COUNTERS = 3, +	IPSET_FLAG_WITH_COUNTERS = (1 << IPSET_FLAG_BIT_WITH_COUNTERS), +	IPSET_FLAG_CADT_MAX	= 15,  };  /* Commands with settype-specific attributes */ @@ -190,6 +205,7 @@ enum ip_set_dim {  	 * If changed, new revision of iptables match/target is required.  	 */  	IPSET_DIM_MAX = 6, +	/* Backward compatibility: set match revision 2 */  	IPSET_BIT_RETURN_NOMATCH = 7,  }; @@ -202,6 +218,18 @@ enum ip_set_kopt {  	IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH),  }; +enum { +	IPSET_COUNTER_NONE = 0, +	IPSET_COUNTER_EQ, +	IPSET_COUNTER_NE, +	IPSET_COUNTER_LT, +	IPSET_COUNTER_GT, +}; + +struct ip_set_counter_match { +	__u8 op; +	__u64 value; +};  /* Interface to iptables/ip6tables */ diff --git a/include/uapi/linux/netfilter/nfnetlink_queue.h b/include/uapi/linux/netfilter/nfnetlink_queue.h index 70ec8c2bc11..a2308ae5a73 100644 --- a/include/uapi/linux/netfilter/nfnetlink_queue.h +++ b/include/uapi/linux/netfilter/nfnetlink_queue.h @@ -45,6 +45,7 @@ enum nfqnl_attr_type {  	NFQA_CT,			/* nf_conntrack_netlink.h */  	NFQA_CT_INFO,			/* enum ip_conntrack_info */  	NFQA_CAP_LEN,			/* __u32 length of captured packet */ +	NFQA_SKB_INFO,			/* __u32 skb meta information */  	__NFQA_MAX  }; @@ -96,6 +97,13 @@ enum nfqnl_attr_config {  /* Flags for NFQA_CFG_FLAGS */  #define NFQA_CFG_F_FAIL_OPEN			(1 << 0)  #define NFQA_CFG_F_CONNTRACK			(1 << 1) -#define NFQA_CFG_F_MAX				(1 << 2) +#define NFQA_CFG_F_GSO				(1 << 2) +#define NFQA_CFG_F_MAX				(1 << 3) + +/* flags for NFQA_SKB_INFO */ +/* packet appears to have wrong checksums, but they are ok */ +#define NFQA_SKB_CSUMNOTREADY (1 << 0) +/* packet is GSO (i.e., exceeds device mtu) */ +#define NFQA_SKB_GSO (1 << 1)  #endif /* _NFNETLINK_QUEUE_H */ diff --git a/include/uapi/linux/netfilter/xt_NFQUEUE.h b/include/uapi/linux/netfilter/xt_NFQUEUE.h index 9eafdbbb401..8bb5fe657d3 100644 --- a/include/uapi/linux/netfilter/xt_NFQUEUE.h +++ b/include/uapi/linux/netfilter/xt_NFQUEUE.h @@ -26,4 +26,13 @@ struct xt_NFQ_info_v2 {  	__u16 bypass;  }; +struct xt_NFQ_info_v3 { +	__u16 queuenum; +	__u16 queues_total; +	__u16 flags; +#define NFQ_FLAG_BYPASS		0x01 /* for compatibility with v2 */ +#define NFQ_FLAG_CPU_FANOUT	0x02 /* use current CPU (no hashing) */ +#define NFQ_FLAG_MASK		0x03 +}; +  #endif /* _XT_NFQ_TARGET_H */ diff --git a/include/uapi/linux/netfilter/xt_set.h b/include/uapi/linux/netfilter/xt_set.h index e3a9978f259..964d3d42f87 100644 --- a/include/uapi/linux/netfilter/xt_set.h +++ b/include/uapi/linux/netfilter/xt_set.h @@ -62,4 +62,13 @@ struct xt_set_info_target_v2 {  	__u32 timeout;  }; +/* Revision 3 match */ + +struct xt_set_info_match_v3 { +	struct xt_set_info match_set; +	struct ip_set_counter_match packets; +	struct ip_set_counter_match bytes; +	__u32 flags; +}; +  #endif /*_XT_SET_H*/ diff --git a/include/uapi/linux/netfilter_ipv6/ip6t_frag.h b/include/uapi/linux/netfilter_ipv6/ip6t_frag.h index b47f61b9e08..dfd8bc2268c 100644 --- a/include/uapi/linux/netfilter_ipv6/ip6t_frag.h +++ b/include/uapi/linux/netfilter_ipv6/ip6t_frag.h @@ -4,9 +4,9 @@  #include <linux/types.h>  struct ip6t_frag { -	__u32 ids[2];			/* Security Parameter Index */ +	__u32 ids[2];			/* Identification range */  	__u32 hdrlen;			/* Header Length */ -	__u8  flags;			/*  */ +	__u8  flags;			/* Flags */  	__u8  invflags;			/* Inverse flags */  }; diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h index 78d5b8a546d..1a85940f8ab 100644 --- a/include/uapi/linux/netlink.h +++ b/include/uapi/linux/netlink.h @@ -1,6 +1,7 @@  #ifndef _UAPI__LINUX_NETLINK_H  #define _UAPI__LINUX_NETLINK_H +#include <linux/kernel.h>  #include <linux/socket.h> /* for __kernel_sa_family_t */  #include <linux/types.h> @@ -78,7 +79,7 @@ struct nlmsghdr {  #define NLMSG_ALIGNTO	4U  #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )  #define NLMSG_HDRLEN	 ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr))) -#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN)) +#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)  #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))  #define NLMSG_DATA(nlh)  ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))  #define NLMSG_NEXT(nlh,len)	 ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \ @@ -105,11 +106,42 @@ struct nlmsgerr {  #define NETLINK_PKTINFO		3  #define NETLINK_BROADCAST_ERROR	4  #define NETLINK_NO_ENOBUFS	5 +#define NETLINK_RX_RING		6 +#define NETLINK_TX_RING		7  struct nl_pktinfo {  	__u32	group;  }; +struct nl_mmap_req { +	unsigned int	nm_block_size; +	unsigned int	nm_block_nr; +	unsigned int	nm_frame_size; +	unsigned int	nm_frame_nr; +}; + +struct nl_mmap_hdr { +	unsigned int	nm_status; +	unsigned int	nm_len; +	__u32		nm_group; +	/* credentials */ +	__u32		nm_pid; +	__u32		nm_uid; +	__u32		nm_gid; +}; + +enum nl_mmap_status { +	NL_MMAP_STATUS_UNUSED, +	NL_MMAP_STATUS_RESERVED, +	NL_MMAP_STATUS_VALID, +	NL_MMAP_STATUS_COPY, +	NL_MMAP_STATUS_SKIP, +}; + +#define NL_MMAP_MSG_ALIGNMENT		NLMSG_ALIGNTO +#define NL_MMAP_MSG_ALIGN(sz)		__ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT) +#define NL_MMAP_HDRLEN			NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr)) +  #define NET_MAJOR 36		/* Major 36 is reserved for networking 						*/  enum { diff --git a/include/uapi/linux/netlink_diag.h b/include/uapi/linux/netlink_diag.h new file mode 100644 index 00000000000..4e31db4eea4 --- /dev/null +++ b/include/uapi/linux/netlink_diag.h @@ -0,0 +1,52 @@ +#ifndef __NETLINK_DIAG_H__ +#define __NETLINK_DIAG_H__ + +#include <linux/types.h> + +struct netlink_diag_req { +	__u8	sdiag_family; +	__u8	sdiag_protocol; +	__u16	pad; +	__u32	ndiag_ino; +	__u32	ndiag_show; +	__u32	ndiag_cookie[2]; +}; + +struct netlink_diag_msg { +	__u8	ndiag_family; +	__u8	ndiag_type; +	__u8	ndiag_protocol; +	__u8	ndiag_state; + +	__u32	ndiag_portid; +	__u32	ndiag_dst_portid; +	__u32	ndiag_dst_group; +	__u32	ndiag_ino; +	__u32	ndiag_cookie[2]; +}; + +struct netlink_diag_ring { +	__u32	ndr_block_size; +	__u32	ndr_block_nr; +	__u32	ndr_frame_size; +	__u32	ndr_frame_nr; +}; + +enum { +	NETLINK_DIAG_MEMINFO, +	NETLINK_DIAG_GROUPS, +	NETLINK_DIAG_RX_RING, +	NETLINK_DIAG_TX_RING, + +	__NETLINK_DIAG_MAX, +}; + +#define NETLINK_DIAG_MAX (__NETLINK_DIAG_MAX - 1) + +#define NDIAG_PROTO_ALL		((__u8) ~0) + +#define NDIAG_SHOW_MEMINFO	0x00000001 /* show memory info of a socket */ +#define NDIAG_SHOW_GROUPS	0x00000002 /* show groups of a netlink socket */ +#define NDIAG_SHOW_RING_CFG	0x00000004 /* show ring configuration */ + +#endif diff --git a/include/uapi/linux/nfc.h b/include/uapi/linux/nfc.h index 7969f46f1bb..7c6f627a717 100644 --- a/include/uapi/linux/nfc.h +++ b/include/uapi/linux/nfc.h @@ -90,6 +90,8 @@ enum nfc_commands {  	NFC_CMD_LLC_SET_PARAMS,  	NFC_CMD_ENABLE_SE,  	NFC_CMD_DISABLE_SE, +	NFC_CMD_LLC_SDREQ, +	NFC_EVENT_LLC_SDRES,  /* private: internal use only */  	__NFC_CMD_AFTER_LAST  }; @@ -140,11 +142,21 @@ enum nfc_attrs {  	NFC_ATTR_LLC_PARAM_RW,  	NFC_ATTR_LLC_PARAM_MIUX,  	NFC_ATTR_SE, +	NFC_ATTR_LLC_SDP,  /* private: internal use only */  	__NFC_ATTR_AFTER_LAST  };  #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) +enum nfc_sdp_attr { +	NFC_SDP_ATTR_UNSPEC, +	NFC_SDP_ATTR_URI, +	NFC_SDP_ATTR_SAP, +/* private: internal use only */ +	__NFC_SDP_ATTR_AFTER_LAST +}; +#define NFC_SDP_ATTR_MAX (__NFC_SDP_ATTR_AFTER_LAST - 1) +  #define NFC_DEVICE_NAME_MAXSIZE 8  #define NFC_NFCID1_MAXSIZE 10  #define NFC_SENSB_RES_MAXSIZE 12 @@ -220,4 +232,11 @@ struct sockaddr_nfc_llcp {  #define NFC_LLCP_DIRECTION_RX		0x00  #define NFC_LLCP_DIRECTION_TX		0x01 +/* socket option names */ +#define NFC_LLCP_RW		0 +#define NFC_LLCP_MIUX		1 +#define NFC_LLCP_REMOTE_MIU	2 +#define NFC_LLCP_REMOTE_LTO	3 +#define NFC_LLCP_REMOTE_RW	4 +  #endif /*__LINUX_NFC_H */ diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index c46bb016f4e..d1e48b5e348 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -36,7 +36,21 @@   * The station is still assumed to belong to the AP interface it was added   * to.   * - * TODO: need more info? + * Station handling varies per interface type and depending on the driver's + * capabilities. + * + * For drivers supporting TDLS with external setup (WIPHY_FLAG_SUPPORTS_TDLS + * and WIPHY_FLAG_TDLS_EXTERNAL_SETUP), the station lifetime is as follows: + *  - a setup station entry is added, not yet authorized, without any rate + *    or capability information, this just exists to avoid race conditions + *  - when the TDLS setup is done, a single NL80211_CMD_SET_STATION is valid + *    to add rate and capability information to the station and at the same + *    time mark it authorized. + *  - %NL80211_TDLS_ENABLE_LINK is then used + *  - after this, the only valid operation is to remove it by tearing down + *    the TDLS link (%NL80211_TDLS_DISABLE_LINK) + * + * TODO: need more info for other interface types   */  /** @@ -499,9 +513,11 @@   * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a   *      beacon or probe response from a compatible mesh peer.  This is only   *      sent while no station information (sta_info) exists for the new peer - *      candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH is set.  On - *      reception of this notification, userspace may decide to create a new - *      station (@NL80211_CMD_NEW_STATION).  To stop this notification from + *      candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH, + *      @NL80211_MESH_SETUP_USERSPACE_AMPE, or + *      @NL80211_MESH_SETUP_USERSPACE_MPM is set.  On reception of this + *      notification, userspace may decide to create a new station + *      (@NL80211_CMD_NEW_STATION).  To stop this notification from   *      reoccurring, the userspace authentication daemon may want to create the   *      new station with the AUTHENTICATED flag unset and maybe change it later   *      depending on the authentication result. @@ -611,6 +627,25 @@   *	%NL80211_ATTR_RADAR_EVENT is used to inform about the type of the   *	event.   * + * @NL80211_CMD_GET_PROTOCOL_FEATURES: Get global nl80211 protocol features, + *	i.e. features for the nl80211 protocol rather than device features. + *	Returns the features in the %NL80211_ATTR_PROTOCOL_FEATURES bitmap. + * + * @NL80211_CMD_UPDATE_FT_IES: Pass down the most up-to-date Fast Transition + *	Information Element to the WLAN driver + * + * @NL80211_CMD_FT_EVENT: Send a Fast transition event from the WLAN driver + *	to the supplicant. This will carry the target AP's MAC address along + *	with the relevant Information Elements. This event is used to report + *	received FT IEs (MDIE, FTIE, RSN IE, TIE, RICIE). + * + * @NL80211_CMD_CRIT_PROTOCOL_START: Indicates user-space will start running + *	a critical protocol that needs more reliability in the connection to + *	complete. + * + * @NL80211_CMD_CRIT_PROTOCOL_STOP: Indicates the connection reliability can + *	return back to normal. + *   * @NL80211_CMD_MAX: highest used command number   * @__NL80211_CMD_AFTER_LAST: internal use   */ @@ -765,6 +800,14 @@ enum nl80211_commands {  	NL80211_CMD_RADAR_DETECT, +	NL80211_CMD_GET_PROTOCOL_FEATURES, + +	NL80211_CMD_UPDATE_FT_IES, +	NL80211_CMD_FT_EVENT, + +	NL80211_CMD_CRIT_PROTOCOL_START, +	NL80211_CMD_CRIT_PROTOCOL_STOP, +  	/* add new commands above here */  	/* used to define NL80211_CMD_MAX below */ @@ -884,7 +927,8 @@ enum nl80211_commands {   *	consisting of a nested array.   *   * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). - * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link. + * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link + *	(see &enum nl80211_plink_action).   * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path.   * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path   * 	info given for %NL80211_CMD_GET_MPATH, nested attribute described at @@ -1167,10 +1211,10 @@ enum nl80211_commands {   * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver   *	allows auth frames in a mesh to be passed to userspace for processing via   *	the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. - * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as - *	defined in &enum nl80211_plink_state. Used when userspace is - *	driving the peer link management state machine. - *	@NL80211_MESH_SETUP_USERSPACE_AMPE must be enabled. + * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as defined in + *	&enum nl80211_plink_state. Used when userspace is driving the peer link + *	management state machine.  @NL80211_MESH_SETUP_USERSPACE_AMPE or + *	@NL80211_MESH_SETUP_USERSPACE_MPM must be enabled.   *   * @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy   *	capabilities, the supported WoWLAN triggers @@ -1368,6 +1412,23 @@ enum nl80211_commands {   *	advertised to the driver, e.g., to enable TDLS off channel operations   *	and PU-APSD.   * + * @NL80211_ATTR_PROTOCOL_FEATURES: global nl80211 feature flags, see + *	&enum nl80211_protocol_features, the attribute is a u32. + * + * @NL80211_ATTR_SPLIT_WIPHY_DUMP: flag attribute, userspace supports + *	receiving the data for a single wiphy split across multiple + *	messages, given with wiphy dump message + * + * @NL80211_ATTR_MDID: Mobility Domain Identifier + * + * @NL80211_ATTR_IE_RIC: Resource Information Container Information + *	Element + * + * @NL80211_ATTR_CRIT_PROT_ID: critical protocol identifier requiring increased + *	reliability, see &enum nl80211_crit_proto_id (u16). + * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which + *      the connection should have increased reliability (u16). + *   * @NL80211_ATTR_MAX: highest attribute number currently defined   * @__NL80211_ATTR_AFTER_LAST: internal use   */ @@ -1654,6 +1715,18 @@ enum nl80211_attrs {  	NL80211_ATTR_STA_CAPABILITY,  	NL80211_ATTR_STA_EXT_CAPABILITY, +	NL80211_ATTR_PROTOCOL_FEATURES, +	NL80211_ATTR_SPLIT_WIPHY_DUMP, + +	NL80211_ATTR_DISABLE_VHT, +	NL80211_ATTR_VHT_CAPABILITY_MASK, + +	NL80211_ATTR_MDID, +	NL80211_ATTR_IE_RIC, + +	NL80211_ATTR_CRIT_PROT_ID, +	NL80211_ATTR_MAX_CRIT_PROT_DURATION, +  	/* add attributes here, update the policy in nl80211.c */  	__NL80211_ATTR_AFTER_LAST, @@ -2412,8 +2485,10 @@ enum nl80211_mesh_power_mode {   * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh   *	point.   * - * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically - *	open peer links when we detect compatible mesh peers. + * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically open + *	peer links when we detect compatible mesh peers. Disabled if + *	@NL80211_MESH_SETUP_USERSPACE_MPM or @NL80211_MESH_SETUP_USERSPACE_AMPE are + *	set.   *   * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames   *	containing a PREQ that an MP can send to a particular destination (path @@ -2559,6 +2634,9 @@ enum nl80211_meshconf_params {   *	vendor specific synchronization method or disable it to use the default   *	neighbor offset synchronization   * + * @NL80211_MESH_SETUP_USERSPACE_MPM: Enable this option if userspace will + *	implement an MPM which handles peer allocation and state. + *   * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number   *   * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use @@ -2571,6 +2649,7 @@ enum nl80211_mesh_setup_params {  	NL80211_MESH_SETUP_USERSPACE_AUTH,  	NL80211_MESH_SETUP_USERSPACE_AMPE,  	NL80211_MESH_SETUP_ENABLE_VENDOR_SYNC, +	NL80211_MESH_SETUP_USERSPACE_MPM,  	/* keep last */  	__NL80211_MESH_SETUP_ATTR_AFTER_LAST, @@ -3307,6 +3386,23 @@ enum nl80211_plink_state {  	MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1  }; +/** + * enum nl80211_plink_action - actions to perform in mesh peers + * + * @NL80211_PLINK_ACTION_NO_ACTION: perform no action + * @NL80211_PLINK_ACTION_OPEN: start mesh peer link establishment + * @NL80211_PLINK_ACTION_BLOCK: block traffic from this mesh peer + * @NUM_NL80211_PLINK_ACTIONS: number of possible actions + */ +enum plink_actions { +	NL80211_PLINK_ACTION_NO_ACTION, +	NL80211_PLINK_ACTION_OPEN, +	NL80211_PLINK_ACTION_BLOCK, + +	NUM_NL80211_PLINK_ACTIONS, +}; + +  #define NL80211_KCK_LEN			16  #define NL80211_KEK_LEN			16  #define NL80211_REPLAY_CTR_LEN		8 @@ -3456,6 +3552,10 @@ enum nl80211_ap_sme_features {   *	stations the authenticated/associated bits have to be set in the mask.   * @NL80211_FEATURE_ADVERTISE_CHAN_LIMITS: cfg80211 advertises channel limits   *	(HT40, VHT 80/160 MHz) if this flag is set + * @NL80211_FEATURE_USERSPACE_MPM: This driver supports a userspace Mesh + *	Peering Management entity which may be implemented by registering for + *	beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is + *	still generated by the driver.   */  enum nl80211_feature_flags {  	NL80211_FEATURE_SK_TX_STATUS			= 1 << 0, @@ -3474,6 +3574,7 @@ enum nl80211_feature_flags {  	/* bit 13 is reserved */  	NL80211_FEATURE_ADVERTISE_CHAN_LIMITS		= 1 << 14,  	NL80211_FEATURE_FULL_AP_CLIENT_STATE		= 1 << 15, +	NL80211_FEATURE_USERSPACE_MPM			= 1 << 16,  };  /** @@ -3587,4 +3688,37 @@ enum nl80211_dfs_state {  	NL80211_DFS_AVAILABLE,  }; +/** + * enum enum nl80211_protocol_features - nl80211 protocol features + * @NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP: nl80211 supports splitting + *	wiphy dumps (if requested by the application with the attribute + *	%NL80211_ATTR_SPLIT_WIPHY_DUMP. Also supported is filtering the + *	wiphy dump by %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFINDEX or + *	%NL80211_ATTR_WDEV. + */ +enum nl80211_protocol_features { +	NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP =	1 << 0, +}; + +/** + * enum nl80211_crit_proto_id - nl80211 critical protocol identifiers + * + * @NL80211_CRIT_PROTO_UNSPEC: protocol unspecified. + * @NL80211_CRIT_PROTO_DHCP: BOOTP or DHCPv6 protocol. + * @NL80211_CRIT_PROTO_EAPOL: EAPOL protocol. + * @NL80211_CRIT_PROTO_APIPA: APIPA protocol. + * @NUM_NL80211_CRIT_PROTO: must be kept last. + */ +enum nl80211_crit_proto_id { +	NL80211_CRIT_PROTO_UNSPEC, +	NL80211_CRIT_PROTO_DHCP, +	NL80211_CRIT_PROTO_EAPOL, +	NL80211_CRIT_PROTO_APIPA, +	/* add other protocols before this one */ +	NUM_NL80211_CRIT_PROTO +}; + +/* maximum duration for critical protocol measures */ +#define NL80211_CRIT_PROTO_MAX_DURATION		5000 /* msec */ +  #endif /* __LINUX_NL80211_H */ diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h new file mode 100644 index 00000000000..405918dd7b3 --- /dev/null +++ b/include/uapi/linux/openvswitch.h @@ -0,0 +1,456 @@ + +/* + * Copyright (c) 2007-2011 Nicira Networks. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA + */ + +#ifndef _UAPI__LINUX_OPENVSWITCH_H +#define _UAPI__LINUX_OPENVSWITCH_H 1 + +#include <linux/types.h> +#include <linux/if_ether.h> + +/** + * struct ovs_header - header for OVS Generic Netlink messages. + * @dp_ifindex: ifindex of local port for datapath (0 to make a request not + * specific to a datapath). + * + * Attributes following the header are specific to a particular OVS Generic + * Netlink family, but all of the OVS families use this header. + */ + +struct ovs_header { +	int dp_ifindex; +}; + +/* Datapaths. */ + +#define OVS_DATAPATH_FAMILY  "ovs_datapath" +#define OVS_DATAPATH_MCGROUP "ovs_datapath" +#define OVS_DATAPATH_VERSION 0x1 + +enum ovs_datapath_cmd { +	OVS_DP_CMD_UNSPEC, +	OVS_DP_CMD_NEW, +	OVS_DP_CMD_DEL, +	OVS_DP_CMD_GET, +	OVS_DP_CMD_SET +}; + +/** + * enum ovs_datapath_attr - attributes for %OVS_DP_* commands. + * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local + * port".  This is the name of the network device whose dp_ifindex is given in + * the &struct ovs_header.  Always present in notifications.  Required in + * %OVS_DP_NEW requests.  May be used as an alternative to specifying + * dp_ifindex in other requests (with a dp_ifindex of 0). + * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially + * set on the datapath port (for OVS_ACTION_ATTR_MISS).  Only valid on + * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should + * not be sent. + * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the + * datapath.  Always present in notifications. + * + * These attributes follow the &struct ovs_header within the Generic Netlink + * payload for %OVS_DP_* commands. + */ +enum ovs_datapath_attr { +	OVS_DP_ATTR_UNSPEC, +	OVS_DP_ATTR_NAME,       /* name of dp_ifindex netdev */ +	OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ +	OVS_DP_ATTR_STATS,      /* struct ovs_dp_stats */ +	__OVS_DP_ATTR_MAX +}; + +#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1) + +struct ovs_dp_stats { +	__u64 n_hit;             /* Number of flow table matches. */ +	__u64 n_missed;          /* Number of flow table misses. */ +	__u64 n_lost;            /* Number of misses not sent to userspace. */ +	__u64 n_flows;           /* Number of flows present */ +}; + +struct ovs_vport_stats { +	__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  */ +}; + +/* Fixed logical ports. */ +#define OVSP_LOCAL      ((__u32)0) + +/* Packet transfer. */ + +#define OVS_PACKET_FAMILY "ovs_packet" +#define OVS_PACKET_VERSION 0x1 + +enum ovs_packet_cmd { +	OVS_PACKET_CMD_UNSPEC, + +	/* Kernel-to-user notifications. */ +	OVS_PACKET_CMD_MISS,    /* Flow table miss. */ +	OVS_PACKET_CMD_ACTION,  /* OVS_ACTION_ATTR_USERSPACE action. */ + +	/* Userspace commands. */ +	OVS_PACKET_CMD_EXECUTE  /* Apply actions to a packet. */ +}; + +/** + * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands. + * @OVS_PACKET_ATTR_PACKET: Present for all notifications.  Contains the entire + * packet as received, from the start of the Ethernet header onward.  For + * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by + * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is + * the flow key extracted from the packet as originally received. + * @OVS_PACKET_ATTR_KEY: Present for all notifications.  Contains the flow key + * extracted from the packet as nested %OVS_KEY_ATTR_* attributes.  This allows + * userspace to adapt its flow setup strategy by comparing its notion of the + * flow key against the kernel's. + * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet.  Used + * for %OVS_PACKET_CMD_EXECUTE.  It has nested %OVS_ACTION_ATTR_* attributes. + * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION + * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an + * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content + * specified there. + * + * These attributes follow the &struct ovs_header within the Generic Netlink + * payload for %OVS_PACKET_* commands. + */ +enum ovs_packet_attr { +	OVS_PACKET_ATTR_UNSPEC, +	OVS_PACKET_ATTR_PACKET,      /* Packet data. */ +	OVS_PACKET_ATTR_KEY,         /* Nested OVS_KEY_ATTR_* attributes. */ +	OVS_PACKET_ATTR_ACTIONS,     /* Nested OVS_ACTION_ATTR_* attributes. */ +	OVS_PACKET_ATTR_USERDATA,    /* OVS_ACTION_ATTR_USERSPACE arg. */ +	__OVS_PACKET_ATTR_MAX +}; + +#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1) + +/* Virtual ports. */ + +#define OVS_VPORT_FAMILY  "ovs_vport" +#define OVS_VPORT_MCGROUP "ovs_vport" +#define OVS_VPORT_VERSION 0x1 + +enum ovs_vport_cmd { +	OVS_VPORT_CMD_UNSPEC, +	OVS_VPORT_CMD_NEW, +	OVS_VPORT_CMD_DEL, +	OVS_VPORT_CMD_GET, +	OVS_VPORT_CMD_SET +}; + +enum ovs_vport_type { +	OVS_VPORT_TYPE_UNSPEC, +	OVS_VPORT_TYPE_NETDEV,   /* network device */ +	OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */ +	__OVS_VPORT_TYPE_MAX +}; + +#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1) + +/** + * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands. + * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath. + * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type + * of vport. + * @OVS_VPORT_ATTR_NAME: Name of vport.  For a vport based on a network device + * this is the name of the network device.  Maximum length %IFNAMSIZ-1 bytes + * plus a null terminator. + * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information. + * @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that + * OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on + * this port.  A value of zero indicates that upcalls should not be sent. + * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for + * packets sent or received through the vport. + * + * These attributes follow the &struct ovs_header within the Generic Netlink + * payload for %OVS_VPORT_* commands. + * + * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and + * %OVS_VPORT_ATTR_NAME attributes are required.  %OVS_VPORT_ATTR_PORT_NO is + * optional; if not specified a free port number is automatically selected. + * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type + * of vport. + * and other attributes are ignored. + * + * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to + * look up the vport to operate on; otherwise dp_idx from the &struct + * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport. + */ +enum ovs_vport_attr { +	OVS_VPORT_ATTR_UNSPEC, +	OVS_VPORT_ATTR_PORT_NO,	/* u32 port number within datapath */ +	OVS_VPORT_ATTR_TYPE,	/* u32 OVS_VPORT_TYPE_* constant. */ +	OVS_VPORT_ATTR_NAME,	/* string name, up to IFNAMSIZ bytes long */ +	OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ +	OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */ +	OVS_VPORT_ATTR_STATS,	/* struct ovs_vport_stats */ +	__OVS_VPORT_ATTR_MAX +}; + +#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1) + +/* Flows. */ + +#define OVS_FLOW_FAMILY  "ovs_flow" +#define OVS_FLOW_MCGROUP "ovs_flow" +#define OVS_FLOW_VERSION 0x1 + +enum ovs_flow_cmd { +	OVS_FLOW_CMD_UNSPEC, +	OVS_FLOW_CMD_NEW, +	OVS_FLOW_CMD_DEL, +	OVS_FLOW_CMD_GET, +	OVS_FLOW_CMD_SET +}; + +struct ovs_flow_stats { +	__u64 n_packets;         /* Number of matched packets. */ +	__u64 n_bytes;           /* Number of matched bytes. */ +}; + +enum ovs_key_attr { +	OVS_KEY_ATTR_UNSPEC, +	OVS_KEY_ATTR_ENCAP,	/* Nested set of encapsulated attributes. */ +	OVS_KEY_ATTR_PRIORITY,  /* u32 skb->priority */ +	OVS_KEY_ATTR_IN_PORT,   /* u32 OVS dp port number */ +	OVS_KEY_ATTR_ETHERNET,  /* struct ovs_key_ethernet */ +	OVS_KEY_ATTR_VLAN,	/* be16 VLAN TCI */ +	OVS_KEY_ATTR_ETHERTYPE,	/* be16 Ethernet type */ +	OVS_KEY_ATTR_IPV4,      /* struct ovs_key_ipv4 */ +	OVS_KEY_ATTR_IPV6,      /* struct ovs_key_ipv6 */ +	OVS_KEY_ATTR_TCP,       /* struct ovs_key_tcp */ +	OVS_KEY_ATTR_UDP,       /* struct ovs_key_udp */ +	OVS_KEY_ATTR_ICMP,      /* struct ovs_key_icmp */ +	OVS_KEY_ATTR_ICMPV6,    /* struct ovs_key_icmpv6 */ +	OVS_KEY_ATTR_ARP,       /* struct ovs_key_arp */ +	OVS_KEY_ATTR_ND,        /* struct ovs_key_nd */ +	OVS_KEY_ATTR_SKB_MARK,  /* u32 skb mark */ +	__OVS_KEY_ATTR_MAX +}; + +#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1) + +/** + * enum ovs_frag_type - IPv4 and IPv6 fragment type + * @OVS_FRAG_TYPE_NONE: Packet is not a fragment. + * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0. + * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset. + * + * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct + * ovs_key_ipv6. + */ +enum ovs_frag_type { +	OVS_FRAG_TYPE_NONE, +	OVS_FRAG_TYPE_FIRST, +	OVS_FRAG_TYPE_LATER, +	__OVS_FRAG_TYPE_MAX +}; + +#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1) + +struct ovs_key_ethernet { +	__u8	 eth_src[ETH_ALEN]; +	__u8	 eth_dst[ETH_ALEN]; +}; + +struct ovs_key_ipv4 { +	__be32 ipv4_src; +	__be32 ipv4_dst; +	__u8   ipv4_proto; +	__u8   ipv4_tos; +	__u8   ipv4_ttl; +	__u8   ipv4_frag;	/* One of OVS_FRAG_TYPE_*. */ +}; + +struct ovs_key_ipv6 { +	__be32 ipv6_src[4]; +	__be32 ipv6_dst[4]; +	__be32 ipv6_label;	/* 20-bits in least-significant bits. */ +	__u8   ipv6_proto; +	__u8   ipv6_tclass; +	__u8   ipv6_hlimit; +	__u8   ipv6_frag;	/* One of OVS_FRAG_TYPE_*. */ +}; + +struct ovs_key_tcp { +	__be16 tcp_src; +	__be16 tcp_dst; +}; + +struct ovs_key_udp { +	__be16 udp_src; +	__be16 udp_dst; +}; + +struct ovs_key_icmp { +	__u8 icmp_type; +	__u8 icmp_code; +}; + +struct ovs_key_icmpv6 { +	__u8 icmpv6_type; +	__u8 icmpv6_code; +}; + +struct ovs_key_arp { +	__be32 arp_sip; +	__be32 arp_tip; +	__be16 arp_op; +	__u8   arp_sha[ETH_ALEN]; +	__u8   arp_tha[ETH_ALEN]; +}; + +struct ovs_key_nd { +	__u32 nd_target[4]; +	__u8  nd_sll[ETH_ALEN]; +	__u8  nd_tll[ETH_ALEN]; +}; + +/** + * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands. + * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow + * key.  Always present in notifications.  Required for all requests (except + * dumps). + * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying + * the actions to take for packets that match the key.  Always present in + * notifications.  Required for %OVS_FLOW_CMD_NEW requests, optional for + * %OVS_FLOW_CMD_SET requests. + * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this + * flow.  Present in notifications if the stats would be nonzero.  Ignored in + * requests. + * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the + * TCP flags seen on packets in this flow.  Only present in notifications for + * TCP flows, and only if it would be nonzero.  Ignored in requests. + * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on + * the system monotonic clock, at which a packet was last processed for this + * flow.  Only present in notifications if a packet has been processed for this + * flow.  Ignored in requests. + * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the + * last-used time, accumulated TCP flags, and statistics for this flow. + * Otherwise ignored in requests.  Never present in notifications. + * + * These attributes follow the &struct ovs_header within the Generic Netlink + * payload for %OVS_FLOW_* commands. + */ +enum ovs_flow_attr { +	OVS_FLOW_ATTR_UNSPEC, +	OVS_FLOW_ATTR_KEY,       /* Sequence of OVS_KEY_ATTR_* attributes. */ +	OVS_FLOW_ATTR_ACTIONS,   /* Nested OVS_ACTION_ATTR_* attributes. */ +	OVS_FLOW_ATTR_STATS,     /* struct ovs_flow_stats. */ +	OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */ +	OVS_FLOW_ATTR_USED,      /* u64 msecs last used in monotonic time. */ +	OVS_FLOW_ATTR_CLEAR,     /* Flag to clear stats, tcp_flags, used. */ +	__OVS_FLOW_ATTR_MAX +}; + +#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) + +/** + * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action. + * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with + * @OVS_ACTION_ATTR_SAMPLE.  A value of 0 samples no packets, a value of + * %UINT32_MAX samples all packets and intermediate values sample intermediate + * fractions of packets. + * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event. + * Actions are passed as nested attributes. + * + * Executes the specified actions with the given probability on a per-packet + * basis. + */ +enum ovs_sample_attr { +	OVS_SAMPLE_ATTR_UNSPEC, +	OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */ +	OVS_SAMPLE_ATTR_ACTIONS,     /* Nested OVS_ACTION_ATTR_* attributes. */ +	__OVS_SAMPLE_ATTR_MAX, +}; + +#define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1) + +/** + * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action. + * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION + * message should be sent.  Required. + * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is + * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA. + */ +enum ovs_userspace_attr { +	OVS_USERSPACE_ATTR_UNSPEC, +	OVS_USERSPACE_ATTR_PID,	      /* u32 Netlink PID to receive upcalls. */ +	OVS_USERSPACE_ATTR_USERDATA,  /* Optional user-specified cookie. */ +	__OVS_USERSPACE_ATTR_MAX +}; + +#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1) + +/** + * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument. + * @vlan_tpid: Tag protocol identifier (TPID) to push. + * @vlan_tci: Tag control identifier (TCI) to push.  The CFI bit must be set + * (but it will not be set in the 802.1Q header that is pushed). + * + * The @vlan_tpid value is typically %ETH_P_8021Q.  The only acceptable TPID + * values are those that the kernel module also parses as 802.1Q headers, to + * prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN + * from having surprising results. + */ +struct ovs_action_push_vlan { +	__be16 vlan_tpid;	/* 802.1Q TPID. */ +	__be16 vlan_tci;	/* 802.1Q TCI (VLAN ID and priority). */ +}; + +/** + * enum ovs_action_attr - Action types. + * + * @OVS_ACTION_ATTR_OUTPUT: Output packet to port. + * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested + * %OVS_USERSPACE_ATTR_* attributes. + * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header.  The + * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its + * value. + * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the + * packet. + * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet. + * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in + * the nested %OVS_SAMPLE_ATTR_* attributes. + * + * Only a single header can be set with a single %OVS_ACTION_ATTR_SET.  Not all + * fields within a header are modifiable, e.g. the IPv4 protocol and fragment + * type may not be changed. + */ + +enum ovs_action_attr { +	OVS_ACTION_ATTR_UNSPEC, +	OVS_ACTION_ATTR_OUTPUT,	      /* u32 port number. */ +	OVS_ACTION_ATTR_USERSPACE,    /* Nested OVS_USERSPACE_ATTR_*. */ +	OVS_ACTION_ATTR_SET,          /* One nested OVS_KEY_ATTR_*. */ +	OVS_ACTION_ATTR_PUSH_VLAN,    /* struct ovs_action_push_vlan. */ +	OVS_ACTION_ATTR_POP_VLAN,     /* No argument. */ +	OVS_ACTION_ATTR_SAMPLE,       /* Nested OVS_SAMPLE_ATTR_*. */ +	__OVS_ACTION_ATTR_MAX +}; + +#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1) + +#endif /* _LINUX_OPENVSWITCH_H */ diff --git a/include/uapi/linux/packet_diag.h b/include/uapi/linux/packet_diag.h index afafd703ad9..b2cc0cd9c4d 100644 --- a/include/uapi/linux/packet_diag.h +++ b/include/uapi/linux/packet_diag.h @@ -16,6 +16,8 @@ struct packet_diag_req {  #define PACKET_SHOW_MCLIST	0x00000002 /* A set of packet_diag_mclist-s */  #define PACKET_SHOW_RING_CFG	0x00000004 /* Rings configuration parameters */  #define PACKET_SHOW_FANOUT	0x00000008 +#define PACKET_SHOW_MEMINFO	0x00000010 +#define PACKET_SHOW_FILTER	0x00000020  struct packet_diag_msg {  	__u8	pdiag_family; @@ -32,6 +34,9 @@ enum {  	PACKET_DIAG_RX_RING,  	PACKET_DIAG_TX_RING,  	PACKET_DIAG_FANOUT, +	PACKET_DIAG_UID, +	PACKET_DIAG_MEMINFO, +	PACKET_DIAG_FILTER,  	__PACKET_DIAG_MAX,  }; diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index ebfadc56d1b..864e324da80 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -292,12 +292,12 @@  /* Message Signalled Interrupts registers */ -#define PCI_MSI_FLAGS		2	/* Various flags */ -#define  PCI_MSI_FLAGS_64BIT	0x80	/* 64-bit addresses allowed */ -#define  PCI_MSI_FLAGS_QSIZE	0x70	/* Message queue size configured */ -#define  PCI_MSI_FLAGS_QMASK	0x0e	/* Maximum queue size available */ -#define  PCI_MSI_FLAGS_ENABLE	0x01	/* MSI feature enabled */ -#define  PCI_MSI_FLAGS_MASKBIT	0x100	/* 64-bit mask bits allowed */ +#define PCI_MSI_FLAGS		2	/* Message Control */ +#define  PCI_MSI_FLAGS_ENABLE	0x0001	/* MSI feature enabled */ +#define  PCI_MSI_FLAGS_QMASK	0x000e	/* Maximum queue size available */ +#define  PCI_MSI_FLAGS_QSIZE	0x0070	/* Message queue size configured */ +#define  PCI_MSI_FLAGS_64BIT	0x0080	/* 64-bit addresses allowed */ +#define  PCI_MSI_FLAGS_MASKBIT	0x0100	/* Per-vector masking capable */  #define PCI_MSI_RFU		3	/* Rest of capability flags */  #define PCI_MSI_ADDRESS_LO	4	/* Lower 32 bits */  #define PCI_MSI_ADDRESS_HI	8	/* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ @@ -309,13 +309,17 @@  #define PCI_MSI_PENDING_64	20	/* Pending intrs for 64-bit devices */  /* MSI-X registers */ -#define PCI_MSIX_FLAGS		2 -#define  PCI_MSIX_FLAGS_QSIZE	0x7FF -#define  PCI_MSIX_FLAGS_ENABLE	(1 << 15) -#define  PCI_MSIX_FLAGS_MASKALL	(1 << 14) -#define PCI_MSIX_TABLE		4 -#define PCI_MSIX_PBA		8 -#define  PCI_MSIX_FLAGS_BIRMASK	(7 << 0) +#define PCI_MSIX_FLAGS		2	/* Message Control */ +#define  PCI_MSIX_FLAGS_QSIZE	0x07FF	/* Table size */ +#define  PCI_MSIX_FLAGS_MASKALL	0x4000	/* Mask all vectors for this function */ +#define  PCI_MSIX_FLAGS_ENABLE	0x8000	/* MSI-X enable */ +#define PCI_MSIX_TABLE		4	/* Table offset */ +#define  PCI_MSIX_TABLE_BIR	0x00000007 /* BAR index */ +#define  PCI_MSIX_TABLE_OFFSET	0xfffffff8 /* Offset into specified BAR */ +#define PCI_MSIX_PBA		8	/* Pending Bit Array offset */ +#define  PCI_MSIX_PBA_BIR	0x00000007 /* BAR index */ +#define  PCI_MSIX_PBA_OFFSET	0xfffffff8 /* Offset into specified BAR */ +#define  PCI_MSIX_FLAGS_BIRMASK	(7 << 0)   /* deprecated */  #define PCI_CAP_MSIX_SIZEOF	12	/* size of MSIX registers */  /* MSI-X entry's format */ diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 9fa9c622a7f..fb104e51496 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h @@ -132,8 +132,10 @@ enum perf_event_sample_format {  	PERF_SAMPLE_BRANCH_STACK		= 1U << 11,  	PERF_SAMPLE_REGS_USER			= 1U << 12,  	PERF_SAMPLE_STACK_USER			= 1U << 13, +	PERF_SAMPLE_WEIGHT			= 1U << 14, +	PERF_SAMPLE_DATA_SRC			= 1U << 15, -	PERF_SAMPLE_MAX = 1U << 14,		/* non-ABI */ +	PERF_SAMPLE_MAX = 1U << 16,		/* non-ABI */  };  /* @@ -443,6 +445,7 @@ struct perf_event_mmap_page {  #define PERF_RECORD_MISC_GUEST_KERNEL		(4 << 0)  #define PERF_RECORD_MISC_GUEST_USER		(5 << 0) +#define PERF_RECORD_MISC_MMAP_DATA		(1 << 13)  /*   * Indicates that the content of PERF_SAMPLE_IP points to   * the actual instruction that triggered the event. See also @@ -588,6 +591,9 @@ enum perf_event_type {  	 * 	{ u64			size;  	 * 	  char			data[size];  	 * 	  u64			dyn_size; } && PERF_SAMPLE_STACK_USER +	 * +	 *	{ u64			weight;   } && PERF_SAMPLE_WEIGHT +	 *	{ u64			data_src;     } && PERF_SAMPLE_DATA_SRC  	 * };  	 */  	PERF_RECORD_SAMPLE			= 9, @@ -613,4 +619,67 @@ enum perf_callchain_context {  #define PERF_FLAG_FD_OUTPUT		(1U << 1)  #define PERF_FLAG_PID_CGROUP		(1U << 2) /* pid=cgroup id, per-cpu mode only */ +union perf_mem_data_src { +	__u64 val; +	struct { +		__u64   mem_op:5,	/* type of opcode */ +			mem_lvl:14,	/* memory hierarchy level */ +			mem_snoop:5,	/* snoop mode */ +			mem_lock:2,	/* lock instr */ +			mem_dtlb:7,	/* tlb access */ +			mem_rsvd:31; +	}; +}; + +/* type of opcode (load/store/prefetch,code) */ +#define PERF_MEM_OP_NA		0x01 /* not available */ +#define PERF_MEM_OP_LOAD	0x02 /* load instruction */ +#define PERF_MEM_OP_STORE	0x04 /* store instruction */ +#define PERF_MEM_OP_PFETCH	0x08 /* prefetch */ +#define PERF_MEM_OP_EXEC	0x10 /* code (execution) */ +#define PERF_MEM_OP_SHIFT	0 + +/* memory hierarchy (memory level, hit or miss) */ +#define PERF_MEM_LVL_NA		0x01  /* not available */ +#define PERF_MEM_LVL_HIT	0x02  /* hit level */ +#define PERF_MEM_LVL_MISS	0x04  /* miss level  */ +#define PERF_MEM_LVL_L1		0x08  /* L1 */ +#define PERF_MEM_LVL_LFB	0x10  /* Line Fill Buffer */ +#define PERF_MEM_LVL_L2		0x20  /* L2 */ +#define PERF_MEM_LVL_L3		0x40  /* L3 */ +#define PERF_MEM_LVL_LOC_RAM	0x80  /* Local DRAM */ +#define PERF_MEM_LVL_REM_RAM1	0x100 /* Remote DRAM (1 hop) */ +#define PERF_MEM_LVL_REM_RAM2	0x200 /* Remote DRAM (2 hops) */ +#define PERF_MEM_LVL_REM_CCE1	0x400 /* Remote Cache (1 hop) */ +#define PERF_MEM_LVL_REM_CCE2	0x800 /* Remote Cache (2 hops) */ +#define PERF_MEM_LVL_IO		0x1000 /* I/O memory */ +#define PERF_MEM_LVL_UNC	0x2000 /* Uncached memory */ +#define PERF_MEM_LVL_SHIFT	5 + +/* snoop mode */ +#define PERF_MEM_SNOOP_NA	0x01 /* not available */ +#define PERF_MEM_SNOOP_NONE	0x02 /* no snoop */ +#define PERF_MEM_SNOOP_HIT	0x04 /* snoop hit */ +#define PERF_MEM_SNOOP_MISS	0x08 /* snoop miss */ +#define PERF_MEM_SNOOP_HITM	0x10 /* snoop hit modified */ +#define PERF_MEM_SNOOP_SHIFT	19 + +/* locked instruction */ +#define PERF_MEM_LOCK_NA	0x01 /* not available */ +#define PERF_MEM_LOCK_LOCKED	0x02 /* locked transaction */ +#define PERF_MEM_LOCK_SHIFT	24 + +/* TLB access */ +#define PERF_MEM_TLB_NA		0x01 /* not available */ +#define PERF_MEM_TLB_HIT	0x02 /* hit level */ +#define PERF_MEM_TLB_MISS	0x04 /* miss level */ +#define PERF_MEM_TLB_L1		0x08 /* L1 */ +#define PERF_MEM_TLB_L2		0x10 /* L2 */ +#define PERF_MEM_TLB_WK		0x20 /* Hardware Walker*/ +#define PERF_MEM_TLB_OS		0x40 /* OS fault handler */ +#define PERF_MEM_TLB_SHIFT	26 + +#define PERF_MEM_S(a, s) \ +	(((u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT) +  #endif /* _UAPI_LINUX_PERF_EVENT_H */ diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index 32aef0a439e..dbd71b0c7d8 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h @@ -348,6 +348,7 @@ enum {  	TCA_HTB_INIT,  	TCA_HTB_CTAB,  	TCA_HTB_RTAB, +	TCA_HTB_DIRECT_QLEN,  	__TCA_HTB_MAX,  }; diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h index 022ab186a81..52ebcc89f30 100644 --- a/include/uapi/linux/ptrace.h +++ b/include/uapi/linux/ptrace.h @@ -5,6 +5,7 @@  /* has the defines to get at the registers. */ +#include <linux/types.h>  #define PTRACE_TRACEME		   0  #define PTRACE_PEEKTEXT		   1 @@ -52,6 +53,17 @@  #define PTRACE_INTERRUPT	0x4207  #define PTRACE_LISTEN		0x4208 +#define PTRACE_PEEKSIGINFO	0x4209 + +struct ptrace_peeksiginfo_args { +	__u64 off;	/* from which siginfo to start */ +	__u32 flags; +	__s32 nr;	/* how may siginfos to take */ +}; + +/* Read signals from a shared (process wide) queue */ +#define PTRACE_PEEKSIGINFO_SHARED	(1 << 0) +  /* Wait extended result codes for the above trace options.  */  #define PTRACE_EVENT_FORK	1  #define PTRACE_EVENT_VFORK	2 diff --git a/include/uapi/linux/rfkill.h b/include/uapi/linux/rfkill.h index 2753c6cc974..058757f7a73 100644 --- a/include/uapi/linux/rfkill.h +++ b/include/uapi/linux/rfkill.h @@ -37,6 +37,7 @@   * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device.   * @RFKILL_TYPE_GPS: switch is on a GPS device.   * @RFKILL_TYPE_FM: switch is on a FM radio device. + * @RFKILL_TYPE_NFC: switch is on an NFC device.   * @NUM_RFKILL_TYPES: number of defined rfkill types   */  enum rfkill_type { @@ -48,6 +49,7 @@ enum rfkill_type {  	RFKILL_TYPE_WWAN,  	RFKILL_TYPE_GPS,  	RFKILL_TYPE_FM, +	RFKILL_TYPE_NFC,  	NUM_RFKILL_TYPES,  }; diff --git a/include/net/sctp/user.h b/include/uapi/linux/sctp.h index 9a0ae091366..66b466e4ca0 100644 --- a/include/net/sctp/user.h +++ b/include/uapi/linux/sctp.h @@ -42,15 +42,17 @@   *    Jon Grimm                <jgrimm@us.ibm.com>   *    Daisy Chang              <daisyc@us.ibm.com>   *    Ryan Layer               <rmlayer@us.ibm.com> - *    Ardelle Fan	       <ardelle.fan@intel.com> + *    Ardelle Fan              <ardelle.fan@intel.com>   *    Sridhar Samudrala        <sri@us.ibm.com> + *    Inaky Perez-Gonzalez     <inaky.gonzalez@intel.com> + *    Vlad Yasevich            <vladislav.yasevich@hp.com>   *   * Any bugs reported given to us we will try to fix... any fixes shared will   * be incorporated into the next SCTP release.   */ -#ifndef __net_sctp_user_h__ -#define __net_sctp_user_h__ +#ifndef _UAPI_SCTP_H +#define _UAPI_SCTP_H  #include <linux/types.h>  #include <linux/socket.h> @@ -165,17 +167,23 @@ enum sctp_sinfo_flags {  	SCTP_ADDR_OVER = 2,  /* Override the primary destination. */  	SCTP_ABORT=4,        /* Send an ABORT message to the peer. */  	SCTP_SACK_IMMEDIATELY = 8,	/* SACK should be sent without delay */ -	SCTP_EOF=MSG_FIN,    /* Initiate graceful shutdown process. */	 +	SCTP_EOF=MSG_FIN,    /* Initiate graceful shutdown process. */  }; +typedef union { +	__u8   			raw; +	struct sctp_initmsg	init; +	struct sctp_sndrcvinfo	sndrcv; +} sctp_cmsg_data_t;  /* These are cmsg_types.  */  typedef enum sctp_cmsg_type {  	SCTP_INIT,              /* 5.2.1 SCTP Initiation Structure */ +#define SCTP_INIT	SCTP_INIT  	SCTP_SNDRCV,            /* 5.2.2 SCTP Header Information Structure */ +#define SCTP_SNDRCV	SCTP_SNDRCV  } sctp_cmsg_t; -  /*   * 5.3.1.1 SCTP_ASSOC_CHANGE   * @@ -345,6 +353,12 @@ struct sctp_pdapi_event {  enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, }; +/* + * 5.3.1.8.  SCTP_AUTHENTICATION_EVENT + * + *  When a receiver is using authentication this message will provide + *  notifications regarding new keys being made active as well as errors. + */  struct sctp_authkey_event {  	__u16 auth_type;  	__u16 auth_flags; @@ -421,15 +435,23 @@ union sctp_notification {  enum sctp_sn_type {  	SCTP_SN_TYPE_BASE     = (1<<15),  	SCTP_ASSOC_CHANGE, +#define SCTP_ASSOC_CHANGE		SCTP_ASSOC_CHANGE  	SCTP_PEER_ADDR_CHANGE, +#define SCTP_PEER_ADDR_CHANGE		SCTP_PEER_ADDR_CHANGE  	SCTP_SEND_FAILED, +#define SCTP_SEND_FAILED		SCTP_SEND_FAILED  	SCTP_REMOTE_ERROR, +#define SCTP_REMOTE_ERROR		SCTP_REMOTE_ERROR  	SCTP_SHUTDOWN_EVENT, +#define SCTP_SHUTDOWN_EVENT		SCTP_SHUTDOWN_EVENT  	SCTP_PARTIAL_DELIVERY_EVENT, +#define SCTP_PARTIAL_DELIVERY_EVENT	SCTP_PARTIAL_DELIVERY_EVENT  	SCTP_ADAPTATION_INDICATION, +#define SCTP_ADAPTATION_INDICATION	SCTP_ADAPTATION_INDICATION  	SCTP_AUTHENTICATION_EVENT,  #define SCTP_AUTHENTICATION_INDICATION	SCTP_AUTHENTICATION_EVENT  	SCTP_SENDER_DRY_EVENT, +#define SCTP_SENDER_DRY_EVENT		SCTP_SENDER_DRY_EVENT  };  /* Notification error codes used to fill up the error fields in some @@ -454,7 +476,7 @@ typedef enum sctp_sn_error {   *   *   The protocol parameters used to initialize and bound retransmission   *   timeout (RTO) are tunable.  See [SCTP] for more information on how - *   these parameters are used in RTO calculation.  + *   these parameters are used in RTO calculation.   */  struct sctp_rtoinfo {  	sctp_assoc_t	srto_assoc_id; @@ -504,6 +526,9 @@ struct sctp_prim {  	struct sockaddr_storage ssp_addr;  } __attribute__((packed, aligned(4))); +/* For backward compatibility use, define the old name too */ +#define sctp_setprim	sctp_prim +  /*   * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)   * @@ -564,12 +589,27 @@ struct sctp_authchunk {   *   * This option gets or sets the list of HMAC algorithms that the local   * endpoint requires the peer to use. -*/ + */ +#ifndef __KERNEL__ +/* This here is only used by user space as is. It might not be a good idea + * to export/reveal the whole structure with reserved fields etc. + */ +enum { +	SCTP_AUTH_HMAC_ID_SHA1 = 1, +	SCTP_AUTH_HMAC_ID_SHA256 = 3, +}; +#endif +  struct sctp_hmacalgo {  	__u32		shmac_num_idents;  	__u16		shmac_idents[];  }; +/* Sadly, user and kernel space have different names for + * this structure member, so this is to not break anything. + */ +#define shmac_number_of_idents	shmac_num_idents +  /*   * 7.1.20.  Set a shared key (SCTP_AUTH_KEY)   * @@ -691,6 +731,24 @@ struct sctp_authchunks {  	uint8_t		gauth_chunks[];  }; +/* The broken spelling has been released already in lksctp-tools header, + * so don't break anyone, now that it's fixed. + */ +#define guth_number_of_chunks	gauth_number_of_chunks + +/* Association states.  */ +enum sctp_sstat_state { +	SCTP_EMPTY                = 0, +	SCTP_CLOSED               = 1, +	SCTP_COOKIE_WAIT          = 2, +	SCTP_COOKIE_ECHOED        = 3, +	SCTP_ESTABLISHED          = 4, +	SCTP_SHUTDOWN_PENDING     = 5, +	SCTP_SHUTDOWN_SENT        = 6, +	SCTP_SHUTDOWN_RECEIVED    = 7, +	SCTP_SHUTDOWN_ACK_SENT    = 8, +}; +  /*   * 8.2.6. Get the Current Identifiers of Associations   *        (SCTP_GET_ASSOC_ID_LIST) @@ -705,15 +763,20 @@ struct sctp_assoc_ids {  /*   * 8.3, 8.5 get all peer/local addresses in an association. - * This parameter struct is used by SCTP_GET_PEER_ADDRS and  + * This parameter struct is used by SCTP_GET_PEER_ADDRS and   * SCTP_GET_LOCAL_ADDRS socket options used internally to implement - * sctp_getpaddrs() and sctp_getladdrs() API.  + * sctp_getpaddrs() and sctp_getladdrs() API.   */  struct sctp_getaddrs_old {  	sctp_assoc_t            assoc_id;  	int			addr_num; +#ifdef __KERNEL__  	struct sockaddr		__user *addrs; +#else +	struct sockaddr		*addrs; +#endif  }; +  struct sctp_getaddrs {  	sctp_assoc_t		assoc_id; /*input*/  	__u32			addr_num; /*output*/ @@ -779,4 +842,5 @@ struct sctp_paddrthlds {  	__u16 spt_pathmaxrxt;  	__u16 spt_pathpfthld;  }; -#endif /* __net_sctp_user_h__ */ + +#endif /* _UAPI_SCTP_H */ diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h index b49eab89c9f..df2e8b4f9c0 100644 --- a/include/uapi/linux/snmp.h +++ b/include/uapi/linux/snmp.h @@ -50,6 +50,7 @@ enum  	IPSTATS_MIB_OUTMCASTOCTETS,		/* OutMcastOctets */  	IPSTATS_MIB_INBCASTOCTETS,		/* InBcastOctets */  	IPSTATS_MIB_OUTBCASTOCTETS,		/* OutBcastOctets */ +	IPSTATS_MIB_CSUMERRORS,			/* InCsumErrors */  	__IPSTATS_MIB_MAX  }; @@ -87,6 +88,7 @@ enum  	ICMP_MIB_OUTTIMESTAMPREPS,		/* OutTimestampReps */  	ICMP_MIB_OUTADDRMASKS,			/* OutAddrMasks */  	ICMP_MIB_OUTADDRMASKREPS,		/* OutAddrMaskReps */ +	ICMP_MIB_CSUMERRORS,			/* InCsumErrors */  	__ICMP_MIB_MAX  }; @@ -103,6 +105,7 @@ enum  	ICMP6_MIB_INERRORS,			/* InErrors */  	ICMP6_MIB_OUTMSGS,			/* OutMsgs */  	ICMP6_MIB_OUTERRORS,			/* OutErrors */ +	ICMP6_MIB_CSUMERRORS,			/* InCsumErrors */  	__ICMP6_MIB_MAX  }; @@ -130,6 +133,7 @@ enum  	TCP_MIB_RETRANSSEGS,			/* RetransSegs */  	TCP_MIB_INERRS,				/* InErrs */  	TCP_MIB_OUTRSTS,			/* OutRsts */ +	TCP_MIB_CSUMERRORS,			/* InCsumErrors */  	__TCP_MIB_MAX  }; @@ -147,6 +151,7 @@ enum  	UDP_MIB_OUTDATAGRAMS,			/* OutDatagrams */  	UDP_MIB_RCVBUFERRORS,			/* RcvbufErrors */  	UDP_MIB_SNDBUFERRORS,			/* SndbufErrors */ +	UDP_MIB_CSUMERRORS,			/* InCsumErrors */  	__UDP_MIB_MAX  }; @@ -202,6 +207,8 @@ enum  	LINUX_MIB_TCPFORWARDRETRANS,		/* TCPForwardRetrans */  	LINUX_MIB_TCPSLOWSTARTRETRANS,		/* TCPSlowStartRetrans */  	LINUX_MIB_TCPTIMEOUTS,			/* TCPTimeouts */ +	LINUX_MIB_TCPLOSSPROBES,		/* TCPLossProbes */ +	LINUX_MIB_TCPLOSSPROBERECOVERY,		/* TCPLossProbeRecovery */  	LINUX_MIB_TCPRENORECOVERYFAIL,		/* TCPRenoRecoveryFail */  	LINUX_MIB_TCPSACKRECOVERYFAIL,		/* TCPSackRecoveryFail */  	LINUX_MIB_TCPSCHEDULERFAILED,		/* TCPSchedulerFailed */ @@ -245,6 +252,7 @@ enum  	LINUX_MIB_TCPFASTOPENPASSIVEFAIL,	/* TCPFastOpenPassiveFail */  	LINUX_MIB_TCPFASTOPENLISTENOVERFLOW,	/* TCPFastOpenListenOverflow */  	LINUX_MIB_TCPFASTOPENCOOKIEREQD,	/* TCPFastOpenCookieReqd */ +	LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */  	__LINUX_MIB_MAX  }; diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h index 6b1ead0b0c9..8d776ebc482 100644 --- a/include/uapi/linux/tcp.h +++ b/include/uapi/linux/tcp.h @@ -102,7 +102,6 @@ enum {  #define TCP_QUICKACK		12	/* Block/reenable quick acks */  #define TCP_CONGESTION		13	/* Congestion control algorithm */  #define TCP_MD5SIG		14	/* TCP MD5 Signature (RFC2385) */ -#define TCP_COOKIE_TRANSACTIONS	15	/* TCP Cookie Transactions */  #define TCP_THIN_LINEAR_TIMEOUTS 16      /* Use linear timeouts for thin streams*/  #define TCP_THIN_DUPACK         17      /* Fast retrans. after 1 dupack */  #define TCP_USER_TIMEOUT	18	/* How long for loss retry before timeout */ @@ -199,29 +198,4 @@ struct tcp_md5sig {  	__u8	tcpm_key[TCP_MD5SIG_MAXKEYLEN];		/* key (binary) */  }; -/* for TCP_COOKIE_TRANSACTIONS (TCPCT) socket option */ -#define TCP_COOKIE_MIN		 8		/*  64-bits */ -#define TCP_COOKIE_MAX		16		/* 128-bits */ -#define TCP_COOKIE_PAIR_SIZE	(2*TCP_COOKIE_MAX) - -/* Flags for both getsockopt and setsockopt */ -#define TCP_COOKIE_IN_ALWAYS	(1 << 0)	/* Discard SYN without cookie */ -#define TCP_COOKIE_OUT_NEVER	(1 << 1)	/* Prohibit outgoing cookies, -						 * supercedes everything. */ - -/* Flags for getsockopt */ -#define TCP_S_DATA_IN		(1 << 2)	/* Was data received? */ -#define TCP_S_DATA_OUT		(1 << 3)	/* Was data sent? */ - -/* TCP_COOKIE_TRANSACTIONS data */ -struct tcp_cookie_transactions { -	__u16	tcpct_flags;			/* see above */ -	__u8	__tcpct_pad1;			/* zero */ -	__u8	tcpct_cookie_desired;		/* bytes */ -	__u16	tcpct_s_data_desired;		/* bytes of variable data */ -	__u16	tcpct_used;			/* bytes in value */ -	__u8	tcpct_value[TCP_MSS_DEFAULT]; -}; - -  #endif /* _UAPI_LINUX_TCP_H */ diff --git a/include/uapi/linux/time.h b/include/uapi/linux/time.h index 0d3c0edc3ed..e75e1b6ff27 100644 --- a/include/uapi/linux/time.h +++ b/include/uapi/linux/time.h @@ -54,11 +54,9 @@ struct itimerval {  #define CLOCK_BOOTTIME			7  #define CLOCK_REALTIME_ALARM		8  #define CLOCK_BOOTTIME_ALARM		9 +#define CLOCK_SGI_CYCLE			10	/* Hardware specific */ +#define CLOCK_TAI			11 -/* - * The IDs of various hardware clocks: - */ -#define CLOCK_SGI_CYCLE			10  #define MAX_CLOCKS			16  #define CLOCKS_MASK			(CLOCK_REALTIME | CLOCK_MONOTONIC)  #define CLOCKS_MONO			CLOCK_MONOTONIC diff --git a/include/uapi/linux/usb/cdc-wdm.h b/include/uapi/linux/usb/cdc-wdm.h new file mode 100644 index 00000000000..f03134feebd --- /dev/null +++ b/include/uapi/linux/usb/cdc-wdm.h @@ -0,0 +1,21 @@ +/* + * USB CDC Device Management userspace API definitions + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * version 2 as published by the Free Software Foundation. + */ + +#ifndef _UAPI__LINUX_USB_CDC_WDM_H +#define _UAPI__LINUX_USB_CDC_WDM_H + +/* + * This IOCTL is used to retrieve the wMaxCommand for the device, + * defining the message limit for both reading and writing. + * + * For CDC WDM functions this will be the wMaxCommand field of the + * Device Management Functional Descriptor. + */ +#define IOCTL_WDM_MAX_COMMAND _IOR('H', 0xA0, __u16) + +#endif /* _UAPI__LINUX_USB_CDC_WDM_H */ diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h index f738e25377f..aa33fd1b2d4 100644 --- a/include/uapi/linux/usb/ch9.h +++ b/include/uapi/linux/usb/ch9.h @@ -138,7 +138,7 @@  /*   * New Feature Selectors as added by USB 3.0 - * See USB 3.0 spec Table 9-6 + * See USB 3.0 spec Table 9-7   */  #define USB_DEVICE_U1_ENABLE	48	/* dev may initiate U1 transition */  #define USB_DEVICE_U2_ENABLE	49	/* dev may initiate U2 transition */ @@ -147,7 +147,7 @@  #define USB_INTR_FUNC_SUSPEND_OPT_MASK	0xFF00  /* - * Suspend Options, Table 9-7 USB 3.0 spec + * Suspend Options, Table 9-8 USB 3.0 spec   */  #define USB_INTRF_FUNC_SUSPEND_LP	(1 << (8 + 0))  #define USB_INTRF_FUNC_SUSPEND_RW	(1 << (8 + 1)) diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index dcd63745e83..69bd5bb0d5a 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -59,6 +59,7 @@  #define V4L2_CTRL_CLASS_IMAGE_SOURCE	0x009e0000	/* Image source controls */  #define V4L2_CTRL_CLASS_IMAGE_PROC	0x009f0000	/* Image processing controls */  #define V4L2_CTRL_CLASS_DV		0x00a00000	/* Digital Video controls */ +#define V4L2_CTRL_CLASS_FM_RX		0x00a10000	/* Digital Video controls */  /* User-class control IDs */ @@ -146,6 +147,19 @@ enum v4l2_colorfx {   * of controls. We reserve 16 controls for this driver. */  #define V4L2_CID_USER_MEYE_BASE			(V4L2_CID_USER_BASE + 0x1000) +/* The base for the bttv driver controls. + * We reserve 32 controls for this driver. */ +#define V4L2_CID_USER_BTTV_BASE			(V4L2_CID_USER_BASE + 0x1010) + + +/* The base for the s2255 driver controls. + * We reserve 16 controls for this driver. */ +#define V4L2_CID_USER_S2255_BASE		(V4L2_CID_USER_BASE + 0x1030) + +/* The base for the si476x driver controls. See include/media/si476x.h for the list + * of controls. Total of 16 controls is reserved for this driver */ +#define V4L2_CID_USER_SI476X_BASE		(V4L2_CID_USER_BASE + 0x1040) +  /* MPEG-class control IDs */  #define V4L2_CID_MPEG_BASE 			(V4L2_CTRL_CLASS_MPEG | 0x900) @@ -351,6 +365,7 @@ enum v4l2_mpeg_video_multi_slice_mode {  #define V4L2_CID_MPEG_VIDEO_DEC_PTS			(V4L2_CID_MPEG_BASE+223)  #define V4L2_CID_MPEG_VIDEO_DEC_FRAME			(V4L2_CID_MPEG_BASE+224)  #define V4L2_CID_MPEG_VIDEO_VBV_DELAY			(V4L2_CID_MPEG_BASE+225) +#define V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER		(V4L2_CID_MPEG_BASE+226)  #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP		(V4L2_CID_MPEG_BASE+300)  #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP		(V4L2_CID_MPEG_BASE+301) @@ -643,6 +658,7 @@ enum v4l2_exposure_metering {  	V4L2_EXPOSURE_METERING_AVERAGE		= 0,  	V4L2_EXPOSURE_METERING_CENTER_WEIGHTED	= 1,  	V4L2_EXPOSURE_METERING_SPOT		= 2, +	V4L2_EXPOSURE_METERING_MATRIX		= 3,  };  #define V4L2_CID_SCENE_MODE			(V4L2_CID_CAMERA_CLASS_BASE+26) @@ -825,4 +841,16 @@ enum v4l2_dv_rgb_range {  #define	V4L2_CID_DV_RX_POWER_PRESENT		(V4L2_CID_DV_CLASS_BASE + 100)  #define V4L2_CID_DV_RX_RGB_RANGE		(V4L2_CID_DV_CLASS_BASE + 101) +#define V4L2_CID_FM_RX_CLASS_BASE		(V4L2_CTRL_CLASS_FM_RX | 0x900) +#define V4L2_CID_FM_RX_CLASS			(V4L2_CTRL_CLASS_FM_RX | 1) + +#define V4L2_CID_TUNE_DEEMPHASIS		(V4L2_CID_FM_RX_CLASS_BASE + 1) +enum v4l2_deemphasis { +	V4L2_DEEMPHASIS_DISABLED	= V4L2_PREEMPHASIS_DISABLED, +	V4L2_DEEMPHASIS_50_uS		= V4L2_PREEMPHASIS_50_uS, +	V4L2_DEEMPHASIS_75_uS		= V4L2_PREEMPHASIS_75_uS, +}; + +#define V4L2_CID_RDS_RECEPTION			(V4L2_CID_FM_RX_CLASS_BASE + 2) +  #endif diff --git a/include/uapi/linux/v4l2-dv-timings.h b/include/uapi/linux/v4l2-dv-timings.h index 9ef8172e5ed..4e0c58d25ff 100644 --- a/include/uapi/linux/v4l2-dv-timings.h +++ b/include/uapi/linux/v4l2-dv-timings.h @@ -42,6 +42,15 @@  		V4L2_DV_BT_STD_DMT | V4L2_DV_BT_STD_CEA861, 0) \  } +/* Note: these are the nominal timings, for HDMI links this format is typically + * double-clocked to meet the minimum pixelclock requirements.  */ +#define V4L2_DV_BT_CEA_720X480I59_94 { \ +	.type = V4L2_DV_BT_656_1120, \ +	V4L2_INIT_BT_TIMINGS(720, 480, 1, 0, \ +		13500000, 19, 62, 57, 4, 3, 15, 4, 3, 16, \ +		V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) \ +} +  #define V4L2_DV_BT_CEA_720X480P59_94 { \  	.type = V4L2_DV_BT_656_1120, \  	V4L2_INIT_BT_TIMINGS(720, 480, 0, 0, \ @@ -49,6 +58,15 @@  		V4L2_DV_BT_STD_CEA861, 0) \  } +/* Note: these are the nominal timings, for HDMI links this format is typically + * double-clocked to meet the minimum pixelclock requirements.  */ +#define V4L2_DV_BT_CEA_720X576I50 { \ +	.type = V4L2_DV_BT_656_1120, \ +	V4L2_INIT_BT_TIMINGS(720, 576, 1, 0, \ +		13500000, 12, 63, 69, 2, 3, 19, 2, 3, 20, \ +		V4L2_DV_BT_STD_CEA861, V4L2_DV_FL_HALF_LINE) \ +} +  #define V4L2_DV_BT_CEA_720X576P50 { \  	.type = V4L2_DV_BT_656_1120, \  	V4L2_INIT_BT_TIMINGS(720, 576, 0, 0, \ diff --git a/include/uapi/linux/v4l2-mediabus.h b/include/uapi/linux/v4l2-mediabus.h index b9b7bea0453..6ee63d09b32 100644 --- a/include/uapi/linux/v4l2-mediabus.h +++ b/include/uapi/linux/v4l2-mediabus.h @@ -37,7 +37,7 @@  enum v4l2_mbus_pixelcode {  	V4L2_MBUS_FMT_FIXED = 0x0001, -	/* RGB - next is 0x1009 */ +	/* RGB - next is 0x100d */  	V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,  	V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,  	V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003, @@ -46,6 +46,10 @@ enum v4l2_mbus_pixelcode {  	V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,  	V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,  	V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008, +	V4L2_MBUS_FMT_RGB666_1X18 = 0x1009, +	V4L2_MBUS_FMT_RGB888_1X24 = 0x100a, +	V4L2_MBUS_FMT_RGB888_2X12_BE = 0x100b, +	V4L2_MBUS_FMT_RGB888_2X12_LE = 0x100c,  	/* YUV (including grey) - next is 0x2017 */  	V4L2_MBUS_FMT_Y8_1X8 = 0x2001, diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 234d1d87091..f40b41c7e10 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -72,27 +72,6 @@  #define VIDEO_MAX_FRAME               32  #define VIDEO_MAX_PLANES               8 -#ifndef __KERNEL__ - -/* These defines are V4L1 specific and should not be used with the V4L2 API! -   They will be removed from this header in the future. */ - -#define VID_TYPE_CAPTURE	1	/* Can capture */ -#define VID_TYPE_TUNER		2	/* Can tune */ -#define VID_TYPE_TELETEXT	4	/* Does teletext */ -#define VID_TYPE_OVERLAY	8	/* Overlay onto frame buffer */ -#define VID_TYPE_CHROMAKEY	16	/* Overlay by chromakey */ -#define VID_TYPE_CLIPPING	32	/* Can clip */ -#define VID_TYPE_FRAMERAM	64	/* Uses the frame buffer memory */ -#define VID_TYPE_SCALES		128	/* Scalable */ -#define VID_TYPE_MONOCHROME	256	/* Monochrome only */ -#define VID_TYPE_SUBCAPTURE	512	/* Can capture subareas of the image */ -#define VID_TYPE_MPEG_DECODER	1024	/* Can decode MPEG streams */ -#define VID_TYPE_MPEG_ENCODER	2048	/* Can encode MPEG streams */ -#define VID_TYPE_MJPEG_DECODER	4096	/* Can decode MJPEG streams */ -#define VID_TYPE_MJPEG_ENCODER	8192	/* Can encode MJPEG streams */ -#endif -  /*   *	M I S C E L L A N E O U S   */ @@ -705,6 +684,7 @@ struct v4l2_buffer {  #define V4L2_BUF_FLAG_TIMESTAMP_MASK		0xe000  #define V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN		0x0000  #define V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC	0x2000 +#define V4L2_BUF_FLAG_TIMESTAMP_COPY		0x4000  /**   * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor @@ -980,52 +960,6 @@ struct v4l2_standard {  	__u32		     reserved[4];  }; -/* The DV Preset API is deprecated in favor of the DV Timings API. -   New drivers shouldn't use this anymore! */ - -/* - *	V I D E O	T I M I N G S	D V	P R E S E T - */ -struct v4l2_dv_preset { -	__u32	preset; -	__u32	reserved[4]; -}; - -/* - *	D V	P R E S E T S	E N U M E R A T I O N - */ -struct v4l2_dv_enum_preset { -	__u32	index; -	__u32	preset; -	__u8	name[32]; /* Name of the preset timing */ -	__u32	width; -	__u32	height; -	__u32	reserved[4]; -}; - -/* - * 	D V	P R E S E T	V A L U E S - */ -#define		V4L2_DV_INVALID		0 -#define		V4L2_DV_480P59_94	1 /* BT.1362 */ -#define		V4L2_DV_576P50		2 /* BT.1362 */ -#define		V4L2_DV_720P24		3 /* SMPTE 296M */ -#define		V4L2_DV_720P25		4 /* SMPTE 296M */ -#define		V4L2_DV_720P30		5 /* SMPTE 296M */ -#define		V4L2_DV_720P50		6 /* SMPTE 296M */ -#define		V4L2_DV_720P59_94	7 /* SMPTE 274M */ -#define		V4L2_DV_720P60		8 /* SMPTE 274M/296M */ -#define		V4L2_DV_1080I29_97	9 /* BT.1120/ SMPTE 274M */ -#define		V4L2_DV_1080I30		10 /* BT.1120/ SMPTE 274M */ -#define		V4L2_DV_1080I25		11 /* BT.1120 */ -#define		V4L2_DV_1080I50		12 /* SMPTE 296M */ -#define		V4L2_DV_1080I60		13 /* SMPTE 296M */ -#define		V4L2_DV_1080P24		14 /* SMPTE 296M */ -#define		V4L2_DV_1080P25		15 /* SMPTE 296M */ -#define		V4L2_DV_1080P30		16 /* SMPTE 296M */ -#define		V4L2_DV_1080P50		17 /* BT.1120 */ -#define		V4L2_DV_1080P60		18 /* BT.1120 */ -  /*   *	D V 	B T	T I M I N G S   */ @@ -1119,7 +1053,7 @@ struct v4l2_bt_timings {     longer and field 2 is really one half-line shorter, so each field has     exactly the same number of half-lines. Whether half-lines can be detected     or used depends on the hardware. */ -#define V4L2_DV_FL_HALF_LINE			(1 << 0) +#define V4L2_DV_FL_HALF_LINE			(1 << 3)  /** struct v4l2_dv_timings - DV timings @@ -1239,7 +1173,6 @@ struct v4l2_input {  #define V4L2_IN_ST_VTR         0x04000000  /* VTR time constant */  /* capabilities flags */ -#define V4L2_IN_CAP_PRESETS		0x00000001 /* Supports S_DV_PRESET */  #define V4L2_IN_CAP_DV_TIMINGS		0x00000002 /* Supports S_DV_TIMINGS */  #define V4L2_IN_CAP_CUSTOM_TIMINGS	V4L2_IN_CAP_DV_TIMINGS /* For compatibility */  #define V4L2_IN_CAP_STD			0x00000004 /* Supports S_STD */ @@ -1263,7 +1196,6 @@ struct v4l2_output {  #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY	3  /* capabilities flags */ -#define V4L2_OUT_CAP_PRESETS		0x00000001 /* Supports S_DV_PRESET */  #define V4L2_OUT_CAP_DV_TIMINGS		0x00000002 /* Supports S_DV_TIMINGS */  #define V4L2_OUT_CAP_CUSTOM_TIMINGS	V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */  #define V4L2_OUT_CAP_STD		0x00000004 /* Supports S_STD */ @@ -1854,10 +1786,12 @@ struct v4l2_event_subscription {  /* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ -#define V4L2_CHIP_MATCH_HOST       0  /* Match against chip ID on host (0 for the host) */ -#define V4L2_CHIP_MATCH_I2C_DRIVER 1  /* Match against I2C driver name */ -#define V4L2_CHIP_MATCH_I2C_ADDR   2  /* Match against I2C 7-bit address */ -#define V4L2_CHIP_MATCH_AC97       3  /* Match against anciliary AC97 chip */ +#define V4L2_CHIP_MATCH_BRIDGE      0  /* Match against chip ID on the bridge (0 for the bridge) */ +#define V4L2_CHIP_MATCH_HOST V4L2_CHIP_MATCH_BRIDGE +#define V4L2_CHIP_MATCH_I2C_DRIVER  1  /* Match against I2C driver name */ +#define V4L2_CHIP_MATCH_I2C_ADDR    2  /* Match against I2C 7-bit address */ +#define V4L2_CHIP_MATCH_AC97        3  /* Match against anciliary AC97 chip */ +#define V4L2_CHIP_MATCH_SUBDEV      4  /* Match against subdev index */  struct v4l2_dbg_match {  	__u32 type; /* Match type */ @@ -1881,6 +1815,17 @@ struct v4l2_dbg_chip_ident {  	__u32 revision;    /* chip revision, chip specific */  } __attribute__ ((packed)); +#define V4L2_CHIP_FL_READABLE (1 << 0) +#define V4L2_CHIP_FL_WRITABLE (1 << 1) + +/* VIDIOC_DBG_G_CHIP_INFO */ +struct v4l2_dbg_chip_info { +	struct v4l2_dbg_match match; +	char name[32]; +	__u32 flags; +	__u32 reserved[32]; +} __attribute__ ((packed)); +  /**   * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument   * @index:	on return, index of the first created buffer @@ -1958,15 +1903,12 @@ struct v4l2_create_buffers {  #define VIDIOC_G_EXT_CTRLS	_IOWR('V', 71, struct v4l2_ext_controls)  #define VIDIOC_S_EXT_CTRLS	_IOWR('V', 72, struct v4l2_ext_controls)  #define VIDIOC_TRY_EXT_CTRLS	_IOWR('V', 73, struct v4l2_ext_controls) -#if 1  #define VIDIOC_ENUM_FRAMESIZES	_IOWR('V', 74, struct v4l2_frmsizeenum)  #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum)  #define VIDIOC_G_ENC_INDEX       _IOR('V', 76, struct v4l2_enc_idx)  #define VIDIOC_ENCODER_CMD      _IOWR('V', 77, struct v4l2_encoder_cmd)  #define VIDIOC_TRY_ENCODER_CMD  _IOWR('V', 78, struct v4l2_encoder_cmd) -#endif -#if 1  /* Experimental, meant for debugging, testing and internal use.     Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.     You must be root to use these ioctls. Never use these in applications! */ @@ -1974,18 +1916,13 @@ struct v4l2_create_buffers {  #define	VIDIOC_DBG_G_REGISTER 	_IOWR('V', 80, struct v4l2_dbg_register)  /* Experimental, meant for debugging, testing and internal use. -   Never use this ioctl in applications! */ +   Never use this ioctl in applications! +   Note: this ioctl is deprecated in favor of VIDIOC_DBG_G_CHIP_INFO and +   will go away in the future. */  #define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) -#endif  #define VIDIOC_S_HW_FREQ_SEEK	 _IOW('V', 82, struct v4l2_hw_freq_seek) -/* These four DV Preset ioctls are deprecated in favor of the DV Timings -   ioctls. */ -#define	VIDIOC_ENUM_DV_PRESETS	_IOWR('V', 83, struct v4l2_dv_enum_preset) -#define	VIDIOC_S_DV_PRESET	_IOWR('V', 84, struct v4l2_dv_preset) -#define	VIDIOC_G_DV_PRESET	_IOWR('V', 85, struct v4l2_dv_preset) -#define	VIDIOC_QUERY_DV_PRESET	_IOR('V',  86, struct v4l2_dv_preset)  #define	VIDIOC_S_DV_TIMINGS	_IOWR('V', 87, struct v4l2_dv_timings)  #define	VIDIOC_G_DV_TIMINGS	_IOWR('V', 88, struct v4l2_dv_timings)  #define	VIDIOC_DQEVENT		 _IOR('V', 89, struct v4l2_event) @@ -2016,6 +1953,10 @@ struct v4l2_create_buffers {     versions. */  #define VIDIOC_ENUM_FREQ_BANDS	_IOWR('V', 101, struct v4l2_frequency_band) +/* Experimental, meant for debugging, testing and internal use. +   Never use these in applications! */ +#define VIDIOC_DBG_G_CHIP_INFO  _IOWR('V', 102, struct v4l2_dbg_chip_info) +  /* Reminder: when adding new ioctls please add support for them to     drivers/media/video/v4l2-compat-ioctl32.c as well! */ diff --git a/include/uapi/linux/vm_sockets.h b/include/uapi/linux/vm_sockets.h index df91301847e..b4ed5d89569 100644 --- a/include/uapi/linux/vm_sockets.h +++ b/include/uapi/linux/vm_sockets.h @@ -13,12 +13,10 @@   * more details.   */ -#ifndef _VM_SOCKETS_H_ -#define _VM_SOCKETS_H_ +#ifndef _UAPI_VM_SOCKETS_H +#define _UAPI_VM_SOCKETS_H -#if !defined(__KERNEL__) -#include <sys/socket.h> -#endif +#include <linux/socket.h>  /* Option name for STREAM socket buffer size.  Use as the option name in   * setsockopt(3) or getsockopt(3) to set or get an unsigned long long that @@ -137,14 +135,13 @@  #define VM_SOCKETS_VERSION_MINOR(_v) (((_v) & 0x0000FFFF))  /* Address structure for vSockets.   The address family should be set to - * whatever vmci_sock_get_af_value_fd() returns.  The structure members should - * all align on their natural boundaries without resorting to compiler packing - * directives.  The total size of this structure should be exactly the same as - * that of struct sockaddr. + * AF_VSOCK.  The structure members should all align on their natural + * boundaries without resorting to compiler packing directives.  The total size + * of this structure should be exactly the same as that of struct sockaddr.   */  struct sockaddr_vm { -	sa_family_t svm_family; +	__kernel_sa_family_t svm_family;  	unsigned short svm_reserved1;  	unsigned int svm_port;  	unsigned int svm_cid; @@ -156,8 +153,4 @@ struct sockaddr_vm {  #define IOCTL_VM_SOCKETS_GET_LOCAL_CID		_IO(7, 0xb9) -#if defined(__KERNEL__) -int vm_sockets_get_local_cid(void); -#endif - -#endif +#endif /* _UAPI_VM_SOCKETS_H */ diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h index 28e493b5b94..a8cd6a4a297 100644 --- a/include/uapi/linux/xfrm.h +++ b/include/uapi/linux/xfrm.h @@ -297,6 +297,7 @@ enum xfrm_attr_type_t {  	XFRMA_MARK,		/* struct xfrm_mark */  	XFRMA_TFCPAD,		/* __u32 */  	XFRMA_REPLAY_ESN_VAL,	/* struct xfrm_replay_esn */ +	XFRMA_SA_EXTRA_FLAGS,	/* __u32 */  	__XFRMA_MAX  #define XFRMA_MAX (__XFRMA_MAX - 1) @@ -367,6 +368,8 @@ struct xfrm_usersa_info {  #define XFRM_STATE_ESN		128  }; +#define XFRM_SA_XFLAG_DONT_ENCAP_DSCP	1 +  struct xfrm_usersa_id {  	xfrm_address_t			daddr;  	__be32				spi; diff --git a/include/video/auo_k190xfb.h b/include/video/auo_k190xfb.h index 609efe8c686..ac329ee1d75 100644 --- a/include/video/auo_k190xfb.h +++ b/include/video/auo_k190xfb.h @@ -22,6 +22,8 @@   */  #define AUOK190X_RESOLUTION_800_600		0  #define AUOK190X_RESOLUTION_1024_768		1 +#define AUOK190X_RESOLUTION_600_800		4 +#define AUOK190X_RESOLUTION_768_1024		5  /*   * struct used by auok190x. board specific stuff comes from *board @@ -98,7 +100,6 @@ struct auok190x_board {  	int gpio_nbusy;  	int resolution; -	int rotation;  	int quirks;  	int fps;  }; diff --git a/include/video/display_timing.h b/include/video/display_timing.h index 71e9a383a98..5d0259b08e0 100644 --- a/include/video/display_timing.h +++ b/include/video/display_timing.h @@ -12,19 +12,22 @@  #include <linux/bitops.h>  #include <linux/types.h> -/* VESA display monitor timing parameters */ -#define VESA_DMT_HSYNC_LOW		BIT(0) -#define VESA_DMT_HSYNC_HIGH		BIT(1) -#define VESA_DMT_VSYNC_LOW		BIT(2) -#define VESA_DMT_VSYNC_HIGH		BIT(3) +enum display_flags { +	DISPLAY_FLAGS_HSYNC_LOW		= BIT(0), +	DISPLAY_FLAGS_HSYNC_HIGH	= BIT(1), +	DISPLAY_FLAGS_VSYNC_LOW		= BIT(2), +	DISPLAY_FLAGS_VSYNC_HIGH	= BIT(3), -/* display specific flags */ -#define DISPLAY_FLAGS_DE_LOW		BIT(0)	/* data enable flag */ -#define DISPLAY_FLAGS_DE_HIGH		BIT(1) -#define DISPLAY_FLAGS_PIXDATA_POSEDGE	BIT(2)	/* drive data on pos. edge */ -#define DISPLAY_FLAGS_PIXDATA_NEGEDGE	BIT(3)	/* drive data on neg. edge */ -#define DISPLAY_FLAGS_INTERLACED	BIT(4) -#define DISPLAY_FLAGS_DOUBLESCAN	BIT(5) +	/* data enable flag */ +	DISPLAY_FLAGS_DE_LOW		= BIT(4), +	DISPLAY_FLAGS_DE_HIGH		= BIT(5), +	/* drive data on pos. edge */ +	DISPLAY_FLAGS_PIXDATA_POSEDGE	= BIT(6), +	/* drive data on neg. edge */ +	DISPLAY_FLAGS_PIXDATA_NEGEDGE	= BIT(7), +	DISPLAY_FLAGS_INTERLACED	= BIT(8), +	DISPLAY_FLAGS_DOUBLESCAN	= BIT(9), +};  /*   * A single signal can be specified via a range of minimal and maximal values @@ -36,12 +39,6 @@ struct timing_entry {  	u32 max;  }; -enum timing_entry_index { -	TE_MIN = 0, -	TE_TYP = 1, -	TE_MAX = 2, -}; -  /*   * Single "mode" entry. This describes one set of signal timings a display can   * have in one setting. This struct can later be converted to struct videomode @@ -72,8 +69,7 @@ struct display_timing {  	struct timing_entry vback_porch;	/* ver. back porch */  	struct timing_entry vsync_len;		/* ver. sync len */ -	unsigned int dmt_flags;			/* VESA DMT flags */ -	unsigned int data_flags;		/* video data flags */ +	enum display_flags flags;		/* display flags */  };  /* @@ -89,25 +85,6 @@ struct display_timings {  	struct display_timing **timings;  }; -/* get value specified by index from struct timing_entry */ -static inline u32 display_timing_get_value(const struct timing_entry *te, -					   enum timing_entry_index index) -{ -	switch (index) { -	case TE_MIN: -		return te->min; -		break; -	case TE_TYP: -		return te->typ; -		break; -	case TE_MAX: -		return te->max; -		break; -	default: -		return te->typ; -	} -} -  /* get one entry from struct display_timings */  static inline struct display_timing *display_timings_get(const struct  							 display_timings *disp, diff --git a/include/video/platform_lcd.h b/include/video/platform_lcd.h index ad3bdfe743b..23864b28414 100644 --- a/include/video/platform_lcd.h +++ b/include/video/platform_lcd.h @@ -15,6 +15,7 @@ struct plat_lcd_data;  struct fb_info;  struct plat_lcd_data { +	int	(*probe)(struct plat_lcd_data *);  	void	(*set_power)(struct plat_lcd_data *, unsigned int power);  	int	(*match_fb)(struct plat_lcd_data *, struct fb_info *);  }; diff --git a/include/video/videomode.h b/include/video/videomode.h index a42156234dd..3f1049d870d 100644 --- a/include/video/videomode.h +++ b/include/video/videomode.h @@ -29,20 +29,30 @@ struct videomode {  	u32 vback_porch;  	u32 vsync_len; -	unsigned int dmt_flags;	/* VESA DMT flags */ -	unsigned int data_flags; /* video data flags */ +	enum display_flags flags; /* display flags */  };  /**   * videomode_from_timing - convert display timing to videomode + * @dt: display_timing structure + * @vm: return value + * + * DESCRIPTION: + * This function converts a struct display_timing to a struct videomode. + */ +void videomode_from_timing(const struct display_timing *dt, +			  struct videomode *vm); + +/** + * videomode_from_timings - convert one display timings entry to videomode   * @disp: structure with all possible timing entries   * @vm: return value   * @index: index into the list of display timings in devicetree   *   * DESCRIPTION: - * This function converts a struct display_timing to a struct videomode. + * This function converts one struct display_timing entry to a struct videomode.   */ -int videomode_from_timing(const struct display_timings *disp, +int videomode_from_timings(const struct display_timings *disp,  			  struct videomode *vm, unsigned int index);  #endif diff --git a/include/xen/events.h b/include/xen/events.h index c6bfe01acf6..b2b27c6a0f7 100644 --- a/include/xen/events.h +++ b/include/xen/events.h @@ -90,8 +90,7 @@ int xen_bind_pirq_gsi_to_irq(unsigned gsi,  int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc);  /* Bind an PSI pirq to an irq. */  int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc, -			     int pirq, int vector, const char *name, -			     domid_t domid); +			     int pirq, const char *name, domid_t domid);  #endif  /* De-allocates the above mentioned physical interrupt. */ diff --git a/include/xen/interface/io/netif.h b/include/xen/interface/io/netif.h index 9dfc1200098..3ef3fe05ee9 100644 --- a/include/xen/interface/io/netif.h +++ b/include/xen/interface/io/netif.h @@ -13,6 +13,24 @@  #include <xen/interface/grant_table.h>  /* + * Older implementation of Xen network frontend / backend has an + * implicit dependency on the MAX_SKB_FRAGS as the maximum number of + * ring slots a skb can use. Netfront / netback may not work as + * expected when frontend and backend have different MAX_SKB_FRAGS. + * + * A better approach is to add mechanism for netfront / netback to + * negotiate this value. However we cannot fix all possible + * frontends, so we need to define a value which states the minimum + * slots backend must support. + * + * The minimum value derives from older Linux kernel's MAX_SKB_FRAGS + * (18), which is proved to work with most frontends. Any new backend + * which doesn't negotiate with frontend should expect frontend to + * send a valid packet using slots up to this value. + */ +#define XEN_NETIF_NR_SLOTS_MIN 18 + +/*   * Notifications after enqueuing any type of message should be conditional on   * the appropriate req_event or rsp_event field in the shared ring.   * If the client sends notification for rx requests then it should specify @@ -47,6 +65,7 @@  #define _XEN_NETTXF_extra_info		(3)  #define  XEN_NETTXF_extra_info		(1U<<_XEN_NETTXF_extra_info) +#define XEN_NETIF_MAX_TX_SIZE 0xFFFF  struct xen_netif_tx_request {      grant_ref_t gref;      /* Reference to buffer page */      uint16_t offset;       /* Offset within buffer page */ diff --git a/include/xen/tmem.h b/include/xen/tmem.h index 591550a22ac..3930a90045f 100644 --- a/include/xen/tmem.h +++ b/include/xen/tmem.h @@ -3,7 +3,15 @@  #include <linux/types.h> +#ifdef CONFIG_XEN_TMEM_MODULE +#define tmem_enabled true +#else  /* defined in drivers/xen/tmem.c */  extern bool tmem_enabled; +#endif + +#ifdef CONFIG_XEN_SELFBALLOONING +extern int xen_selfballoon_init(bool, bool); +#endif  #endif /* _XEN_TMEM_H */  |