WindCharger: Updates uClibc to include AI_ADDRCONFIG

The two main files that were updated were:
-- build/crosstool-1.20-build.config
-- build/uClibc-0.9.33.2.config

Everything else was auto-generated by crosstool-ng

This change also uses the new linux headers for building gcc.

Change-Id: I854b6ff43515d34d46cbe6058aa017626e6099ef
diff --git a/bin/mips-qca-linux-uclibc-c++ b/bin/mips-qca-linux-uclibc-c++
index e682358..8094f18 100755
--- a/bin/mips-qca-linux-uclibc-c++
+++ b/bin/mips-qca-linux-uclibc-c++
Binary files differ
diff --git a/bin/mips-qca-linux-uclibc-cpp b/bin/mips-qca-linux-uclibc-cpp
index ca888e9..5e47c4e 100755
--- a/bin/mips-qca-linux-uclibc-cpp
+++ b/bin/mips-qca-linux-uclibc-cpp
Binary files differ
diff --git a/bin/mips-qca-linux-uclibc-ct-ng.config b/bin/mips-qca-linux-uclibc-ct-ng.config
index 9f3f20e..d5eac5e 100755
--- a/bin/mips-qca-linux-uclibc-ct-ng.config
+++ b/bin/mips-qca-linux-uclibc-ct-ng.config
Binary files differ
diff --git a/bin/mips-qca-linux-uclibc-g++ b/bin/mips-qca-linux-uclibc-g++
index e682358..8094f18 100755
--- a/bin/mips-qca-linux-uclibc-g++
+++ b/bin/mips-qca-linux-uclibc-g++
Binary files differ
diff --git a/bin/mips-qca-linux-uclibc-gcc b/bin/mips-qca-linux-uclibc-gcc
index 13ed9fa..7701b19 100755
--- a/bin/mips-qca-linux-uclibc-gcc
+++ b/bin/mips-qca-linux-uclibc-gcc
Binary files differ
diff --git a/bin/mips-qca-linux-uclibc-gcc-4.6.4 b/bin/mips-qca-linux-uclibc-gcc-4.6.4
index 13ed9fa..7701b19 100755
--- a/bin/mips-qca-linux-uclibc-gcc-4.6.4
+++ b/bin/mips-qca-linux-uclibc-gcc-4.6.4
Binary files differ
diff --git a/bin/mips-qca-linux-uclibc-gcov b/bin/mips-qca-linux-uclibc-gcov
index a9cd9a8..00e9e10 100755
--- a/bin/mips-qca-linux-uclibc-gcov
+++ b/bin/mips-qca-linux-uclibc-gcov
Binary files differ
diff --git a/bin/mips-qca-linux-uclibc-gdb b/bin/mips-qca-linux-uclibc-gdb
index 18b44fb..6da55fc 100755
--- a/bin/mips-qca-linux-uclibc-gdb
+++ b/bin/mips-qca-linux-uclibc-gdb
Binary files differ
diff --git a/build/crosstool-1.20-build.config b/build/crosstool-1.20-build.config
index adc4ccc..a6d8aaa 100644
--- a/build/crosstool-1.20-build.config
+++ b/build/crosstool-1.20-build.config
@@ -174,7 +174,7 @@
 #
 # Tuple completion and aliasing
 #
-CT_TARGET_VENDOR=""
+CT_TARGET_VENDOR="qca"
 CT_TARGET_ALIAS_SED_EXPR=""
 CT_TARGET_ALIAS="mips-linux-uclibc"
 
@@ -235,7 +235,7 @@
 # CT_KERNEL_V_2_6_31 is not set
 # CT_KERNEL_V_2_6_27 is not set
 CT_KERNEL_LINUX_CUSTOM=y
-CT_KERNEL_LINUX_CUSTOM_LOCATION="/usr/local/google/home/awdavies/proj/wind/LSDK/linux/kernels/mips-linux-2.6.31/"
+CT_KERNEL_LINUX_CUSTOM_LOCATION="/usr/local/google/home/awdavies/proj/embedded/kernel/windcharger/"
 CT_KERNEL_windows_AVAILABLE=y
 
 #
diff --git a/build/uClibc-0.9.33.2.config b/build/uClibc-0.9.33.2.config
index a4865c9..e3c7339 100644
--- a/build/uClibc-0.9.33.2.config
+++ b/build/uClibc-0.9.33.2.config
@@ -137,7 +137,7 @@
 UCLIBC_HAS_LIBRESOLV_STUB=y
 UCLIBC_HAS_LIBNSL_STUB=y
 UCLIBC_HAS_RESOLVER_SUPPORT=y
-# UCLIBC_SUPPORT_AI_ADDRCONFIG is not set
+UCLIBC_SUPPORT_AI_ADDRCONFIG=y
 # UCLIBC_HAS_BSD_RES_CLOSE is not set
 
 #
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbegin.o b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbegin.o
index 9b1569c..6968695 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbegin.o
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbegin.o
Binary files differ
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbeginS.o b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbeginS.o
index 224f8c0..3f79dc4 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbeginS.o
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbeginS.o
Binary files differ
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbeginT.o b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbeginT.o
index 9a20c6e..fc8e767 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbeginT.o
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtbeginT.o
Binary files differ
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtend.o b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtend.o
index 5297a67..9338db7 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtend.o
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtend.o
Binary files differ
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtendS.o b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtendS.o
index 2f2dae0..09c3b55 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtendS.o
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtendS.o
Binary files differ
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtfastmath.o b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtfastmath.o
index 142952f..c63e3de 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtfastmath.o
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/crtfastmath.o
Binary files differ
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/include/mf-runtime.h b/lib/gcc/mips-qca-linux-uclibc/4.6.4/include/mf-runtime.h
deleted file mode 100644
index 4c512d5..0000000
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/include/mf-runtime.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/* Implementation header for mudflap runtime library.
-   Mudflap: narrow-pointer bounds-checking by tree rewriting.
-   Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
-   Contributed by Frank Ch. Eigler <fche@redhat.com>
-   and Graydon Hoare <graydon@redhat.com>
-
-This file is part of GCC.
-
-GCC 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 3, or (at your option) any later
-version.
-
-GCC 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.
-
-Under Section 7 of GPL version 3, you are granted additional
-permissions described in the GCC Runtime Library Exception, version
-3.1, as published by the Free Software Foundation.
-
-You should have received a copy of the GNU General Public License and
-a copy of the GCC Runtime Library Exception along with this program;
-see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
-<http://www.gnu.org/licenses/>.  */
-
-/* Public libmudflap declarations -*- C -*- */
-
-#ifndef MF_RUNTIME_H
-#define MF_RUNTIME_H
-
-typedef void *__mf_ptr_t;
-typedef unsigned int __mf_uintptr_t __attribute__ ((__mode__ (__pointer__)));
-typedef __SIZE_TYPE__ __mf_size_t;
-
-/* Global declarations used by instrumentation.  When _MUDFLAP is
-   defined, these have been auto-declared by the compiler and we
-   should not declare them again (ideally we *would* declare them
-   again, to verify that the compiler's declarations match the
-   library's, but the C++ front end has no mechanism for allowing
-   the re-definition of a structure type).  */
-#ifndef _MUDFLAP
-struct __mf_cache { __mf_uintptr_t low; __mf_uintptr_t high; };
-extern struct __mf_cache __mf_lookup_cache [];
-extern __mf_uintptr_t __mf_lc_mask;
-extern unsigned char __mf_lc_shift;
-#endif
-
-/* Multithreading support.  */
-#ifdef _MUDFLAPTH
-/* extern pthread_mutex_t __mf_biglock; */
-#ifndef _REENTRANT
-#define _REENTRANT
-#endif
-#ifndef _THREAD_SAFE
-#define _THREAD_SAFE
-#endif
-#endif
-
-/* Codes to describe the type of access to check: __mf_check arg 3 */
-
-#define __MF_CHECK_READ 0
-#define __MF_CHECK_WRITE 1
-
-
-/* Codes to describe a region of memory being registered: __mf_*register arg 3 */
-
-#define __MF_TYPE_NOACCESS 0
-#define __MF_TYPE_HEAP 1
-#define __MF_TYPE_HEAP_I 2
-#define __MF_TYPE_STACK 3
-#define __MF_TYPE_STATIC 4
-#define __MF_TYPE_GUESS 5
-
-
-/* The public mudflap API */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void __mf_check (void *ptr, __mf_size_t sz, int type, const char *location)
-       __attribute((nothrow));
-extern void __mf_register (void *ptr, __mf_size_t sz, int type, const char *name)
-       __attribute((nothrow));
-extern void __mf_unregister (void *ptr, __mf_size_t sz, int type)
-       __attribute((nothrow));
-extern unsigned __mf_watch (void *ptr, __mf_size_t sz);
-extern unsigned __mf_unwatch (void *ptr, __mf_size_t sz);
-extern void __mf_report ();
-extern int __mf_set_options (const char *opts);
-
-
-/* Redirect some standard library functions to libmudflap.  These are
-   done by simple #define rather than linker wrapping, since only
-   instrumented modules are meant to be affected.  */
-
-#ifdef _MUDFLAP
-#pragma redefine_extname memcpy __mfwrap_memcpy
-#pragma redefine_extname memmove __mfwrap_memmove
-#pragma redefine_extname memset __mfwrap_memset
-#pragma redefine_extname memcmp __mfwrap_memcmp
-#pragma redefine_extname memchr __mfwrap_memchr
-#pragma redefine_extname memrchr __mfwrap_memrchr
-#pragma redefine_extname strcpy __mfwrap_strcpy
-#pragma redefine_extname strncpy __mfwrap_strncpy
-#pragma redefine_extname strcat __mfwrap_strcat
-#pragma redefine_extname strncat __mfwrap_strncat
-#pragma redefine_extname strcmp __mfwrap_strcmp
-#pragma redefine_extname strcasecmp __mfwrap_strcasecmp
-#pragma redefine_extname strncmp __mfwrap_strncmp
-#pragma redefine_extname strncasecmp __mfwrap_strncasecmp
-#pragma redefine_extname strdup __mfwrap_strdup
-#pragma redefine_extname strndup __mfwrap_strndup
-#pragma redefine_extname strchr __mfwrap_strchr
-#pragma redefine_extname strrchr __mfwrap_strrchr
-#pragma redefine_extname strstr __mfwrap_strstr
-#pragma redefine_extname memmem __mfwrap_memmem
-#pragma redefine_extname strlen __mfwrap_strlen
-#pragma redefine_extname strnlen __mfwrap_strnlen
-#pragma redefine_extname bzero __mfwrap_bzero
-#pragma redefine_extname bcopy __mfwrap_bcopy
-#pragma redefine_extname bcmp __mfwrap_bcmp
-#pragma redefine_extname index __mfwrap_index
-#pragma redefine_extname rindex __mfwrap_rindex
-#pragma redefine_extname asctime __mfwrap_asctime
-#pragma redefine_extname ctime __mfwrap_ctime
-#pragma redefine_extname gmtime __mfwrap_gmtime
-#pragma redefine_extname localtime __mfwrap_localtime
-#pragma redefine_extname time __mfwrap_time
-#pragma redefine_extname strerror __mfwrap_strerror
-#pragma redefine_extname fopen __mfwrap_fopen
-#pragma redefine_extname fdopen __mfwrap_fdopen
-#pragma redefine_extname freopen __mfwrap_freopen
-#pragma redefine_extname fclose __mfwrap_fclose
-#pragma redefine_extname fread __mfwrap_fread
-#pragma redefine_extname fwrite __mfwrap_fwrite
-#pragma redefine_extname fgetc __mfwrap_fgetc
-#pragma redefine_extname fgets __mfwrap_fgets
-#pragma redefine_extname getc __mfwrap_getc
-#pragma redefine_extname gets __mfwrap_gets
-#pragma redefine_extname ungetc __mfwrap_ungetc
-#pragma redefine_extname fputc __mfwrap_fputc
-#pragma redefine_extname fputs __mfwrap_fputs
-#pragma redefine_extname putc __mfwrap_putc
-#pragma redefine_extname puts __mfwrap_puts
-#pragma redefine_extname clearerr __mfwrap_clearerr
-#pragma redefine_extname feof __mfwrap_feof
-#pragma redefine_extname ferror __mfwrap_ferror
-#pragma redefine_extname fileno __mfwrap_fileno
-#pragma redefine_extname printf __mfwrap_printf
-#pragma redefine_extname fprintf __mfwrap_fprintf
-#pragma redefine_extname sprintf __mfwrap_sprintf
-#pragma redefine_extname snprintf __mfwrap_snprintf
-#pragma redefine_extname vprintf __mfwrap_vprintf
-#pragma redefine_extname vfprintf __mfwrap_vfprintf
-#pragma redefine_extname vsprintf __mfwrap_vsprintf
-#pragma redefine_extname vsnprintf __mfwrap_vsnprintf
-#pragma redefine_extname access __mfwrap_access
-#pragma redefine_extname remove __mfwrap_remove
-#pragma redefine_extname fflush __mfwrap_fflush
-#pragma redefine_extname fseek __mfwrap_fseek
-#pragma redefine_extname ftell __mfwrap_ftell
-#pragma redefine_extname rewind __mfwrap_rewind
-#pragma redefine_extname fgetpos __mfwrap_fgetpos
-#pragma redefine_extname fsetpos __mfwrap_fsetpos
-#pragma redefine_extname stat __mfwrap_stat
-#pragma redefine_extname fstat __mfwrap_fstat
-#pragma redefine_extname lstat __mfwrap_lstat
-#pragma redefine_extname mkfifo __mfwrap_mkfifo
-#pragma redefine_extname setvbuf __mfwrap_setvbuf
-#pragma redefine_extname setbuf __mfwrap_setbuf
-#pragma redefine_extname setbuffer __mfwrap_setbuffer
-#pragma redefine_extname setlinebuf __mfwrap_setlinebuf
-#pragma redefine_extname opendir __mfwrap_opendir
-#pragma redefine_extname closedir __mfwrap_closedir
-#pragma redefine_extname readdir __mfwrap_readdir
-#pragma redefine_extname recv __mfwrap_recv
-#pragma redefine_extname recvfrom __mfwrap_recvfrom
-#pragma redefine_extname recvmsg __mfwrap_recvmsg
-#pragma redefine_extname send __mfwrap_send
-#pragma redefine_extname sendto __mfwrap_sendto
-#pragma redefine_extname sendmsg __mfwrap_sendmsg
-#pragma redefine_extname setsockopt __mfwrap_setsockopt
-#pragma redefine_extname getsockopt __mfwrap_getsockopt
-#pragma redefine_extname accept __mfwrap_accept
-#pragma redefine_extname bind __mfwrap_bind
-#pragma redefine_extname connect __mfwrap_connect
-#pragma redefine_extname gethostname __mfwrap_gethostname
-#pragma redefine_extname sethostname __mfwrap_sethostname
-#pragma redefine_extname gethostbyname __mfwrap_gethostbyname
-#pragma redefine_extname wait __mfwrap_wait
-#pragma redefine_extname waitpid __mfwrap_waitpid
-#pragma redefine_extname popen __mfwrap_popen
-#pragma redefine_extname pclose __mfwrap_pclose
-#pragma redefine_extname execve __mfwrap_execve
-#pragma redefine_extname execv __mfwrap_execv
-#pragma redefine_extname execvp __mfwrap_execvp
-#pragma redefine_extname system __mfwrap_system
-#pragma redefine_extname dlopen __mfwrap_dlopen
-#pragma redefine_extname dlerror __mfwrap_dlerror
-#pragma redefine_extname dlsym __mfwrap_dlsym
-#pragma redefine_extname dlclose __mfwrap_dlclose
-#pragma redefine_extname fopen64 __mfwrap_fopen64
-#pragma redefine_extname freopen64 __mfwrap_freopen64
-#pragma redefine_extname stat64 __mfwrap_stat64
-#pragma redefine_extname fseeko64 __mfwrap_fseeko64
-#pragma redefine_extname ftello64 __mfwrap_ftello64
-#pragma redefine_extname semop __mfwrap_semop
-#pragma redefine_extname semctl __mfwrap_semctl
-#pragma redefine_extname shmctl __mfwrap_shmctl
-#pragma redefine_extname shmat __mfwrap_shmat
-#pragma redefine_extname shmdt __mfwrap_shmdt
-#pragma redefine_extname __ctype_b_loc __mfwrap___ctype_b_loc
-#pragma redefine_extname __ctype_toupper_loc __mfwrap___ctype_toupper_loc
-#pragma redefine_extname __ctype_tolower_loc __mfwrap___ctype_tolower_loc
-#pragma redefine_extname getlogin __mfwrap_getlogin
-#pragma redefine_extname cuserid __mfwrap_cuserid
-#pragma redefine_extname getpwnam __mfwrap_getpwnam
-#pragma redefine_extname getpwuid __mfwrap_getpwuid
-#pragma redefine_extname getgrnam __mfwrap_getgrnam
-#pragma redefine_extname getgrgid __mfwrap_getgrgid
-#pragma redefine_extname getservent __mfwrap_getservent
-#pragma redefine_extname getservbyname __mfwrap_getservbyname
-#pragma redefine_extname getservbyport __mfwrap_getservbyport
-#pragma redefine_extname gai_strerror __mfwrap_gai_strerror
-#pragma redefine_extname getmntent __mfwrap_getmntent
-#pragma redefine_extname inet_ntoa __mfwrap_inet_ntoa
-#pragma redefine_extname getprotoent __mfwrap_getprotoent
-#pragma redefine_extname getprotobyname __mfwrap_getprotobyname
-#pragma redefine_extname getprotobynumber __mfwrap_getprotobynumber
-
-/* Disable glibc macros.  */
-#define __NO_STRING_INLINES
-
-#endif /* _MUDFLAP */
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* MF_RUNTIME_H */
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/include/omp.h b/lib/gcc/mips-qca-linux-uclibc/4.6.4/include/omp.h
new file mode 100644
index 0000000..6102dbf
--- /dev/null
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/include/omp.h
@@ -0,0 +1,105 @@
+/* Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+   Contributed by Richard Henderson <rth@redhat.com>.
+
+   This file is part of the GNU OpenMP Library (libgomp).
+
+   Libgomp 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 3, or (at your option)
+   any later version.
+
+   Libgomp 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.
+
+   Under Section 7 of GPL version 3, you are granted additional
+   permissions described in the GCC Runtime Library Exception, version
+   3.1, as published by the Free Software Foundation.
+
+   You should have received a copy of the GNU General Public License and
+   a copy of the GCC Runtime Library Exception along with this program;
+   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef OMP_H
+#define OMP_H 1
+
+#ifndef _LIBGOMP_OMP_LOCK_DEFINED
+#define _LIBGOMP_OMP_LOCK_DEFINED 1
+/* These two structures get edited by the libgomp build process to 
+   reflect the shape of the two types.  Their internals are private
+   to the library.  */
+
+typedef struct
+{
+  unsigned char _x[4] 
+    __attribute__((__aligned__(4)));
+} omp_lock_t;
+
+typedef struct
+{
+  unsigned char _x[12] 
+    __attribute__((__aligned__(4)));
+} omp_nest_lock_t;
+#endif
+
+typedef enum omp_sched_t
+{
+  omp_sched_static = 1,
+  omp_sched_dynamic = 2,
+  omp_sched_guided = 3,
+  omp_sched_auto = 4
+} omp_sched_t;
+
+#ifdef __cplusplus
+extern "C" {
+# define __GOMP_NOTHROW throw ()
+#else
+# define __GOMP_NOTHROW __attribute__((__nothrow__))
+#endif
+
+extern void omp_set_num_threads (int) __GOMP_NOTHROW;
+extern int omp_get_num_threads (void) __GOMP_NOTHROW;
+extern int omp_get_max_threads (void) __GOMP_NOTHROW;
+extern int omp_get_thread_num (void) __GOMP_NOTHROW;
+extern int omp_get_num_procs (void) __GOMP_NOTHROW;
+
+extern int omp_in_parallel (void) __GOMP_NOTHROW;
+
+extern void omp_set_dynamic (int) __GOMP_NOTHROW;
+extern int omp_get_dynamic (void) __GOMP_NOTHROW;
+
+extern void omp_set_nested (int) __GOMP_NOTHROW;
+extern int omp_get_nested (void) __GOMP_NOTHROW;
+
+extern void omp_init_lock (omp_lock_t *) __GOMP_NOTHROW;
+extern void omp_destroy_lock (omp_lock_t *) __GOMP_NOTHROW;
+extern void omp_set_lock (omp_lock_t *) __GOMP_NOTHROW;
+extern void omp_unset_lock (omp_lock_t *) __GOMP_NOTHROW;
+extern int omp_test_lock (omp_lock_t *) __GOMP_NOTHROW;
+
+extern void omp_init_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
+extern void omp_destroy_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
+extern void omp_set_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
+extern void omp_unset_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
+extern int omp_test_nest_lock (omp_nest_lock_t *) __GOMP_NOTHROW;
+
+extern double omp_get_wtime (void) __GOMP_NOTHROW;
+extern double omp_get_wtick (void) __GOMP_NOTHROW;
+
+void omp_set_schedule (omp_sched_t, int) __GOMP_NOTHROW;
+void omp_get_schedule (omp_sched_t *, int *) __GOMP_NOTHROW;
+int omp_get_thread_limit (void) __GOMP_NOTHROW;
+void omp_set_max_active_levels (int) __GOMP_NOTHROW;
+int omp_get_max_active_levels (void) __GOMP_NOTHROW;
+int omp_get_level (void) __GOMP_NOTHROW;
+int omp_get_ancestor_thread_num (int) __GOMP_NOTHROW;
+int omp_get_team_size (int) __GOMP_NOTHROW;
+int omp_get_active_level (void) __GOMP_NOTHROW;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OMP_H */
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcc.a b/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcc.a
index 76323c7..d396c46 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcc.a
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcc.a
Binary files differ
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcc_eh.a b/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcc_eh.a
index d409f22..dcb384f 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcc_eh.a
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcc_eh.a
Binary files differ
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcov.a b/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcov.a
index 38c054e..b77d696 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcov.a
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/libgcov.a
Binary files differ
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/auto-host.h b/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/auto-host.h
index 6446f97..6b83d30 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/auto-host.h
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/auto-host.h
@@ -36,7 +36,7 @@
    fully standards-compliant handling of destructors, but requires
    __cxa_atexit in libc. */
 #ifndef USED_FOR_TARGET
-/* #undef DEFAULT_USE_CXA_ATEXIT */
+#define DEFAULT_USE_CXA_ATEXIT 2
 #endif
 
 
@@ -116,13 +116,13 @@
 
 /* Define if gcc should always pass --build-id to linker. */
 #ifndef USED_FOR_TARGET
-#define ENABLE_LD_BUILDID 1
+/* #undef ENABLE_LD_BUILDID */
 #endif
 
 
 /* Define to 1 to enable libquadmath support */
 #ifndef USED_FOR_TARGET
-/* #undef ENABLE_LIBQUADMATH_SUPPORT */
+#define ENABLE_LIBQUADMATH_SUPPORT 1
 #endif
 
 
@@ -470,7 +470,7 @@
 
 /* Define if your assembler and linker support thread-local storage. */
 #ifndef USED_FOR_TARGET
-/* #undef HAVE_AS_TLS */
+#define HAVE_AS_TLS 1
 #endif
 
 
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/configargs.h b/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/configargs.h
index 6885b73..f66e3cb 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/configargs.h
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/configargs.h
@@ -1,7 +1,7 @@
 /* Generated automatically. */
-static const char configuration_arguments[] = "/usr/local/google/home/awdavies/proj/crosstool/mips32r2/.build/src/gcc-4.6.4/configure --build=x86_64-build_unknown-linux-gnu --host=x86_64-build_unknown-linux-gnu --target=mips-qca-linux-uclibc --prefix=/usr/local/google/home/awdavies/x-tools/mips-qca-linux-uclibc --with-sysroot=/usr/local/google/home/awdavies/x-tools/mips-qca-linux-uclibc/mips-qca-linux-uclibc/sysroot --enable-languages=c,c++ --with-arch=mips32r2 --with-abi=32 --with-tune=mips32r2 --with-float=soft --with-pkgversion='crosstool-NG 1.20.0' --disable-__cxa_atexit --enable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --with-gmp=/usr/local/google/home/awdavies/proj/crosstool/mips32r2/.build/mips-qca-linux-uclibc/buildtools --with-mpfr=/usr/local/google/home/awdavies/proj/crosstool/mips32r2/.build/mips-qca-linux-uclibc/buildtools --with-mpc=/usr/local/google/home/awdavies/proj/crosstool/mips32r2/.build/mips-qca-linux-uclibc/buildtools --with-ppl=no --with-isl=no --with-cloog=no --with-libelf=/usr/local/google/home/awdavies/proj/crosstool/mips32r2/.build/mips-qca-linux-uclibc/buildtools --enable-threads=posix --enable-target-optspace --enable-linker-build-id --enable-decimal-float=no --with-mips-plt --disable-nls --disable-multilib --with-local-prefix=/usr/local/google/home/awdavies/x-tools/mips-qca-linux-uclibc/mips-qca-linux-uclibc/sysroot --enable-c99 --enable-long-long --disable-libssp --disable-__cxa_atexit --with-float=soft --enable-target-optspace --with-gnu-ld --disable-decimal-float --enable-threads --disable-nls --with-abi=32 --disable-multilib --with-fPIC --disable-nls -disable-tls";
+static const char configuration_arguments[] = "/usr/local/google/home/awdavies/proj/crosstool/mips32r2/.build/src/gcc-4.6.4/configure --build=x86_64-build_unknown-linux-gnu --host=x86_64-build_unknown-linux-gnu --target=mips-qca-linux-uclibc --prefix=/usr/local/google/home/awdavies/x-tools/mips-qca-linux-uclibc --with-local-prefix=/usr/local/google/home/awdavies/x-tools/mips-qca-linux-uclibc/mips-qca-linux-uclibc/sysroot --with-pic --disable-libmudflap --enable-languages=c,c++ --with-sysroot=/usr/local/google/home/awdavies/x-tools/mips-qca-linux-uclibc/mips-qca-linux-uclibc/sysroot --enable-target-optspace --with-gmp=/usr/local/google/home/awdavies/proj/crosstool/mips32r2/.build/mips-qca-linux-uclibc/buildtools --with-mpfr=/usr/local/google/home/awdavies/proj/crosstool/mips32r2/.build/mips-qca-linux-uclibc/buildtools --with-gnu-ld --disable-__cta_atexit --disable-libssp --disable-libmudflap --enable-shared --disable-nls --enable-threads --disable-multilib --disable-decimal-float --with-float=soft --with-abi=32 --with-mtune=mips32r2";
 static const char thread_model[] = "posix";
 
 static const struct {
   const char *name, *value;
-} configure_default_options[] = { { "abi", "32" }, { "arch", "mips32r2" }, { "tune", "mips32r2" }, { "float", "soft" }, { "llsc", "llsc" }, { "mips-plt", "plt" }, { "synci", "no-synci" } };
+} configure_default_options[] = { { "abi", "32" }, { "float", "soft" }, { "llsc", "llsc" }, { "synci", "no-synci" } };
diff --git a/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/insn-flags.h b/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/insn-flags.h
index ac1fff2..05bc828 100644
--- a/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/insn-flags.h
+++ b/lib/gcc/mips-qca-linux-uclibc/4.6.4/plugin/include/insn-flags.h
@@ -248,6 +248,8 @@
 #define HAVE_consttable_int (TARGET_MIPS16)
 #define HAVE_consttable_float (TARGET_MIPS16)
 #define HAVE_align 1
+#define HAVE_tls_get_tp_si ((HAVE_AS_TLS && !TARGET_MIPS16) && (Pmode == SImode))
+#define HAVE_tls_get_tp_di ((HAVE_AS_TLS && !TARGET_MIPS16) && (Pmode == DImode))
 #define HAVE_sync_compare_and_swapsi (GENERATE_LL_SC)
 #define HAVE_sync_compare_and_swapdi ((GENERATE_LL_SC) && (TARGET_64BIT))
 #define HAVE_compare_and_swap_12 (GENERATE_LL_SC)
@@ -1044,18 +1046,8 @@
 extern rtx        gen_consttable_int                  (rtx, rtx);
 extern rtx        gen_consttable_float                (rtx);
 extern rtx        gen_align                           (rtx);
-static inline rtx gen_tls_get_tp_si                   (rtx);
-static inline rtx
-gen_tls_get_tp_si(rtx ARG_UNUSED (a))
-{
-  return 0;
-}
-static inline rtx gen_tls_get_tp_di                   (rtx);
-static inline rtx
-gen_tls_get_tp_di(rtx ARG_UNUSED (a))
-{
-  return 0;
-}
+extern rtx        gen_tls_get_tp_si                   (rtx);
+extern rtx        gen_tls_get_tp_di                   (rtx);
 extern rtx        gen_sync_compare_and_swapsi         (rtx, rtx, rtx, rtx);
 extern rtx        gen_sync_compare_and_swapdi         (rtx, rtx, rtx, rtx);
 extern rtx        gen_compare_and_swap_12             (rtx, rtx, rtx, rtx, rtx, rtx);
diff --git a/lib/libiberty.a b/lib/libiberty.a
index 52e5c06..2daea34 100644
--- a/lib/libiberty.a
+++ b/lib/libiberty.a
Binary files differ
diff --git a/lib32 b/lib32
deleted file mode 120000
index 7951405..0000000
--- a/lib32
+++ /dev/null
@@ -1 +0,0 @@
-lib
\ No newline at end of file
diff --git a/lib64 b/lib64
deleted file mode 120000
index 7951405..0000000
--- a/lib64
+++ /dev/null
@@ -1 +0,0 @@
-lib
\ No newline at end of file
diff --git a/libexec/gcc/mips-qca-linux-uclibc/4.6.4/cc1 b/libexec/gcc/mips-qca-linux-uclibc/4.6.4/cc1
index d9946c9..93afbc2 100755
--- a/libexec/gcc/mips-qca-linux-uclibc/4.6.4/cc1
+++ b/libexec/gcc/mips-qca-linux-uclibc/4.6.4/cc1
Binary files differ
diff --git a/libexec/gcc/mips-qca-linux-uclibc/4.6.4/cc1plus b/libexec/gcc/mips-qca-linux-uclibc/4.6.4/cc1plus
index a89d9ca..a1c9969 100755
--- a/libexec/gcc/mips-qca-linux-uclibc/4.6.4/cc1plus
+++ b/libexec/gcc/mips-qca-linux-uclibc/4.6.4/cc1plus
Binary files differ
diff --git a/libexec/gcc/mips-qca-linux-uclibc/4.6.4/collect2 b/libexec/gcc/mips-qca-linux-uclibc/4.6.4/collect2
index 040a08e..bf7112e 100755
--- a/libexec/gcc/mips-qca-linux-uclibc/4.6.4/collect2
+++ b/libexec/gcc/mips-qca-linux-uclibc/4.6.4/collect2
Binary files differ
diff --git a/libexec/gcc/mips-qca-linux-uclibc/4.6.4/lto1 b/libexec/gcc/mips-qca-linux-uclibc/4.6.4/lto1
index d681240..a873f86 100755
--- a/libexec/gcc/mips-qca-linux-uclibc/4.6.4/lto1
+++ b/libexec/gcc/mips-qca-linux-uclibc/4.6.4/lto1
Binary files differ
diff --git a/mips-qca-linux-uclibc/bin/c++ b/mips-qca-linux-uclibc/bin/c++
index e682358..8094f18 100755
--- a/mips-qca-linux-uclibc/bin/c++
+++ b/mips-qca-linux-uclibc/bin/c++
Binary files differ
diff --git a/mips-qca-linux-uclibc/bin/g++ b/mips-qca-linux-uclibc/bin/g++
index e682358..8094f18 100755
--- a/mips-qca-linux-uclibc/bin/g++
+++ b/mips-qca-linux-uclibc/bin/g++
Binary files differ
diff --git a/mips-qca-linux-uclibc/bin/gcc b/mips-qca-linux-uclibc/bin/gcc
index 13ed9fa..7701b19 100755
--- a/mips-qca-linux-uclibc/bin/gcc
+++ b/mips-qca-linux-uclibc/bin/gcc
Binary files differ
diff --git a/mips-qca-linux-uclibc/debug-root/usr/bin/gdbserver b/mips-qca-linux-uclibc/debug-root/usr/bin/gdbserver
index 88701c9..6fd750d 100755
--- a/mips-qca-linux-uclibc/debug-root/usr/bin/gdbserver
+++ b/mips-qca-linux-uclibc/debug-root/usr/bin/gdbserver
Binary files differ
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/cstdio b/mips-qca-linux-uclibc/include/c++/4.6.4/cstdio
index 049704d..2a3e76b 100644
--- a/mips-qca-linux-uclibc/include/c++/4.6.4/cstdio
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/cstdio
@@ -130,7 +130,7 @@
   using ::sprintf;
   using ::sscanf;
   using ::tmpfile;
-  using ::tmpnam;
+  //using ::tmpnam;
   using ::ungetc;
   using ::vfprintf;
   using ::vprintf;
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algo.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algo.h
new file mode 100644
index 0000000..b27de9b
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algo.h
@@ -0,0 +1,2363 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/algo.h
+ *  @brief Parallel STL function calls corresponding to the stl_algo.h header.
+ *
+ *  The functions defined here mainly do case switches and
+ *  call the actual parallelized versions in other files.
+ *  Inlining policy: Functions that basically only contain one function call,
+ *  are declared inline.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_ALGO_H
+#define _GLIBCXX_PARALLEL_ALGO_H 1
+
+#include <parallel/algorithmfwd.h>
+#include <bits/stl_algobase.h>
+#include <bits/stl_algo.h>
+#include <parallel/iterator.h>
+#include <parallel/base.h>
+#include <parallel/sort.h>
+#include <parallel/workstealing.h>
+#include <parallel/par_loop.h>
+#include <parallel/omp_loop.h>
+#include <parallel/omp_loop_static.h>
+#include <parallel/for_each_selectors.h>
+#include <parallel/for_each.h>
+#include <parallel/find.h>
+#include <parallel/find_selectors.h>
+#include <parallel/search.h>
+#include <parallel/random_shuffle.h>
+#include <parallel/partition.h>
+#include <parallel/merge.h>
+#include <parallel/unique_copy.h>
+#include <parallel/set_operations.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __parallel
+{
+  // Sequential fallback
+  template<typename _IIter, typename _Function>
+    inline _Function
+    for_each(_IIter __begin, _IIter __end, _Function __f, 
+             __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::for_each(__begin, __end, __f); }
+
+
+  // Sequential fallback for input iterator case
+  template<typename _IIter, typename _Function, typename _IteratorTag>
+    inline _Function
+    __for_each_switch(_IIter __begin, _IIter __end, _Function __f, 
+                    _IteratorTag)
+    { return for_each(__begin, __end, __f, __gnu_parallel::sequential_tag()); }
+
+  // Parallel algorithm for random access iterators
+  template<typename _RAIter, typename _Function>
+    _Function
+    __for_each_switch(_RAIter __begin, _RAIter __end, 
+                    _Function __f, random_access_iterator_tag, 
+                    __gnu_parallel::_Parallelism __parallelism_tag
+                    = __gnu_parallel::parallel_balanced)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().for_each_minimal_n
+            && __gnu_parallel::__is_parallel(__parallelism_tag)))
+        {
+          bool __dummy;
+    __gnu_parallel::__for_each_selector<_RAIter> __functionality;
+
+          return __gnu_parallel::
+            __for_each_template_random_access(
+              __begin, __end, __f, __functionality,
+              __gnu_parallel::_DummyReduct(), true, __dummy, -1,
+              __parallelism_tag);
+        }
+      else
+        return for_each(__begin, __end, __f, __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface
+  template<typename _Iterator, typename _Function>
+    inline _Function
+    for_each(_Iterator __begin, _Iterator __end, _Function __f, 
+             __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef std::iterator_traits<_Iterator> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      return __for_each_switch(__begin, __end, __f, _IteratorCategory(), 
+                             __parallelism_tag);
+    }
+
+  template<typename _Iterator, typename _Function>
+    inline _Function
+    for_each(_Iterator __begin, _Iterator __end, _Function __f) 
+    {
+      typedef std::iterator_traits<_Iterator> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      return __for_each_switch(__begin, __end, __f, _IteratorCategory());
+    }
+
+
+  // Sequential fallback
+  template<typename _IIter, typename _Tp>
+    inline _IIter
+    find(_IIter __begin, _IIter __end, const _Tp& __val, 
+         __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::find(__begin, __end, __val); }
+
+  // Sequential fallback for input iterator case
+  template<typename _IIter, typename _Tp, typename _IteratorTag>
+    inline _IIter
+    __find_switch(_IIter __begin, _IIter __end, const _Tp& __val,
+                _IteratorTag)
+    { return _GLIBCXX_STD_A::find(__begin, __end, __val); }
+
+  // Parallel find for random access iterators
+  template<typename _RAIter, typename _Tp>
+    _RAIter
+    __find_switch(_RAIter __begin, _RAIter __end,
+                const _Tp& __val, random_access_iterator_tag)
+    {
+      typedef iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+
+      if (_GLIBCXX_PARALLEL_CONDITION(true))
+        {
+	  std::binder2nd<__gnu_parallel::_EqualTo<_ValueType, const _Tp&> >
+            __comp(__gnu_parallel::_EqualTo<_ValueType, const _Tp&>(), __val);
+          return __gnu_parallel::__find_template(
+                   __begin, __end, __begin, __comp,
+                   __gnu_parallel::__find_if_selector()).first;
+        }
+      else
+        return _GLIBCXX_STD_A::find(__begin, __end, __val);
+    }
+
+  // Public interface
+  template<typename _IIter, typename _Tp>
+    inline _IIter
+    find(_IIter __begin, _IIter __end, const _Tp& __val)
+    {
+      typedef std::iterator_traits<_IIter> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      return __find_switch(__begin, __end, __val, _IteratorCategory());
+    }
+
+  // Sequential fallback
+  template<typename _IIter, typename _Predicate>
+    inline _IIter
+    find_if(_IIter __begin, _IIter __end, _Predicate __pred, 
+            __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::find_if(__begin, __end, __pred); }
+
+  // Sequential fallback for input iterator case
+  template<typename _IIter, typename _Predicate, typename _IteratorTag>
+    inline _IIter
+    __find_if_switch(_IIter __begin, _IIter __end, _Predicate __pred, 
+                   _IteratorTag)
+    { return _GLIBCXX_STD_A::find_if(__begin, __end, __pred); }
+
+  // Parallel find_if for random access iterators
+  template<typename _RAIter, typename _Predicate>
+    _RAIter
+    __find_if_switch(_RAIter __begin, _RAIter __end, 
+                   _Predicate __pred, random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(true))
+        return __gnu_parallel::__find_template(__begin, __end, __begin, __pred,
+                                             __gnu_parallel::
+                                             __find_if_selector()).first;
+      else
+        return _GLIBCXX_STD_A::find_if(__begin, __end, __pred);
+    }
+
+  // Public interface
+  template<typename _IIter, typename _Predicate>
+    inline _IIter
+    find_if(_IIter __begin, _IIter __end, _Predicate __pred)
+    {
+      typedef std::iterator_traits<_IIter> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      return __find_if_switch(__begin, __end, __pred, _IteratorCategory());
+    }
+
+  // Sequential fallback
+  template<typename _IIter, typename _FIterator>
+    inline _IIter
+    find_first_of(_IIter __begin1, _IIter __end1, 
+                  _FIterator __begin2, _FIterator __end2, 
+                  __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::find_first_of(__begin1, __end1, __begin2, __end2);
+      }
+
+  // Sequential fallback
+  template<typename _IIter, typename _FIterator,
+           typename _BinaryPredicate>
+    inline _IIter
+    find_first_of(_IIter __begin1, _IIter __end1,
+                  _FIterator __begin2, _FIterator __end2,
+                  _BinaryPredicate __comp, __gnu_parallel::sequential_tag)
+  { return _GLIBCXX_STD_A::find_first_of(
+             __begin1, __end1, __begin2, __end2, __comp); }
+
+  // Sequential fallback for input iterator type
+  template<typename _IIter, typename _FIterator,
+           typename _IteratorTag1, typename _IteratorTag2>
+    inline _IIter
+    __find_first_of_switch(_IIter __begin1, _IIter __end1,
+                         _FIterator __begin2, _FIterator __end2, 
+                         _IteratorTag1, _IteratorTag2)
+    { return find_first_of(__begin1, __end1, __begin2, __end2, 
+                           __gnu_parallel::sequential_tag()); }
+
+  // Parallel algorithm for random access iterators
+  template<typename _RAIter, typename _FIterator,
+           typename _BinaryPredicate, typename _IteratorTag>
+    inline _RAIter
+    __find_first_of_switch(_RAIter __begin1,
+                         _RAIter __end1,
+                         _FIterator __begin2, _FIterator __end2, 
+                         _BinaryPredicate __comp, random_access_iterator_tag, 
+                         _IteratorTag)
+    {
+      return __gnu_parallel::
+        __find_template(__begin1, __end1, __begin1, __comp,
+                      __gnu_parallel::__find_first_of_selector
+                      <_FIterator>(__begin2, __end2)).first;
+    }
+
+  // Sequential fallback for input iterator type
+  template<typename _IIter, typename _FIterator,
+           typename _BinaryPredicate, typename _IteratorTag1,
+           typename _IteratorTag2>
+    inline _IIter
+    __find_first_of_switch(_IIter __begin1, _IIter __end1,
+                         _FIterator __begin2, _FIterator __end2, 
+                         _BinaryPredicate __comp, _IteratorTag1, _IteratorTag2)
+    { return find_first_of(__begin1, __end1, __begin2, __end2, __comp, 
+                           __gnu_parallel::sequential_tag()); }
+
+  // Public interface
+  template<typename _IIter, typename _FIterator,
+           typename _BinaryPredicate>
+    inline _IIter
+    find_first_of(_IIter __begin1, _IIter __end1,
+                  _FIterator __begin2, _FIterator __end2, 
+                  _BinaryPredicate __comp)
+    {
+      typedef std::iterator_traits<_IIter> _IIterTraits;
+      typedef std::iterator_traits<_FIterator> _FIterTraits;
+      typedef typename _IIterTraits::iterator_category _IIteratorCategory;
+      typedef typename _FIterTraits::iterator_category _FIteratorCategory;
+
+      return __find_first_of_switch(__begin1, __end1, __begin2, __end2, __comp,
+                                  _IIteratorCategory(), _FIteratorCategory());
+    }
+
+  // Public interface, insert default comparator
+  template<typename _IIter, typename _FIterator>
+    inline _IIter
+    find_first_of(_IIter __begin1, _IIter __end1, 
+                  _FIterator __begin2, _FIterator __end2)
+    {
+      typedef std::iterator_traits<_IIter> _IIterTraits;
+      typedef std::iterator_traits<_FIterator> _FIterTraits;
+      typedef typename _IIterTraits::value_type _IValueType;
+      typedef typename _FIterTraits::value_type _FValueType;
+
+      return __gnu_parallel::find_first_of(__begin1, __end1, __begin2, __end2,
+                         __gnu_parallel::_EqualTo<_IValueType, _FValueType>());
+    }
+
+  // Sequential fallback
+  template<typename _IIter, typename _OutputIterator>
+    inline _OutputIterator
+    unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out,
+                __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::unique_copy(__begin1, __end1, __out); }
+
+  // Sequential fallback
+  template<typename _IIter, typename _OutputIterator,
+           typename _Predicate>
+    inline _OutputIterator
+    unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out,
+                _Predicate __pred, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::unique_copy(__begin1, __end1, __out, __pred); }
+
+  // Sequential fallback for input iterator case
+  template<typename _IIter, typename _OutputIterator,
+           typename _Predicate, typename _IteratorTag1, typename _IteratorTag2>
+    inline _OutputIterator
+    __unique_copy_switch(_IIter __begin, _IIter __last, 
+                       _OutputIterator __out, _Predicate __pred, 
+                       _IteratorTag1, _IteratorTag2)
+    { return _GLIBCXX_STD_A::unique_copy(__begin, __last, __out, __pred); }
+
+  // Parallel unique_copy for random access iterators
+  template<typename _RAIter, typename RandomAccessOutputIterator,
+           typename _Predicate>
+    RandomAccessOutputIterator
+    __unique_copy_switch(_RAIter __begin, _RAIter __last, 
+                       RandomAccessOutputIterator __out, _Predicate __pred, 
+                       random_access_iterator_tag, random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__last - __begin)
+            > __gnu_parallel::_Settings::get().unique_copy_minimal_n))
+        return __gnu_parallel::__parallel_unique_copy(
+                 __begin, __last, __out, __pred);
+      else
+        return _GLIBCXX_STD_A::unique_copy(__begin, __last, __out, __pred);
+    }
+
+  // Public interface
+  template<typename _IIter, typename _OutputIterator>
+    inline _OutputIterator
+    unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out)
+    {
+      typedef std::iterator_traits<_IIter> _IIterTraits;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits::iterator_category _IIteratorCategory;
+      typedef typename _IIterTraits::value_type _ValueType;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+
+      return __unique_copy_switch(
+               __begin1, __end1, __out, equal_to<_ValueType>(),
+               _IIteratorCategory(), _OIterCategory());
+    }
+
+  // Public interface
+  template<typename _IIter, typename _OutputIterator, typename _Predicate>
+    inline _OutputIterator
+    unique_copy(_IIter __begin1, _IIter __end1, _OutputIterator __out,
+                _Predicate __pred)
+    {
+      typedef std::iterator_traits<_IIter> _IIterTraits;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits::iterator_category _IIteratorCategory;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+
+      return __unique_copy_switch(
+               __begin1, __end1, __out, __pred,
+               _IIteratorCategory(), _OIterCategory());
+    }
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator>
+    inline _OutputIterator
+    set_union(_IIter1 __begin1, _IIter1 __end1,
+              _IIter2 __begin2, _IIter2 __end2,
+              _OutputIterator __out, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::set_union(
+               __begin1, __end1, __begin2, __end2, __out); }
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _Predicate>
+    inline _OutputIterator
+    set_union(_IIter1 __begin1, _IIter1 __end1,
+              _IIter2 __begin2, _IIter2 __end2,
+              _OutputIterator __out, _Predicate __pred,
+              __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::set_union(__begin1, __end1,
+                                       __begin2, __end2, __out, __pred); }
+
+  // Sequential fallback for input iterator case
+  template<typename _IIter1, typename _IIter2, typename _Predicate,
+           typename _OutputIterator, typename _IteratorTag1,
+           typename _IteratorTag2, typename _IteratorTag3>
+    inline _OutputIterator
+    __set_union_switch(
+      _IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2,
+      _OutputIterator __result, _Predicate __pred,
+      _IteratorTag1, _IteratorTag2, _IteratorTag3)
+    { return _GLIBCXX_STD_A::set_union(__begin1, __end1,
+                                       __begin2, __end2, __result, __pred); }
+
+  // Parallel set_union for random access iterators
+  template<typename _RAIter1, typename _RAIter2,
+           typename _Output_RAIter, typename _Predicate>
+    _Output_RAIter
+    __set_union_switch(_RAIter1 __begin1, _RAIter1 __end1, 
+                     _RAIter2 __begin2, _RAIter2 __end2, 
+                     _Output_RAIter __result, _Predicate __pred,
+                     random_access_iterator_tag, random_access_iterator_tag, 
+                     random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
+            >= __gnu_parallel::_Settings::get().set_union_minimal_n
+            || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2)
+            >= __gnu_parallel::_Settings::get().set_union_minimal_n))
+        return __gnu_parallel::__parallel_set_union(
+                 __begin1, __end1, __begin2, __end2, __result, __pred);
+      else
+        return _GLIBCXX_STD_A::set_union(__begin1, __end1,
+                                         __begin2, __end2, __result, __pred);
+    }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator>
+    inline _OutputIterator 
+    set_union(_IIter1 __begin1, _IIter1 __end1,
+              _IIter2 __begin2, _IIter2 __end2, _OutputIterator __out)
+    {
+      typedef std::iterator_traits<_IIter1> _IIterTraits1;
+      typedef std::iterator_traits<_IIter2> _IIterTraits2;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits1::iterator_category
+        _IIterCategory1;
+      typedef typename _IIterTraits2::iterator_category
+        _IIterCategory2;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+      typedef typename _IIterTraits1::value_type _ValueType1;
+      typedef typename _IIterTraits2::value_type _ValueType2;
+
+      return __set_union_switch(
+               __begin1, __end1, __begin2, __end2, __out,
+               __gnu_parallel::_Less<_ValueType1, _ValueType2>(),
+               _IIterCategory1(), _IIterCategory2(), _OIterCategory());
+    }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _Predicate>
+    inline _OutputIterator 
+    set_union(_IIter1 __begin1, _IIter1 __end1,
+              _IIter2 __begin2, _IIter2 __end2,
+              _OutputIterator __out, _Predicate __pred)
+    {
+      typedef std::iterator_traits<_IIter1> _IIterTraits1;
+      typedef std::iterator_traits<_IIter2> _IIterTraits2;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits1::iterator_category
+        _IIterCategory1;
+      typedef typename _IIterTraits2::iterator_category
+        _IIterCategory2;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+
+      return __set_union_switch(
+               __begin1, __end1, __begin2, __end2, __out, __pred,
+               _IIterCategory1(), _IIterCategory2(), _OIterCategory());
+    }
+
+  // Sequential fallback.
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator>
+    inline _OutputIterator
+    set_intersection(_IIter1 __begin1, _IIter1 __end1,
+                     _IIter2 __begin2, _IIter2 __end2,
+                     _OutputIterator __out, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::set_intersection(__begin1, __end1,
+                                              __begin2, __end2, __out); }
+
+  // Sequential fallback.
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _Predicate>
+    inline _OutputIterator
+    set_intersection(_IIter1 __begin1, _IIter1 __end1,
+                     _IIter2 __begin2, _IIter2 __end2,
+                     _OutputIterator __out, _Predicate __pred, 
+                     __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::set_intersection(
+               __begin1, __end1, __begin2, __end2, __out, __pred); }
+
+  // Sequential fallback for input iterator case
+  template<typename _IIter1, typename _IIter2,
+           typename _Predicate, typename _OutputIterator,
+           typename _IteratorTag1, typename _IteratorTag2,
+           typename _IteratorTag3>
+    inline _OutputIterator 
+    __set_intersection_switch(_IIter1 __begin1, _IIter1 __end1,
+                              _IIter2 __begin2, _IIter2 __end2,
+                              _OutputIterator __result, _Predicate __pred,
+                              _IteratorTag1, _IteratorTag2, _IteratorTag3)
+    { return _GLIBCXX_STD_A::set_intersection(__begin1, __end1, __begin2,
+                                              __end2, __result, __pred); }
+
+  // Parallel set_intersection for random access iterators
+  template<typename _RAIter1, typename _RAIter2,
+           typename _Output_RAIter, typename _Predicate>
+    _Output_RAIter
+    __set_intersection_switch(_RAIter1 __begin1,
+                            _RAIter1 __end1,
+                            _RAIter2 __begin2,
+                            _RAIter2 __end2,
+                            _Output_RAIter __result,
+                            _Predicate __pred,
+                            random_access_iterator_tag,
+                            random_access_iterator_tag,
+                            random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
+            >= __gnu_parallel::_Settings::get().set_union_minimal_n
+            || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2)
+            >= __gnu_parallel::_Settings::get().set_union_minimal_n))
+        return __gnu_parallel::__parallel_set_intersection(
+                 __begin1, __end1, __begin2, __end2, __result, __pred);
+      else
+        return _GLIBCXX_STD_A::set_intersection(
+                 __begin1, __end1, __begin2, __end2, __result, __pred);
+    }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator>
+    inline _OutputIterator 
+    set_intersection(_IIter1 __begin1, _IIter1 __end1, 
+                     _IIter2 __begin2, _IIter2 __end2, 
+                     _OutputIterator __out)
+    {
+      typedef std::iterator_traits<_IIter1> _IIterTraits1;
+      typedef std::iterator_traits<_IIter2> _IIterTraits2;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits1::iterator_category
+        _IIterCategory1;
+      typedef typename _IIterTraits2::iterator_category
+        _IIterCategory2;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+      typedef typename _IIterTraits1::value_type _ValueType1;
+      typedef typename _IIterTraits2::value_type _ValueType2;
+
+      return __set_intersection_switch(
+               __begin1, __end1, __begin2, __end2, __out,
+               __gnu_parallel::_Less<_ValueType1, _ValueType2>(),
+               _IIterCategory1(), _IIterCategory2(), _OIterCategory());
+    }
+
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _Predicate>
+    inline _OutputIterator 
+    set_intersection(_IIter1 __begin1, _IIter1 __end1,
+                     _IIter2 __begin2, _IIter2 __end2,
+                     _OutputIterator __out, _Predicate __pred)
+    {
+      typedef std::iterator_traits<_IIter1> _IIterTraits1;
+      typedef std::iterator_traits<_IIter2> _IIterTraits2;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits1::iterator_category
+        _IIterCategory1;
+      typedef typename _IIterTraits2::iterator_category
+        _IIterCategory2;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+
+      return __set_intersection_switch(
+               __begin1, __end1, __begin2, __end2, __out, __pred,
+               _IIterCategory1(), _IIterCategory2(), _OIterCategory());
+    }
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator>
+    inline _OutputIterator
+    set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1,
+                             _IIter2 __begin2, _IIter2 __end2,
+                             _OutputIterator __out,
+                             __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::set_symmetric_difference(
+               __begin1, __end1, __begin2, __end2, __out); }
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _Predicate>
+    inline _OutputIterator
+    set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1,
+                             _IIter2 __begin2, _IIter2 __end2,
+                             _OutputIterator __out, _Predicate __pred,
+                             __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::set_symmetric_difference(
+               __begin1, __end1, __begin2, __end2, __out, __pred); }
+
+  // Sequential fallback for input iterator case
+  template<typename _IIter1, typename _IIter2,
+           typename _Predicate, typename _OutputIterator,
+           typename _IteratorTag1, typename _IteratorTag2,
+           typename _IteratorTag3>
+    inline _OutputIterator 
+    __set_symmetric_difference_switch(
+      _IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, _IIter2 __end2,
+      _OutputIterator __result, _Predicate __pred,
+      _IteratorTag1, _IteratorTag2, _IteratorTag3)
+    { return _GLIBCXX_STD_A::set_symmetric_difference(
+               __begin1, __end1, __begin2, __end2, __result, __pred); }
+
+  // Parallel set_symmetric_difference for random access iterators
+  template<typename _RAIter1, typename _RAIter2,
+           typename _Output_RAIter, typename _Predicate>
+    _Output_RAIter
+    __set_symmetric_difference_switch(_RAIter1 __begin1,
+                                    _RAIter1 __end1,
+                                    _RAIter2 __begin2,
+                                    _RAIter2 __end2,
+                                    _Output_RAIter __result,
+                                    _Predicate __pred,
+                                    random_access_iterator_tag,
+                                    random_access_iterator_tag,
+                                    random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+      static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
+      >= __gnu_parallel::_Settings::get().set_symmetric_difference_minimal_n
+      || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2)
+      >= __gnu_parallel::_Settings::get().set_symmetric_difference_minimal_n))
+  return __gnu_parallel::__parallel_set_symmetric_difference(
+           __begin1, __end1, __begin2, __end2, __result, __pred);
+      else
+        return _GLIBCXX_STD_A::set_symmetric_difference(
+                 __begin1, __end1, __begin2, __end2, __result, __pred);
+    }
+
+  // Public interface.
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator>
+    inline _OutputIterator 
+    set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1,
+                             _IIter2 __begin2, _IIter2 __end2,
+                             _OutputIterator __out)
+    {
+      typedef std::iterator_traits<_IIter1> _IIterTraits1;
+      typedef std::iterator_traits<_IIter2> _IIterTraits2;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits1::iterator_category
+        _IIterCategory1;
+      typedef typename _IIterTraits2::iterator_category
+        _IIterCategory2;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+      typedef typename _IIterTraits1::value_type _ValueType1;
+      typedef typename _IIterTraits2::value_type _ValueType2;
+
+      return __set_symmetric_difference_switch(
+               __begin1, __end1, __begin2, __end2, __out,
+               __gnu_parallel::_Less<_ValueType1, _ValueType2>(),
+               _IIterCategory1(), _IIterCategory2(), _OIterCategory());
+    }
+
+  // Public interface.
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _Predicate>
+    inline _OutputIterator 
+    set_symmetric_difference(_IIter1 __begin1, _IIter1 __end1,
+                             _IIter2 __begin2, _IIter2 __end2,
+                             _OutputIterator __out, _Predicate __pred)
+    {
+      typedef std::iterator_traits<_IIter1> _IIterTraits1;
+      typedef std::iterator_traits<_IIter2> _IIterTraits2;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits1::iterator_category
+        _IIterCategory1;
+      typedef typename _IIterTraits2::iterator_category
+        _IIterCategory2;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+
+      return __set_symmetric_difference_switch(
+               __begin1, __end1, __begin2, __end2, __out, __pred,
+               _IIterCategory1(), _IIterCategory2(), _OIterCategory());
+    }
+
+  // Sequential fallback.
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator>
+    inline _OutputIterator
+    set_difference(_IIter1 __begin1, _IIter1 __end1, 
+                   _IIter2 __begin2, _IIter2 __end2, 
+                   _OutputIterator __out, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::set_difference(
+               __begin1,__end1, __begin2, __end2, __out); }
+
+  // Sequential fallback.
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _Predicate>
+    inline _OutputIterator
+    set_difference(_IIter1 __begin1, _IIter1 __end1, 
+                   _IIter2 __begin2, _IIter2 __end2, 
+                   _OutputIterator __out, _Predicate __pred, 
+                   __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::set_difference(__begin1, __end1,
+                                            __begin2, __end2, __out, __pred); }
+
+  // Sequential fallback for input iterator case.
+  template<typename _IIter1, typename _IIter2, typename _Predicate,
+           typename _OutputIterator, typename _IteratorTag1,
+           typename _IteratorTag2, typename _IteratorTag3>
+    inline _OutputIterator
+    __set_difference_switch(_IIter1 __begin1, _IIter1 __end1, 
+                          _IIter2 __begin2, _IIter2 __end2, 
+                          _OutputIterator __result, _Predicate __pred, 
+                          _IteratorTag1, _IteratorTag2, _IteratorTag3)
+    { return _GLIBCXX_STD_A::set_difference(
+               __begin1, __end1, __begin2, __end2, __result, __pred); }
+
+  // Parallel set_difference for random access iterators
+  template<typename _RAIter1, typename _RAIter2,
+           typename _Output_RAIter, typename _Predicate>
+    _Output_RAIter
+    __set_difference_switch(_RAIter1 __begin1,
+                          _RAIter1 __end1,
+                          _RAIter2 __begin2,
+                          _RAIter2 __end2,
+                          _Output_RAIter __result, _Predicate __pred,
+                          random_access_iterator_tag,
+                          random_access_iterator_tag,
+                          random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
+            >= __gnu_parallel::_Settings::get().set_difference_minimal_n
+            || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2)
+            >= __gnu_parallel::_Settings::get().set_difference_minimal_n))
+        return __gnu_parallel::__parallel_set_difference(
+                 __begin1, __end1, __begin2, __end2, __result, __pred);
+      else
+        return _GLIBCXX_STD_A::set_difference(
+                 __begin1, __end1, __begin2, __end2, __result, __pred);
+    }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator>
+    inline _OutputIterator
+    set_difference(_IIter1 __begin1, _IIter1 __end1, 
+                   _IIter2 __begin2, _IIter2 __end2, 
+                   _OutputIterator __out)
+    {
+      typedef std::iterator_traits<_IIter1> _IIterTraits1;
+      typedef std::iterator_traits<_IIter2> _IIterTraits2;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits1::iterator_category
+        _IIterCategory1;
+      typedef typename _IIterTraits2::iterator_category
+        _IIterCategory2;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+      typedef typename _IIterTraits1::value_type _ValueType1;
+      typedef typename _IIterTraits2::value_type _ValueType2;
+
+      return __set_difference_switch(
+               __begin1, __end1, __begin2, __end2, __out,
+               __gnu_parallel::_Less<_ValueType1, _ValueType2>(),
+               _IIterCategory1(), _IIterCategory2(), _OIterCategory());
+    }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _Predicate>
+    inline _OutputIterator
+    set_difference(_IIter1 __begin1, _IIter1 __end1, 
+                   _IIter2 __begin2, _IIter2 __end2, 
+                   _OutputIterator __out, _Predicate __pred)
+    {
+      typedef std::iterator_traits<_IIter1> _IIterTraits1;
+      typedef std::iterator_traits<_IIter2> _IIterTraits2;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits1::iterator_category
+        _IIterCategory1;
+      typedef typename _IIterTraits2::iterator_category
+        _IIterCategory2;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+
+      return __set_difference_switch(
+               __begin1, __end1, __begin2, __end2, __out, __pred,
+               _IIterCategory1(), _IIterCategory2(), _OIterCategory());
+    }
+
+  // Sequential fallback
+  template<typename _FIterator>
+    inline _FIterator
+    adjacent_find(_FIterator __begin, _FIterator __end, 
+                  __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::adjacent_find(__begin, __end); }
+
+  // Sequential fallback
+  template<typename _FIterator, typename _BinaryPredicate>
+    inline _FIterator
+    adjacent_find(_FIterator __begin, _FIterator __end, 
+                  _BinaryPredicate __binary_pred,
+                  __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::adjacent_find(__begin, __end, __binary_pred); }
+
+  // Parallel algorithm for random access iterators
+  template<typename _RAIter>
+    _RAIter
+    __adjacent_find_switch(_RAIter __begin, _RAIter __end, 
+                         random_access_iterator_tag)
+    {
+      typedef iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+
+      if (_GLIBCXX_PARALLEL_CONDITION(true))
+        {
+          _RAIter __spot = __gnu_parallel::
+              __find_template(
+                __begin, __end - 1, __begin, equal_to<_ValueType>(),
+                __gnu_parallel::__adjacent_find_selector())
+            .first;
+          if (__spot == (__end - 1))
+            return __end;
+          else
+            return __spot;
+        }
+      else
+        return adjacent_find(__begin, __end, __gnu_parallel::sequential_tag());
+    }
+
+  // Sequential fallback for input iterator case
+  template<typename _FIterator, typename _IteratorTag>
+    inline _FIterator
+    __adjacent_find_switch(_FIterator __begin, _FIterator __end,
+                         _IteratorTag)
+    { return adjacent_find(__begin, __end, __gnu_parallel::sequential_tag()); }
+
+  // Public interface
+  template<typename _FIterator>
+    inline _FIterator
+    adjacent_find(_FIterator __begin, _FIterator __end)
+    {
+      typedef iterator_traits<_FIterator> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      return __adjacent_find_switch(__begin, __end, _IteratorCategory());
+    }
+
+  // Sequential fallback for input iterator case
+  template<typename _FIterator, typename _BinaryPredicate,
+           typename _IteratorTag>
+    inline _FIterator
+    __adjacent_find_switch(_FIterator __begin, _FIterator __end, 
+                         _BinaryPredicate __pred, _IteratorTag)
+    { return adjacent_find(__begin, __end, __pred,
+                           __gnu_parallel::sequential_tag()); }
+
+  // Parallel algorithm for random access iterators
+  template<typename _RAIter, typename _BinaryPredicate>
+    _RAIter
+    __adjacent_find_switch(_RAIter __begin, _RAIter __end, 
+                         _BinaryPredicate __pred, random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(true))
+        return __gnu_parallel::__find_template(__begin, __end, __begin, __pred,
+                                             __gnu_parallel::
+                                             __adjacent_find_selector()).first;
+      else
+        return adjacent_find(__begin, __end, __pred,
+                             __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface
+  template<typename _FIterator, typename _BinaryPredicate>
+    inline _FIterator
+    adjacent_find(_FIterator __begin, _FIterator __end, 
+                  _BinaryPredicate __pred)
+    {
+      typedef iterator_traits<_FIterator> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      return __adjacent_find_switch(__begin, __end, __pred,
+                                    _IteratorCategory());
+    }
+
+  // Sequential fallback
+  template<typename _IIter, typename _Tp>
+    inline typename iterator_traits<_IIter>::difference_type
+    count(_IIter __begin, _IIter __end, const _Tp& __value, 
+          __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::count(__begin, __end, __value); }
+
+  // Parallel code for random access iterators
+  template<typename _RAIter, typename _Tp>
+    typename iterator_traits<_RAIter>::difference_type
+    __count_switch(_RAIter __begin, _RAIter __end, 
+                 const _Tp& __value, random_access_iterator_tag, 
+                 __gnu_parallel::_Parallelism __parallelism_tag 
+                 = __gnu_parallel::parallel_unbalanced)
+    {
+      typedef iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      typedef __gnu_parallel::_SequenceIndex _SequenceIndex;
+
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().count_minimal_n
+            && __gnu_parallel::__is_parallel(__parallelism_tag)))
+        {
+          __gnu_parallel::__count_selector<_RAIter, _DifferenceType>
+            __functionality;
+          _DifferenceType __res = 0;
+          __gnu_parallel::
+            __for_each_template_random_access(
+              __begin, __end, __value, __functionality,
+              std::plus<_SequenceIndex>(), __res, __res, -1,
+              __parallelism_tag);
+          return __res;
+        }
+      else
+        return count(__begin, __end, __value,
+                     __gnu_parallel::sequential_tag());
+    }
+
+  // Sequential fallback for input iterator case.
+  template<typename _IIter, typename _Tp, typename _IteratorTag>
+    inline typename iterator_traits<_IIter>::difference_type
+    __count_switch(_IIter __begin, _IIter __end, const _Tp& __value, 
+                 _IteratorTag)
+    { return count(__begin, __end, __value, __gnu_parallel::sequential_tag());
+      }
+
+  // Public interface.
+  template<typename _IIter, typename _Tp>
+    inline typename iterator_traits<_IIter>::difference_type
+    count(_IIter __begin, _IIter __end, const _Tp& __value, 
+          __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      return __count_switch(__begin, __end, __value, _IteratorCategory(),
+                            __parallelism_tag);
+    }
+
+  template<typename _IIter, typename _Tp>
+    inline typename iterator_traits<_IIter>::difference_type
+    count(_IIter __begin, _IIter __end, const _Tp& __value)
+    {
+      typedef iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      return __count_switch(__begin, __end, __value, _IteratorCategory());
+    }
+
+
+  // Sequential fallback.
+  template<typename _IIter, typename _Predicate>
+    inline typename iterator_traits<_IIter>::difference_type
+    count_if(_IIter __begin, _IIter __end, _Predicate __pred, 
+             __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::count_if(__begin, __end, __pred); }
+
+  // Parallel count_if for random access iterators
+  template<typename _RAIter, typename _Predicate>
+    typename iterator_traits<_RAIter>::difference_type
+    __count_if_switch(_RAIter __begin, _RAIter __end, 
+                    _Predicate __pred, random_access_iterator_tag,
+                    __gnu_parallel::_Parallelism __parallelism_tag
+                    = __gnu_parallel::parallel_unbalanced)
+    {
+      typedef iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      typedef __gnu_parallel::_SequenceIndex _SequenceIndex;
+
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().count_minimal_n
+            && __gnu_parallel::__is_parallel(__parallelism_tag)))
+        {
+          _DifferenceType __res = 0;
+          __gnu_parallel::
+            __count_if_selector<_RAIter, _DifferenceType>
+            __functionality;
+          __gnu_parallel::
+            __for_each_template_random_access(
+              __begin, __end, __pred, __functionality,
+              std::plus<_SequenceIndex>(), __res, __res, -1,
+              __parallelism_tag);
+          return __res;
+        }
+      else
+        return count_if(__begin, __end, __pred,
+                        __gnu_parallel::sequential_tag());
+    }
+
+  // Sequential fallback for input iterator case.
+  template<typename _IIter, typename _Predicate, typename _IteratorTag>
+    inline typename iterator_traits<_IIter>::difference_type
+    __count_if_switch(_IIter __begin, _IIter __end, _Predicate __pred, 
+                    _IteratorTag)
+    { return count_if(__begin, __end, __pred,
+                      __gnu_parallel::sequential_tag()); }
+
+  // Public interface.
+  template<typename _IIter, typename _Predicate>
+    inline typename iterator_traits<_IIter>::difference_type
+    count_if(_IIter __begin, _IIter __end, _Predicate __pred, 
+             __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      return __count_if_switch(__begin, __end, __pred, _IteratorCategory(), 
+                             __parallelism_tag);
+    }
+
+  template<typename _IIter, typename _Predicate>
+    inline typename iterator_traits<_IIter>::difference_type
+    count_if(_IIter __begin, _IIter __end, _Predicate __pred)
+    {
+      typedef iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      return __count_if_switch(__begin, __end, __pred, _IteratorCategory());
+    }
+
+
+  // Sequential fallback.
+  template<typename _FIterator1, typename _FIterator2>
+    inline _FIterator1
+    search(_FIterator1 __begin1, _FIterator1 __end1,
+           _FIterator2 __begin2, _FIterator2 __end2,
+           __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::search(__begin1, __end1, __begin2, __end2); }
+
+  // Parallel algorithm for random access iterator
+  template<typename _RAIter1, typename _RAIter2>
+    _RAIter1
+    __search_switch(_RAIter1 __begin1, _RAIter1 __end1,
+                  _RAIter2 __begin2, _RAIter2 __end2,
+                  random_access_iterator_tag, random_access_iterator_tag)
+    {
+      typedef std::iterator_traits<_RAIter1> _Iterator1Traits;
+      typedef typename _Iterator1Traits::value_type _ValueType1;
+      typedef std::iterator_traits<_RAIter2> _Iterator2Traits;
+      typedef typename _Iterator2Traits::value_type _ValueType2;
+
+      if (_GLIBCXX_PARALLEL_CONDITION(
+                static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
+            >= __gnu_parallel::_Settings::get().search_minimal_n))
+        return __gnu_parallel::
+          __search_template(
+            __begin1, __end1, __begin2, __end2,
+            __gnu_parallel::_EqualTo<_ValueType1, _ValueType2>());
+      else
+        return search(__begin1, __end1, __begin2, __end2,
+                      __gnu_parallel::sequential_tag());
+    }
+
+  // Sequential fallback for input iterator case
+  template<typename _FIterator1, typename _FIterator2,
+           typename _IteratorTag1, typename _IteratorTag2>
+    inline _FIterator1
+    __search_switch(_FIterator1 __begin1, _FIterator1 __end1,
+                  _FIterator2 __begin2, _FIterator2 __end2,
+                  _IteratorTag1, _IteratorTag2)
+    { return search(__begin1, __end1, __begin2, __end2,
+                    __gnu_parallel::sequential_tag()); }
+
+  // Public interface.
+  template<typename _FIterator1, typename _FIterator2>
+    inline _FIterator1
+    search(_FIterator1 __begin1, _FIterator1 __end1,
+           _FIterator2 __begin2, _FIterator2 __end2)
+    {
+      typedef std::iterator_traits<_FIterator1> _Iterator1Traits;
+      typedef typename _Iterator1Traits::iterator_category _IteratorCategory1;
+      typedef std::iterator_traits<_FIterator2> _Iterator2Traits;
+      typedef typename _Iterator2Traits::iterator_category _IteratorCategory2;
+
+      return __search_switch(__begin1, __end1, __begin2, __end2,
+                           _IteratorCategory1(), _IteratorCategory2());
+    }
+
+  // Public interface.
+  template<typename _FIterator1, typename _FIterator2,
+           typename _BinaryPredicate>
+    inline _FIterator1
+    search(_FIterator1 __begin1, _FIterator1 __end1,
+           _FIterator2 __begin2, _FIterator2 __end2,
+           _BinaryPredicate __pred, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::search(
+                               __begin1, __end1, __begin2, __end2, __pred); }
+
+  // Parallel algorithm for random access iterator.
+  template<typename _RAIter1, typename _RAIter2,
+           typename _BinaryPredicate>
+    _RAIter1
+    __search_switch(_RAIter1 __begin1, _RAIter1 __end1,
+                  _RAIter2 __begin2, _RAIter2 __end2,
+                  _BinaryPredicate __pred,
+                  random_access_iterator_tag, random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+                static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
+            >= __gnu_parallel::_Settings::get().search_minimal_n))
+        return __gnu_parallel::__search_template(__begin1, __end1,
+                                               __begin2, __end2, __pred);
+      else
+        return search(__begin1, __end1, __begin2, __end2, __pred,
+                      __gnu_parallel::sequential_tag());
+    }
+
+  // Sequential fallback for input iterator case
+  template<typename _FIterator1, typename _FIterator2,
+           typename _BinaryPredicate, typename _IteratorTag1,
+           typename _IteratorTag2>
+    inline _FIterator1
+    __search_switch(_FIterator1 __begin1, _FIterator1 __end1,
+                  _FIterator2 __begin2, _FIterator2 __end2,
+                  _BinaryPredicate __pred, _IteratorTag1, _IteratorTag2)
+    { return search(__begin1, __end1, __begin2, __end2, __pred,
+                    __gnu_parallel::sequential_tag()); }
+
+  // Public interface
+  template<typename _FIterator1, typename _FIterator2,
+           typename _BinaryPredicate>
+    inline _FIterator1
+    search(_FIterator1 __begin1, _FIterator1 __end1,
+           _FIterator2 __begin2, _FIterator2 __end2,
+           _BinaryPredicate  __pred)
+    {
+      typedef std::iterator_traits<_FIterator1> _Iterator1Traits;
+      typedef typename _Iterator1Traits::iterator_category _IteratorCategory1;
+      typedef std::iterator_traits<_FIterator2> _Iterator2Traits;
+      typedef typename _Iterator2Traits::iterator_category _IteratorCategory2;
+      return __search_switch(__begin1, __end1, __begin2, __end2, __pred,
+                           _IteratorCategory1(), _IteratorCategory2());
+    }
+
+  // Sequential fallback
+  template<typename _FIterator, typename _Integer, typename _Tp>
+    inline _FIterator
+    search_n(_FIterator __begin, _FIterator __end, _Integer __count,
+             const _Tp& __val, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val); }
+
+  // Sequential fallback
+  template<typename _FIterator, typename _Integer, typename _Tp,
+           typename _BinaryPredicate>
+    inline _FIterator
+    search_n(_FIterator __begin, _FIterator __end, _Integer __count,
+             const _Tp& __val, _BinaryPredicate __binary_pred,
+             __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::search_n(
+               __begin, __end, __count, __val, __binary_pred); }
+
+  // Public interface.
+  template<typename _FIterator, typename _Integer, typename _Tp>
+    inline _FIterator
+    search_n(_FIterator __begin, _FIterator __end, _Integer __count,
+             const _Tp& __val)
+    {
+      typedef typename iterator_traits<_FIterator>::value_type _ValueType;
+      return __gnu_parallel::search_n(__begin, __end, __count, __val,
+                      __gnu_parallel::_EqualTo<_ValueType, _Tp>());
+    }
+
+  // Parallel algorithm for random access iterators.
+  template<typename _RAIter, typename _Integer,
+           typename _Tp, typename _BinaryPredicate>
+    _RAIter
+    __search_n_switch(_RAIter __begin, _RAIter __end, _Integer __count,
+                      const _Tp& __val, _BinaryPredicate __binary_pred,
+                      random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+                static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().search_minimal_n))
+        {
+          __gnu_parallel::_PseudoSequence<_Tp, _Integer> __ps(__val, __count);
+          return __gnu_parallel::__search_template(
+                   __begin, __end, __ps.begin(), __ps.end(), __binary_pred);
+        }
+      else
+        return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val,
+                                        __binary_pred);
+    }
+
+  // Sequential fallback for input iterator case.
+  template<typename _FIterator, typename _Integer, typename _Tp,
+           typename _BinaryPredicate, typename _IteratorTag>
+    inline _FIterator
+    __search_n_switch(_FIterator __begin, _FIterator __end, _Integer __count,
+                      const _Tp& __val, _BinaryPredicate __binary_pred,
+                      _IteratorTag)
+    { return _GLIBCXX_STD_A::search_n(__begin, __end, __count, __val,
+                                      __binary_pred); }
+
+  // Public interface.
+  template<typename _FIterator, typename _Integer, typename _Tp,
+           typename _BinaryPredicate>
+    inline _FIterator
+    search_n(_FIterator __begin, _FIterator __end, _Integer __count,
+             const _Tp& __val, _BinaryPredicate __binary_pred)
+    {
+      return __search_n_switch(__begin, __end, __count, __val, __binary_pred,
+                             typename std::iterator_traits<_FIterator>::
+                             iterator_category());
+    }
+
+
+  // Sequential fallback.
+  template<typename _IIter, typename _OutputIterator,
+           typename _UnaryOperation>
+    inline _OutputIterator
+    transform(_IIter __begin, _IIter __end, _OutputIterator __result, 
+              _UnaryOperation __unary_op, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::transform(__begin, __end, __result, __unary_op); }
+
+  // Parallel unary transform for random access iterators.
+  template<typename _RAIter1, typename _RAIter2,
+           typename _UnaryOperation>
+    _RAIter2
+    __transform1_switch(_RAIter1 __begin, _RAIter1 __end,
+                      _RAIter2 __result, _UnaryOperation __unary_op,
+                      random_access_iterator_tag, random_access_iterator_tag,
+                      __gnu_parallel::_Parallelism __parallelism_tag
+                      = __gnu_parallel::parallel_balanced)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().transform_minimal_n
+            && __gnu_parallel::__is_parallel(__parallelism_tag)))
+        {
+          bool __dummy = true;
+          typedef __gnu_parallel::_IteratorPair<_RAIter1,
+            _RAIter2, random_access_iterator_tag> _ItTrip;
+          _ItTrip __begin_pair(__begin, __result),
+                  __end_pair(__end, __result + (__end - __begin));
+          __gnu_parallel::__transform1_selector<_ItTrip> __functionality;
+          __gnu_parallel::
+            __for_each_template_random_access(
+              __begin_pair, __end_pair, __unary_op, __functionality,
+              __gnu_parallel::_DummyReduct(),
+              __dummy, __dummy, -1, __parallelism_tag);
+          return __functionality._M_finish_iterator;
+        }
+      else
+        return transform(__begin, __end, __result, __unary_op, 
+                         __gnu_parallel::sequential_tag());
+    }
+
+  // Sequential fallback for input iterator case.
+  template<typename _RAIter1, typename _RAIter2,
+           typename _UnaryOperation, typename _IteratorTag1,
+           typename _IteratorTag2>
+    inline _RAIter2
+    __transform1_switch(_RAIter1 __begin, _RAIter1 __end,
+                      _RAIter2 __result, _UnaryOperation __unary_op,
+                      _IteratorTag1, _IteratorTag2)
+    { return transform(__begin, __end, __result, __unary_op, 
+                       __gnu_parallel::sequential_tag()); }
+
+  // Public interface.
+  template<typename _IIter, typename _OutputIterator,
+           typename _UnaryOperation>
+    inline _OutputIterator
+    transform(_IIter __begin, _IIter __end, _OutputIterator __result,
+              _UnaryOperation __unary_op, 
+              __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef std::iterator_traits<_IIter> _IIterTraits;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits::iterator_category _IIteratorCategory;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+
+      return __transform1_switch(__begin, __end, __result, __unary_op,
+                               _IIteratorCategory(), _OIterCategory(), 
+                               __parallelism_tag);
+    }
+
+  template<typename _IIter, typename _OutputIterator,
+           typename _UnaryOperation>
+    inline _OutputIterator
+    transform(_IIter __begin, _IIter __end, _OutputIterator __result,
+              _UnaryOperation __unary_op)
+    {
+      typedef std::iterator_traits<_IIter> _IIterTraits;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits::iterator_category _IIteratorCategory;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+
+      return __transform1_switch(__begin, __end, __result, __unary_op,
+                               _IIteratorCategory(), _OIterCategory());
+    }
+
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _BinaryOperation>
+    inline _OutputIterator
+    transform(_IIter1 __begin1, _IIter1 __end1,
+              _IIter2 __begin2, _OutputIterator __result,
+              _BinaryOperation __binary_op, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::transform(__begin1, __end1,
+                                       __begin2, __result, __binary_op); }
+
+  // Parallel binary transform for random access iterators.
+  template<typename _RAIter1, typename _RAIter2,
+           typename _RAIter3, typename _BinaryOperation>
+    _RAIter3
+    __transform2_switch(_RAIter1 __begin1, _RAIter1 __end1,
+                      _RAIter2 __begin2,
+                      _RAIter3 __result, _BinaryOperation __binary_op,
+                      random_access_iterator_tag, random_access_iterator_tag,
+                      random_access_iterator_tag,
+                      __gnu_parallel::_Parallelism __parallelism_tag 
+                      = __gnu_parallel::parallel_balanced)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            (__end1 - __begin1) >=
+                __gnu_parallel::_Settings::get().transform_minimal_n
+            && __gnu_parallel::__is_parallel(__parallelism_tag)))
+        {
+          bool __dummy = true;
+          typedef __gnu_parallel::_IteratorTriple<_RAIter1,
+            _RAIter2, _RAIter3,
+            random_access_iterator_tag> _ItTrip;
+          _ItTrip __begin_triple(__begin1, __begin2, __result),
+            __end_triple(__end1, __begin2 + (__end1 - __begin1),
+                       __result + (__end1 - __begin1));
+          __gnu_parallel::__transform2_selector<_ItTrip> __functionality;
+          __gnu_parallel::
+            __for_each_template_random_access(__begin_triple, __end_triple,
+                                            __binary_op, __functionality,
+                                            __gnu_parallel::_DummyReduct(),
+                                            __dummy, __dummy, -1,
+                                            __parallelism_tag);
+          return __functionality._M_finish_iterator;
+        }
+      else
+        return transform(__begin1, __end1, __begin2, __result, __binary_op, 
+                         __gnu_parallel::sequential_tag());
+    }
+
+  // Sequential fallback for input iterator case.
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _BinaryOperation,
+           typename _Tag1, typename _Tag2, typename _Tag3>
+    inline _OutputIterator
+    __transform2_switch(_IIter1 __begin1, _IIter1 __end1, 
+                      _IIter2 __begin2, _OutputIterator __result, 
+                      _BinaryOperation __binary_op, _Tag1, _Tag2, _Tag3)
+    { return transform(__begin1, __end1, __begin2, __result, __binary_op,
+                       __gnu_parallel::sequential_tag()); }
+
+  // Public interface.
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _BinaryOperation>
+    inline _OutputIterator
+    transform(_IIter1 __begin1, _IIter1 __end1,
+              _IIter2 __begin2, _OutputIterator __result,
+              _BinaryOperation __binary_op, 
+              __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef std::iterator_traits<_IIter1> _IIterTraits1;
+      typedef typename _IIterTraits1::iterator_category
+        _IIterCategory1;
+      typedef std::iterator_traits<_IIter2> _IIterTraits2;
+      typedef typename _IIterTraits2::iterator_category
+        _IIterCategory2;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+
+      return __transform2_switch(
+               __begin1, __end1, __begin2, __result, __binary_op,
+               _IIterCategory1(), _IIterCategory2(), _OIterCategory(),
+               __parallelism_tag);
+    }
+
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _BinaryOperation>
+    inline _OutputIterator
+    transform(_IIter1 __begin1, _IIter1 __end1,
+              _IIter2 __begin2, _OutputIterator __result,
+              _BinaryOperation __binary_op)
+    {
+      typedef std::iterator_traits<_IIter1> _IIterTraits1;
+      typedef typename _IIterTraits1::iterator_category
+        _IIterCategory1;
+      typedef std::iterator_traits<_IIter2> _IIterTraits2;
+      typedef typename _IIterTraits2::iterator_category
+        _IIterCategory2;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+
+      return __transform2_switch(
+               __begin1, __end1, __begin2, __result, __binary_op,
+               _IIterCategory1(), _IIterCategory2(), _OIterCategory());
+    }
+
+  // Sequential fallback
+  template<typename _FIterator, typename _Tp>
+    inline void
+    replace(_FIterator __begin, _FIterator __end, const _Tp& __old_value, 
+            const _Tp& __new_value, __gnu_parallel::sequential_tag)
+    { _GLIBCXX_STD_A::replace(__begin, __end, __old_value, __new_value); }
+
+  // Sequential fallback for input iterator case
+  template<typename _FIterator, typename _Tp, typename _IteratorTag>
+    inline void
+    __replace_switch(_FIterator __begin, _FIterator __end, 
+                     const _Tp& __old_value, const _Tp& __new_value,
+                     _IteratorTag)
+    { replace(__begin, __end, __old_value, __new_value, 
+              __gnu_parallel::sequential_tag()); }
+
+  // Parallel replace for random access iterators
+  template<typename _RAIter, typename _Tp>
+    inline void
+    __replace_switch(_RAIter __begin, _RAIter __end, 
+                   const _Tp& __old_value, const _Tp& __new_value, 
+                   random_access_iterator_tag, 
+                   __gnu_parallel::_Parallelism __parallelism_tag
+                   = __gnu_parallel::parallel_balanced)
+    {
+      // XXX parallel version is where?
+      replace(__begin, __end, __old_value, __new_value, 
+              __gnu_parallel::sequential_tag()); 
+    }
+
+  // Public interface
+  template<typename _FIterator, typename _Tp>
+    inline void
+    replace(_FIterator __begin, _FIterator __end, const _Tp& __old_value, 
+            const _Tp& __new_value,
+            __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef iterator_traits<_FIterator> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      __replace_switch(__begin, __end, __old_value, __new_value,
+                       _IteratorCategory(),
+                     __parallelism_tag);
+    }
+
+  template<typename _FIterator, typename _Tp>
+    inline void
+    replace(_FIterator __begin, _FIterator __end, const _Tp& __old_value, 
+            const _Tp& __new_value)
+    {
+      typedef iterator_traits<_FIterator> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      __replace_switch(__begin, __end, __old_value, __new_value,
+                       _IteratorCategory());
+    }
+
+
+  // Sequential fallback
+  template<typename _FIterator, typename _Predicate, typename _Tp>
+    inline void
+    replace_if(_FIterator __begin, _FIterator __end, _Predicate __pred, 
+               const _Tp& __new_value, __gnu_parallel::sequential_tag)
+    { _GLIBCXX_STD_A::replace_if(__begin, __end, __pred, __new_value); }
+
+  // Sequential fallback for input iterator case
+  template<typename _FIterator, typename _Predicate, typename _Tp,
+           typename _IteratorTag>
+    inline void
+    __replace_if_switch(_FIterator __begin, _FIterator __end,
+                      _Predicate __pred, const _Tp& __new_value, _IteratorTag)
+    { replace_if(__begin, __end, __pred, __new_value,
+                 __gnu_parallel::sequential_tag()); }
+
+  // Parallel algorithm for random access iterators.
+  template<typename _RAIter, typename _Predicate, typename _Tp>
+    void
+    __replace_if_switch(_RAIter __begin, _RAIter __end,
+                      _Predicate __pred, const _Tp& __new_value,
+                      random_access_iterator_tag,
+                      __gnu_parallel::_Parallelism __parallelism_tag
+                      = __gnu_parallel::parallel_balanced)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().replace_minimal_n
+            && __gnu_parallel::__is_parallel(__parallelism_tag)))
+        {
+          bool __dummy;
+          __gnu_parallel::
+            __replace_if_selector<_RAIter, _Predicate, _Tp>
+            __functionality(__new_value);
+          __gnu_parallel::
+            __for_each_template_random_access(
+              __begin, __end, __pred, __functionality,
+              __gnu_parallel::_DummyReduct(),
+              true, __dummy, -1, __parallelism_tag);
+        }
+      else
+        replace_if(__begin, __end, __pred, __new_value, 
+                   __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface.
+  template<typename _FIterator, typename _Predicate, typename _Tp>
+    inline void
+    replace_if(_FIterator __begin, _FIterator __end,
+               _Predicate __pred, const _Tp& __new_value, 
+               __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef std::iterator_traits<_FIterator> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      __replace_if_switch(__begin, __end, __pred, __new_value,
+                          _IteratorCategory(), __parallelism_tag);
+    }
+
+  template<typename _FIterator, typename _Predicate, typename _Tp>
+    inline void
+    replace_if(_FIterator __begin, _FIterator __end,
+               _Predicate __pred, const _Tp& __new_value)
+    {
+      typedef std::iterator_traits<_FIterator> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      __replace_if_switch(__begin, __end, __pred, __new_value,
+                          _IteratorCategory());
+    }
+
+  // Sequential fallback
+  template<typename _FIterator, typename _Generator>
+    inline void
+    generate(_FIterator __begin, _FIterator __end, _Generator __gen, 
+             __gnu_parallel::sequential_tag)
+    { _GLIBCXX_STD_A::generate(__begin, __end, __gen); }
+
+  // Sequential fallback for input iterator case.
+  template<typename _FIterator, typename _Generator, typename _IteratorTag>
+    inline void
+    __generate_switch(_FIterator __begin, _FIterator __end, _Generator __gen,
+                    _IteratorTag)
+    { generate(__begin, __end, __gen, __gnu_parallel::sequential_tag()); }
+
+  // Parallel algorithm for random access iterators.
+  template<typename _RAIter, typename _Generator>
+    void
+    __generate_switch(_RAIter __begin, _RAIter __end,
+                    _Generator __gen, random_access_iterator_tag, 
+                    __gnu_parallel::_Parallelism __parallelism_tag
+                    = __gnu_parallel::parallel_balanced)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().generate_minimal_n
+            && __gnu_parallel::__is_parallel(__parallelism_tag)))
+        {
+          bool __dummy;
+          __gnu_parallel::__generate_selector<_RAIter>
+            __functionality;
+          __gnu_parallel::
+            __for_each_template_random_access(
+              __begin, __end, __gen, __functionality,
+              __gnu_parallel::_DummyReduct(),
+              true, __dummy, -1, __parallelism_tag);
+        }
+      else
+        generate(__begin, __end, __gen, __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface.
+  template<typename _FIterator, typename _Generator>
+    inline void
+    generate(_FIterator __begin, _FIterator __end,
+             _Generator __gen, __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef std::iterator_traits<_FIterator> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      __generate_switch(__begin, __end, __gen, _IteratorCategory(),
+                        __parallelism_tag);
+    }
+
+  template<typename _FIterator, typename _Generator>
+    inline void
+    generate(_FIterator __begin, _FIterator __end, _Generator __gen)
+    {
+      typedef std::iterator_traits<_FIterator> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      __generate_switch(__begin, __end, __gen, _IteratorCategory());
+    }
+
+
+  // Sequential fallback.
+  template<typename _OutputIterator, typename _Size, typename _Generator>
+    inline _OutputIterator
+    generate_n(_OutputIterator __begin, _Size __n, _Generator __gen, 
+               __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::generate_n(__begin, __n, __gen); }
+
+  // Sequential fallback for input iterator case.
+  template<typename _OutputIterator, typename _Size, typename _Generator,
+           typename _IteratorTag>
+    inline _OutputIterator
+    __generate_n_switch(_OutputIterator __begin, _Size __n, _Generator __gen,
+                        _IteratorTag)
+    { return generate_n(__begin, __n, __gen,
+                        __gnu_parallel::sequential_tag()); }
+
+  // Parallel algorithm for random access iterators.
+  template<typename _RAIter, typename _Size, typename _Generator>
+    inline _RAIter
+    __generate_n_switch(_RAIter __begin, _Size __n, _Generator __gen, 
+                      random_access_iterator_tag, 
+                      __gnu_parallel::_Parallelism __parallelism_tag
+                      = __gnu_parallel::parallel_balanced)
+    {
+      // XXX parallel version is where?
+      return generate_n(__begin, __n, __gen, __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface.
+  template<typename _OutputIterator, typename _Size, typename _Generator>
+    inline _OutputIterator
+    generate_n(_OutputIterator __begin, _Size __n, _Generator __gen, 
+               __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef std::iterator_traits<_OutputIterator> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      return __generate_n_switch(__begin, __n, __gen, _IteratorCategory(), 
+                               __parallelism_tag); 
+    }
+
+  template<typename _OutputIterator, typename _Size, typename _Generator>
+    inline _OutputIterator
+    generate_n(_OutputIterator __begin, _Size __n, _Generator __gen)
+    {
+      typedef std::iterator_traits<_OutputIterator> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      return __generate_n_switch(__begin, __n, __gen, _IteratorCategory());
+    }
+
+
+  // Sequential fallback.
+  template<typename _RAIter>
+    inline void
+    random_shuffle(_RAIter __begin, _RAIter __end, 
+                   __gnu_parallel::sequential_tag)
+    { _GLIBCXX_STD_A::random_shuffle(__begin, __end); }
+
+  // Sequential fallback.
+  template<typename _RAIter, typename _RandomNumberGenerator>
+    inline void
+    random_shuffle(_RAIter __begin, _RAIter __end,
+                   _RandomNumberGenerator& __rand,
+                   __gnu_parallel::sequential_tag)
+    { _GLIBCXX_STD_A::random_shuffle(__begin, __end, __rand); }
+
+
+  /** @brief Functor wrapper for std::rand(). */
+  template<typename _MustBeInt = int>
+    struct _CRandNumber
+    {
+      int
+      operator()(int __limit)
+      { return rand() % __limit; }
+    };
+
+  // Fill in random number generator.
+  template<typename _RAIter>
+    inline void
+    random_shuffle(_RAIter __begin, _RAIter __end)
+    {
+      _CRandNumber<> __r;
+      // Parallelization still possible.
+      __gnu_parallel::random_shuffle(__begin, __end, __r);
+    }
+
+  // Parallel algorithm for random access iterators.
+  template<typename _RAIter, typename _RandomNumberGenerator>
+    void
+    random_shuffle(_RAIter __begin, _RAIter __end,
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+                   _RandomNumberGenerator&& __rand)
+#else
+                   _RandomNumberGenerator& __rand)
+#endif
+    {
+      if (__begin == __end)
+        return;
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().random_shuffle_minimal_n))
+        __gnu_parallel::__parallel_random_shuffle(__begin, __end, __rand);
+      else
+        __gnu_parallel::__sequential_random_shuffle(__begin, __end, __rand);
+    }
+
+  // Sequential fallback.
+  template<typename _FIterator, typename _Predicate>
+    inline _FIterator
+    partition(_FIterator __begin, _FIterator __end,
+              _Predicate __pred, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::partition(__begin, __end, __pred); }
+
+  // Sequential fallback for input iterator case.
+  template<typename _FIterator, typename _Predicate, typename _IteratorTag>
+    inline _FIterator
+    __partition_switch(_FIterator __begin, _FIterator __end,
+                     _Predicate __pred, _IteratorTag)
+    { return partition(__begin, __end, __pred,
+                       __gnu_parallel::sequential_tag()); }
+
+  // Parallel algorithm for random access iterators.
+  template<typename _RAIter, typename _Predicate>
+    _RAIter
+    __partition_switch(_RAIter __begin, _RAIter __end,
+                     _Predicate __pred, random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().partition_minimal_n))
+        {
+          typedef typename std::iterator_traits<_RAIter>::
+            difference_type _DifferenceType;
+          _DifferenceType __middle = __gnu_parallel::
+            __parallel_partition(__begin, __end, __pred,
+                               __gnu_parallel::__get_max_threads());
+          return __begin + __middle;
+        }
+      else
+        return partition(__begin, __end, __pred,
+                         __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface.
+  template<typename _FIterator, typename _Predicate>
+    inline _FIterator
+    partition(_FIterator __begin, _FIterator __end, _Predicate __pred)
+    {
+      typedef iterator_traits<_FIterator> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      return __partition_switch(__begin, __end, __pred, _IteratorCategory());
+    }
+
+  // sort interface
+
+  // Sequential fallback
+  template<typename _RAIter>
+    inline void
+    sort(_RAIter __begin, _RAIter __end, 
+         __gnu_parallel::sequential_tag)
+    { _GLIBCXX_STD_A::sort(__begin, __end); }
+
+  // Sequential fallback
+  template<typename _RAIter, typename _Compare>
+    inline void
+    sort(_RAIter __begin, _RAIter __end, _Compare __comp,
+         __gnu_parallel::sequential_tag)
+    { _GLIBCXX_STD_A::sort<_RAIter, _Compare>(__begin, __end,
+                                                             __comp); }
+
+  // Public interface
+  template<typename _RAIter, typename _Compare,
+           typename _Parallelism>
+  void
+  sort(_RAIter __begin, _RAIter __end, _Compare __comp,
+       _Parallelism __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+
+    if (__begin != __end)
+      {
+        if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >=
+              __gnu_parallel::_Settings::get().sort_minimal_n))
+          __gnu_parallel::__parallel_sort<false>(
+                            __begin, __end, __comp, __parallelism);
+        else
+          sort(__begin, __end, __comp, __gnu_parallel::sequential_tag());
+      }
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+    inline void
+    sort(_RAIter __begin, _RAIter __end)
+    {
+      typedef iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      sort(__begin, __end, std::less<_ValueType>(),
+           __gnu_parallel::default_parallel_tag());
+    }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  sort(_RAIter __begin, _RAIter __end,
+       __gnu_parallel::default_parallel_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  sort(_RAIter __begin, _RAIter __end,
+       __gnu_parallel::parallel_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  sort(_RAIter __begin, _RAIter __end,
+       __gnu_parallel::multiway_mergesort_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  sort(_RAIter __begin, _RAIter __end,
+       __gnu_parallel::multiway_mergesort_sampling_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  sort(_RAIter __begin, _RAIter __end,
+       __gnu_parallel::multiway_mergesort_exact_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  sort(_RAIter __begin, _RAIter __end,
+       __gnu_parallel::quicksort_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  sort(_RAIter __begin, _RAIter __end,
+       __gnu_parallel::balanced_quicksort_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface
+  template<typename _RAIter, typename _Compare>
+    void
+    sort(_RAIter __begin, _RAIter __end, _Compare __comp)
+    {
+      typedef iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+    sort(__begin, __end, __comp, __gnu_parallel::default_parallel_tag());
+  }
+
+
+  // stable_sort interface
+
+
+  // Sequential fallback
+  template<typename _RAIter>
+  inline void
+  stable_sort(_RAIter __begin, _RAIter __end,
+       __gnu_parallel::sequential_tag)
+  { _GLIBCXX_STD_A::stable_sort(__begin, __end); }
+
+  // Sequential fallback
+  template<typename _RAIter, typename _Compare>
+  inline void
+  stable_sort(_RAIter __begin, _RAIter __end,
+              _Compare __comp, __gnu_parallel::sequential_tag)
+  { _GLIBCXX_STD_A::stable_sort<_RAIter, _Compare>(
+      __begin, __end, __comp); }
+
+  // Public interface
+  template<typename _RAIter, typename _Compare,
+           typename _Parallelism>
+  void
+  stable_sort(_RAIter __begin, _RAIter __end,
+              _Compare __comp, _Parallelism __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+
+    if (__begin != __end)
+      {
+        if (_GLIBCXX_PARALLEL_CONDITION(
+              static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin) >=
+              __gnu_parallel::_Settings::get().sort_minimal_n))
+          __gnu_parallel::__parallel_sort<true>(
+                            __begin, __end, __comp, __parallelism);
+        else
+          stable_sort(__begin, __end, __comp,
+                      __gnu_parallel::sequential_tag());
+      }
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  stable_sort(_RAIter __begin, _RAIter __end)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    stable_sort(__begin, __end, std::less<_ValueType>(),
+                __gnu_parallel::default_parallel_tag());
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  stable_sort(_RAIter __begin, _RAIter __end,
+              __gnu_parallel::default_parallel_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    stable_sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  stable_sort(_RAIter __begin, _RAIter __end,
+              __gnu_parallel::parallel_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    stable_sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  stable_sort(_RAIter __begin, _RAIter __end,
+              __gnu_parallel::multiway_mergesort_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    stable_sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  stable_sort(_RAIter __begin, _RAIter __end,
+              __gnu_parallel::quicksort_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    stable_sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+  inline void
+  stable_sort(_RAIter __begin, _RAIter __end,
+              __gnu_parallel::balanced_quicksort_tag __parallelism)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    stable_sort(__begin, __end, std::less<_ValueType>(), __parallelism);
+  }
+
+  // Public interface
+  template<typename _RAIter, typename _Compare>
+  void
+  stable_sort(_RAIter __begin, _RAIter __end,
+              _Compare __comp)
+  {
+    typedef iterator_traits<_RAIter> _TraitsType;
+    typedef typename _TraitsType::value_type _ValueType;
+    stable_sort(
+      __begin, __end, __comp, __gnu_parallel::default_parallel_tag());
+  }
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator>
+    inline _OutputIterator
+    merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, 
+          _IIter2 __end2, _OutputIterator __result,
+          __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::merge(
+               __begin1, __end1, __begin2, __end2, __result); }
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _Compare>
+    inline _OutputIterator
+    merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
+          _IIter2 __end2, _OutputIterator __result, _Compare __comp,
+          __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::merge(
+                __begin1, __end1, __begin2, __end2, __result, __comp); }
+
+  // Sequential fallback for input iterator case
+  template<typename _IIter1, typename _IIter2, typename _OutputIterator,
+           typename _Compare, typename _IteratorTag1,
+           typename _IteratorTag2, typename _IteratorTag3>
+    inline _OutputIterator
+    __merge_switch(_IIter1 __begin1, _IIter1 __end1,
+                 _IIter2 __begin2, _IIter2 __end2,
+                 _OutputIterator __result, _Compare __comp,
+                 _IteratorTag1, _IteratorTag2, _IteratorTag3)
+     { return _GLIBCXX_STD_A::merge(__begin1, __end1, __begin2, __end2,
+                                    __result, __comp); }
+
+  // Parallel algorithm for random access iterators
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _Compare>
+    _OutputIterator
+    __merge_switch(_IIter1 __begin1, _IIter1 __end1, 
+                 _IIter2 __begin2, _IIter2 __end2, 
+                 _OutputIterator __result, _Compare __comp, 
+                 random_access_iterator_tag, random_access_iterator_tag, 
+                 random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            (static_cast<__gnu_parallel::_SequenceIndex>(__end1 - __begin1)
+             >= __gnu_parallel::_Settings::get().merge_minimal_n
+             || static_cast<__gnu_parallel::_SequenceIndex>(__end2 - __begin2)
+             >= __gnu_parallel::_Settings::get().merge_minimal_n)))
+        return __gnu_parallel::__parallel_merge_advance(
+                 __begin1, __end1, __begin2, __end2, __result,
+                 (__end1 - __begin1) + (__end2 - __begin2), __comp);
+      else
+        return __gnu_parallel::__merge_advance(
+                 __begin1, __end1, __begin2, __end2, __result,
+                 (__end1 - __begin1) + (__end2 - __begin2), __comp);
+  }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator, typename _Compare>
+    inline _OutputIterator
+    merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, 
+          _IIter2 __end2, _OutputIterator __result, _Compare __comp)
+    {
+      typedef typename iterator_traits<_IIter1>::value_type _ValueType;
+
+      typedef std::iterator_traits<_IIter1> _IIterTraits1;
+      typedef std::iterator_traits<_IIter2> _IIterTraits2;
+      typedef std::iterator_traits<_OutputIterator> _OIterTraits;
+      typedef typename _IIterTraits1::iterator_category
+        _IIterCategory1;
+      typedef typename _IIterTraits2::iterator_category
+        _IIterCategory2;
+      typedef typename _OIterTraits::iterator_category _OIterCategory;
+
+      return __merge_switch(
+              __begin1, __end1, __begin2, __end2, __result, __comp,
+              _IIterCategory1(), _IIterCategory2(), _OIterCategory());
+  }
+
+
+  // Public interface, insert default comparator
+  template<typename _IIter1, typename _IIter2,
+           typename _OutputIterator>
+    inline _OutputIterator
+    merge(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, 
+          _IIter2 __end2, _OutputIterator __result)
+    {
+      typedef std::iterator_traits<_IIter1> _Iterator1Traits;
+      typedef std::iterator_traits<_IIter2> _Iterator2Traits;
+      typedef typename _Iterator1Traits::value_type _ValueType1;
+      typedef typename _Iterator2Traits::value_type _ValueType2;
+
+      return __gnu_parallel::merge(__begin1, __end1, __begin2, __end2,
+                  __result, __gnu_parallel::_Less<_ValueType1, _ValueType2>());
+    }
+
+  // Sequential fallback
+  template<typename _RAIter>
+    inline void
+    nth_element(_RAIter __begin, _RAIter __nth, 
+                _RAIter __end, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::nth_element(__begin, __nth, __end); }
+
+  // Sequential fallback
+  template<typename _RAIter, typename _Compare>
+    inline void
+    nth_element(_RAIter __begin, _RAIter __nth, 
+                _RAIter __end, _Compare __comp, 
+              __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::nth_element(__begin, __nth, __end, __comp); }
+
+  // Public interface
+  template<typename _RAIter, typename _Compare>
+    inline void
+    nth_element(_RAIter __begin, _RAIter __nth, 
+                _RAIter __end, _Compare __comp)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().nth_element_minimal_n))
+        __gnu_parallel::__parallel_nth_element(__begin, __nth, __end, __comp);
+      else
+        nth_element(__begin, __nth, __end, __comp,
+                    __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+    inline void
+    nth_element(_RAIter __begin, _RAIter __nth, 
+                _RAIter __end)
+    {
+      typedef iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      __gnu_parallel::nth_element(__begin, __nth, __end,
+                                  std::less<_ValueType>());
+    }
+
+  // Sequential fallback
+  template<typename _RAIter, typename _Compare>
+    inline void
+    partial_sort(_RAIter __begin, _RAIter __middle, 
+                 _RAIter __end, _Compare __comp,
+                 __gnu_parallel::sequential_tag)
+    { _GLIBCXX_STD_A::partial_sort(__begin, __middle, __end, __comp); }
+
+  // Sequential fallback
+  template<typename _RAIter>
+    inline void
+    partial_sort(_RAIter __begin, _RAIter __middle, 
+                 _RAIter __end, __gnu_parallel::sequential_tag)
+    { _GLIBCXX_STD_A::partial_sort(__begin, __middle, __end); }
+
+  // Public interface, parallel algorithm for random access iterators
+  template<typename _RAIter, typename _Compare>
+    void
+    partial_sort(_RAIter __begin, _RAIter __middle, 
+                 _RAIter __end, _Compare __comp)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().partial_sort_minimal_n))
+        __gnu_parallel::
+          __parallel_partial_sort(__begin, __middle, __end, __comp);
+      else
+        partial_sort(__begin, __middle, __end, __comp,
+                     __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface, insert default comparator
+  template<typename _RAIter>
+    inline void
+    partial_sort(_RAIter __begin, _RAIter __middle, 
+                 _RAIter __end)
+    {
+      typedef iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      __gnu_parallel::partial_sort(__begin, __middle, __end,
+                                   std::less<_ValueType>());
+    }
+
+  // Sequential fallback
+  template<typename _FIterator>
+    inline _FIterator
+    max_element(_FIterator __begin, _FIterator __end, 
+                __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::max_element(__begin, __end); }
+
+  // Sequential fallback
+  template<typename _FIterator, typename _Compare>
+    inline _FIterator
+    max_element(_FIterator __begin, _FIterator __end, _Compare __comp, 
+                __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::max_element(__begin, __end, __comp); }
+
+  // Sequential fallback for input iterator case
+  template<typename _FIterator, typename _Compare, typename _IteratorTag>
+    inline _FIterator
+    __max_element_switch(_FIterator __begin, _FIterator __end, 
+                       _Compare __comp, _IteratorTag)
+    { return max_element(__begin, __end, __comp,
+                         __gnu_parallel::sequential_tag()); }
+
+  // Parallel algorithm for random access iterators
+  template<typename _RAIter, typename _Compare>
+    _RAIter
+    __max_element_switch(_RAIter __begin, _RAIter __end, 
+                       _Compare __comp, random_access_iterator_tag, 
+                       __gnu_parallel::_Parallelism __parallelism_tag
+                       = __gnu_parallel::parallel_balanced)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().max_element_minimal_n
+            && __gnu_parallel::__is_parallel(__parallelism_tag)))
+        {
+          _RAIter __res(__begin);
+          __gnu_parallel::__identity_selector<_RAIter>
+            __functionality;
+          __gnu_parallel::
+            __for_each_template_random_access(
+              __begin, __end, __gnu_parallel::_Nothing(), __functionality,
+              __gnu_parallel::__max_element_reduct<_Compare, _RAIter>(__comp),
+              __res, __res, -1, __parallelism_tag);
+          return __res;
+        }
+      else
+        return max_element(__begin, __end, __comp,
+                           __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface, insert default comparator
+  template<typename _FIterator>
+    inline _FIterator
+    max_element(_FIterator __begin, _FIterator __end, 
+                __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef typename iterator_traits<_FIterator>::value_type _ValueType;
+      return max_element(__begin, __end, std::less<_ValueType>(),
+                         __parallelism_tag);
+    }
+
+  template<typename _FIterator>
+    inline _FIterator
+    max_element(_FIterator __begin, _FIterator __end)
+    {
+      typedef typename iterator_traits<_FIterator>::value_type _ValueType;
+      return __gnu_parallel::max_element(__begin, __end,
+                                         std::less<_ValueType>());
+    }
+
+  // Public interface
+  template<typename _FIterator, typename _Compare>
+    inline _FIterator
+    max_element(_FIterator __begin, _FIterator __end, _Compare __comp,
+                __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef iterator_traits<_FIterator> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      return __max_element_switch(__begin, __end, __comp, _IteratorCategory(), 
+                                  __parallelism_tag);
+    }
+
+  template<typename _FIterator, typename _Compare>
+    inline _FIterator
+    max_element(_FIterator __begin, _FIterator __end, _Compare __comp)
+    {
+      typedef iterator_traits<_FIterator> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      return __max_element_switch(__begin, __end, __comp, _IteratorCategory());
+    }
+
+
+  // Sequential fallback
+  template<typename _FIterator>
+    inline _FIterator
+    min_element(_FIterator __begin, _FIterator __end, 
+                __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::min_element(__begin, __end); }
+
+  // Sequential fallback
+  template<typename _FIterator, typename _Compare>
+    inline _FIterator
+    min_element(_FIterator __begin, _FIterator __end, _Compare __comp, 
+                __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::min_element(__begin, __end, __comp); }
+
+  // Sequential fallback for input iterator case
+  template<typename _FIterator, typename _Compare, typename _IteratorTag>
+    inline _FIterator
+    __min_element_switch(_FIterator __begin, _FIterator __end, 
+                       _Compare __comp, _IteratorTag)
+    { return min_element(__begin, __end, __comp,
+                         __gnu_parallel::sequential_tag()); }
+
+  // Parallel algorithm for random access iterators
+  template<typename _RAIter, typename _Compare>
+    _RAIter
+    __min_element_switch(_RAIter __begin, _RAIter __end, 
+                       _Compare __comp, random_access_iterator_tag, 
+                       __gnu_parallel::_Parallelism __parallelism_tag
+                       = __gnu_parallel::parallel_balanced)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().min_element_minimal_n
+            && __gnu_parallel::__is_parallel(__parallelism_tag)))
+        {
+          _RAIter __res(__begin);
+          __gnu_parallel::__identity_selector<_RAIter>
+            __functionality;
+          __gnu_parallel::
+            __for_each_template_random_access(
+              __begin, __end, __gnu_parallel::_Nothing(), __functionality,
+              __gnu_parallel::__min_element_reduct<_Compare, _RAIter>(__comp),
+              __res, __res, -1, __parallelism_tag);
+          return __res;
+        }
+      else
+        return min_element(__begin, __end, __comp,
+                           __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface, insert default comparator
+  template<typename _FIterator>
+    inline _FIterator
+    min_element(_FIterator __begin, _FIterator __end, 
+                __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef typename iterator_traits<_FIterator>::value_type _ValueType;
+      return min_element(__begin, __end, std::less<_ValueType>(),
+                         __parallelism_tag);
+    }
+
+  template<typename _FIterator>
+    inline _FIterator
+    min_element(_FIterator __begin, _FIterator __end)
+    {
+      typedef typename iterator_traits<_FIterator>::value_type _ValueType;
+      return __gnu_parallel::min_element(__begin, __end,
+                                         std::less<_ValueType>());
+    }
+
+  // Public interface
+  template<typename _FIterator, typename _Compare>
+    inline _FIterator
+    min_element(_FIterator __begin, _FIterator __end, _Compare __comp,
+                __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef iterator_traits<_FIterator> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      return __min_element_switch(__begin, __end, __comp, _IteratorCategory(), 
+                                __parallelism_tag);
+    }
+
+  template<typename _FIterator, typename _Compare>
+    inline _FIterator
+    min_element(_FIterator __begin, _FIterator __end, _Compare __comp)
+    {
+      typedef iterator_traits<_FIterator> _TraitsType;
+      typedef typename _TraitsType::iterator_category _IteratorCategory;
+      return __min_element_switch(__begin, __end, __comp, _IteratorCategory());
+    }
+} // end namespace
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_ALGO_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algobase.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algobase.h
new file mode 100644
index 0000000..20456b5
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algobase.h
@@ -0,0 +1,279 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/algobase.h
+ *  @brief Parallel STL function calls corresponding to the
+ *  stl_algobase.h header.  The functions defined here mainly do case
+ *  switches and call the actual parallelized versions in other files.
+ *  Inlining policy: Functions that basically only contain one
+ *  function call, are declared inline.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_ALGOBASE_H
+#define _GLIBCXX_PARALLEL_ALGOBASE_H 1
+
+#include <bits/stl_algobase.h>
+#include <parallel/base.h>
+#include <parallel/tags.h>
+#include <parallel/settings.h>
+#include <parallel/find.h>
+#include <parallel/find_selectors.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __parallel
+{
+  // NB: equal and lexicographical_compare require mismatch.
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2>
+    inline pair<_IIter1, _IIter2>
+    mismatch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
+             __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::mismatch(__begin1, __end1, __begin2); }
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    inline pair<_IIter1, _IIter2>
+    mismatch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
+             _Predicate __pred, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::mismatch(__begin1, __end1, __begin2, __pred); }
+
+  // Sequential fallback for input iterator case
+  template<typename _IIter1, typename _IIter2,
+           typename _Predicate, typename _IteratorTag1, typename _IteratorTag2>
+    inline pair<_IIter1, _IIter2>
+    __mismatch_switch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
+                      _Predicate __pred, _IteratorTag1, _IteratorTag2)
+    { return _GLIBCXX_STD_A::mismatch(__begin1, __end1, __begin2, __pred); }
+
+  // Parallel mismatch for random access iterators
+  template<typename _RAIter1, typename _RAIter2, typename _Predicate>
+    pair<_RAIter1, _RAIter2>
+    __mismatch_switch(_RAIter1 __begin1, _RAIter1 __end1,
+                      _RAIter2 __begin2, _Predicate __pred, 
+                      random_access_iterator_tag, random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(true))
+        {
+          _RAIter1 __res =
+            __gnu_parallel::__find_template(__begin1, __end1, __begin2, __pred,
+                                            __gnu_parallel::
+                                            __mismatch_selector()).first;
+          return make_pair(__res , __begin2 + (__res - __begin1));
+        }
+      else
+        return _GLIBCXX_STD_A::mismatch(__begin1, __end1, __begin2, __pred);
+    }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2>
+    inline pair<_IIter1, _IIter2>
+    mismatch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2)
+    {
+      typedef std::iterator_traits<_IIter1> _Iterator1Traits;
+      typedef std::iterator_traits<_IIter2> _Iterator2Traits;
+      typedef typename _Iterator1Traits::value_type _ValueType1;
+      typedef typename _Iterator2Traits::value_type _ValueType2;
+      typedef typename _Iterator1Traits::iterator_category _IteratorCategory1;
+      typedef typename _Iterator2Traits::iterator_category _IteratorCategory2;
+
+      typedef __gnu_parallel::_EqualTo<_ValueType1, _ValueType2> _EqualTo;
+
+      return __mismatch_switch(__begin1, __end1, __begin2, _EqualTo(),
+                               _IteratorCategory1(), _IteratorCategory2());
+    }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    inline pair<_IIter1, _IIter2>
+    mismatch(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2,
+             _Predicate __pred)
+    {
+      typedef std::iterator_traits<_IIter1> _Iterator1Traits;
+      typedef std::iterator_traits<_IIter2> _Iterator2Traits;
+      typedef typename _Iterator1Traits::iterator_category _IteratorCategory1;
+      typedef typename _Iterator2Traits::iterator_category _IteratorCategory2;
+
+      return __mismatch_switch(__begin1, __end1, __begin2, __pred,
+                               _IteratorCategory1(), _IteratorCategory2());
+    }
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2>
+    inline bool
+    equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, 
+          __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::equal(__begin1, __end1, __begin2); }
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    inline bool
+    equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, 
+          _Predicate __pred, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::equal(__begin1, __end1, __begin2, __pred); }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2>
+    inline bool
+    equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2)
+    {
+      return __gnu_parallel::mismatch(__begin1, __end1, __begin2).first
+              == __end1;
+    }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    inline bool
+    equal(_IIter1 __begin1, _IIter1 __end1, _IIter2 __begin2, 
+          _Predicate __pred)
+    {
+      return __gnu_parallel::mismatch(__begin1, __end1, __begin2, __pred).first
+              == __end1;
+    }
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2>
+    inline bool
+    lexicographical_compare(_IIter1 __begin1, _IIter1 __end1, 
+                            _IIter2 __begin2, _IIter2 __end2, 
+                            __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::lexicographical_compare(__begin1, __end1,
+                                                     __begin2, __end2); }
+
+  // Sequential fallback
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    inline bool
+    lexicographical_compare(_IIter1 __begin1, _IIter1 __end1, 
+                            _IIter2 __begin2, _IIter2 __end2, 
+                            _Predicate __pred, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::lexicographical_compare(
+               __begin1, __end1, __begin2, __end2, __pred); }
+
+  // Sequential fallback for input iterator case
+  template<typename _IIter1, typename _IIter2,
+           typename _Predicate, typename _IteratorTag1, typename _IteratorTag2>
+    inline bool
+    __lexicographical_compare_switch(_IIter1 __begin1, _IIter1 __end1,
+                                     _IIter2 __begin2, _IIter2 __end2, 
+                                     _Predicate __pred,
+                                     _IteratorTag1, _IteratorTag2)
+    { return _GLIBCXX_STD_A::lexicographical_compare(
+               __begin1, __end1, __begin2, __end2, __pred); }
+
+  // Parallel lexicographical_compare for random access iterators
+  // Limitation: Both valuetypes must be the same
+  template<typename _RAIter1, typename _RAIter2, typename _Predicate>
+    bool
+    __lexicographical_compare_switch(_RAIter1 __begin1, _RAIter1 __end1,
+                                     _RAIter2 __begin2, _RAIter2 __end2,
+                                     _Predicate __pred,
+                                     random_access_iterator_tag, 
+                                     random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(true))
+        {
+          typedef iterator_traits<_RAIter1> _TraitsType1;
+          typedef typename _TraitsType1::value_type _ValueType1;
+
+          typedef iterator_traits<_RAIter2> _TraitsType2;
+          typedef typename _TraitsType2::value_type _ValueType2;
+
+          typedef __gnu_parallel::
+                  _EqualFromLess<_ValueType1, _ValueType2, _Predicate>
+                  _EqualFromLessCompare;
+
+          // Longer sequence in first place.
+          if ((__end1 - __begin1) < (__end2 - __begin2))
+            {
+              typedef pair<_RAIter1, _RAIter2> _SpotType;
+              _SpotType __mm = __mismatch_switch(__begin1, __end1, __begin2, 
+                                             _EqualFromLessCompare(__pred), 
+                                             random_access_iterator_tag(), 
+                                             random_access_iterator_tag());
+
+              return (__mm.first == __end1)
+                        || bool(__pred(*__mm.first, *__mm.second));
+            }
+          else
+            {
+              typedef pair<_RAIter2, _RAIter1> _SpotType;
+              _SpotType __mm = __mismatch_switch(__begin2, __end2, __begin1, 
+                                             _EqualFromLessCompare(__pred), 
+                                             random_access_iterator_tag(), 
+                                             random_access_iterator_tag());
+
+              return (__mm.first != __end2)
+                        && bool(__pred(*__mm.second, *__mm.first));
+            }
+        }
+      else
+        return _GLIBCXX_STD_A::lexicographical_compare(
+                 __begin1, __end1, __begin2, __end2, __pred);
+    }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2>
+    inline bool
+    lexicographical_compare(_IIter1 __begin1, _IIter1 __end1,
+                            _IIter2 __begin2, _IIter2 __end2)
+    {
+      typedef iterator_traits<_IIter1> _TraitsType1;
+      typedef typename _TraitsType1::value_type _ValueType1;
+      typedef typename _TraitsType1::iterator_category _IteratorCategory1;
+
+      typedef iterator_traits<_IIter2> _TraitsType2;
+      typedef typename _TraitsType2::value_type _ValueType2;
+      typedef typename _TraitsType2::iterator_category _IteratorCategory2;
+      typedef __gnu_parallel::_Less<_ValueType1, _ValueType2> _LessType;
+
+      return __lexicographical_compare_switch(
+               __begin1, __end1, __begin2, __end2, _LessType(),
+               _IteratorCategory1(), _IteratorCategory2());
+    }
+
+  // Public interface
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    inline bool
+    lexicographical_compare(_IIter1 __begin1, _IIter1 __end1,
+                            _IIter2 __begin2, _IIter2 __end2,
+                            _Predicate __pred)
+    {
+      typedef iterator_traits<_IIter1> _TraitsType1;
+      typedef typename _TraitsType1::iterator_category _IteratorCategory1;
+
+      typedef iterator_traits<_IIter2> _TraitsType2;
+      typedef typename _TraitsType2::iterator_category _IteratorCategory2;
+
+      return __lexicographical_compare_switch(
+               __begin1, __end1, __begin2, __end2, __pred,
+               _IteratorCategory1(), _IteratorCategory2());
+    }
+} // end namespace
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_ALGOBASE_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algorithm b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algorithm
new file mode 100644
index 0000000..3c93d5b
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algorithm
@@ -0,0 +1,40 @@
+// Algorithm extensions -*- C++ -*-
+
+// Copyright (C) 2007, 2009
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option)
+// any later version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/algorithm
+ *  This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _PARALLEL_ALGORITHM
+#define _PARALLEL_ALGORITHM 1
+
+#pragma GCC system_header
+
+#include <algorithm>
+#include <parallel/algorithmfwd.h>
+#include <parallel/algobase.h>
+#include <parallel/algo.h>
+
+#endif
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algorithmfwd.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algorithmfwd.h
new file mode 100644
index 0000000..7d4a792
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/algorithmfwd.h
@@ -0,0 +1,908 @@
+// <algorithm> parallel extensions -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/algorithmfwd.h
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PARALLEL_ALGORITHMFWD_H
+#define _GLIBCXX_PARALLEL_ALGORITHMFWD_H 1
+
+#pragma GCC system_header
+
+#include <parallel/tags.h>
+#include <parallel/settings.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __parallel
+{
+  template<typename _FIter>
+    _FIter
+    adjacent_find(_FIter, _FIter);
+
+  template<typename _FIter>
+    _FIter
+    adjacent_find(_FIter, _FIter, __gnu_parallel::sequential_tag);
+
+  template<typename _FIter, typename _IterTag>
+    _FIter
+    __adjacent_find_switch(_FIter, _FIter, _IterTag);
+
+  template<typename _RAIter>
+    _RAIter
+    __adjacent_find_switch(_RAIter, _RAIter, random_access_iterator_tag);
+
+
+  template<typename _FIter, typename _BiPredicate>
+    _FIter
+    adjacent_find(_FIter, _FIter, _BiPredicate);
+
+  template<typename _FIter, typename _BiPredicate>
+    _FIter
+    adjacent_find(_FIter, _FIter, _BiPredicate,
+                  __gnu_parallel::sequential_tag);
+
+  template<typename _FIter, typename _BiPredicate, typename _IterTag>
+    _FIter
+    __adjacent_find_switch(_FIter, _FIter, _BiPredicate, _IterTag);
+
+  template<typename _RAIter, typename _BiPredicate>
+    _RAIter
+    __adjacent_find_switch(_RAIter, _RAIter, _BiPredicate, 
+                         random_access_iterator_tag);
+
+
+  template<typename _IIter, typename _Tp>
+    typename iterator_traits<_IIter>::difference_type
+    count(_IIter, _IIter, const _Tp&);
+
+  template<typename _IIter, typename _Tp>
+    typename iterator_traits<_IIter>::difference_type
+    count(_IIter, _IIter, const _Tp&, __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _Tp>
+    typename iterator_traits<_IIter>::difference_type
+    count(_IIter, _IIter, const _Tp&, __gnu_parallel::_Parallelism);
+
+  template<typename _IIter, typename _Tp, typename _IterTag>
+    typename iterator_traits<_IIter>::difference_type
+    __count_switch(_IIter, _IIter, const _Tp&, _IterTag);
+
+  template<typename _RAIter, typename _Tp>
+    typename iterator_traits<_RAIter>::difference_type
+    __count_switch(_RAIter, _RAIter, const _Tp&, random_access_iterator_tag,
+                 __gnu_parallel::_Parallelism __parallelism
+                 = __gnu_parallel::parallel_unbalanced);
+
+
+  template<typename _IIter, typename _Predicate>
+    typename iterator_traits<_IIter>::difference_type
+    count_if(_IIter, _IIter, _Predicate);
+
+  template<typename _IIter, typename _Predicate>
+    typename iterator_traits<_IIter>::difference_type
+    count_if(_IIter, _IIter, _Predicate, __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _Predicate>
+    typename iterator_traits<_IIter>::difference_type
+    count_if(_IIter, _IIter, _Predicate, __gnu_parallel::_Parallelism);
+
+  template<typename _IIter, typename _Predicate, typename _IterTag>
+    typename iterator_traits<_IIter>::difference_type
+    __count_if_switch(_IIter, _IIter, _Predicate, _IterTag);
+
+  template<typename _RAIter, typename _Predicate>
+    typename iterator_traits<_RAIter>::difference_type
+    __count_if_switch(_RAIter, _RAIter, _Predicate, random_access_iterator_tag,
+                    __gnu_parallel::_Parallelism __parallelism
+                    = __gnu_parallel::parallel_unbalanced);
+
+  // algobase.h
+  template<typename _IIter1, typename _IIter2>
+    bool
+    equal(_IIter1, _IIter1, _IIter2, __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    bool
+    equal(_IIter1, _IIter1, _IIter2, _Predicate,
+          __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2>
+    bool
+    equal(_IIter1, _IIter1, _IIter2);
+
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    bool
+    equal(_IIter1, _IIter1, _IIter2, _Predicate);
+
+  template<typename _IIter, typename _Tp>
+    _IIter
+    find(_IIter, _IIter, const _Tp&, __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _Tp>
+    _IIter
+    find(_IIter, _IIter, const _Tp& __val);
+
+  template<typename _IIter, typename _Tp, typename _IterTag>
+    _IIter
+    __find_switch(_IIter, _IIter, const _Tp&, _IterTag);
+
+  template<typename _RAIter, typename _Tp>
+    _RAIter
+    __find_switch(_RAIter, _RAIter, const _Tp&, random_access_iterator_tag);
+
+  template<typename _IIter, typename _Predicate>
+    _IIter
+    find_if(_IIter, _IIter, _Predicate, __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _Predicate>
+    _IIter
+    find_if(_IIter, _IIter, _Predicate);
+
+  template<typename _IIter, typename _Predicate, typename _IterTag>
+    _IIter
+    __find_if_switch(_IIter, _IIter, _Predicate, _IterTag);
+
+  template<typename _RAIter, typename _Predicate>
+    _RAIter
+    __find_if_switch(_RAIter, _RAIter, _Predicate, random_access_iterator_tag);
+
+  template<typename _IIter, typename _FIter>
+    _IIter
+    find_first_of(_IIter, _IIter, _FIter, _FIter,
+                  __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _FIter, typename _BiPredicate>
+    _IIter
+    find_first_of(_IIter, _IIter, _FIter, _FIter, _BiPredicate,
+                  __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _FIter, typename _BiPredicate>
+    _IIter
+    find_first_of(_IIter, _IIter, _FIter, _FIter, _BiPredicate);
+
+  template<typename _IIter, typename _FIter>
+    _IIter
+    find_first_of(_IIter, _IIter, _FIter, _FIter);
+
+  template<typename _IIter, typename _FIter,
+           typename _IterTag1, typename _IterTag2>
+    _IIter
+    __find_first_of_switch(
+      _IIter, _IIter, _FIter, _FIter, _IterTag1, _IterTag2);
+
+  template<typename _RAIter, typename _FIter, typename _BiPredicate,
+           typename _IterTag>
+    _RAIter
+    __find_first_of_switch(_RAIter, _RAIter, _FIter, _FIter, _BiPredicate,
+                         random_access_iterator_tag, _IterTag);
+
+  template<typename _IIter, typename _FIter, typename _BiPredicate,
+           typename _IterTag1, typename _IterTag2>
+    _IIter
+    __find_first_of_switch(_IIter, _IIter, _FIter, _FIter, _BiPredicate,
+                         _IterTag1, _IterTag2);
+
+
+  template<typename _IIter, typename _Function>
+    _Function
+    for_each(_IIter, _IIter, _Function);
+
+  template<typename _IIter, typename _Function>
+    _Function
+    for_each(_IIter, _IIter, _Function, __gnu_parallel::sequential_tag);
+
+  template<typename _Iterator, typename _Function>
+    _Function
+    for_each(_Iterator, _Iterator, _Function, __gnu_parallel::_Parallelism);
+
+  template<typename _IIter, typename _Function, typename _IterTag>
+    _Function
+    __for_each_switch(_IIter, _IIter, _Function, _IterTag);
+
+  template<typename _RAIter, typename _Function>
+    _Function
+    __for_each_switch(_RAIter, _RAIter, _Function, random_access_iterator_tag,
+                    __gnu_parallel::_Parallelism  __parallelism
+                    = __gnu_parallel::parallel_balanced);
+
+
+  template<typename _FIter, typename _Generator>
+    void
+    generate(_FIter, _FIter, _Generator);
+
+  template<typename _FIter, typename _Generator>
+    void
+    generate(_FIter, _FIter, _Generator, __gnu_parallel::sequential_tag);
+
+  template<typename _FIter, typename _Generator>
+    void
+    generate(_FIter, _FIter, _Generator, __gnu_parallel::_Parallelism);
+
+  template<typename _FIter, typename _Generator, typename _IterTag>
+    void
+    __generate_switch(_FIter, _FIter, _Generator, _IterTag);
+
+  template<typename _RAIter, typename _Generator>
+    void
+    __generate_switch(_RAIter, _RAIter, _Generator, random_access_iterator_tag,
+                    __gnu_parallel::_Parallelism __parallelism
+                    = __gnu_parallel::parallel_balanced);
+
+  template<typename _OIter, typename _Size, typename _Generator>
+    _OIter
+    generate_n(_OIter, _Size, _Generator);
+
+  template<typename _OIter, typename _Size, typename _Generator>
+    _OIter
+    generate_n(_OIter, _Size, _Generator, __gnu_parallel::sequential_tag);
+
+  template<typename _OIter, typename _Size, typename _Generator>
+    _OIter
+    generate_n(_OIter, _Size, _Generator, __gnu_parallel::_Parallelism);
+
+  template<typename _OIter, typename _Size, typename _Generator,
+           typename _IterTag>
+    _OIter
+    __generate_n_switch(_OIter, _Size, _Generator, _IterTag);
+
+  template<typename _RAIter, typename _Size, typename _Generator>
+    _RAIter
+    __generate_n_switch(_RAIter, _Size, _Generator, random_access_iterator_tag,
+                      __gnu_parallel::_Parallelism __parallelism
+                      = __gnu_parallel::parallel_balanced);
+
+  template<typename _IIter1, typename _IIter2>
+    bool
+    lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2,
+                            __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    bool
+    lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Predicate,
+                            __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2>
+    bool
+    lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2);
+
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    bool
+    lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Predicate);
+
+  template<typename _IIter1, typename _IIter2,
+           typename _Predicate, typename _IterTag1, typename _IterTag2>
+    bool
+    __lexicographical_compare_switch(_IIter1, _IIter1, _IIter2, _IIter2,
+                                   _Predicate, _IterTag1, _IterTag2);
+
+  template<typename _RAIter1, typename _RAIter2, typename _Predicate>
+    bool
+    __lexicographical_compare_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2,
+                                   _Predicate, random_access_iterator_tag,
+                                   random_access_iterator_tag);
+
+  // algo.h
+  template<typename _IIter1, typename _IIter2>
+    pair<_IIter1, _IIter2>
+    mismatch(_IIter1, _IIter1, _IIter2, __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    pair<_IIter1, _IIter2>
+    mismatch(_IIter1, _IIter1, _IIter2, _Predicate,
+             __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2>
+    pair<_IIter1, _IIter2>
+    mismatch(_IIter1, _IIter1, _IIter2);
+
+  template<typename _IIter1, typename _IIter2, typename _Predicate>
+    pair<_IIter1, _IIter2>
+    mismatch(_IIter1, _IIter1, _IIter2, _Predicate);
+
+  template<typename _IIter1, typename _IIter2, typename _Predicate,
+           typename _IterTag1, typename _IterTag2>
+    pair<_IIter1, _IIter2>
+    __mismatch_switch(_IIter1, _IIter1, _IIter2, _Predicate,
+                    _IterTag1, _IterTag2);
+
+  template<typename _RAIter1, typename _RAIter2, typename _Predicate>
+    pair<_RAIter1, _RAIter2>
+    __mismatch_switch(_RAIter1, _RAIter1, _RAIter2, _Predicate,
+                    random_access_iterator_tag, random_access_iterator_tag);
+
+  template<typename _FIter1, typename _FIter2>
+    _FIter1
+    search(_FIter1, _FIter1, _FIter2, _FIter2, __gnu_parallel::sequential_tag);
+
+  template<typename _FIter1, typename _FIter2>
+    _FIter1
+    search(_FIter1, _FIter1, _FIter2, _FIter2);
+
+  template<typename _FIter1, typename _FIter2, typename _BiPredicate>
+    _FIter1
+    search(_FIter1, _FIter1, _FIter2, _FIter2, _BiPredicate,
+           __gnu_parallel::sequential_tag);
+
+  template<typename _FIter1, typename _FIter2, typename _BiPredicate>
+    _FIter1
+    search(_FIter1, _FIter1, _FIter2, _FIter2, _BiPredicate);
+
+  template<typename _RAIter1, typename _RAIter2>
+    _RAIter1
+    __search_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2,
+                  random_access_iterator_tag, random_access_iterator_tag);
+
+  template<typename _FIter1, typename _FIter2, typename _IterTag1,
+           typename _IterTag2>
+    _FIter1
+    __search_switch(_FIter1, _FIter1, _FIter2, _FIter2, _IterTag1, _IterTag2);
+
+  template<typename _RAIter1, typename _RAIter2, typename _BiPredicate>
+    _RAIter1
+    __search_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2, _BiPredicate,
+                  random_access_iterator_tag, random_access_iterator_tag);
+
+  template<typename _FIter1, typename _FIter2, typename _BiPredicate,
+           typename _IterTag1, typename _IterTag2>
+    _FIter1
+    __search_switch(_FIter1, _FIter1, _FIter2, _FIter2, _BiPredicate,
+                  _IterTag1, _IterTag2);
+
+  template<typename _FIter, typename _Integer, typename _Tp>
+    _FIter
+    search_n(_FIter, _FIter, _Integer, const _Tp&,
+             __gnu_parallel::sequential_tag);
+
+  template<typename _FIter, typename _Integer, typename _Tp,
+           typename _BiPredicate>
+    _FIter
+    search_n(_FIter, _FIter, _Integer, const _Tp&, _BiPredicate,
+             __gnu_parallel::sequential_tag);
+    
+  template<typename _FIter, typename _Integer, typename _Tp>
+    _FIter
+    search_n(_FIter, _FIter, _Integer, const _Tp&);
+
+  template<typename _FIter, typename _Integer, typename _Tp,
+           typename _BiPredicate>
+    _FIter
+    search_n(_FIter, _FIter, _Integer, const _Tp&, _BiPredicate);
+
+  template<typename _RAIter, typename _Integer, typename _Tp,
+           typename _BiPredicate>
+    _RAIter
+    __search_n_switch(_RAIter, _RAIter, _Integer, const _Tp&,
+                    _BiPredicate, random_access_iterator_tag);
+
+  template<typename _FIter, typename _Integer, typename _Tp,
+           typename _BiPredicate, typename _IterTag>
+    _FIter
+    __search_n_switch(_FIter, _FIter, _Integer, const _Tp&,
+                    _BiPredicate, _IterTag);
+
+
+  template<typename _IIter, typename _OIter, typename _UnaryOperation>
+    _OIter
+    transform(_IIter, _IIter, _OIter, _UnaryOperation);
+
+  template<typename _IIter, typename _OIter, typename _UnaryOperation>
+    _OIter
+    transform(_IIter, _IIter, _OIter, _UnaryOperation, 
+              __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _OIter, typename _UnaryOperation>
+    _OIter
+    transform(_IIter, _IIter, _OIter, _UnaryOperation, 
+              __gnu_parallel::_Parallelism);
+
+  template<typename _IIter, typename _OIter, typename _UnaryOperation,
+           typename _IterTag1, typename _IterTag2>
+    _OIter
+    __transform1_switch(_IIter, _IIter, _OIter, _UnaryOperation, 
+                      _IterTag1, _IterTag2);
+    
+
+  template<typename _RAIIter, typename _RAOIter, typename _UnaryOperation>
+    _RAOIter
+    __transform1_switch(_RAIIter, _RAIIter, _RAOIter, _UnaryOperation, 
+                      random_access_iterator_tag, random_access_iterator_tag, 
+                      __gnu_parallel::_Parallelism __parallelism
+                      = __gnu_parallel::parallel_balanced);
+
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _BiOperation>
+    _OIter
+    transform(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _BiOperation>
+    _OIter
+    transform(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation, 
+              __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _BiOperation>
+    _OIter
+    transform(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation, 
+              __gnu_parallel::_Parallelism);
+
+  template<typename _RAIter1, typename _RAIter2, typename _RAIter3,
+           typename _BiOperation>
+    _RAIter3
+    __transform2_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter3, _BiOperation, 
+                      random_access_iterator_tag, random_access_iterator_tag, 
+                      random_access_iterator_tag,
+                      __gnu_parallel::_Parallelism __parallelism
+                      = __gnu_parallel::parallel_balanced);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _BiOperation, typename _Tag1,
+           typename _Tag2, typename _Tag3>
+    _OIter
+    __transform2_switch(_IIter1, _IIter1, _IIter2, _OIter, _BiOperation, 
+                      _Tag1, _Tag2, _Tag3);
+
+
+  template<typename _FIter, typename _Tp>
+    void
+    replace(_FIter, _FIter, const _Tp&, const _Tp&);
+
+  template<typename _FIter, typename _Tp>
+    void
+    replace(_FIter, _FIter, const _Tp&, const _Tp&, 
+            __gnu_parallel::sequential_tag);
+
+  template<typename _FIter, typename _Tp>
+    void
+    replace(_FIter, _FIter, const _Tp&, const _Tp&,
+            __gnu_parallel::_Parallelism);
+
+  template<typename _FIter, typename _Tp, typename _IterTag>
+    void
+    __replace_switch(_FIter, _FIter, const _Tp&, const _Tp&, _IterTag);
+
+  template<typename _RAIter, typename _Tp>
+    void
+    __replace_switch(_RAIter, _RAIter, const _Tp&, const _Tp&, 
+                   random_access_iterator_tag, __gnu_parallel::_Parallelism);
+
+
+  template<typename _FIter, typename _Predicate, typename _Tp>
+    void
+    replace_if(_FIter, _FIter, _Predicate, const _Tp&);
+
+  template<typename _FIter, typename _Predicate, typename _Tp>
+    void
+    replace_if(_FIter, _FIter, _Predicate, const _Tp&,
+               __gnu_parallel::sequential_tag);
+
+  template<typename _FIter, typename _Predicate, typename _Tp>
+    void
+    replace_if(_FIter, _FIter, _Predicate, const _Tp&,
+               __gnu_parallel::_Parallelism);
+
+  template<typename _FIter, typename _Predicate, typename _Tp,
+           typename _IterTag>
+    void
+    __replace_if_switch(_FIter, _FIter, _Predicate, const _Tp&, _IterTag);
+ 
+  template<typename _RAIter, typename _Predicate, typename _Tp>
+    void
+    __replace_if_switch(_RAIter, _RAIter, _Predicate, const _Tp&,
+                      random_access_iterator_tag,
+                      __gnu_parallel::_Parallelism);
+
+
+  template<typename _FIter>
+    _FIter
+    max_element(_FIter, _FIter);
+
+  template<typename _FIter>
+    _FIter
+    max_element(_FIter, _FIter, __gnu_parallel::sequential_tag);
+
+  template<typename _FIter>
+    _FIter
+    max_element(_FIter, _FIter, __gnu_parallel::_Parallelism);
+
+  template<typename _FIter, typename _Compare>
+    _FIter
+    max_element(_FIter, _FIter, _Compare);
+
+  template<typename _FIter, typename _Compare>
+    _FIter
+    max_element(_FIter, _FIter, _Compare, __gnu_parallel::sequential_tag);
+
+  template<typename _FIter, typename _Compare>
+    _FIter
+    max_element(_FIter, _FIter, _Compare, __gnu_parallel::_Parallelism);
+
+  template<typename _FIter, typename _Compare, typename _IterTag>
+    _FIter
+    __max_element_switch(_FIter, _FIter, _Compare, _IterTag);
+
+  template<typename _RAIter, typename _Compare>
+    _RAIter
+    __max_element_switch(
+      _RAIter, _RAIter, _Compare, random_access_iterator_tag,
+      __gnu_parallel::_Parallelism __parallelism
+      = __gnu_parallel::parallel_balanced);
+
+
+  template<typename _IIter1, typename _IIter2, typename _OIter>
+    _OIter
+    merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, 
+          __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Compare>
+    _OIter
+    merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare, 
+          __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Compare>
+    _OIter
+    merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter>
+    _OIter
+    merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Compare, typename _IterTag1, typename _IterTag2,
+           typename _IterTag3>
+    _OIter
+    __merge_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare, 
+                 _IterTag1, _IterTag2, _IterTag3);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Compare>
+    _OIter
+    __merge_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare, 
+                 random_access_iterator_tag, random_access_iterator_tag, 
+                 random_access_iterator_tag);
+
+
+  template<typename _FIter>
+    _FIter
+    min_element(_FIter, _FIter);
+
+  template<typename _FIter>
+    _FIter
+    min_element(_FIter, _FIter, __gnu_parallel::sequential_tag);
+
+  template<typename _FIter>
+    _FIter
+    min_element(_FIter, _FIter,
+                __gnu_parallel::_Parallelism __parallelism_tag);
+
+  template<typename _FIter, typename _Compare>
+    _FIter
+    min_element(_FIter, _FIter, _Compare);
+
+  template<typename _FIter, typename _Compare>
+    _FIter
+    min_element(_FIter, _FIter, _Compare, __gnu_parallel::sequential_tag);
+
+  template<typename _FIter, typename _Compare>
+    _FIter
+    min_element(_FIter, _FIter, _Compare, __gnu_parallel::_Parallelism);
+
+  template<typename _FIter, typename _Compare, typename _IterTag>
+    _FIter
+    __min_element_switch(_FIter, _FIter, _Compare, _IterTag);
+
+  template<typename _RAIter, typename _Compare>
+    _RAIter
+    __min_element_switch(
+      _RAIter, _RAIter, _Compare, random_access_iterator_tag,
+      __gnu_parallel::_Parallelism __parallelism
+      = __gnu_parallel::parallel_balanced);
+
+  template<typename _RAIter>
+    void
+    nth_element(_RAIter, _RAIter, _RAIter, __gnu_parallel::sequential_tag);
+
+  template<typename _RAIter, typename _Compare>
+    void
+    nth_element(_RAIter, _RAIter, _RAIter, _Compare,
+                __gnu_parallel::sequential_tag);
+
+  template<typename _RAIter, typename _Compare>
+    void
+    nth_element(_RAIter, _RAIter, _RAIter, _Compare);
+
+  template<typename _RAIter>
+    void
+    nth_element(_RAIter, _RAIter, _RAIter);
+
+  template<typename _RAIter, typename _Compare>
+    void
+    partial_sort(_RAIter, _RAIter, _RAIter, _Compare,
+                 __gnu_parallel::sequential_tag);
+
+  template<typename _RAIter>
+    void
+    partial_sort(_RAIter, _RAIter, _RAIter, __gnu_parallel::sequential_tag);
+
+  template<typename _RAIter, typename _Compare>
+    void
+    partial_sort(_RAIter, _RAIter, _RAIter, _Compare);
+
+  template<typename _RAIter>
+    void
+    partial_sort(_RAIter, _RAIter, _RAIter);
+
+  template<typename _FIter, typename _Predicate>
+    _FIter
+    partition(_FIter, _FIter, _Predicate, __gnu_parallel::sequential_tag);
+    
+  template<typename _FIter, typename _Predicate>
+    _FIter
+    partition(_FIter, _FIter, _Predicate);
+
+  template<typename _FIter, typename _Predicate, typename _IterTag>
+    _FIter
+    __partition_switch(_FIter, _FIter, _Predicate, _IterTag);
+    
+  template<typename _RAIter, typename _Predicate>
+    _RAIter
+    __partition_switch(
+      _RAIter, _RAIter, _Predicate, random_access_iterator_tag);
+
+  template<typename _RAIter>
+    void
+    random_shuffle(_RAIter, _RAIter, __gnu_parallel::sequential_tag);
+
+  template<typename _RAIter, typename _RandomNumberGenerator>
+    void
+    random_shuffle(_RAIter, _RAIter, _RandomNumberGenerator&,
+                   __gnu_parallel::sequential_tag);
+
+  template<typename _RAIter>
+    void
+    random_shuffle(_RAIter, _RAIter);
+
+  template<typename _RAIter, typename _RandomNumberGenerator>
+    void
+    random_shuffle(_RAIter, _RAIter,
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+		   _RandomNumberGenerator&&);
+#else
+		   _RandomNumberGenerator&);
+#endif
+
+  template<typename _IIter1, typename _IIter2, typename _OIter>
+    _OIter
+    set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+            __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Predicate>
+    _OIter
+    set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate,
+              __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter>
+    _OIter
+    set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Predicate>
+    _OIter 
+    set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate);
+
+  template<typename _IIter1, typename _IIter2, typename _Predicate,
+           typename _OIter, typename _IterTag1, typename _IterTag2,
+           typename _IterTag3>
+    _OIter
+    __set_union_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+                     _Predicate, _IterTag1, _IterTag2, _IterTag3);
+
+  template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter,
+           typename _Predicate>
+    _Output_RAIter
+    __set_union_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2, _Output_RAIter,
+                     _Predicate, random_access_iterator_tag,
+                     random_access_iterator_tag, random_access_iterator_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter>
+    _OIter
+    set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+                     __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Predicate>
+    _OIter
+    set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate,
+                     __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter>
+    _OIter
+    set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Predicate>
+    _OIter 
+    set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate);
+
+  template<typename _IIter1, typename _IIter2, typename _Predicate,
+           typename _OIter, typename _IterTag1, typename _IterTag2,
+           typename _IterTag3>
+    _OIter
+    __set_intersection_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+                            _Predicate, _IterTag1, _IterTag2, _IterTag3);
+
+  template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter,
+           typename _Predicate>
+    _Output_RAIter
+    __set_intersection_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2,
+                            _Output_RAIter, _Predicate,
+                            random_access_iterator_tag,
+                            random_access_iterator_tag,
+                            random_access_iterator_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter>
+    _OIter
+    set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+                             __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Predicate>
+    _OIter
+    set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+                             _Predicate, __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter>
+    _OIter 
+    set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Predicate>
+    _OIter 
+    set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+                             _Predicate);
+
+  template<typename _IIter1, typename _IIter2, typename _Predicate,
+           typename _OIter, typename _IterTag1, typename _IterTag2,
+           typename _IterTag3>
+    _OIter
+    __set_symmetric_difference_switch(_IIter1, _IIter1, _IIter2, _IIter2,
+                                    _OIter, _Predicate, _IterTag1, _IterTag2,
+                                    _IterTag3);
+
+  template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter,
+           typename _Predicate>
+    _Output_RAIter
+    __set_symmetric_difference_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2,
+                                    _Output_RAIter, _Predicate,
+                                    random_access_iterator_tag,
+                                    random_access_iterator_tag,
+                                    random_access_iterator_tag);
+
+
+  template<typename _IIter1, typename _IIter2, typename _OIter>
+    _OIter
+    set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+                   __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Predicate>
+    _OIter
+    set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate,
+                   __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter>
+    _OIter
+    set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
+
+  template<typename _IIter1, typename _IIter2, typename _OIter,
+           typename _Predicate>
+    _OIter
+    set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Predicate);
+
+  template<typename _IIter1, typename _IIter2, typename _Predicate,
+           typename _OIter, typename _IterTag1, typename _IterTag2,
+           typename _IterTag3>
+    _OIter
+    __set_difference_switch(_IIter1, _IIter1, _IIter2, _IIter2, _OIter,
+                          _Predicate, _IterTag1, _IterTag2, _IterTag3);
+
+  template<typename _RAIter1, typename _RAIter2, typename _Output_RAIter,
+           typename _Predicate>
+    _Output_RAIter
+    __set_difference_switch(_RAIter1, _RAIter1, _RAIter2, _RAIter2,
+                          _Output_RAIter, _Predicate,
+                          random_access_iterator_tag,
+                          random_access_iterator_tag,
+                          random_access_iterator_tag);
+
+
+  template<typename _RAIter>
+    void
+    sort(_RAIter, _RAIter, __gnu_parallel::sequential_tag);
+
+  template<typename _RAIter, typename _Compare>
+    void
+    sort(_RAIter, _RAIter, _Compare, __gnu_parallel::sequential_tag);
+
+  template<typename _RAIter>
+    void
+    sort(_RAIter, _RAIter);
+
+  template<typename _RAIter, typename _Compare>
+    void
+    sort(_RAIter, _RAIter, _Compare);
+
+  template<typename _RAIter>
+    void
+    stable_sort(_RAIter, _RAIter, __gnu_parallel::sequential_tag);
+
+  template<typename _RAIter, typename _Compare>
+    void
+    stable_sort(_RAIter, _RAIter, _Compare, __gnu_parallel::sequential_tag);
+
+  template<typename _RAIter>
+    void
+    stable_sort(_RAIter, _RAIter);
+
+  template<typename _RAIter, typename _Compare>
+    void
+    stable_sort(_RAIter, _RAIter, _Compare);
+
+  template<typename _IIter, typename _OIter>
+    _OIter
+    unique_copy(_IIter, _IIter, _OIter, __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _OIter, typename _Predicate>
+    _OIter
+    unique_copy(_IIter, _IIter, _OIter, _Predicate,
+                __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _OIter>
+    _OIter
+    unique_copy(_IIter, _IIter, _OIter);
+
+  template<typename _IIter, typename _OIter, typename _Predicate>
+    _OIter
+    unique_copy(_IIter, _IIter, _OIter, _Predicate);
+
+  template<typename _IIter, typename _OIter, typename _Predicate,
+           typename _IterTag1, typename _IterTag2>
+    _OIter
+    __unique_copy_switch(_IIter, _IIter, _OIter, _Predicate,
+                       _IterTag1, _IterTag2);
+
+  template<typename _RAIter, typename _RandomAccess_OIter, typename _Predicate>
+    _RandomAccess_OIter
+    __unique_copy_switch(_RAIter, _RAIter, _RandomAccess_OIter, _Predicate,
+                       random_access_iterator_tag, random_access_iterator_tag);
+} // end namespace __parallel
+} // end namespace std
+
+#endif /* _GLIBCXX_PARALLEL_ALGORITHMFWD_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/balanced_quicksort.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/balanced_quicksort.h
new file mode 100644
index 0000000..441e7b4
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/balanced_quicksort.h
@@ -0,0 +1,492 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/balanced_quicksort.h
+ *  @brief Implementation of a dynamically load-balanced parallel quicksort.
+ *
+ *  It works in-place and needs only logarithmic extra memory.
+ *  The algorithm is similar to the one proposed in
+ *
+ *  P. Tsigas and Y. Zhang.
+ *  A simple, fast parallel implementation of quicksort and
+ *  its performance evaluation on SUN enterprise 10000.
+ *  In 11th Euromicro Conference on Parallel, Distributed and
+ *  Network-Based Processing, page 372, 2003.
+ *
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_BALANCED_QUICKSORT_H
+#define _GLIBCXX_PARALLEL_BALANCED_QUICKSORT_H 1
+
+#include <parallel/basic_iterator.h>
+#include <bits/stl_algo.h>
+#include <bits/stl_function.h>
+
+#include <parallel/settings.h>
+#include <parallel/partition.h>
+#include <parallel/random_number.h>
+#include <parallel/queue.h>
+
+#if _GLIBCXX_ASSERTIONS
+#include <parallel/checkers.h>
+#endif
+
+namespace __gnu_parallel
+{
+  /** @brief Information local to one thread in the parallel quicksort run. */
+  template<typename _RAIter>
+    struct _QSBThreadLocal
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      /** @brief Continuous part of the sequence, described by an
+      iterator pair. */
+      typedef std::pair<_RAIter, _RAIter> _Piece;
+
+      /** @brief Initial piece to work on. */
+      _Piece _M_initial;
+
+      /** @brief Work-stealing queue. */
+      _RestrictedBoundedConcurrentQueue<_Piece> _M_leftover_parts;
+
+      /** @brief Number of threads involved in this algorithm. */
+      _ThreadIndex _M_num_threads;
+
+      /** @brief Pointer to a counter of elements left over to sort. */
+      volatile _DifferenceType* _M_elements_leftover;
+
+      /** @brief The complete sequence to sort. */
+      _Piece _M_global;
+
+      /** @brief Constructor.
+       *  @param __queue_size size of the work-stealing queue. */
+      _QSBThreadLocal(int __queue_size) : _M_leftover_parts(__queue_size) { }
+    };
+
+  /** @brief Balanced quicksort divide step.
+    *  @param __begin Begin iterator of subsequence.
+    *  @param __end End iterator of subsequence.
+    *  @param __comp Comparator.
+    *  @param __num_threads Number of threads that are allowed to work on
+    *  this part.
+    *  @pre @c (__end-__begin)>=1 */
+  template<typename _RAIter, typename _Compare>
+    typename std::iterator_traits<_RAIter>::difference_type
+    __qsb_divide(_RAIter __begin, _RAIter __end,
+		 _Compare __comp, _ThreadIndex __num_threads)
+    {
+      _GLIBCXX_PARALLEL_ASSERT(__num_threads > 0);
+
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _RAIter __pivot_pos =
+	__median_of_three_iterators(__begin, __begin + (__end - __begin) / 2,
+				    __end  - 1, __comp);
+
+#if defined(_GLIBCXX_ASSERTIONS)
+      // Must be in between somewhere.
+      _DifferenceType __n = __end - __begin;
+
+      _GLIBCXX_PARALLEL_ASSERT((!__comp(*__pivot_pos, *__begin)
+				&& !__comp(*(__begin + __n / 2),
+					   *__pivot_pos))
+			       || (!__comp(*__pivot_pos, *__begin)
+				   && !__comp(*(__end - 1), *__pivot_pos))
+			       || (!__comp(*__pivot_pos, *(__begin + __n / 2))
+				   && !__comp(*__begin, *__pivot_pos))
+			       || (!__comp(*__pivot_pos, *(__begin + __n / 2))
+				   && !__comp(*(__end - 1), *__pivot_pos))
+			       || (!__comp(*__pivot_pos, *(__end - 1))
+				   && !__comp(*__begin, *__pivot_pos))
+			       || (!__comp(*__pivot_pos, *(__end - 1))
+				   && !__comp(*(__begin + __n / 2),
+					      *__pivot_pos)));
+#endif
+
+      // Swap pivot value to end.
+      if (__pivot_pos != (__end - 1))
+	std::iter_swap(__pivot_pos, __end - 1);
+      __pivot_pos = __end - 1;
+
+      __gnu_parallel::__binder2nd<_Compare, _ValueType, _ValueType, bool>
+	__pred(__comp, *__pivot_pos);
+
+      // Divide, returning __end - __begin - 1 in the worst case.
+      _DifferenceType __split_pos = __parallel_partition(__begin, __end - 1,
+							 __pred,
+							 __num_threads);
+
+      // Swap back pivot to middle.
+      std::iter_swap(__begin + __split_pos, __pivot_pos);
+      __pivot_pos = __begin + __split_pos;
+
+#if _GLIBCXX_ASSERTIONS
+      _RAIter __r;
+      for (__r = __begin; __r != __pivot_pos; ++__r)
+	_GLIBCXX_PARALLEL_ASSERT(__comp(*__r, *__pivot_pos));
+      for (; __r != __end; ++__r)
+	_GLIBCXX_PARALLEL_ASSERT(!__comp(*__r, *__pivot_pos));
+#endif
+
+      return __split_pos;
+    }
+
+  /** @brief Quicksort conquer step.
+    *  @param __tls Array of thread-local storages.
+    *  @param __begin Begin iterator of subsequence.
+    *  @param __end End iterator of subsequence.
+    *  @param __comp Comparator.
+    *  @param __iam Number of the thread processing this function.
+    *  @param __num_threads
+    *          Number of threads that are allowed to work on this part. */
+  template<typename _RAIter, typename _Compare>
+    void
+    __qsb_conquer(_QSBThreadLocal<_RAIter>** __tls,
+		  _RAIter __begin, _RAIter __end,
+		  _Compare __comp,
+		  _ThreadIndex __iam, _ThreadIndex __num_threads,
+		  bool __parent_wait)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _DifferenceType __n = __end - __begin;
+
+      if (__num_threads <= 1 || __n <= 1)
+	{
+          __tls[__iam]->_M_initial.first  = __begin;
+          __tls[__iam]->_M_initial.second = __end;
+
+          __qsb_local_sort_with_helping(__tls, __comp, __iam, __parent_wait);
+
+          return;
+	}
+
+      // Divide step.
+      _DifferenceType __split_pos =
+	__qsb_divide(__begin, __end, __comp, __num_threads);
+
+#if _GLIBCXX_ASSERTIONS
+      _GLIBCXX_PARALLEL_ASSERT(0 <= __split_pos &&
+                               __split_pos < (__end - __begin));
+#endif
+
+      _ThreadIndex
+	__num_threads_leftside = std::max<_ThreadIndex>
+	(1, std::min<_ThreadIndex>(__num_threads - 1, __split_pos
+				   * __num_threads / __n));
+
+#     pragma omp atomic
+      *__tls[__iam]->_M_elements_leftover -= (_DifferenceType)1;
+
+      // Conquer step.
+#     pragma omp parallel num_threads(2)
+      {
+	bool __wait;
+	if(omp_get_num_threads() < 2)
+          __wait = false;
+	else
+          __wait = __parent_wait;
+
+#       pragma omp sections
+	{
+#         pragma omp section
+	  {
+	    __qsb_conquer(__tls, __begin, __begin + __split_pos, __comp,
+			  __iam, __num_threads_leftside, __wait);
+	    __wait = __parent_wait;
+	  }
+	  // The pivot_pos is left in place, to ensure termination.
+#         pragma omp section
+	  {
+	    __qsb_conquer(__tls, __begin + __split_pos + 1, __end, __comp,
+			  __iam + __num_threads_leftside,
+			  __num_threads - __num_threads_leftside, __wait);
+	    __wait = __parent_wait;
+	  }
+	}
+      }
+    }
+
+  /**
+    *  @brief Quicksort step doing load-balanced local sort.
+    *  @param __tls Array of thread-local storages.
+    *  @param __comp Comparator.
+    *  @param __iam Number of the thread processing this function.
+    */
+  template<typename _RAIter, typename _Compare>
+    void
+    __qsb_local_sort_with_helping(_QSBThreadLocal<_RAIter>** __tls,
+				  _Compare& __comp, _ThreadIndex __iam,
+				  bool __wait)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      typedef std::pair<_RAIter, _RAIter> _Piece;
+
+      _QSBThreadLocal<_RAIter>& __tl = *__tls[__iam];
+
+      _DifferenceType
+	__base_case_n = _Settings::get().sort_qsb_base_case_maximal_n;
+      if (__base_case_n < 2)
+	__base_case_n = 2;
+      _ThreadIndex __num_threads = __tl._M_num_threads;
+
+      // Every thread has its own random number generator.
+      _RandomNumber __rng(__iam + 1);
+
+      _Piece __current = __tl._M_initial;
+
+      _DifferenceType __elements_done = 0;
+#if _GLIBCXX_ASSERTIONS
+      _DifferenceType __total_elements_done = 0;
+#endif
+
+      for (;;)
+	{
+          // Invariant: __current must be a valid (maybe empty) range.
+          _RAIter __begin = __current.first, __end = __current.second;
+          _DifferenceType __n = __end - __begin;
+
+          if (__n > __base_case_n)
+            {
+              // Divide.
+              _RAIter __pivot_pos = __begin +  __rng(__n);
+
+              // Swap __pivot_pos value to end.
+              if (__pivot_pos != (__end - 1))
+        	std::iter_swap(__pivot_pos, __end - 1);
+              __pivot_pos = __end - 1;
+
+              __gnu_parallel::__binder2nd
+		<_Compare, _ValueType, _ValueType, bool>
+		__pred(__comp, *__pivot_pos);
+
+              // Divide, leave pivot unchanged in last place.
+              _RAIter __split_pos1, __split_pos2;
+              __split_pos1 = __gnu_sequential::partition(__begin, __end - 1,
+							 __pred);
+
+              // Left side: < __pivot_pos; __right side: >= __pivot_pos.
+#if _GLIBCXX_ASSERTIONS
+              _GLIBCXX_PARALLEL_ASSERT(__begin <= __split_pos1
+                                       && __split_pos1 < __end);
+#endif
+              // Swap pivot back to middle.
+              if (__split_pos1 != __pivot_pos)
+        	std::iter_swap(__split_pos1, __pivot_pos);
+              __pivot_pos = __split_pos1;
+
+              // In case all elements are equal, __split_pos1 == 0.
+              if ((__split_pos1 + 1 - __begin) < (__n >> 7)
+		  || (__end - __split_pos1) < (__n >> 7))
+        	{
+                  // Very unequal split, one part smaller than one 128th
+                  // elements not strictly larger than the pivot.
+                  __gnu_parallel::__unary_negate<__gnu_parallel::__binder1st
+                    <_Compare, _ValueType, _ValueType, bool>, _ValueType>
+                    __pred(__gnu_parallel::__binder1st
+                	 <_Compare, _ValueType, _ValueType, bool>
+			   (__comp, *__pivot_pos));
+
+                  // Find other end of pivot-equal range.
+                  __split_pos2 = __gnu_sequential::partition(__split_pos1 + 1,
+							     __end, __pred);
+        	}
+              else
+        	// Only skip the pivot.
+        	__split_pos2 = __split_pos1 + 1;
+
+              // Elements equal to pivot are done.
+              __elements_done += (__split_pos2 - __split_pos1);
+#if _GLIBCXX_ASSERTIONS
+              __total_elements_done += (__split_pos2 - __split_pos1);
+#endif
+              // Always push larger part onto stack.
+              if (((__split_pos1 + 1) - __begin) < (__end - (__split_pos2)))
+        	{
+                  // Right side larger.
+                  if ((__split_pos2) != __end)
+                    __tl._M_leftover_parts.push_front
+		      (std::make_pair(__split_pos2, __end));
+
+                  //__current.first = __begin;    //already set anyway
+                  __current.second = __split_pos1;
+                  continue;
+        	}
+              else
+        	{
+                  // Left side larger.
+                  if (__begin != __split_pos1)
+                    __tl._M_leftover_parts.push_front(std::make_pair
+						      (__begin, __split_pos1));
+
+                  __current.first = __split_pos2;
+                  //__current.second = __end;     //already set anyway
+                  continue;
+        	}
+            }
+          else
+            {
+              __gnu_sequential::sort(__begin, __end, __comp);
+              __elements_done += __n;
+#if _GLIBCXX_ASSERTIONS
+              __total_elements_done += __n;
+#endif
+
+              // Prefer own stack, small pieces.
+              if (__tl._M_leftover_parts.pop_front(__current))
+        	continue;
+
+#             pragma omp atomic
+              *__tl._M_elements_leftover -= __elements_done;
+
+              __elements_done = 0;
+
+#if _GLIBCXX_ASSERTIONS
+              double __search_start = omp_get_wtime();
+#endif
+
+              // Look for new work.
+              bool __successfully_stolen = false;
+              while (__wait && *__tl._M_elements_leftover > 0
+                     && !__successfully_stolen
+#if _GLIBCXX_ASSERTIONS
+                      // Possible dead-lock.
+                     && (omp_get_wtime() < (__search_start + 1.0))
+#endif
+		     )
+        	{
+                  _ThreadIndex __victim;
+                  __victim = __rng(__num_threads);
+
+                  // Large pieces.
+                  __successfully_stolen = (__victim != __iam)
+		    && __tls[__victim]->_M_leftover_parts.pop_back(__current);
+                  if (!__successfully_stolen)
+                    __yield();
+#if !defined(__ICC) && !defined(__ECC)
+#                 pragma omp flush
+#endif
+        	}
+
+#if _GLIBCXX_ASSERTIONS
+              if (omp_get_wtime() >= (__search_start + 1.0))
+        	{
+                  sleep(1);
+                  _GLIBCXX_PARALLEL_ASSERT(omp_get_wtime()
+                                           < (__search_start + 1.0));
+        	}
+#endif
+              if (!__successfully_stolen)
+        	{
+#if _GLIBCXX_ASSERTIONS
+                  _GLIBCXX_PARALLEL_ASSERT(*__tl._M_elements_leftover == 0);
+#endif
+                  return;
+        	}
+            }
+	}
+    }
+
+  /** @brief Top-level quicksort routine.
+    *  @param __begin Begin iterator of sequence.
+    *  @param __end End iterator of sequence.
+    *  @param __comp Comparator.
+    *  @param __num_threads Number of threads that are allowed to work on
+    *  this part.
+    */
+  template<typename _RAIter, typename _Compare>
+    void
+    __parallel_sort_qsb(_RAIter __begin, _RAIter __end,
+			_Compare __comp, _ThreadIndex __num_threads)
+    {
+      _GLIBCXX_CALL(__end - __begin)
+
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      typedef std::pair<_RAIter, _RAIter> _Piece;
+
+      typedef _QSBThreadLocal<_RAIter> _TLSType;
+
+      _DifferenceType __n = __end - __begin;
+
+      if (__n <= 1)
+	return;
+
+      // At least one element per processor.
+      if (__num_threads > __n)
+	__num_threads = static_cast<_ThreadIndex>(__n);
+
+      // Initialize thread local storage
+      _TLSType** __tls = new _TLSType*[__num_threads];
+      _DifferenceType __queue_size = (__num_threads
+				      * (_ThreadIndex)(__rd_log2(__n) + 1));
+      for (_ThreadIndex __t = 0; __t < __num_threads; ++__t)
+	__tls[__t] = new _QSBThreadLocal<_RAIter>(__queue_size);
+
+      // There can never be more than ceil(__rd_log2(__n)) ranges on the
+      // stack, because
+      // 1. Only one processor pushes onto the stack
+      // 2. The largest range has at most length __n
+      // 3. Each range is larger than half of the range remaining
+      volatile _DifferenceType __elements_leftover = __n;
+      for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+	{
+          __tls[__i]->_M_elements_leftover = &__elements_leftover;
+          __tls[__i]->_M_num_threads = __num_threads;
+          __tls[__i]->_M_global = std::make_pair(__begin, __end);
+
+          // Just in case nothing is left to assign.
+          __tls[__i]->_M_initial = std::make_pair(__end, __end);
+	}
+
+      // Main recursion call.
+      __qsb_conquer(__tls, __begin, __begin + __n, __comp, 0,
+		    __num_threads, true);
+
+#if _GLIBCXX_ASSERTIONS
+      // All stack must be empty.
+      _Piece __dummy;
+      for (_ThreadIndex __i = 1; __i < __num_threads; ++__i)
+	_GLIBCXX_PARALLEL_ASSERT(
+          !__tls[__i]->_M_leftover_parts.pop_back(__dummy));
+#endif
+
+      for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+	delete __tls[__i];
+      delete[] __tls;
+    }
+} // namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_BALANCED_QUICKSORT_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/base.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/base.h
new file mode 100644
index 0000000..86adea8
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/base.h
@@ -0,0 +1,426 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/base.h
+ *  @brief Sequential helper functions.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_BASE_H
+#define _GLIBCXX_PARALLEL_BASE_H 1
+
+#include <bits/c++config.h>
+#include <bits/stl_function.h>
+#include <omp.h>
+#include <parallel/features.h>
+#include <parallel/basic_iterator.h>
+#include <parallel/parallel.h>
+
+// Parallel mode namespaces.
+
+/**
+ * @namespace std::__parallel
+ * @brief GNU parallel code, replaces standard behavior with parallel behavior.
+ */
+namespace std _GLIBCXX_VISIBILITY(default) 
+{ 
+  namespace __parallel { } 
+}
+
+/**
+ * @namespace __gnu_parallel
+ * @brief GNU parallel code for public use.
+ */
+namespace __gnu_parallel
+{
+  // Import all the parallel versions of components in namespace std.
+  using namespace std::__parallel;
+}
+
+/**
+ * @namespace __gnu_sequential
+ * @brief GNU sequential classes for public use.
+ */
+namespace __gnu_sequential 
+{ 
+  // Import whatever is the serial version.
+#ifdef _GLIBCXX_PARALLEL
+  using namespace std::_GLIBCXX_STD_A;
+#else
+  using namespace std;
+#endif   
+}
+
+
+namespace __gnu_parallel
+{
+  // NB: Including this file cannot produce (unresolved) symbols from
+  // the OpenMP runtime unless the parallel mode is actually invoked
+  // and active, which imples that the OpenMP runtime is actually
+  // going to be linked in.
+  inline _ThreadIndex
+  __get_max_threads() 
+  { 
+    _ThreadIndex __i = omp_get_max_threads();
+    return __i > 1 ? __i : 1; 
+  }
+
+
+  inline bool 
+  __is_parallel(const _Parallelism __p) { return __p != sequential; }
+
+
+  /** @brief Calculates the rounded-down logarithm of @c __n for base 2.
+   *  @param __n Argument.
+   *  @return Returns 0 for any argument <1.
+   */
+  template<typename _Size>
+    inline _Size
+    __rd_log2(_Size __n)
+    {
+      _Size __k;
+      for (__k = 0; __n > 1; __n >>= 1)
+        ++__k;
+      return __k;
+    }
+
+  /** @brief Encode two integers into one gnu_parallel::_CASable.
+   *  @param __a First integer, to be encoded in the most-significant @c
+   *  _CASable_bits/2 bits.
+   *  @param __b Second integer, to be encoded in the least-significant
+   *  @c _CASable_bits/2 bits.
+   *  @return value encoding @c __a and @c __b.
+   *  @see __decode2
+   */
+  inline _CASable
+  __encode2(int __a, int __b)     //must all be non-negative, actually
+  {
+    return (((_CASable)__a) << (_CASable_bits / 2)) | (((_CASable)__b) << 0);
+  }
+
+  /** @brief Decode two integers from one gnu_parallel::_CASable.
+   *  @param __x __gnu_parallel::_CASable to decode integers from.
+   *  @param __a First integer, to be decoded from the most-significant
+   *  @c _CASable_bits/2 bits of @c __x.
+   *  @param __b Second integer, to be encoded in the least-significant
+   *  @c _CASable_bits/2 bits of @c __x.
+   *  @see __encode2
+   */
+  inline void
+  __decode2(_CASable __x, int& __a, int& __b)
+  {
+    __a = (int)((__x >> (_CASable_bits / 2)) & _CASable_mask);
+    __b = (int)((__x >>               0 ) & _CASable_mask);
+  }
+
+  //needed for parallel "numeric", even if "algorithm" not included
+
+  /** @brief Equivalent to std::min. */
+  template<typename _Tp>
+    inline const _Tp&
+    min(const _Tp& __a, const _Tp& __b)
+    { return (__a < __b) ? __a : __b; }
+
+  /** @brief Equivalent to std::max. */
+  template<typename _Tp>
+    inline const _Tp&
+    max(const _Tp& __a, const _Tp& __b)
+    { return (__a > __b) ? __a : __b; }
+
+  /** @brief Constructs predicate for equality from strict weak
+   *  ordering predicate
+   */
+  template<typename _T1, typename _T2, typename _Compare>
+    class _EqualFromLess : public std::binary_function<_T1, _T2, bool>
+    {
+    private:
+      _Compare& _M_comp;
+
+    public:
+      _EqualFromLess(_Compare& __comp) : _M_comp(__comp) { }
+
+      bool operator()(const _T1& __a, const _T2& __b)
+      { return !_M_comp(__a, __b) && !_M_comp(__b, __a); }
+    };
+
+
+  /** @brief Similar to std::unary_negate,
+   *  but giving the argument types explicitly. */
+  template<typename _Predicate, typename argument_type>
+    class __unary_negate
+    : public std::unary_function<argument_type, bool>
+    {
+    protected:
+      _Predicate _M_pred;
+
+    public:
+      explicit
+      __unary_negate(const _Predicate& __x) : _M_pred(__x) { }
+
+      bool
+      operator()(const argument_type& __x)
+      { return !_M_pred(__x); }
+    };
+
+  /** @brief Similar to std::binder1st,
+   *  but giving the argument types explicitly. */
+  template<typename _Operation, typename _FirstArgumentType,
+	   typename _SecondArgumentType, typename _ResultType>
+    class __binder1st
+    : public std::unary_function<_SecondArgumentType, _ResultType>
+    {
+    protected:
+      _Operation _M_op;
+      _FirstArgumentType _M_value;
+
+    public:
+      __binder1st(const _Operation& __x, const _FirstArgumentType& __y)
+      : _M_op(__x), _M_value(__y) { }
+
+      _ResultType
+      operator()(const _SecondArgumentType& __x)
+      { return _M_op(_M_value, __x); }
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 109.  Missing binders for non-const sequence elements
+      _ResultType
+      operator()(_SecondArgumentType& __x) const
+      { return _M_op(_M_value, __x); }
+    };
+
+  /**
+   *  @brief Similar to std::binder2nd, but giving the argument types
+   *  explicitly.
+   */
+  template<typename _Operation, typename _FirstArgumentType,
+	   typename _SecondArgumentType, typename _ResultType>
+    class __binder2nd
+    : public std::unary_function<_FirstArgumentType, _ResultType>
+    {
+    protected:
+      _Operation _M_op;
+      _SecondArgumentType _M_value;
+
+    public:
+      __binder2nd(const _Operation& __x, const _SecondArgumentType& __y)
+      : _M_op(__x), _M_value(__y) { }
+
+      _ResultType
+      operator()(const _FirstArgumentType& __x) const
+      { return _M_op(__x, _M_value); }
+
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 109.  Missing binders for non-const sequence elements
+      _ResultType
+      operator()(_FirstArgumentType& __x)
+      { return _M_op(__x, _M_value); }
+    };
+
+  /** @brief Similar to std::equal_to, but allows two different types. */
+  template<typename _T1, typename _T2>
+    struct _EqualTo : std::binary_function<_T1, _T2, bool>
+    {
+      bool operator()(const _T1& __t1, const _T2& __t2) const
+      { return __t1 == __t2; }
+    };
+
+  /** @brief Similar to std::less, but allows two different types. */
+  template<typename _T1, typename _T2>
+    struct _Less : std::binary_function<_T1, _T2, bool>
+    {
+      bool
+      operator()(const _T1& __t1, const _T2& __t2) const
+      { return __t1 < __t2; }
+
+      bool
+      operator()(const _T2& __t2, const _T1& __t1) const
+      { return __t2 < __t1; }
+    };
+
+  // Partial specialization for one type. Same as std::less.
+  template<typename _Tp>
+    struct _Less<_Tp, _Tp>
+    : public std::less<_Tp> { };
+
+  /** @brief Similar to std::plus, but allows two different types. */
+  template<typename _Tp1, typename _Tp2, typename _Result
+	   = __typeof__(*static_cast<_Tp1*>(0)
+			+ *static_cast<_Tp2*>(0))>
+    struct _Plus : public std::binary_function<_Tp1, _Tp2, _Result>
+    {
+      _Result
+      operator()(const _Tp1& __x, const _Tp2& __y) const
+      { return __x + __y; }
+    };
+
+  // Partial specialization for one type. Same as std::plus.
+  template<typename _Tp>
+    struct _Plus<_Tp, _Tp, _Tp>
+    : public std::plus<_Tp> { };
+
+  /** @brief Similar to std::multiplies, but allows two different types. */
+  template<typename _Tp1, typename _Tp2, typename _Result
+	   = __typeof__(*static_cast<_Tp1*>(0)
+			* *static_cast<_Tp2*>(0))>
+    struct _Multiplies : public std::binary_function<_Tp1, _Tp2, _Result>
+    {
+      _Result
+      operator()(const _Tp1& __x, const _Tp2& __y) const
+      { return __x * __y; }
+    };
+
+  // Partial specialization for one type. Same as std::multiplies.
+  template<typename _Tp>
+    struct _Multiplies<_Tp, _Tp, _Tp>
+    : public std::multiplies<_Tp> { };
+
+  /** @brief _Iterator associated with __gnu_parallel::_PseudoSequence.
+   *  If features the usual random-access iterator functionality.
+   *  @param _Tp Sequence _M_value type.
+   *  @param _DifferenceTp Sequence difference type.
+   */
+  template<typename _Tp, typename _DifferenceTp>
+    class _PseudoSequenceIterator
+    {
+    public:
+      typedef _DifferenceTp _DifferenceType;
+
+      _PseudoSequenceIterator(const _Tp& __val, _DifferenceType __pos)
+      : _M_val(__val), _M_pos(__pos) { }
+
+      // Pre-increment operator.
+      _PseudoSequenceIterator&
+      operator++()
+      {
+	++_M_pos;
+	return *this;
+      }
+
+      // Post-increment operator.
+      _PseudoSequenceIterator
+      operator++(int)
+      { return _PseudoSequenceIterator(_M_pos++); }
+
+      const _Tp&
+      operator*() const
+      { return _M_val; }
+
+      const _Tp&
+      operator[](_DifferenceType) const
+      { return _M_val; }
+
+      bool
+      operator==(const _PseudoSequenceIterator& __i2)
+      { return _M_pos == __i2._M_pos; }
+
+      bool
+      operator!=(const _PseudoSequenceIterator& __i2)
+      { return _M_pos != __i2._M_pos; }
+
+      _DifferenceType
+      operator-(const _PseudoSequenceIterator& __i2)
+      { return _M_pos - __i2._M_pos; }
+
+    private:
+      const _Tp& _M_val;
+      _DifferenceType _M_pos;
+    };
+
+  /** @brief Sequence that conceptually consists of multiple copies of
+      the same element.
+      *  The copies are not stored explicitly, of course.
+      *  @param _Tp Sequence _M_value type.
+      *  @param _DifferenceTp Sequence difference type.
+      */
+  template<typename _Tp, typename _DifferenceTp>
+    class _PseudoSequence
+    {
+    public:
+      typedef _DifferenceTp _DifferenceType;
+
+      // Better cast down to uint64_t, than up to _DifferenceTp.
+      typedef _PseudoSequenceIterator<_Tp, uint64_t> iterator;
+
+      /** @brief Constructor.
+       *  @param _M_val Element of the sequence.
+       *  @param __count Number of (virtual) copies.
+       */
+      _PseudoSequence(const _Tp& __val, _DifferenceType __count)
+      : _M_val(__val), _M_count(__count)  { }
+
+      /** @brief Begin iterator. */
+      iterator
+      begin() const
+      { return iterator(_M_val, 0); }
+
+      /** @brief End iterator. */
+      iterator
+      end() const
+      { return iterator(_M_val, _M_count); }
+
+    private:
+      const _Tp& _M_val;
+      _DifferenceType _M_count;
+    };
+
+  /** @brief Compute the median of three referenced elements,
+      according to @c __comp.
+      *  @param __a First iterator.
+      *  @param __b Second iterator.
+      *  @param __c Third iterator.
+      *  @param __comp Comparator.
+      */
+  template<typename _RAIter, typename _Compare>
+    _RAIter
+    __median_of_three_iterators(_RAIter __a, _RAIter __b,
+				_RAIter __c, _Compare __comp)
+    {
+      if (__comp(*__a, *__b))
+	if (__comp(*__b, *__c))
+	  return __b;
+	else
+	  if (__comp(*__a, *__c))
+	    return __c;
+	  else
+	    return __a;
+      else
+	{
+	  // Just swap __a and __b.
+	  if (__comp(*__a, *__c))
+	    return __a;
+	  else
+	    if (__comp(*__b, *__c))
+	      return __c;
+	    else
+	      return __b;
+	}
+    }
+
+#define _GLIBCXX_PARALLEL_ASSERT(_Condition) __glibcxx_assert(_Condition)
+
+} //namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_BASE_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/basic_iterator.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/basic_iterator.h
new file mode 100644
index 0000000..a624edc
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/basic_iterator.h
@@ -0,0 +1,41 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/basic_iterator.h
+ *  @brief Includes the original header files concerned with iterators
+ *  except for stream iterators.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_BASIC_ITERATOR_H
+#define _GLIBCXX_PARALLEL_BASIC_ITERATOR_H 1
+
+#include <bits/c++config.h>
+#include <bits/stl_iterator_base_types.h>
+#include <bits/stl_iterator_base_funcs.h>
+#include <bits/stl_iterator.h>
+
+#endif /* _GLIBCXX_PARALLEL_BASIC_ITERATOR_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/checkers.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/checkers.h
new file mode 100644
index 0000000..32507fd
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/checkers.h
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/checkers.h
+ *  @brief Routines for checking the correctness of algorithm results.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_CHECKERS_H
+#define _GLIBCXX_PARALLEL_CHECKERS_H 1
+
+#include <cstdio>
+#include <bits/stl_algobase.h>
+#include <bits/stl_function.h>
+
+namespace __gnu_parallel
+{
+  /**
+   * @brief Check whether @c [__begin, @c __end) is sorted according
+   * to @c __comp.
+   * @param __begin Begin iterator of sequence.
+   * @param __end End iterator of sequence.
+   * @param __comp Comparator.
+   * @return @c true if sorted, @c false otherwise.
+   */
+  template<typename _IIter, typename _Compare>
+    bool
+    __is_sorted(_IIter __begin, _IIter __end, _Compare __comp)
+    {
+      if (__begin == __end)
+        return true;
+
+      _IIter __current(__begin), __recent(__begin);
+
+      unsigned long long __position = 1;
+      for (__current++; __current != __end; __current++)
+        {
+          if (__comp(*__current, *__recent))
+            {
+              return false;
+            }
+          __recent = __current;
+          __position++;
+        }
+
+      return true;
+    }
+}
+
+#endif /* _GLIBCXX_PARALLEL_CHECKERS_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/compatibility.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/compatibility.h
new file mode 100644
index 0000000..9fffd8e
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/compatibility.h
@@ -0,0 +1,364 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/compatibility.h
+ *  @brief Compatibility layer, mostly concerned with atomic operations.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_COMPATIBILITY_H
+#define _GLIBCXX_PARALLEL_COMPATIBILITY_H 1
+
+#include <parallel/types.h>
+#include <parallel/base.h>
+
+#if defined(__SUNPRO_CC) && defined(__sparc)
+#include <sys/atomic.h>
+#endif
+
+#if !defined(_WIN32) || defined (__CYGWIN__)
+#include <sched.h>
+#endif
+
+#if defined(_MSC_VER)
+#include <Windows.h>
+#include <intrin.h>
+#undef max
+#undef min
+#endif
+
+#ifdef __MINGW32__
+// Including <windows.h> will drag in all the windows32 names.  Since
+// that can cause user code portability problems, we just declare the
+// one needed function here.
+extern "C"
+__attribute((dllimport)) void __attribute__((stdcall)) Sleep (unsigned long);
+#endif
+
+namespace __gnu_parallel
+{
+#if defined(__ICC)
+  template<typename _MustBeInt = int>
+  int32_t __faa32(int32_t* __x, int32_t __inc)
+  {
+    asm volatile("lock xadd %0,%1"
+                 : "=__r" (__inc), "=__m" (*__x)
+                 : "0" (__inc)
+                 : "memory");
+    return __inc;
+  }
+#if defined(__x86_64)
+  template<typename _MustBeInt = int>
+  int64_t __faa64(int64_t* __x, int64_t __inc)
+  {
+    asm volatile("lock xadd %0,%1"
+                 : "=__r" (__inc), "=__m" (*__x)
+                 : "0" (__inc)
+                 : "memory");
+    return __inc;
+  }
+#endif
+#endif
+
+  // atomic functions only work on integers
+
+  /** @brief Add a value to a variable, atomically.
+   *
+   *  Implementation is heavily platform-dependent.
+   *  @param __ptr Pointer to a 32-bit signed integer.
+   *  @param __addend Value to add.
+   */
+  inline int32_t
+  __fetch_and_add_32(volatile int32_t* __ptr, int32_t __addend)
+  {
+#if defined(__ICC)      //x86 version
+    return _InterlockedExchangeAdd((void*)__ptr, __addend);
+#elif defined(__ECC)    //IA-64 version
+    return _InterlockedExchangeAdd((void*)__ptr, __addend);
+#elif defined(__ICL) || defined(_MSC_VER)
+    return _InterlockedExchangeAdd(reinterpret_cast<volatile long*>(__ptr),
+                                   __addend);
+#elif defined(__GNUC__)
+    return __sync_fetch_and_add(__ptr, __addend);
+#elif defined(__SUNPRO_CC) && defined(__sparc)
+    volatile int32_t __before, __after;
+    do
+      {
+        __before = *__ptr;
+        __after = __before + __addend;
+      } while (atomic_cas_32((volatile unsigned int*)__ptr, __before,
+                             __after) != __before);
+    return __before;
+#else   //fallback, slow
+#pragma message("slow __fetch_and_add_32")
+    int32_t __res;
+#pragma omp critical
+    {
+      __res = *__ptr;
+      *(__ptr) += __addend;
+    }
+    return __res;
+#endif
+  }
+
+  /** @brief Add a value to a variable, atomically.
+   *
+   *  Implementation is heavily platform-dependent.
+   *  @param __ptr Pointer to a 64-bit signed integer.
+   *  @param __addend Value to add.
+   */
+  inline int64_t
+  __fetch_and_add_64(volatile int64_t* __ptr, int64_t __addend)
+  {
+#if defined(__ICC) && defined(__x86_64) //x86 version
+    return __faa64<int>((int64_t*)__ptr, __addend);
+#elif defined(__ECC)    //IA-64 version
+    return _InterlockedExchangeAdd64((void*)__ptr, __addend);
+#elif defined(__ICL) || defined(_MSC_VER)
+#ifndef _WIN64
+    _GLIBCXX_PARALLEL_ASSERT(false);    //not available in this case
+    return 0;
+#else
+    return _InterlockedExchangeAdd64(__ptr, __addend);
+#endif
+#elif defined(__GNUC__) && defined(__x86_64)
+    return __sync_fetch_and_add(__ptr, __addend);
+#elif defined(__GNUC__) && defined(__i386) &&                   \
+  (defined(__i686) || defined(__pentium4) || defined(__athlon)  \
+   || defined(__k8) || defined(__core2))
+    return __sync_fetch_and_add(__ptr, __addend);
+#elif defined(__SUNPRO_CC) && defined(__sparc)
+    volatile int64_t __before, __after;
+    do
+      {
+        __before = *__ptr;
+        __after = __before + __addend;
+      } while (atomic_cas_64((volatile unsigned long long*)__ptr, __before,
+                             __after) != __before);
+    return __before;
+#else   //fallback, slow
+#if defined(__GNUC__) && defined(__i386)
+    // XXX doesn'__t work with -march=native
+    //#warning "please compile with -march=i686 or better"
+#endif
+#pragma message("slow __fetch_and_add_64")
+    int64_t __res;
+#pragma omp critical
+    {
+      __res = *__ptr;
+      *(__ptr) += __addend;
+    }
+    return __res;
+#endif
+  }
+
+  /** @brief Add a value to a variable, atomically.
+   *
+   *  Implementation is heavily platform-dependent.
+   *  @param __ptr Pointer to a signed integer.
+   *  @param __addend Value to add.
+   */
+  template<typename _Tp>
+  inline _Tp
+  __fetch_and_add(volatile _Tp* __ptr, _Tp __addend)
+  {
+    if (sizeof(_Tp) == sizeof(int32_t))
+      return
+        (_Tp)__fetch_and_add_32((volatile int32_t*) __ptr, (int32_t)__addend);
+    else if (sizeof(_Tp) == sizeof(int64_t))
+      return
+        (_Tp)__fetch_and_add_64((volatile int64_t*) __ptr, (int64_t)__addend);
+    else
+      _GLIBCXX_PARALLEL_ASSERT(false);
+  }
+
+
+#if defined(__ICC)
+
+  template<typename _MustBeInt = int>
+  inline int32_t
+  __cas32(volatile int32_t* __ptr, int32_t __old, int32_t __nw)
+  {
+    int32_t __before;
+    __asm__ __volatile__("lock; cmpxchgl %1,%2"
+                         : "=a"(__before)
+                         : "q"(__nw), "__m"(*(volatile long long*)(__ptr)),
+                               "0"(__old)
+                         : "memory");
+    return __before;
+  }
+
+#if defined(__x86_64)
+  template<typename _MustBeInt = int>
+  inline int64_t
+  __cas64(volatile int64_t *__ptr, int64_t __old, int64_t __nw)
+  {
+    int64_t __before;
+    __asm__ __volatile__("lock; cmpxchgq %1,%2"
+                         : "=a"(__before)
+                         : "q"(__nw), "__m"(*(volatile long long*)(__ptr)),
+                               "0"(__old)
+                         : "memory");
+    return __before;
+  }
+#endif
+
+#endif
+
+  /** @brief Compare @c *__ptr and @c __comparand. If equal, let @c
+   * *__ptr=__replacement and return @c true, return @c false otherwise.
+   *
+   *  Implementation is heavily platform-dependent.
+   *  @param __ptr Pointer to 32-bit signed integer.
+   *  @param __comparand Compare value.
+   *  @param __replacement Replacement value.
+   */
+  inline bool
+  __compare_and_swap_32(volatile int32_t* __ptr, int32_t __comparand,
+                        int32_t __replacement)
+  {
+#if defined(__ICC)      //x86 version
+    return _InterlockedCompareExchange((void*)__ptr, __replacement,
+                                       __comparand) == __comparand;
+#elif defined(__ECC)    //IA-64 version
+    return _InterlockedCompareExchange((void*)__ptr, __replacement,
+                                       __comparand) == __comparand;
+#elif defined(__ICL) || defined(_MSC_VER)
+    return _InterlockedCompareExchange(
+               reinterpret_cast<volatile long*>(__ptr),
+               __replacement, __comparand)
+             == __comparand;
+#elif defined(__GNUC__)
+    return __sync_bool_compare_and_swap(__ptr, __comparand, __replacement);
+#elif defined(__SUNPRO_CC) && defined(__sparc)
+    return atomic_cas_32((volatile unsigned int*)__ptr, __comparand,
+                         __replacement) == __comparand;
+#else
+#pragma message("slow __compare_and_swap_32")
+    bool __res = false;
+#pragma omp critical
+    {
+      if (*__ptr == __comparand)
+        {
+          *__ptr = __replacement;
+          __res = true;
+        }
+    }
+    return __res;
+#endif
+  }
+
+  /** @brief Compare @c *__ptr and @c __comparand. If equal, let @c
+   * *__ptr=__replacement and return @c true, return @c false otherwise.
+   *
+   *  Implementation is heavily platform-dependent.
+   *  @param __ptr Pointer to 64-bit signed integer.
+   *  @param __comparand Compare value.
+   *  @param __replacement Replacement value.
+   */
+  inline bool
+  __compare_and_swap_64(volatile int64_t* __ptr, int64_t __comparand,
+                        int64_t __replacement)
+  {
+#if defined(__ICC) && defined(__x86_64) //x86 version
+    return __cas64<int>(__ptr, __comparand, __replacement) == __comparand;
+#elif defined(__ECC)    //IA-64 version
+    return _InterlockedCompareExchange64((void*)__ptr, __replacement,
+                                         __comparand) == __comparand;
+#elif defined(__ICL) || defined(_MSC_VER)
+#ifndef _WIN64
+    _GLIBCXX_PARALLEL_ASSERT(false);    //not available in this case
+    return 0;
+#else
+    return _InterlockedCompareExchange64(__ptr, __replacement,
+                                         __comparand) == __comparand;
+#endif
+
+#elif defined(__GNUC__) && defined(__x86_64)
+    return __sync_bool_compare_and_swap(__ptr, __comparand, __replacement);
+#elif defined(__GNUC__) && defined(__i386) &&                   \
+  (defined(__i686) || defined(__pentium4) || defined(__athlon)  \
+   || defined(__k8) || defined(__core2))
+    return __sync_bool_compare_and_swap(__ptr, __comparand, __replacement);
+#elif defined(__SUNPRO_CC) && defined(__sparc)
+    return atomic_cas_64((volatile unsigned long long*)__ptr,
+                         __comparand, __replacement) == __comparand;
+#else
+#if defined(__GNUC__) && defined(__i386)
+    // XXX -march=native
+    //#warning "please compile with -march=i686 or better"
+#endif
+#pragma message("slow __compare_and_swap_64")
+    bool __res = false;
+#pragma omp critical
+    {
+      if (*__ptr == __comparand)
+        {
+          *__ptr = __replacement;
+          __res = true;
+        }
+    }
+    return __res;
+#endif
+  }
+
+  /** @brief Compare @c *__ptr and @c __comparand. If equal, let @c
+   * *__ptr=__replacement and return @c true, return @c false otherwise.
+   *
+   *  Implementation is heavily platform-dependent.
+   *  @param __ptr Pointer to signed integer.
+   *  @param __comparand Compare value.
+   *  @param __replacement Replacement value. */
+  template<typename _Tp>
+  inline bool
+  __compare_and_swap(volatile _Tp* __ptr, _Tp __comparand, _Tp __replacement)
+  {
+    if (sizeof(_Tp) == sizeof(int32_t))
+      return __compare_and_swap_32((volatile int32_t*) __ptr,
+                                   (int32_t)__comparand,
+                                   (int32_t)__replacement);
+    else if (sizeof(_Tp) == sizeof(int64_t))
+      return __compare_and_swap_64((volatile int64_t*) __ptr,
+                                   (int64_t)__comparand,
+                                   (int64_t)__replacement);
+    else
+      _GLIBCXX_PARALLEL_ASSERT(false);
+  }
+
+  /** @brief Yield the control to another thread, without waiting for
+      the end to the time slice. */
+  inline void
+  __yield()
+  {
+#if defined (_WIN32) && !defined (__CYGWIN__)
+    Sleep(0);
+#else
+    sched_yield();
+#endif
+  }
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_COMPATIBILITY_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/compiletime_settings.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/compiletime_settings.h
new file mode 100644
index 0000000..e375a94
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/compiletime_settings.h
@@ -0,0 +1,75 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/compiletime_settings.h
+ *  @brief Defines on options concerning debugging and performance, at
+ *  compile-time.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#include <cstdio>
+
+/** @brief Determine verbosity level of the parallel mode.
+ *  Level 1 prints a message each time a parallel-mode function is entered. */
+#define _GLIBCXX_VERBOSE_LEVEL 0
+
+/** @def _GLIBCXX_CALL
+ *  @brief Macro to produce log message when entering a function.
+ *  @param __n Input size.
+ *  @see _GLIBCXX_VERBOSE_LEVEL */
+#if (_GLIBCXX_VERBOSE_LEVEL == 0)
+#define _GLIBCXX_CALL(__n)
+#endif
+#if (_GLIBCXX_VERBOSE_LEVEL == 1)
+#define _GLIBCXX_CALL(__n) \
+  printf("   %__s:\niam = %d, __n = %ld, __num_threads = %d\n", \
+  __PRETTY_FUNCTION__, omp_get_thread_num(), (__n), __get_max_threads());
+#endif
+
+#ifndef _GLIBCXX_SCALE_DOWN_FPU
+/** @brief Use floating-point scaling instead of modulo for mapping
+ *  random numbers to a range.  This can be faster on certain CPUs. */
+#define _GLIBCXX_SCALE_DOWN_FPU 0
+#endif
+
+#ifndef _GLIBCXX_ASSERTIONS
+/** @brief Switch on many _GLIBCXX_PARALLEL_ASSERTions in parallel code.
+ *  Should be switched on only locally. */
+#define _GLIBCXX_ASSERTIONS 0
+#endif
+
+#ifndef _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1
+/** @brief Switch on many _GLIBCXX_PARALLEL_ASSERTions in parallel code.
+ *  Consider the size of the L1 cache for
+*  gnu_parallel::__parallel_random_shuffle(). */
+#define _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1 0
+#endif
+#ifndef _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB
+/** @brief Switch on many _GLIBCXX_PARALLEL_ASSERTions in parallel code.
+ *  Consider the size of the TLB for
+*  gnu_parallel::__parallel_random_shuffle(). */
+#define _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB 0
+#endif
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/equally_split.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/equally_split.h
new file mode 100644
index 0000000..481c988
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/equally_split.h
@@ -0,0 +1,88 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/equally_split.h
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_EQUALLY_SPLIT_H
+#define _GLIBCXX_PARALLEL_EQUALLY_SPLIT_H 1
+
+namespace __gnu_parallel
+{
+  /** @brief function to split a sequence into parts of almost equal size.
+   *
+   *  The resulting sequence __s of length __num_threads+1 contains the
+   *  splitting positions when splitting the range [0,__n) into parts of
+   *  almost equal size (plus minus 1).  The first entry is 0, the last
+   *  one n. There may result empty parts.
+   *  @param __n Number of elements
+   *  @param __num_threads Number of parts
+   *  @param __s Splitters
+   *  @returns End of __splitter sequence, i.e. @c __s+__num_threads+1 */
+  template<typename _DifferenceType, typename _OutputIterator>
+    _OutputIterator
+    equally_split(_DifferenceType __n, _ThreadIndex __num_threads,
+		  _OutputIterator __s)
+    {
+      _DifferenceType __chunk_length = __n / __num_threads;
+      _DifferenceType __num_longer_chunks = __n % __num_threads;
+      _DifferenceType __pos = 0;
+      for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+	{
+	  *__s++ = __pos;
+	  __pos += ((__i < __num_longer_chunks)
+		    ? (__chunk_length + 1) : __chunk_length);
+	}
+      *__s++ = __n;
+      return __s;
+    }
+
+  /** @brief function to split a sequence into parts of almost equal size.
+   *
+   *  Returns the position of the splitting point between
+   *  thread number __thread_no (included) and
+   *  thread number __thread_no+1 (excluded).
+   *  @param __n Number of elements
+   *  @param __num_threads Number of parts
+   *  @returns splitting point */
+  template<typename _DifferenceType>
+    _DifferenceType
+    equally_split_point(_DifferenceType __n,
+			_ThreadIndex __num_threads,
+			_ThreadIndex __thread_no)
+    {
+      _DifferenceType __chunk_length = __n / __num_threads;
+      _DifferenceType __num_longer_chunks = __n % __num_threads;
+      if (__thread_no < __num_longer_chunks)
+	return __thread_no * (__chunk_length + 1);
+      else
+	return __num_longer_chunks * (__chunk_length + 1)
+          + (__thread_no - __num_longer_chunks) * __chunk_length;
+    }
+}
+
+#endif /* _GLIBCXX_PARALLEL_EQUALLY_SPLIT_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/features.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/features.h
new file mode 100644
index 0000000..077429f
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/features.h
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/features.h
+ *  @brief Defines on whether to include algorithm variants.
+ *
+ *  Less variants reduce executable size and compile time.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_FEATURES_H
+#define _GLIBCXX_PARALLEL_FEATURES_H 1
+
+#ifndef _GLIBCXX_MERGESORT
+/** @def _GLIBCXX_MERGESORT
+ *  @brief Include parallel multi-way mergesort.
+ *  @see __gnu_parallel::_Settings::sort_algorithm */
+#define _GLIBCXX_MERGESORT 1
+#endif
+
+#ifndef _GLIBCXX_QUICKSORT
+/** @def _GLIBCXX_QUICKSORT
+ *  @brief Include parallel unbalanced quicksort.
+ *  @see __gnu_parallel::_Settings::sort_algorithm */
+#define _GLIBCXX_QUICKSORT 1
+#endif
+
+#ifndef _GLIBCXX_BAL_QUICKSORT
+/** @def _GLIBCXX_BAL_QUICKSORT
+ *  @brief Include parallel dynamically load-balanced quicksort.
+ *  @see __gnu_parallel::_Settings::sort_algorithm */
+#define _GLIBCXX_BAL_QUICKSORT 1
+#endif
+
+#ifndef _GLIBCXX_FIND_GROWING_BLOCKS
+/** @brief Include the growing blocks variant for std::find.
+ *  @see __gnu_parallel::_Settings::find_algorithm */
+#define _GLIBCXX_FIND_GROWING_BLOCKS 1
+#endif
+
+#ifndef _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS
+/** @brief Include the equal-sized blocks variant for std::find.
+ *  @see __gnu_parallel::_Settings::find_algorithm */
+#define _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS 1
+#endif
+
+#ifndef _GLIBCXX_FIND_EQUAL_SPLIT
+/** @def _GLIBCXX_FIND_EQUAL_SPLIT
+ *  @brief Include the equal splitting variant for std::find.
+ *  @see __gnu_parallel::_Settings::find_algorithm */
+#define _GLIBCXX_FIND_EQUAL_SPLIT 1
+#endif
+
+
+#ifndef _GLIBCXX_TREE_INITIAL_SPLITTING
+/** @def _GLIBCXX_TREE_INITIAL_SPLITTING
+ *  @brief Include the initial splitting variant for
+ *  _Rb_tree::insert_unique(_IIter beg, _IIter __end).
+ *  @see __gnu_parallel::_Rb_tree */
+#define _GLIBCXX_TREE_INITIAL_SPLITTING 1
+#endif
+
+#ifndef _GLIBCXX_TREE_DYNAMIC_BALANCING
+/** @def _GLIBCXX_TREE_DYNAMIC_BALANCING
+ *  @brief Include the dynamic balancing variant for
+ *  _Rb_tree::insert_unique(_IIter beg, _IIter __end).
+ *  @see __gnu_parallel::_Rb_tree */
+#define _GLIBCXX_TREE_DYNAMIC_BALANCING 1
+#endif
+
+#ifndef _GLIBCXX_TREE_FULL_COPY
+/** @def _GLIBCXX_TREE_FULL_COPY
+ *  @brief In order to sort the input sequence of
+ *  _Rb_tree::insert_unique(_IIter beg, _IIter __end) a
+ *  full copy of the input elements is done.
+ *  @see __gnu_parallel::_Rb_tree */
+#define _GLIBCXX_TREE_FULL_COPY 1
+#endif
+
+
+#endif /* _GLIBCXX_PARALLEL_FEATURES_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/find.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/find.h
new file mode 100644
index 0000000..28bc703
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/find.h
@@ -0,0 +1,405 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/find.h
+ *  @brief Parallel implementation base for std::find(), std::equal()
+ *  and related functions.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze and Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_FIND_H
+#define _GLIBCXX_PARALLEL_FIND_H 1
+
+#include <bits/stl_algobase.h>
+
+#include <parallel/features.h>
+#include <parallel/parallel.h>
+#include <parallel/compatibility.h>
+#include <parallel/equally_split.h>
+
+namespace __gnu_parallel
+{
+  /**
+   *  @brief Parallel std::find, switch for different algorithms.
+   *  @param __begin1 Begin iterator of first sequence.
+   *  @param __end1 End iterator of first sequence.
+   *  @param __begin2 Begin iterator of second sequence. Must have same
+   *  length as first sequence.
+   *  @param __pred Find predicate.
+   *  @param __selector _Functionality (e. g. std::find_if(), std::equal(),...)
+   *  @return Place of finding in both sequences.
+   */
+  template<typename _RAIter1,
+	   typename _RAIter2,
+	   typename _Pred,
+           typename _Selector>
+    inline std::pair<_RAIter1, _RAIter2>
+    __find_template(_RAIter1 __begin1, _RAIter1 __end1,
+		    _RAIter2 __begin2, _Pred __pred, _Selector __selector)
+    {
+      switch (_Settings::get().find_algorithm)
+	{
+	case GROWING_BLOCKS:
+          return __find_template(__begin1, __end1, __begin2, __pred,
+				 __selector, growing_blocks_tag());
+	case CONSTANT_SIZE_BLOCKS:
+          return __find_template(__begin1, __end1, __begin2, __pred,
+				 __selector, constant_size_blocks_tag());
+	case EQUAL_SPLIT:
+          return __find_template(__begin1, __end1, __begin2, __pred,
+				 __selector, equal_split_tag());
+	default:
+          _GLIBCXX_PARALLEL_ASSERT(false);
+          return std::make_pair(__begin1, __begin2);
+	}
+    }
+
+#if _GLIBCXX_FIND_EQUAL_SPLIT
+
+  /**
+   *  @brief Parallel std::find, equal splitting variant.
+   *  @param __begin1 Begin iterator of first sequence.
+   *  @param __end1 End iterator of first sequence.
+   *  @param __begin2 Begin iterator of second sequence. Second __sequence
+   *  must have same length as first sequence.
+   *  @param __pred Find predicate.
+   *  @param __selector _Functionality (e. g. std::find_if(), std::equal(),...)
+   *  @return Place of finding in both sequences.
+   */
+  template<typename _RAIter1,
+           typename _RAIter2,
+           typename _Pred,
+           typename _Selector>
+    std::pair<_RAIter1, _RAIter2>
+    __find_template(_RAIter1 __begin1, _RAIter1 __end1,
+		    _RAIter2 __begin2, _Pred __pred,
+		    _Selector __selector, equal_split_tag)
+    {
+      _GLIBCXX_CALL(__end1 - __begin1)
+
+      typedef std::iterator_traits<_RAIter1> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      typedef typename _TraitsType::value_type _ValueType;
+
+      _DifferenceType __length = __end1 - __begin1;
+      _DifferenceType __result = __length;
+      _DifferenceType* __borders;
+
+      omp_lock_t __result_lock;
+      omp_init_lock(&__result_lock);
+
+      _ThreadIndex __num_threads = __get_max_threads();
+#     pragma omp parallel num_threads(__num_threads)
+      {
+#     pragma omp single
+	{
+	  __num_threads = omp_get_num_threads();
+	  __borders = new _DifferenceType[__num_threads + 1];
+	  equally_split(__length, __num_threads, __borders);
+	} //single
+
+	_ThreadIndex __iam = omp_get_thread_num();
+	_DifferenceType __start = __borders[__iam],
+	                 __stop = __borders[__iam + 1];
+
+	_RAIter1 __i1 = __begin1 + __start;
+	_RAIter2 __i2 = __begin2 + __start;
+	for (_DifferenceType __pos = __start; __pos < __stop; ++__pos)
+	  {
+#           pragma omp flush(__result)
+	    // Result has been set to something lower.
+	    if (__result < __pos)
+	      break;
+
+	    if (__selector(__i1, __i2, __pred))
+	      {
+		omp_set_lock(&__result_lock);
+		if (__pos < __result)
+		  __result = __pos;
+		omp_unset_lock(&__result_lock);
+		break;
+	      }
+	    ++__i1;
+	    ++__i2;
+	  }
+      } //parallel
+
+      omp_destroy_lock(&__result_lock);
+      delete[] __borders;
+
+      return std::pair<_RAIter1, _RAIter2>(__begin1 + __result,
+					   __begin2 + __result);
+    }
+
+#endif
+
+#if _GLIBCXX_FIND_GROWING_BLOCKS
+
+  /**
+   *  @brief Parallel std::find, growing block size variant.
+   *  @param __begin1 Begin iterator of first sequence.
+   *  @param __end1 End iterator of first sequence.
+   *  @param __begin2 Begin iterator of second sequence. Second __sequence
+   *  must have same length as first sequence.
+   *  @param __pred Find predicate.
+   *  @param __selector _Functionality (e. g. std::find_if(), std::equal(),...)
+   *  @return Place of finding in both sequences.
+   *  @see __gnu_parallel::_Settings::find_sequential_search_size
+   *  @see __gnu_parallel::_Settings::find_scale_factor
+   *
+   *  There are two main differences between the growing blocks and
+   *  the constant-size blocks variants.
+   *  1. For GB, the block size grows; for CSB, the block size is fixed.
+   *  2. For GB, the blocks are allocated dynamically;
+   *     for CSB, the blocks are allocated in a predetermined manner,
+   *     namely spacial round-robin.
+   */
+  template<typename _RAIter1,
+           typename _RAIter2,
+           typename _Pred,
+           typename _Selector>
+    std::pair<_RAIter1, _RAIter2>
+    __find_template(_RAIter1 __begin1, _RAIter1 __end1,
+		    _RAIter2 __begin2, _Pred __pred, _Selector __selector,
+		    growing_blocks_tag)
+    {
+      _GLIBCXX_CALL(__end1 - __begin1)
+
+      typedef std::iterator_traits<_RAIter1> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      typedef typename _TraitsType::value_type _ValueType;
+
+      const _Settings& __s = _Settings::get();
+
+      _DifferenceType __length = __end1 - __begin1;
+
+      _DifferenceType
+	__sequential_search_size = std::min<_DifferenceType>
+	(__length, __s.find_sequential_search_size);
+
+      // Try it sequentially first.
+      std::pair<_RAIter1, _RAIter2>
+	__find_seq_result = __selector._M_sequential_algorithm
+	(__begin1, __begin1 + __sequential_search_size,
+	 __begin2, __pred);
+
+      if (__find_seq_result.first != (__begin1 + __sequential_search_size))
+	return __find_seq_result;
+
+      // Index of beginning of next free block (after sequential find).
+      _DifferenceType __next_block_start = __sequential_search_size;
+      _DifferenceType __result = __length;
+
+      omp_lock_t __result_lock;
+      omp_init_lock(&__result_lock);
+
+      const float __scale_factor = __s.find_scale_factor;
+
+      _ThreadIndex __num_threads = __get_max_threads();
+#     pragma omp parallel shared(__result) num_threads(__num_threads)
+      {
+#       pragma omp single
+	__num_threads = omp_get_num_threads();
+
+	// Not within first __k elements -> start parallel.
+	_ThreadIndex __iam = omp_get_thread_num();
+
+	_DifferenceType __block_size =
+	  std::max<_DifferenceType>(1, __scale_factor * __next_block_start);
+	_DifferenceType __start = __fetch_and_add<_DifferenceType>
+	  (&__next_block_start, __block_size);
+
+	// Get new block, update pointer to next block.
+	_DifferenceType __stop =
+	  std::min<_DifferenceType>(__length, __start + __block_size);
+
+	std::pair<_RAIter1, _RAIter2> __local_result;
+
+	while (__start < __length)
+	  {
+#           pragma omp flush(__result)
+	    // Get new value of result.
+	    if (__result < __start)
+	      {
+		// No chance to find first element.
+		break;
+	      }
+
+	    __local_result = __selector._M_sequential_algorithm
+	      (__begin1 + __start, __begin1 + __stop,
+	       __begin2 + __start, __pred);
+
+	    if (__local_result.first != (__begin1 + __stop))
+	      {
+		omp_set_lock(&__result_lock);
+		if ((__local_result.first - __begin1) < __result)
+		  {
+		    __result = __local_result.first - __begin1;
+
+		    // Result cannot be in future blocks, stop algorithm.
+		    __fetch_and_add<_DifferenceType>(&__next_block_start,
+						     __length);
+		  }
+		omp_unset_lock(&__result_lock);
+	      }
+
+	    _DifferenceType __block_size =
+	     std::max<_DifferenceType>(1, __scale_factor * __next_block_start);
+
+	    // Get new block, update pointer to next block.
+	    __start = __fetch_and_add<_DifferenceType>(&__next_block_start,
+						       __block_size);
+	    __stop =
+	      std::min<_DifferenceType>(__length, __start + __block_size);
+	  }
+      } //parallel
+
+      omp_destroy_lock(&__result_lock);
+
+      // Return iterator on found element.
+      return
+	std::pair<_RAIter1, _RAIter2>(__begin1 + __result,
+				      __begin2 + __result);
+    }
+
+#endif
+
+#if _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS
+
+  /**
+   *   @brief Parallel std::find, constant block size variant.
+   *  @param __begin1 Begin iterator of first sequence.
+   *  @param __end1 End iterator of first sequence.
+   *  @param __begin2 Begin iterator of second sequence. Second __sequence
+   *  must have same length as first sequence.
+   *  @param __pred Find predicate.
+   *  @param __selector _Functionality (e. g. std::find_if(), std::equal(),...)
+   *  @return Place of finding in both sequences.
+   *  @see __gnu_parallel::_Settings::find_sequential_search_size
+   *  @see __gnu_parallel::_Settings::find_block_size
+   *  There are two main differences between the growing blocks and the
+   *  constant-size blocks variants.
+   *  1. For GB, the block size grows; for CSB, the block size is fixed.
+   *  2. For GB, the blocks are allocated dynamically; for CSB, the
+   *  blocks are allocated in a predetermined manner, namely spacial
+   *  round-robin.
+   */
+  template<typename _RAIter1,
+           typename _RAIter2,
+           typename _Pred,
+           typename _Selector>
+    std::pair<_RAIter1, _RAIter2>
+    __find_template(_RAIter1 __begin1, _RAIter1 __end1,
+                  _RAIter2 __begin2, _Pred __pred, _Selector __selector,
+                  constant_size_blocks_tag)
+    {
+      _GLIBCXX_CALL(__end1 - __begin1)
+      typedef std::iterator_traits<_RAIter1> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      typedef typename _TraitsType::value_type _ValueType;
+
+      const _Settings& __s = _Settings::get();
+
+      _DifferenceType __length = __end1 - __begin1;
+
+      _DifferenceType __sequential_search_size = std::min<_DifferenceType>
+	(__length, __s.find_sequential_search_size);
+
+      // Try it sequentially first.
+      std::pair<_RAIter1, _RAIter2>
+	__find_seq_result = __selector._M_sequential_algorithm
+	(__begin1, __begin1 + __sequential_search_size, __begin2, __pred);
+
+      if (__find_seq_result.first != (__begin1 + __sequential_search_size))
+	return __find_seq_result;
+
+      _DifferenceType __result = __length;
+      omp_lock_t __result_lock;
+      omp_init_lock(&__result_lock);
+
+      // Not within first __sequential_search_size elements -> start parallel.
+
+      _ThreadIndex __num_threads = __get_max_threads();
+#     pragma omp parallel shared(__result) num_threads(__num_threads)
+      {
+#       pragma omp single
+	__num_threads = omp_get_num_threads();
+
+	_ThreadIndex __iam = omp_get_thread_num();
+	_DifferenceType __block_size = __s.find_initial_block_size;
+
+	// First element of thread's current iteration.
+	_DifferenceType __iteration_start = __sequential_search_size;
+
+	// Where to work (initialization).
+	_DifferenceType __start = __iteration_start + __iam * __block_size;
+	_DifferenceType __stop = std::min<_DifferenceType>(__length,
+							   __start
+							   + __block_size);
+
+	std::pair<_RAIter1, _RAIter2> __local_result;
+
+	while (__start < __length)
+	  {
+	    // Get new value of result.
+#           pragma omp flush(__result)
+	    // No chance to find first element.
+	    if (__result < __start)
+	      break;
+
+	    __local_result = __selector._M_sequential_algorithm
+	      (__begin1 + __start, __begin1 + __stop,
+	       __begin2 + __start, __pred);
+
+	    if (__local_result.first != (__begin1 + __stop))
+	      {
+		omp_set_lock(&__result_lock);
+		if ((__local_result.first - __begin1) < __result)
+		  __result = __local_result.first - __begin1;
+		omp_unset_lock(&__result_lock);
+		// Will not find better value in its interval.
+		break;
+	      }
+
+	    __iteration_start += __num_threads * __block_size;
+
+	    // Where to work.
+	    __start = __iteration_start + __iam * __block_size;
+	    __stop = std::min<_DifferenceType>(__length,
+					       __start + __block_size);
+	  }
+      } //parallel
+
+      omp_destroy_lock(&__result_lock);
+
+      // Return iterator on found element.
+      return std::pair<_RAIter1, _RAIter2>(__begin1 + __result,
+					   __begin2 + __result);
+    }
+#endif
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_FIND_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/find_selectors.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/find_selectors.h
new file mode 100644
index 0000000..df77978
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/find_selectors.h
@@ -0,0 +1,197 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/find_selectors.h
+ *  @brief _Function objects representing different tasks to be plugged
+ *  into the parallel find algorithm.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_FIND_SELECTORS_H
+#define _GLIBCXX_PARALLEL_FIND_SELECTORS_H 1
+
+#include <parallel/tags.h>
+#include <parallel/basic_iterator.h>
+#include <bits/stl_pair.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Base class of all __gnu_parallel::__find_template selectors. */
+  struct __generic_find_selector
+  { };
+
+  /** 
+   *  @brief Test predicate on a single element, used for std::find()
+   *  and std::find_if ().
+   */
+  struct __find_if_selector : public __generic_find_selector
+  {
+    /** @brief Test on one position.
+     * @param __i1 _Iterator on first sequence.
+     * @param __i2 _Iterator on second sequence (unused).
+     * @param __pred Find predicate.
+     */
+    template<typename _RAIter1, typename _RAIter2,
+             typename _Pred>
+      bool 
+      operator()(_RAIter1 __i1, _RAIter2 __i2, _Pred __pred)
+      { return __pred(*__i1); }
+
+    /** @brief Corresponding sequential algorithm on a sequence.
+     *  @param __begin1 Begin iterator of first sequence.
+     *  @param __end1 End iterator of first sequence.
+     *  @param __begin2 Begin iterator of second sequence.
+     *  @param __pred Find predicate.
+     */
+    template<typename _RAIter1, typename _RAIter2,
+             typename _Pred>
+      std::pair<_RAIter1, _RAIter2> 
+      _M_sequential_algorithm(_RAIter1 __begin1,
+                           _RAIter1 __end1,
+                           _RAIter2 __begin2, _Pred __pred)
+      { return std::make_pair(find_if(__begin1, __end1, __pred,
+                                      sequential_tag()), __begin2); }
+  };
+
+  /** @brief Test predicate on two adjacent elements. */
+  struct __adjacent_find_selector : public __generic_find_selector
+  {
+    /** @brief Test on one position.
+     *  @param __i1 _Iterator on first sequence.
+     *  @param __i2 _Iterator on second sequence (unused).
+     *  @param __pred Find predicate.
+     */
+    template<typename _RAIter1, typename _RAIter2,
+             typename _Pred>
+      bool 
+      operator()(_RAIter1 __i1, _RAIter2 __i2, _Pred __pred)
+      {
+        // Passed end iterator is one short.
+        return __pred(*__i1, *(__i1 + 1));
+      }
+
+    /** @brief Corresponding sequential algorithm on a sequence.
+     *  @param __begin1 Begin iterator of first sequence.
+     *  @param __end1 End iterator of first sequence.
+     *  @param __begin2 Begin iterator of second sequence.
+     *  @param __pred Find predicate.
+     */
+    template<typename _RAIter1, typename _RAIter2,
+             typename _Pred>
+      std::pair<_RAIter1, _RAIter2>
+      _M_sequential_algorithm(_RAIter1 __begin1,
+			      _RAIter1 __end1,
+			      _RAIter2 __begin2, _Pred __pred)
+      {
+        // Passed end iterator is one short.
+        _RAIter1 __spot = adjacent_find(__begin1, __end1 + 1,
+					__pred, sequential_tag());
+        if (__spot == (__end1 + 1))
+          __spot = __end1;
+        return std::make_pair(__spot, __begin2);
+      }
+  };
+
+  /** @brief Test inverted predicate on a single element. */
+  struct __mismatch_selector : public __generic_find_selector
+  {
+    /** 
+     *  @brief Test on one position.
+     *  @param __i1 _Iterator on first sequence.
+     *  @param __i2 _Iterator on second sequence (unused).
+     *  @param __pred Find predicate. 
+     */
+    template<typename _RAIter1, typename _RAIter2,
+             typename _Pred>
+      bool 
+      operator()(_RAIter1 __i1, _RAIter2 __i2, _Pred __pred)
+      { return !__pred(*__i1, *__i2); }
+
+    /** 
+     *  @brief Corresponding sequential algorithm on a sequence.
+     *  @param __begin1 Begin iterator of first sequence.
+     *  @param __end1 End iterator of first sequence.
+     *  @param __begin2 Begin iterator of second sequence.
+     *  @param __pred Find predicate. 
+     */
+    template<typename _RAIter1, typename _RAIter2,
+             typename _Pred>
+      std::pair<_RAIter1, _RAIter2>
+      _M_sequential_algorithm(_RAIter1 __begin1,
+			      _RAIter1 __end1,
+			      _RAIter2 __begin2, _Pred __pred)
+      { return mismatch(__begin1, __end1, __begin2,
+			__pred, sequential_tag()); }
+  };
+
+
+  /** @brief Test predicate on several elements. */
+  template<typename _FIterator>
+    struct __find_first_of_selector : public __generic_find_selector
+    {
+      _FIterator _M_begin;
+      _FIterator _M_end;
+
+      explicit __find_first_of_selector(_FIterator __begin,
+					_FIterator __end)
+      : _M_begin(__begin), _M_end(__end) { }
+
+      /** @brief Test on one position.
+       *  @param __i1 _Iterator on first sequence.
+       *  @param __i2 _Iterator on second sequence (unused).
+       *  @param __pred Find predicate. */
+      template<typename _RAIter1, typename _RAIter2,
+	       typename _Pred>
+        bool
+        operator()(_RAIter1 __i1, _RAIter2 __i2, _Pred __pred)
+        {
+	  for (_FIterator __pos_in_candidates = _M_begin;
+	       __pos_in_candidates != _M_end; ++__pos_in_candidates)
+	    if (__pred(*__i1, *__pos_in_candidates))
+	      return true;
+	  return false;
+	}
+
+      /** @brief Corresponding sequential algorithm on a sequence.
+       *  @param __begin1 Begin iterator of first sequence.
+       *  @param __end1 End iterator of first sequence.
+       *  @param __begin2 Begin iterator of second sequence.
+       *  @param __pred Find predicate. */
+      template<typename _RAIter1, typename _RAIter2,
+	       typename _Pred>
+        std::pair<_RAIter1, _RAIter2>
+        _M_sequential_algorithm(_RAIter1 __begin1,
+				_RAIter1 __end1,
+				_RAIter2 __begin2, _Pred __pred)
+        {
+	  return std::make_pair(find_first_of(__begin1, __end1,
+					      _M_begin, _M_end, __pred,
+					      sequential_tag()), __begin2);
+	}
+     };
+}
+
+#endif /* _GLIBCXX_PARALLEL_FIND_SELECTORS_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/for_each.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/for_each.h
new file mode 100644
index 0000000..0132593
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/for_each.h
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/for_each.h
+ *  @brief Main interface for embarrassingly parallel functions.
+ *
+ *  The explicit implementation are in other header files, like
+ *  workstealing.h, par_loop.h, omp_loop.h, and omp_loop_static.h.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_FOR_EACH_H
+#define _GLIBCXX_PARALLEL_FOR_EACH_H 1
+
+#include <parallel/settings.h>
+#include <parallel/par_loop.h>
+#include <parallel/omp_loop.h>
+#include <parallel/workstealing.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Chose the desired algorithm by evaluating @c __parallelism_tag.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator of input sequence.
+   *  @param __user_op A user-specified functor (comparator, predicate,
+   *  associative operator,...)
+   *  @param __functionality functor to @a process an element with
+   *  __user_op (depends on desired functionality, e. g. accumulate,
+   *  for_each,...
+   *  @param __reduction Reduction functor.
+   *  @param __reduction_start Initial value for reduction.
+   *  @param __output Output iterator.
+   *  @param __bound Maximum number of elements processed.
+   *  @param __parallelism_tag Parallelization method */
+  template<typename _IIter, typename _UserOp,
+           typename _Functionality, typename _Red, typename _Result>
+    _UserOp
+    __for_each_template_random_access(_IIter __begin, _IIter __end,
+                                      _UserOp __user_op,
+                                      _Functionality& __functionality,
+                                      _Red __reduction,
+                                      _Result __reduction_start,
+                                      _Result& __output, typename
+                                      std::iterator_traits<_IIter>::
+                                      difference_type __bound,
+                                      _Parallelism __parallelism_tag)
+    {
+      if (__parallelism_tag == parallel_unbalanced)
+        return __for_each_template_random_access_ed
+	  (__begin, __end, __user_op, __functionality, __reduction,
+	   __reduction_start, __output, __bound);
+      else if (__parallelism_tag == parallel_omp_loop)
+        return __for_each_template_random_access_omp_loop
+	  (__begin, __end, __user_op, __functionality, __reduction,
+	   __reduction_start, __output, __bound);
+      else if (__parallelism_tag == parallel_omp_loop_static)
+        return __for_each_template_random_access_omp_loop
+	  (__begin, __end, __user_op, __functionality, __reduction,
+	   __reduction_start, __output, __bound);
+      else      //e. g. parallel_balanced
+        return __for_each_template_random_access_workstealing
+	  (__begin, __end, __user_op, __functionality, __reduction,
+	   __reduction_start, __output, __bound);
+  }
+}
+
+#endif /* _GLIBCXX_PARALLEL_FOR_EACH_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/for_each_selectors.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/for_each_selectors.h
new file mode 100644
index 0000000..3a37e5c
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/for_each_selectors.h
@@ -0,0 +1,349 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/for_each_selectors.h
+ *  @brief Functors representing different tasks to be plugged into the
+ *  generic parallelization methods for embarrassingly parallel functions.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_FOR_EACH_SELECTORS_H
+#define _GLIBCXX_PARALLEL_FOR_EACH_SELECTORS_H 1
+
+#include <parallel/basic_iterator.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Generic __selector for embarrassingly parallel functions. */
+  template<typename _It>
+    struct __generic_for_each_selector
+    {
+      /** @brief _Iterator on last element processed; needed for some
+       *  algorithms (e. g. std::transform()).
+       */
+      _It _M_finish_iterator;
+    };
+
+  /** @brief std::for_each() selector. */
+  template<typename _It>
+    struct __for_each_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Functor execution.
+       *  @param __o Operator.
+       *  @param __i iterator referencing object. */
+      template<typename _Op>
+        bool
+        operator()(_Op& __o, _It __i)
+        {
+          __o(*__i);
+          return true;
+        }
+    };
+
+  /** @brief std::generate() selector. */
+  template<typename _It>
+    struct __generate_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Functor execution.
+       *  @param __o Operator.
+       *  @param __i iterator referencing object. */
+      template<typename _Op>
+        bool
+        operator()(_Op& __o, _It __i)
+        {
+          *__i = __o();
+          return true;
+        }
+    };
+
+  /** @brief std::fill() selector. */
+  template<typename _It>
+    struct __fill_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Functor execution.
+       *  @param __v Current value.
+       *  @param __i iterator referencing object. */
+      template<typename _ValueType>
+        bool
+        operator()(_ValueType& __v, _It __i)
+        {
+          *__i = __v;
+          return true;
+        }
+    };
+
+  /** @brief std::transform() __selector, one input sequence variant. */
+  template<typename _It>
+    struct __transform1_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Functor execution.
+       *  @param __o Operator.
+       *  @param __i iterator referencing object. */
+      template<typename _Op>
+        bool
+        operator()(_Op& __o, _It __i)
+        {
+          *__i.second = __o(*__i.first);
+          return true;
+        }
+    };
+
+  /** @brief std::transform() __selector, two input sequences variant. */
+  template<typename _It>
+    struct __transform2_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Functor execution.
+       *  @param __o Operator.
+       *  @param __i iterator referencing object. */
+      template<typename _Op>
+        bool
+        operator()(_Op& __o, _It __i)
+        {
+          *__i._M_third = __o(*__i._M_first, *__i._M_second);
+          return true;
+        }
+    };
+
+  /** @brief std::replace() selector. */
+  template<typename _It, typename _Tp>
+    struct __replace_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Value to replace with. */
+      const _Tp& __new_val;
+
+      /** @brief Constructor
+       *  @param __new_val Value to replace with. */
+      explicit
+      __replace_selector(const _Tp &__new_val) : __new_val(__new_val) {}
+
+      /** @brief Functor execution.
+       *  @param __v Current value.
+       *  @param __i iterator referencing object. */
+      bool
+      operator()(_Tp& __v, _It __i)
+      {
+        if (*__i == __v)
+          *__i = __new_val;
+        return true;
+      }
+    };
+
+  /** @brief std::replace() selector. */
+  template<typename _It, typename _Op, typename _Tp>
+    struct __replace_if_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Value to replace with. */
+      const _Tp& __new_val;
+
+      /** @brief Constructor.
+       *  @param __new_val Value to replace with. */
+      explicit
+      __replace_if_selector(const _Tp &__new_val) : __new_val(__new_val) { }
+
+      /** @brief Functor execution.
+       *  @param __o Operator.
+       *  @param __i iterator referencing object. */
+      bool
+      operator()(_Op& __o, _It __i)
+      {
+        if (__o(*__i))
+          *__i = __new_val;
+        return true;
+      }
+    };
+
+  /** @brief std::count() selector. */
+  template<typename _It, typename _Diff>
+    struct __count_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Functor execution.
+       *  @param __v Current value.
+       *  @param __i iterator referencing object.
+       *  @return 1 if count, 0 if does not count. */
+      template<typename _ValueType>
+        _Diff
+        operator()(_ValueType& __v, _It __i)
+        { return (__v == *__i) ? 1 : 0; }
+    };
+
+  /** @brief std::count_if () selector. */
+  template<typename _It, typename _Diff>
+    struct __count_if_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Functor execution.
+       *  @param __o Operator.
+       *  @param __i iterator referencing object.
+       *  @return 1 if count, 0 if does not count. */
+      template<typename _Op>
+        _Diff
+        operator()(_Op& __o, _It __i)
+        { return (__o(*__i)) ? 1 : 0; }
+    };
+
+  /** @brief std::accumulate() selector. */
+  template<typename _It>
+    struct __accumulate_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Functor execution.
+       *  @param __o Operator (unused).
+       *  @param __i iterator referencing object.
+       *  @return The current value. */
+      template<typename _Op>
+        typename std::iterator_traits<_It>::value_type
+        operator()(_Op __o, _It __i)
+        { return *__i; }
+    };
+
+  /** @brief std::inner_product() selector. */
+  template<typename _It, typename _It2, typename _Tp>
+    struct __inner_product_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Begin iterator of first sequence. */
+      _It  __begin1_iterator;
+
+      /** @brief Begin iterator of second sequence. */
+      _It2 __begin2_iterator;
+
+      /** @brief Constructor.
+       *  @param b1 Begin iterator of first sequence.
+       *  @param b2 Begin iterator of second sequence. */
+      explicit
+      __inner_product_selector(_It __b1, _It2 __b2)
+      : __begin1_iterator(__b1), __begin2_iterator(__b2) { }
+
+      /** @brief Functor execution.
+       *  @param __mult Multiplication functor.
+       *  @param __current iterator referencing object.
+       *  @return Inner product elemental __result. */
+      template<typename _Op>
+        _Tp
+        operator()(_Op __mult, _It __current)
+        {
+          typename std::iterator_traits<_It>::difference_type __position
+            = __current - __begin1_iterator;
+          return __mult(*__current, *(__begin2_iterator + __position));
+        }
+    };
+
+  /** @brief Selector that just returns the passed iterator. */
+  template<typename _It>
+    struct __identity_selector : public __generic_for_each_selector<_It>
+    {
+      /** @brief Functor execution.
+       *  @param __o Operator (unused).
+       *  @param __i iterator referencing object.
+       *  @return Passed iterator. */
+      template<typename _Op>
+        _It
+        operator()(_Op __o, _It __i)
+        { return __i; }
+    };
+
+  /** @brief Selector that returns the difference between two adjacent
+   *  __elements.
+   */
+  template<typename _It>
+    struct __adjacent_difference_selector
+    : public __generic_for_each_selector<_It>
+    {
+      template<typename _Op>
+        bool
+        operator()(_Op& __o, _It __i)
+        {
+          typename _It::first_type __go_back_one = __i.first;
+          --__go_back_one;
+          *__i.second = __o(*__i.first, *__go_back_one);
+          return true;
+        }
+    };
+
+  /** @brief Functor doing nothing
+   *
+   *  For some __reduction tasks (this is not a function object, but is
+   *  passed as __selector __dummy parameter.
+   */
+  struct _Nothing
+  {
+    /** @brief Functor execution.
+     *  @param __i iterator referencing object. */
+    template<typename _It>
+      void
+      operator()(_It) { }
+  };
+
+  /** @brief Reduction function doing nothing. */
+  struct _DummyReduct
+  {
+    bool
+    operator()(bool, bool) const
+    { return true; }
+  };
+
+  /** @brief Reduction for finding the maximum element, using a comparator. */
+  template<typename _Compare, typename _It>
+    struct __min_element_reduct
+    {
+      _Compare& __comp;
+
+      explicit
+      __min_element_reduct(_Compare &__c) : __comp(__c) { }
+
+      _It
+      operator()(_It __x, _It __y)
+      { return (__comp(*__x, *__y)) ? __x : __y; }
+    };
+
+  /** @brief Reduction for finding the maximum element, using a comparator. */
+  template<typename _Compare, typename _It>
+    struct __max_element_reduct
+    {
+      _Compare& __comp;
+
+      explicit
+      __max_element_reduct(_Compare& __c) : __comp(__c) { }
+
+      _It
+      operator()(_It __x, _It __y)
+      { return (__comp(*__x, *__y)) ? __y : __x; }
+    };
+
+  /** @brief General reduction, using a binary operator. */
+  template<typename _BinOp>
+    struct __accumulate_binop_reduct
+    {
+      _BinOp& __binop;
+
+      explicit
+      __accumulate_binop_reduct(_BinOp& __b) : __binop(__b) { }
+
+      template<typename _Result, typename _Addend>
+        _Result
+        operator()(const _Result& __x, const _Addend& __y)
+        { return __binop(__x, __y); }
+    };
+}
+
+#endif /* _GLIBCXX_PARALLEL_FOR_EACH_SELECTORS_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/iterator.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/iterator.h
new file mode 100644
index 0000000..0138550
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/iterator.h
@@ -0,0 +1,198 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/iterator.h
+ * @brief Helper iterator classes for the std::transform() functions.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_ITERATOR_H
+#define _GLIBCXX_PARALLEL_ITERATOR_H 1
+
+#include <parallel/basic_iterator.h>
+#include <bits/stl_pair.h>
+
+namespace __gnu_parallel
+{
+  /** @brief A pair of iterators. The usual iterator operations are
+   *  applied to both child iterators.
+   */
+  template<typename _Iterator1, typename _Iterator2,
+           typename _IteratorCategory>
+    class _IteratorPair : public std::pair<_Iterator1, _Iterator2>
+    {
+    private:
+      typedef std::pair<_Iterator1, _Iterator2> _Base;
+
+    public:
+      typedef _IteratorCategory iterator_category;
+      typedef void value_type;
+
+      typedef std::iterator_traits<_Iterator1> _TraitsType;
+      typedef typename _TraitsType::difference_type difference_type;
+      typedef _IteratorPair* pointer;
+      typedef _IteratorPair& reference;
+
+      _IteratorPair() { }
+
+      _IteratorPair(const _Iterator1& __first, const _Iterator2& __second)
+      : _Base(__first, __second) { }
+
+      // Pre-increment operator.
+      _IteratorPair&
+      operator++()
+      {
+        ++_Base::first;
+        ++_Base::second;
+        return *this;
+      }
+
+      // Post-increment operator.
+      const _IteratorPair
+      operator++(int)
+      { return _IteratorPair(_Base::first++, _Base::second++); }
+
+      // Pre-decrement operator.
+      _IteratorPair&
+      operator--()
+      {
+        --_Base::first;
+        --_Base::second;
+        return *this;
+      }
+
+      // Post-decrement operator.
+      const _IteratorPair
+      operator--(int)
+      { return _IteratorPair(_Base::first--, _Base::second--); }
+
+      // Type conversion.
+      operator _Iterator2() const
+      { return _Base::second; }
+
+      _IteratorPair&
+      operator=(const _IteratorPair& __other)
+      {
+        _Base::first = __other.first;
+        _Base::second = __other.second;
+        return *this;
+      }
+
+      _IteratorPair
+      operator+(difference_type __delta) const
+      { return _IteratorPair(_Base::first + __delta, _Base::second + __delta);
+        }
+
+      difference_type
+      operator-(const _IteratorPair& __other) const
+      { return _Base::first - __other.first; }
+  };
+
+
+  /** @brief A triple of iterators. The usual iterator operations are
+      applied to all three child iterators.
+   */
+  template<typename _Iterator1, typename _Iterator2, typename _Iterator3,
+           typename _IteratorCategory>
+    class _IteratorTriple
+    {
+    public:
+      typedef _IteratorCategory iterator_category;
+      typedef void value_type;
+      typedef typename std::iterator_traits<_Iterator1>::difference_type
+                                                            difference_type;
+      typedef _IteratorTriple* pointer;
+      typedef _IteratorTriple& reference;
+
+      _Iterator1 _M_first;
+      _Iterator2 _M_second;
+      _Iterator3 _M_third;
+
+      _IteratorTriple() { }
+
+      _IteratorTriple(const _Iterator1& __first, const _Iterator2& __second,
+                      const _Iterator3& __third)
+      {
+        _M_first = __first;
+        _M_second = __second;
+        _M_third = __third;
+      }
+
+      // Pre-increment operator.
+      _IteratorTriple&
+      operator++()
+      {
+        ++_M_first;
+        ++_M_second;
+        ++_M_third;
+        return *this;
+      }
+
+      // Post-increment operator.
+      const _IteratorTriple
+      operator++(int)
+      { return _IteratorTriple(_M_first++, _M_second++, _M_third++); }
+
+      // Pre-decrement operator.
+      _IteratorTriple&
+      operator--()
+      {
+        --_M_first;
+        --_M_second;
+        --_M_third;
+        return *this;
+      }
+
+      // Post-decrement operator.
+      const _IteratorTriple
+      operator--(int)
+      { return _IteratorTriple(_M_first--, _M_second--, _M_third--); }
+
+      // Type conversion.
+      operator _Iterator3() const
+      { return _M_third; }
+
+      _IteratorTriple&
+      operator=(const _IteratorTriple& __other)
+      {
+        _M_first = __other._M_first;
+        _M_second = __other._M_second;
+        _M_third = __other._M_third;
+        return *this;
+      }
+
+      _IteratorTriple
+      operator+(difference_type __delta) const
+      { return _IteratorTriple(_M_first + __delta, _M_second + __delta,
+                               _M_third + __delta); }
+
+      difference_type
+      operator-(const _IteratorTriple& __other) const
+      { return _M_first - __other._M_first; }
+  };
+}
+
+#endif /* _GLIBCXX_PARALLEL_ITERATOR_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/list_partition.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/list_partition.h
new file mode 100644
index 0000000..1f1bfa2
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/list_partition.h
@@ -0,0 +1,179 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/list_partition.h
+ *  @brief _Functionality to split __sequence referenced by only input
+ *  iterators.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Leonor Frias Moya and Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_LIST_PARTITION_H
+#define _GLIBCXX_PARALLEL_LIST_PARTITION_H 1
+
+#include <parallel/parallel.h>
+#include <vector>
+
+namespace __gnu_parallel
+{
+  /** @brief Shrinks and doubles the ranges.
+   *  @param __os_starts Start positions worked on (oversampled).
+   *  @param __count_to_two Counts up to 2.
+   *  @param __range_length Current length of a chunk.
+   *  @param __make_twice Whether the @c __os_starts is allowed to be
+   *  grown or not
+   */
+  template<typename _IIter>
+    void
+    __shrink_and_double(std::vector<_IIter>& __os_starts,
+			size_t& __count_to_two, size_t& __range_length,
+			const bool __make_twice)
+    {
+      ++__count_to_two;
+      if (!__make_twice || __count_to_two < 2)
+        __shrink(__os_starts, __count_to_two, __range_length);
+      else
+        {
+          __os_starts.resize((__os_starts.size() - 1) * 2 + 1);
+          __count_to_two = 0;
+        }
+    }
+
+  /** @brief Combines two ranges into one and thus halves the number of ranges.
+   *  @param __os_starts Start positions worked on (oversampled).
+   *  @param __count_to_two Counts up to 2.
+   *  @param __range_length Current length of a chunk. */
+  template<typename _IIter>
+    void
+    __shrink(std::vector<_IIter>& __os_starts, size_t& __count_to_two,
+	     size_t& __range_length)
+    {
+      for (typename std::vector<_IIter>::size_type __i = 0;
+           __i <= (__os_starts.size() / 2); ++__i)
+        __os_starts[__i] = __os_starts[__i * 2];
+      __range_length *= 2;
+    }
+
+  /** @brief Splits a sequence given by input iterators into parts of
+   * almost equal size
+   *
+   *  The function needs only one pass over the sequence.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator of input sequence.
+   *  @param __starts Start iterators for the resulting parts, dimension
+   *  @c __num_parts+1. For convenience, @c __starts @c [__num_parts]
+   *  contains the end iterator of the sequence.
+   *  @param __lengths Length of the resulting parts.
+   *  @param __num_parts Number of parts to split the sequence into.
+   *  @param __f Functor to be applied to each element by traversing __it
+   *  @param __oversampling Oversampling factor. If 0, then the
+   *  partitions will differ in at most 
+   *  \sqrt{\mathrm{__end} - \mathrm{__begin}} 
+   *  __elements. Otherwise, the ratio between the
+   *  longest and the shortest part is bounded by
+   *  1/(\mathrm{__oversampling} \cdot \mathrm{num\_parts})
+   *  @return Length of the whole sequence.
+   */
+  template<typename _IIter, typename _FunctorType>
+    size_t
+    list_partition(const _IIter __begin, const _IIter __end,
+                   _IIter* __starts, size_t* __lengths, const int __num_parts,
+                   _FunctorType& __f, int __oversampling = 0)
+    {
+      bool __make_twice = false;
+
+      // The resizing algorithm is chosen according to the oversampling factor.
+      if (__oversampling == 0)
+        {
+          __make_twice = true;
+          __oversampling = 1;
+        }
+
+      std::vector<_IIter> __os_starts(2 * __oversampling * __num_parts + 1);
+
+      __os_starts[0] = __begin;
+      _IIter __prev  = __begin, __it = __begin;
+      size_t __dist_limit = 0, __dist = 0;
+      size_t __cur = 1, __next = 1;
+      size_t __range_length = 1;
+      size_t __count_to_two = 0;
+      while (__it != __end)
+        {
+          __cur = __next;
+          for (; __cur < __os_starts.size() and __it != __end; ++__cur)
+            {
+              for (__dist_limit += __range_length;
+                   __dist < __dist_limit and __it != __end; ++__dist)
+                {
+                  __f(__it);
+                  ++__it;
+                }
+              __os_starts[__cur] = __it;
+            }
+
+          // Must compare for end and not __cur < __os_starts.size() , because
+          // __cur could be == __os_starts.size() as well
+          if (__it == __end)
+            break;
+
+          __shrink_and_double(__os_starts, __count_to_two, __range_length,
+                              __make_twice);
+          __next = __os_starts.size() / 2 + 1;
+        }
+
+      // Calculation of the parts (one must be extracted from __current
+      // because the partition beginning at end, consists only of
+      // itself).
+      size_t __size_part = (__cur - 1) / __num_parts;
+      int __size_greater = static_cast<int>((__cur - 1) % __num_parts);
+      __starts[0] = __os_starts[0];
+
+      size_t __index = 0;
+
+      // Smallest partitions.
+      for (int __i = 1; __i < (__num_parts + 1 - __size_greater); ++__i)
+        {
+          __lengths[__i - 1] =  __size_part * __range_length;
+          __index += __size_part;
+          __starts[__i] = __os_starts[__index];
+        }
+
+      // Biggest partitions.
+      for (int __i = __num_parts + 1 - __size_greater; __i <= __num_parts;
+           ++__i)
+        {
+          __lengths[__i - 1] =  (__size_part+1) * __range_length;
+          __index += (__size_part+1);
+          __starts[__i] = __os_starts[__index];
+        }
+
+      // Correction of the end size (the end iteration has not finished).
+      __lengths[__num_parts - 1] -= (__dist_limit - __dist);
+
+      return __dist;
+    }
+}
+
+#endif /* _GLIBCXX_PARALLEL_LIST_PARTITION_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/losertree.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/losertree.h
new file mode 100644
index 0000000..cb24f7f
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/losertree.h
@@ -0,0 +1,1055 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/losertree.h
+*  @brief Many generic loser tree variants.
+*  This file is a GNU parallel extension to the Standard C++ Library.
+*/
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_LOSERTREE_H
+#define _GLIBCXX_PARALLEL_LOSERTREE_H 1
+
+#include <bits/stl_algobase.h>
+#include <bits/stl_function.h>
+#include <parallel/features.h>
+#include <parallel/base.h>
+
+namespace __gnu_parallel
+{
+  /**
+   * @brief Guarded loser/tournament tree.
+   *
+   * The smallest element is at the top.
+   *
+   * Guarding is done explicitly through one flag _M_sup per element,
+   * inf is not needed due to a better initialization routine.  This
+   * is a well-performing variant.
+   *
+   * @param _Tp the element type
+   * @param _Compare the comparator to use, defaults to std::less<_Tp>
+   */
+  template<typename _Tp, typename _Compare>
+    class _LoserTreeBase
+    {
+    protected:
+      /** @brief Internal representation of a _LoserTree element. */
+      struct _Loser
+      {
+	/** @brief flag, true iff this is a "maximum" __sentinel. */
+	bool _M_sup;
+	/** @brief __index of the __source __sequence. */
+	int _M_source;
+	/** @brief _M_key of the element in the _LoserTree. */
+	_Tp _M_key;
+      };
+
+      unsigned int _M_ik, _M_k, _M_offset;
+
+      /** log_2{_M_k} */
+      unsigned int _M_log_k;
+
+      /** @brief _LoserTree __elements. */
+      _Loser* _M_losers;
+
+      /** @brief _Compare to use. */
+      _Compare _M_comp;
+
+      /**
+       * @brief State flag that determines whether the _LoserTree is empty.
+       *
+       * Only used for building the _LoserTree.
+       */
+      bool _M_first_insert;
+
+    public:
+      /**
+       * @brief The constructor.
+       *
+       * @param __k The number of sequences to merge.
+       * @param __comp The comparator to use.
+       */
+      _LoserTreeBase(unsigned int __k, _Compare __comp)
+      : _M_comp(__comp)
+      {
+	_M_ik = __k;
+
+	// Compute log_2{_M_k} for the _Loser Tree
+	_M_log_k = __rd_log2(_M_ik - 1) + 1;
+
+	// Next greater power of 2.
+	_M_k = 1 << _M_log_k;
+	_M_offset = _M_k;
+
+	// Avoid default-constructing _M_losers[]._M_key
+	_M_losers = static_cast<_Loser*>(::operator new(2 * _M_k
+							* sizeof(_Loser)));
+	for (unsigned int __i = _M_ik - 1; __i < _M_k; ++__i)
+	  _M_losers[__i + _M_k]._M_sup = true;
+
+	_M_first_insert = true;
+      }
+
+      /**
+       * @brief The destructor.
+       */
+      ~_LoserTreeBase()
+      {
+	for (unsigned int __i = 0; __i < (2 * _M_k); ++__i)
+	  _M_losers[__i].~_Loser();
+	::operator delete(_M_losers);
+      }
+
+      /**
+       * @brief Initializes the sequence "_M_source" with the element "__key".
+       *
+       * @param __key the element to insert
+       * @param __source __index of the __source __sequence
+       * @param __sup flag that determines whether the value to insert is an
+       *   explicit __supremum.
+       */
+      void
+      __insert_start(const _Tp& __key, int __source, bool __sup)
+      {
+	unsigned int __pos = _M_k + __source;
+
+	if (_M_first_insert)
+	  {
+	    // Construct all keys, so we can easily destruct them.
+	    for (unsigned int __i = 0; __i < (2 * _M_k); ++__i)
+	      ::new(&(_M_losers[__i]._M_key)) _Tp(__key);
+	    _M_first_insert = false;
+	  }
+	else
+	  _M_losers[__pos]._M_key = __key;
+
+	_M_losers[__pos]._M_sup = __sup;
+	_M_losers[__pos]._M_source = __source;
+      }
+
+      /**
+       * @return the index of the sequence with the smallest element.
+       */
+      int __get_min_source()
+      { return _M_losers[0]._M_source; }
+    };
+
+    /**
+     * @brief Stable _LoserTree variant.
+     *
+     * Provides the stable implementations of insert_start, __init_winner,
+     * __init and __delete_min_insert.
+     *
+     * Unstable variant is done using partial specialisation below.
+     */
+  template<bool __stable/* default == true */, typename _Tp,
+	   typename _Compare>
+    class _LoserTree
+    : public _LoserTreeBase<_Tp, _Compare>
+    {
+      typedef _LoserTreeBase<_Tp, _Compare> _Base;
+      using _Base::_M_k;
+      using _Base::_M_losers;
+      using _Base::_M_first_insert;
+
+    public:
+      _LoserTree(unsigned int __k, _Compare __comp)
+      : _Base::_LoserTreeBase(__k, __comp)
+      { }
+
+      unsigned int
+      __init_winner(unsigned int __root)
+      {
+	if (__root >= _M_k)
+	  return __root;
+	else
+	  {
+	    unsigned int __left = __init_winner(2 * __root);
+	    unsigned int __right = __init_winner(2 * __root + 1);
+	    if (_M_losers[__right]._M_sup
+		|| (!_M_losers[__left]._M_sup
+		    && !_M_comp(_M_losers[__right]._M_key,
+				_M_losers[__left]._M_key)))
+	      {
+		// Left one is less or equal.
+		_M_losers[__root] = _M_losers[__right];
+		return __left;
+	      }
+	    else
+	      {
+		// Right one is less.
+		_M_losers[__root] = _M_losers[__left];
+		return __right;
+	      }
+	  }
+      }
+
+      void __init()
+      { _M_losers[0] = _M_losers[__init_winner(1)]; }
+
+      /**
+       * @brief Delete the smallest element and insert a new element from
+       *   the previously smallest element's sequence.
+       *
+       * This implementation is stable.
+       */
+      // Do not pass a const reference since __key will be used as
+      // local variable.
+      void
+      __delete_min_insert(_Tp __key, bool __sup)
+      {
+        using std::swap;
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top!
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+
+	int __source = _M_losers[0]._M_source;
+	for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0;
+	     __pos /= 2)
+	  {
+	    // The smaller one gets promoted, ties are broken by _M_source.
+	    if ((__sup && (!_M_losers[__pos]._M_sup
+			   || _M_losers[__pos]._M_source < __source))
+		|| (!__sup && !_M_losers[__pos]._M_sup
+		    && ((_M_comp(_M_losers[__pos]._M_key, __key))
+			|| (!_M_comp(__key, _M_losers[__pos]._M_key)
+			    && _M_losers[__pos]._M_source < __source))))
+	      {
+		// The other one is smaller.
+		std::swap(_M_losers[__pos]._M_sup, __sup);
+		std::swap(_M_losers[__pos]._M_source, __source);
+		swap(_M_losers[__pos]._M_key, __key);
+	      }
+	  }
+
+	_M_losers[0]._M_sup = __sup;
+	_M_losers[0]._M_source = __source;
+	_M_losers[0]._M_key = __key;
+      }
+    };
+
+    /**
+     * @brief Unstable _LoserTree variant.
+     *
+     * Stability (non-stable here) is selected with partial specialization.
+     */
+  template<typename _Tp, typename _Compare>
+    class _LoserTree</* __stable == */false, _Tp, _Compare>
+    : public _LoserTreeBase<_Tp, _Compare>
+    {
+      typedef _LoserTreeBase<_Tp, _Compare> _Base;
+      using _Base::_M_log_k;
+      using _Base::_M_k;
+      using _Base::_M_losers;
+      using _Base::_M_first_insert;
+
+    public:
+      _LoserTree(unsigned int __k, _Compare __comp)
+      : _Base::_LoserTreeBase(__k, __comp)
+      { }
+
+      /**
+       * Computes the winner of the competition at position "__root".
+       *
+       * Called recursively (starting at 0) to build the initial tree.
+       *
+       * @param __root __index of the "game" to start.
+       */
+      unsigned int
+      __init_winner(unsigned int __root)
+      {
+	if (__root >= _M_k)
+	  return __root;
+	else
+	  {
+	    unsigned int __left = __init_winner(2 * __root);
+	    unsigned int __right = __init_winner(2 * __root + 1);
+	    if (_M_losers[__right]._M_sup
+		|| (!_M_losers[__left]._M_sup
+		    && !_M_comp(_M_losers[__right]._M_key,
+				_M_losers[__left]._M_key)))
+	      {
+		// Left one is less or equal.
+		_M_losers[__root] = _M_losers[__right];
+		return __left;
+	      }
+	    else
+	      {
+		// Right one is less.
+		_M_losers[__root] = _M_losers[__left];
+		return __right;
+	      }
+	  }
+      }
+
+      void
+      __init()
+      { _M_losers[0] = _M_losers[__init_winner(1)]; }
+
+      /**
+       * Delete the _M_key smallest element and insert the element __key
+       * instead.
+       *
+       * @param __key the _M_key to insert
+       * @param __sup true iff __key is an explicitly marked supremum
+       */
+      // Do not pass a const reference since __key will be used as local
+      // variable.
+      void
+      __delete_min_insert(_Tp __key, bool __sup)
+      {
+        using std::swap;
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top!
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+
+	int __source = _M_losers[0]._M_source;
+	for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0;
+	     __pos /= 2)
+	  {
+	    // The smaller one gets promoted.
+	    if (__sup || (!_M_losers[__pos]._M_sup
+			  && _M_comp(_M_losers[__pos]._M_key, __key)))
+	      {
+		// The other one is smaller.
+		std::swap(_M_losers[__pos]._M_sup, __sup);
+		std::swap(_M_losers[__pos]._M_source, __source);
+		swap(_M_losers[__pos]._M_key, __key);
+	      }
+	  }
+
+	_M_losers[0]._M_sup = __sup;
+	_M_losers[0]._M_source = __source;
+	_M_losers[0]._M_key = __key;
+      }
+    };
+
+  /**
+   * @brief Base class of _Loser Tree implementation using pointers.
+   */
+  template<typename _Tp, typename _Compare>
+    class _LoserTreePointerBase
+    {
+    protected:
+      /** @brief Internal representation of _LoserTree __elements. */
+      struct _Loser
+      {
+	bool _M_sup;
+	int _M_source;
+	const _Tp* _M_keyp;
+      };
+
+      unsigned int _M_ik, _M_k, _M_offset;
+      _Loser* _M_losers;
+      _Compare _M_comp;
+
+    public:
+      _LoserTreePointerBase(unsigned int __k,
+			    _Compare __comp = std::less<_Tp>())
+      : _M_comp(__comp)
+      {
+	_M_ik = __k;
+
+	// Next greater power of 2.
+	_M_k = 1 << (__rd_log2(_M_ik - 1) + 1);
+	_M_offset = _M_k;
+	_M_losers = new _Loser[_M_k * 2];
+	for (unsigned int __i = _M_ik - 1; __i < _M_k; __i++)
+	  _M_losers[__i + _M_k]._M_sup = true;
+      }
+
+      ~_LoserTreePointerBase()
+      { delete[] _M_losers; }
+
+      int __get_min_source()
+      { return _M_losers[0]._M_source; }
+
+      void __insert_start(const _Tp& __key, int __source, bool __sup)
+      {
+	unsigned int __pos = _M_k + __source;
+
+	_M_losers[__pos]._M_sup = __sup;
+	_M_losers[__pos]._M_source = __source;
+	_M_losers[__pos]._M_keyp = &__key;
+      }
+    };
+
+  /**
+   * @brief Stable _LoserTree implementation.
+   *
+   * The unstable variant is implemented using partial instantiation below.
+   */
+  template<bool __stable/* default == true */, typename _Tp, typename _Compare>
+    class _LoserTreePointer
+    : public _LoserTreePointerBase<_Tp, _Compare>
+    {
+      typedef _LoserTreePointerBase<_Tp, _Compare> _Base;
+      using _Base::_M_k;
+      using _Base::_M_losers;
+
+    public:
+      _LoserTreePointer(unsigned int __k, _Compare __comp = std::less<_Tp>())
+      : _Base::_LoserTreePointerBase(__k, __comp)
+      { }
+
+      unsigned int
+      __init_winner(unsigned int __root)
+      {
+	if (__root >= _M_k)
+	  return __root;
+	else
+	  {
+	    unsigned int __left = __init_winner(2 * __root);
+	    unsigned int __right = __init_winner(2 * __root + 1);
+	    if (_M_losers[__right]._M_sup
+		|| (!_M_losers[__left]._M_sup
+		    && !_M_comp(*_M_losers[__right]._M_keyp,
+				*_M_losers[__left]._M_keyp)))
+	      {
+		// Left one is less or equal.
+		_M_losers[__root] = _M_losers[__right];
+		return __left;
+	      }
+	    else
+	      {
+		// Right one is less.
+		_M_losers[__root] = _M_losers[__left];
+		return __right;
+	      }
+	  }
+      }
+
+      void __init()
+      { _M_losers[0] = _M_losers[__init_winner(1)]; }
+
+      void __delete_min_insert(const _Tp& __key, bool __sup)
+      {
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top!
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+
+	const _Tp* __keyp = &__key;
+	int __source = _M_losers[0]._M_source;
+	for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0;
+	     __pos /= 2)
+	  {
+	    // The smaller one gets promoted, ties are broken by __source.
+	    if ((__sup && (!_M_losers[__pos]._M_sup
+			   || _M_losers[__pos]._M_source < __source))
+		|| (!__sup && !_M_losers[__pos]._M_sup &&
+		    ((_M_comp(*_M_losers[__pos]._M_keyp, *__keyp))
+		     || (!_M_comp(*__keyp, *_M_losers[__pos]._M_keyp)
+			 && _M_losers[__pos]._M_source < __source))))
+	      {
+		// The other one is smaller.
+		std::swap(_M_losers[__pos]._M_sup, __sup);
+		std::swap(_M_losers[__pos]._M_source, __source);
+		std::swap(_M_losers[__pos]._M_keyp, __keyp);
+	      }
+	  }
+
+	_M_losers[0]._M_sup = __sup;
+	_M_losers[0]._M_source = __source;
+	_M_losers[0]._M_keyp = __keyp;
+      }
+    };
+
+  /**
+   * @brief Unstable _LoserTree implementation.
+   *
+   * The stable variant is above.
+   */
+  template<typename _Tp, typename _Compare>
+    class _LoserTreePointer</* __stable == */false, _Tp, _Compare>
+    : public _LoserTreePointerBase<_Tp, _Compare>
+    {
+      typedef _LoserTreePointerBase<_Tp, _Compare> _Base;
+      using _Base::_M_k;
+      using _Base::_M_losers;
+
+    public:
+      _LoserTreePointer(unsigned int __k, _Compare __comp = std::less<_Tp>())
+      : _Base::_LoserTreePointerBase(__k, __comp)
+      { }
+
+      unsigned int
+      __init_winner(unsigned int __root)
+      {
+	if (__root >= _M_k)
+	  return __root;
+	else
+	  {
+	    unsigned int __left = __init_winner(2 * __root);
+	    unsigned int __right = __init_winner(2 * __root + 1);
+	    if (_M_losers[__right]._M_sup
+        	|| (!_M_losers[__left]._M_sup
+		    && !_M_comp(*_M_losers[__right]._M_keyp,
+				*_M_losers[__left]._M_keyp)))
+	      {
+		// Left one is less or equal.
+		_M_losers[__root] = _M_losers[__right];
+		return __left;
+	      }
+	    else
+	      {
+		// Right one is less.
+		_M_losers[__root] = _M_losers[__left];
+		return __right;
+	      }
+	  }
+      }
+
+      void __init()
+      { _M_losers[0] = _M_losers[__init_winner(1)]; }
+
+      void __delete_min_insert(const _Tp& __key, bool __sup)
+      {
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top!
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+
+	const _Tp* __keyp = &__key;
+	int __source = _M_losers[0]._M_source;
+	for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0;
+	     __pos /= 2)
+	  {
+	    // The smaller one gets promoted.
+	    if (__sup || (!_M_losers[__pos]._M_sup
+			  && _M_comp(*_M_losers[__pos]._M_keyp, *__keyp)))
+	      {
+		// The other one is smaller.
+		std::swap(_M_losers[__pos]._M_sup, __sup);
+		std::swap(_M_losers[__pos]._M_source, __source);
+		std::swap(_M_losers[__pos]._M_keyp, __keyp);
+	      }
+	  }
+
+	_M_losers[0]._M_sup = __sup;
+	_M_losers[0]._M_source = __source;
+	_M_losers[0]._M_keyp = __keyp;
+      }
+    };
+
+  /** @brief Base class for unguarded _LoserTree implementation.
+   * 
+   * The whole element is copied into the tree structure.
+   *
+   * No guarding is done, therefore not a single input sequence must
+   * run empty.  Unused __sequence heads are marked with a sentinel which
+   * is &gt; all elements that are to be merged.
+   *
+   * This is a very fast variant.
+   */
+  template<typename _Tp, typename _Compare>
+    class _LoserTreeUnguardedBase
+    {
+    protected:
+      struct _Loser
+      {
+	int _M_source;
+	_Tp _M_key;
+      };
+
+      unsigned int _M_ik, _M_k, _M_offset;
+      _Loser* _M_losers;
+      _Compare _M_comp;
+
+    public:
+      _LoserTreeUnguardedBase(unsigned int __k, const _Tp& __sentinel,
+			      _Compare __comp = std::less<_Tp>())
+      : _M_comp(__comp)
+      {
+	_M_ik = __k;
+
+	// Next greater power of 2.
+	_M_k = 1 << (__rd_log2(_M_ik - 1) + 1);
+	_M_offset = _M_k;
+	// Avoid default-constructing _M_losers[]._M_key
+	_M_losers = static_cast<_Loser*>(::operator new(2 * _M_k
+							* sizeof(_Loser)));
+
+        for (unsigned int __i = 0; __i < _M_k; ++__i)
+          {
+	    ::new(&(_M_losers[__i]._M_key)) _Tp(__sentinel);
+	    _M_losers[__i]._M_source = -1;
+	  }
+        for (unsigned int __i = _M_k + _M_ik - 1; __i < (2 * _M_k); ++__i)
+          {
+	    ::new(&(_M_losers[__i]._M_key)) _Tp(__sentinel);
+	    _M_losers[__i]._M_source = -1;
+	  }
+      }
+
+      ~_LoserTreeUnguardedBase()
+      {
+	for (unsigned int __i = 0; __i < (2 * _M_k); ++__i)
+	  _M_losers[__i].~_Loser();
+	::operator delete(_M_losers);
+      }
+
+      int
+      __get_min_source()
+      {
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top!
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+	return _M_losers[0]._M_source;
+      }
+
+      void
+      __insert_start(const _Tp& __key, int __source, bool)
+      {
+	unsigned int __pos = _M_k + __source;
+
+	::new(&(_M_losers[__pos]._M_key)) _Tp(__key);
+	_M_losers[__pos]._M_source = __source;
+      }
+    };
+
+  /**
+   * @brief Stable implementation of unguarded _LoserTree.
+   *
+   * Unstable variant is selected below with partial specialization.
+   */
+  template<bool __stable/* default == true */, typename _Tp, typename _Compare>
+    class _LoserTreeUnguarded
+    : public _LoserTreeUnguardedBase<_Tp, _Compare>
+    {
+      typedef _LoserTreeUnguardedBase<_Tp, _Compare> _Base;
+      using _Base::_M_k;
+      using _Base::_M_losers;
+
+  public:
+      _LoserTreeUnguarded(unsigned int __k, const _Tp& __sentinel,
+			  _Compare __comp = std::less<_Tp>())
+      : _Base::_LoserTreeUnguardedBase(__k, __sentinel, __comp)
+      { }
+
+      unsigned int
+      __init_winner(unsigned int __root)
+      {
+	if (__root >= _M_k)
+	  return __root;
+	else
+	  {
+	    unsigned int __left = __init_winner(2 * __root);
+	    unsigned int __right = __init_winner(2 * __root + 1);
+	    if (!_M_comp(_M_losers[__right]._M_key,
+			 _M_losers[__left]._M_key))
+	      {
+		// Left one is less or equal.
+		_M_losers[__root] = _M_losers[__right];
+		return __left;
+	      }
+	    else
+	      {
+		// Right one is less.
+		_M_losers[__root] = _M_losers[__left];
+		return __right;
+	      }
+	  }
+      }
+
+      void
+      __init()
+      {
+	_M_losers[0] = _M_losers[__init_winner(1)];
+
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top at the beginning
+	// (0 sequences!)
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+      }
+
+      // Do not pass a const reference since __key will be used as
+      // local variable.
+      void
+      __delete_min_insert(_Tp __key, bool)
+      {
+        using std::swap;
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top!
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+
+	int __source = _M_losers[0]._M_source;
+	for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0;
+	     __pos /= 2)
+	  {
+	    // The smaller one gets promoted, ties are broken by _M_source.
+	    if (_M_comp(_M_losers[__pos]._M_key, __key)
+        	|| (!_M_comp(__key, _M_losers[__pos]._M_key)
+                    && _M_losers[__pos]._M_source < __source))
+	      {
+		// The other one is smaller.
+		std::swap(_M_losers[__pos]._M_source, __source);
+		swap(_M_losers[__pos]._M_key, __key);
+	      }
+	  }
+
+	_M_losers[0]._M_source = __source;
+	_M_losers[0]._M_key = __key;
+      }
+    };
+
+  /**
+   * @brief Non-Stable implementation of unguarded _LoserTree.
+   *
+   * Stable implementation is above.
+   */
+  template<typename _Tp, typename _Compare>
+    class _LoserTreeUnguarded</* __stable == */false, _Tp, _Compare>
+    : public _LoserTreeUnguardedBase<_Tp, _Compare>
+    {
+      typedef _LoserTreeUnguardedBase<_Tp, _Compare> _Base;
+      using _Base::_M_k;
+      using _Base::_M_losers;
+
+    public:
+      _LoserTreeUnguarded(unsigned int __k, const _Tp& __sentinel,
+			  _Compare __comp = std::less<_Tp>())
+      : _Base::_LoserTreeUnguardedBase(__k, __sentinel, __comp)
+      { }
+
+      unsigned int
+      __init_winner(unsigned int __root)
+      {
+	if (__root >= _M_k)
+	  return __root;
+	else
+	  {
+	    unsigned int __left = __init_winner(2 * __root);
+	    unsigned int __right = __init_winner(2 * __root + 1);
+
+#if _GLIBCXX_ASSERTIONS
+	    // If __left one is sentinel then __right one must be, too.
+	    if (_M_losers[__left]._M_source == -1)
+	      _GLIBCXX_PARALLEL_ASSERT(_M_losers[__right]._M_source == -1);
+#endif
+
+	    if (!_M_comp(_M_losers[__right]._M_key,
+			 _M_losers[__left]._M_key))
+	      {
+		// Left one is less or equal.
+		_M_losers[__root] = _M_losers[__right];
+		return __left;
+	      }
+	    else
+	      {
+		// Right one is less.
+		_M_losers[__root] = _M_losers[__left];
+		return __right;
+	      }
+	  }
+      }
+
+      void
+      __init()
+      {
+	_M_losers[0] = _M_losers[__init_winner(1)];
+
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top at the beginning
+	// (0 sequences!)
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+      }
+
+      // Do not pass a const reference since __key will be used as
+      // local variable.
+      void
+      __delete_min_insert(_Tp __key, bool)
+      {
+        using std::swap;
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top!
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+
+	int __source = _M_losers[0]._M_source;
+	for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0;
+	     __pos /= 2)
+	  {
+	    // The smaller one gets promoted.
+	    if (_M_comp(_M_losers[__pos]._M_key, __key))
+	      {
+		// The other one is smaller.
+		std::swap(_M_losers[__pos]._M_source, __source);
+		swap(_M_losers[__pos]._M_key, __key);
+	      }
+	  }
+
+	_M_losers[0]._M_source = __source;
+	_M_losers[0]._M_key = __key;
+      }
+    };
+
+  /** @brief Unguarded loser tree, keeping only pointers to the
+  * elements in the tree structure.
+  *
+  *  No guarding is done, therefore not a single input sequence must
+  *  run empty.  This is a very fast variant.
+  */
+  template<typename _Tp, typename _Compare>
+    class _LoserTreePointerUnguardedBase
+    {
+    protected:
+      struct _Loser
+      {
+	int _M_source;
+	const _Tp* _M_keyp;
+      };
+
+      unsigned int _M_ik, _M_k, _M_offset;
+      _Loser* _M_losers;
+      _Compare _M_comp;
+
+    public:
+
+      _LoserTreePointerUnguardedBase(unsigned int __k, const _Tp& __sentinel,
+				     _Compare __comp = std::less<_Tp>())
+      : _M_comp(__comp)
+      {
+	_M_ik = __k;
+
+	// Next greater power of 2.
+	_M_k = 1 << (__rd_log2(_M_ik - 1) + 1);
+	_M_offset = _M_k;
+	// Avoid default-constructing _M_losers[]._M_key
+	_M_losers = new _Loser[2 * _M_k];
+
+	for (unsigned int __i = _M_k + _M_ik - 1; __i < (2 * _M_k); ++__i)
+	  {
+	    _M_losers[__i]._M_keyp = &__sentinel;
+	    _M_losers[__i]._M_source = -1;
+	  }
+      }
+
+      ~_LoserTreePointerUnguardedBase()
+      { delete[] _M_losers; }
+
+      int
+      __get_min_source()
+      {
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top!
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+	return _M_losers[0]._M_source;
+      }
+
+      void
+      __insert_start(const _Tp& __key, int __source, bool)
+      {
+	unsigned int __pos = _M_k + __source;
+
+	_M_losers[__pos]._M_keyp = &__key;
+	_M_losers[__pos]._M_source = __source;
+      }
+    };
+
+  /**
+   * @brief Stable unguarded _LoserTree variant storing pointers.
+   *
+   * Unstable variant is implemented below using partial specialization.
+   */
+  template<bool __stable/* default == true */, typename _Tp, typename _Compare>
+    class _LoserTreePointerUnguarded
+    : public _LoserTreePointerUnguardedBase<_Tp, _Compare>
+    {
+      typedef _LoserTreePointerUnguardedBase<_Tp, _Compare> _Base;
+      using _Base::_M_k;
+      using _Base::_M_losers;
+
+    public:
+      _LoserTreePointerUnguarded(unsigned int __k, const _Tp& __sentinel,
+				 _Compare __comp = std::less<_Tp>())
+      : _Base::_LoserTreePointerUnguardedBase(__k, __sentinel, __comp)
+      { }
+
+      unsigned int
+      __init_winner(unsigned int __root)
+      {
+	if (__root >= _M_k)
+	  return __root;
+	else
+	  {
+	    unsigned int __left = __init_winner(2 * __root);
+	    unsigned int __right = __init_winner(2 * __root + 1);
+	    if (!_M_comp(*_M_losers[__right]._M_keyp,
+			 *_M_losers[__left]._M_keyp))
+	      {
+		// Left one is less or equal.
+		_M_losers[__root] = _M_losers[__right];
+		return __left;
+	      }
+	    else
+	      {
+		// Right one is less.
+		_M_losers[__root] = _M_losers[__left];
+		return __right;
+	      }
+	  }
+      }
+
+      void
+      __init()
+      {
+	_M_losers[0] = _M_losers[__init_winner(1)];
+
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top at the beginning
+	// (0 sequences!)
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+      }
+
+      void
+      __delete_min_insert(const _Tp& __key, bool __sup)
+      {
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top!
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+
+	const _Tp* __keyp = &__key;
+	int __source = _M_losers[0]._M_source;
+	for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0;
+	     __pos /= 2)
+	  {
+	    // The smaller one gets promoted, ties are broken by _M_source.
+	    if (_M_comp(*_M_losers[__pos]._M_keyp, *__keyp)
+		|| (!_M_comp(*__keyp, *_M_losers[__pos]._M_keyp)
+		    && _M_losers[__pos]._M_source < __source))
+	      {
+		// The other one is smaller.
+		std::swap(_M_losers[__pos]._M_source, __source);
+		std::swap(_M_losers[__pos]._M_keyp, __keyp);
+	      }
+	  }
+
+	_M_losers[0]._M_source = __source;
+	_M_losers[0]._M_keyp = __keyp;
+      }
+    };
+
+  /**
+   * @brief Unstable unguarded _LoserTree variant storing pointers.
+   *
+   * Stable variant is above.
+   */
+  template<typename _Tp, typename _Compare>
+    class _LoserTreePointerUnguarded</* __stable == */false, _Tp, _Compare>
+    : public _LoserTreePointerUnguardedBase<_Tp, _Compare>
+    {
+      typedef _LoserTreePointerUnguardedBase<_Tp, _Compare> _Base;
+      using _Base::_M_k;
+      using _Base::_M_losers;
+
+  public:
+      _LoserTreePointerUnguarded(unsigned int __k, const _Tp& __sentinel,
+				 _Compare __comp = std::less<_Tp>())
+      : _Base::_LoserTreePointerUnguardedBase(__k, __sentinel, __comp)
+      { }
+
+      unsigned int
+      __init_winner(unsigned int __root)
+      {
+	if (__root >= _M_k)
+	  return __root;
+	else
+	  {
+	    unsigned int __left = __init_winner(2 * __root);
+	    unsigned int __right = __init_winner(2 * __root + 1);
+
+#if _GLIBCXX_ASSERTIONS
+	    // If __left one is sentinel then __right one must be, too.
+	    if (_M_losers[__left]._M_source == -1)
+	      _GLIBCXX_PARALLEL_ASSERT(_M_losers[__right]._M_source == -1);
+#endif
+
+	    if (!_M_comp(*_M_losers[__right]._M_keyp,
+			 *_M_losers[__left]._M_keyp))
+	      {
+		// Left one is less or equal.
+		_M_losers[__root] = _M_losers[__right];
+		return __left;
+	      }
+	    else
+	      {
+		// Right one is less.
+		_M_losers[__root] = _M_losers[__left];
+		return __right;
+	      }
+	  }
+      }
+
+      void
+      __init()
+      {
+	_M_losers[0] = _M_losers[__init_winner(1)];
+
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top at the beginning
+	// (0 sequences!)
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+      }
+
+      void
+      __delete_min_insert(const _Tp& __key, bool __sup)
+      {
+#if _GLIBCXX_ASSERTIONS
+	// no dummy sequence can ever be at the top!
+	_GLIBCXX_PARALLEL_ASSERT(_M_losers[0]._M_source != -1);
+#endif
+
+	const _Tp* __keyp = &__key;
+	int __source = _M_losers[0]._M_source;
+	for (unsigned int __pos = (_M_k + __source) / 2; __pos > 0;
+	     __pos /= 2)
+	  {
+	    // The smaller one gets promoted.
+	    if (_M_comp(*(_M_losers[__pos]._M_keyp), *__keyp))
+	      {
+		// The other one is smaller.
+		std::swap(_M_losers[__pos]._M_source, __source);
+		std::swap(_M_losers[__pos]._M_keyp, __keyp);
+	      }
+	  }
+
+	_M_losers[0]._M_source = __source;
+	_M_losers[0]._M_keyp = __keyp;
+      }
+    };
+} // namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_LOSERTREE_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/merge.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/merge.h
new file mode 100644
index 0000000..a19e996
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/merge.h
@@ -0,0 +1,251 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/merge.h
+ *  @brief Parallel implementation of std::merge().
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_MERGE_H
+#define _GLIBCXX_PARALLEL_MERGE_H 1
+
+#include <parallel/basic_iterator.h>
+#include <bits/stl_algo.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Merge routine being able to merge only the @c __max_length
+   * smallest elements.
+   *
+   * The @c __begin iterators are advanced accordingly, they might not
+   * reach @c __end, in contrast to the usual variant.
+   * @param __begin1 Begin iterator of first sequence.
+   * @param __end1 End iterator of first sequence.
+   * @param __begin2 Begin iterator of second sequence.
+   * @param __end2 End iterator of second sequence.
+   * @param __target Target begin iterator.
+   * @param __max_length Maximum number of elements to merge.
+   * @param __comp Comparator.
+   * @return Output end iterator. */
+  template<typename _RAIter1, typename _RAIter2,
+           typename _OutputIterator, typename _DifferenceTp,
+           typename _Compare>
+    _OutputIterator
+    __merge_advance_usual(_RAIter1& __begin1, _RAIter1 __end1,
+			  _RAIter2& __begin2, _RAIter2 __end2,
+			  _OutputIterator __target,
+			  _DifferenceTp __max_length, _Compare __comp)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      while (__begin1 != __end1 && __begin2 != __end2 && __max_length > 0)
+        {
+          // array1[__i1] < array0[i0]
+          if (__comp(*__begin2, *__begin1))
+            *__target++ = *__begin2++;
+          else
+            *__target++ = *__begin1++;
+          --__max_length;
+        }
+
+      if (__begin1 != __end1)
+        {
+          __target = std::copy(__begin1, __begin1 + __max_length, __target);
+          __begin1 += __max_length;
+        }
+      else
+        {
+          __target = std::copy(__begin2, __begin2 + __max_length, __target);
+          __begin2 += __max_length;
+        }
+      return __target;
+    }
+
+  /** @brief Merge routine being able to merge only the @c __max_length
+   * smallest elements.
+   *
+   * The @c __begin iterators are advanced accordingly, they might not
+   * reach @c __end, in contrast to the usual variant.
+   * Specially designed code should allow the compiler to generate
+   * conditional moves instead of branches.
+   * @param __begin1 Begin iterator of first sequence.
+   * @param __end1 End iterator of first sequence.
+   * @param __begin2 Begin iterator of second sequence.
+   * @param __end2 End iterator of second sequence.
+   * @param __target Target begin iterator.
+   * @param __max_length Maximum number of elements to merge.
+   * @param __comp Comparator.
+   * @return Output end iterator. */
+  template<typename _RAIter1, typename _RAIter2,
+           typename _OutputIterator, typename _DifferenceTp,
+           typename _Compare>
+    _OutputIterator
+    __merge_advance_movc(_RAIter1& __begin1, _RAIter1 __end1,
+			 _RAIter2& __begin2, _RAIter2 __end2,
+			 _OutputIterator __target,
+			 _DifferenceTp __max_length, _Compare __comp)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      typedef typename std::iterator_traits<_RAIter1>::value_type
+        _ValueType1;
+      typedef typename std::iterator_traits<_RAIter2>::value_type
+        _ValueType2;
+
+#if _GLIBCXX_ASSERTIONS
+      _GLIBCXX_PARALLEL_ASSERT(__max_length >= 0);
+#endif
+
+      while (__begin1 != __end1 && __begin2 != __end2 && __max_length > 0)
+        {
+          _RAIter1 __next1 = __begin1 + 1;
+          _RAIter2 __next2 = __begin2 + 1;
+          _ValueType1 __element1 = *__begin1;
+          _ValueType2 __element2 = *__begin2;
+
+          if (__comp(__element2, __element1))
+            {
+              __element1 = __element2;
+              __begin2 = __next2;
+            }
+          else
+            __begin1 = __next1;
+
+          *__target = __element1;
+
+          ++__target;
+          --__max_length;
+        }
+      if (__begin1 != __end1)
+        {
+          __target = std::copy(__begin1, __begin1 + __max_length, __target);
+          __begin1 += __max_length;
+        }
+      else
+        {
+          __target = std::copy(__begin2, __begin2 + __max_length, __target);
+          __begin2 += __max_length;
+        }
+      return __target;
+    }
+
+  /** @brief Merge routine being able to merge only the @c __max_length
+   * smallest elements.
+   *
+   *  The @c __begin iterators are advanced accordingly, they might not
+   *  reach @c __end, in contrast to the usual variant.
+   *  Static switch on whether to use the conditional-move variant.
+   *  @param __begin1 Begin iterator of first sequence.
+   *  @param __end1 End iterator of first sequence.
+   *  @param __begin2 Begin iterator of second sequence.
+   *  @param __end2 End iterator of second sequence.
+   *  @param __target Target begin iterator.
+   *  @param __max_length Maximum number of elements to merge.
+   *  @param __comp Comparator.
+   *  @return Output end iterator. */
+  template<typename _RAIter1, typename _RAIter2,
+           typename _OutputIterator, typename _DifferenceTp,
+           typename _Compare>
+    inline _OutputIterator
+    __merge_advance(_RAIter1& __begin1, _RAIter1 __end1,
+		    _RAIter2& __begin2, _RAIter2 __end2,
+		    _OutputIterator __target, _DifferenceTp __max_length,
+		    _Compare __comp)
+    {
+      _GLIBCXX_CALL(__max_length)
+
+      return __merge_advance_movc(__begin1, __end1, __begin2, __end2,
+				  __target, __max_length, __comp);
+    }
+
+  /** @brief Merge routine fallback to sequential in case the
+      iterators of the two input sequences are of different type.
+      *  @param __begin1 Begin iterator of first sequence.
+      *  @param __end1 End iterator of first sequence.
+      *  @param __begin2 Begin iterator of second sequence.
+      *  @param __end2 End iterator of second sequence.
+      *  @param __target Target begin iterator.
+      *  @param __max_length Maximum number of elements to merge.
+      *  @param __comp Comparator.
+      *  @return Output end iterator. */
+  template<typename _RAIter1, typename _RAIter2,
+           typename _RAIter3, typename _Compare>
+    inline _RAIter3
+    __parallel_merge_advance(_RAIter1& __begin1, _RAIter1 __end1,
+			     _RAIter2& __begin2,
+			     // different iterators, parallel implementation
+			     // not available
+			     _RAIter2 __end2, _RAIter3 __target, typename
+			     std::iterator_traits<_RAIter1>::
+			     difference_type __max_length, _Compare __comp)
+    { return __merge_advance(__begin1, __end1, __begin2, __end2, __target,
+			     __max_length, __comp); }
+
+  /** @brief Parallel merge routine being able to merge only the @c
+   * __max_length smallest elements.
+   *
+   *  The @c __begin iterators are advanced accordingly, they might not
+   *  reach @c __end, in contrast to the usual variant.
+   *  The functionality is projected onto parallel_multiway_merge.
+   *  @param __begin1 Begin iterator of first sequence.
+   *  @param __end1 End iterator of first sequence.
+   *  @param __begin2 Begin iterator of second sequence.
+   *  @param __end2 End iterator of second sequence.
+   *  @param __target Target begin iterator.
+   *  @param __max_length Maximum number of elements to merge.
+   *  @param __comp Comparator.
+   *  @return Output end iterator.
+   */
+  template<typename _RAIter1, typename _RAIter3,
+           typename _Compare>
+    inline _RAIter3
+    __parallel_merge_advance(_RAIter1& __begin1, _RAIter1 __end1,
+			     _RAIter1& __begin2, _RAIter1 __end2,
+			     _RAIter3 __target, typename
+			     std::iterator_traits<_RAIter1>::
+			     difference_type __max_length, _Compare __comp)
+    {
+      typedef typename
+          std::iterator_traits<_RAIter1>::value_type _ValueType;
+      typedef typename std::iterator_traits<_RAIter1>::
+        difference_type _DifferenceType1 /* == difference_type2 */;
+      typedef typename std::iterator_traits<_RAIter3>::
+        difference_type _DifferenceType3;
+      typedef typename std::pair<_RAIter1, _RAIter1>
+        _IteratorPair;
+
+      _IteratorPair __seqs[2] = { std::make_pair(__begin1, __end1),
+				  std::make_pair(__begin2, __end2) };
+      _RAIter3 __target_end = parallel_multiway_merge
+	< /* __stable = */ true, /* __sentinels = */ false>
+	(__seqs, __seqs + 2, __target, multiway_merge_exact_splitting
+	 < /* __stable = */ true, _IteratorPair*,
+	 _Compare, _DifferenceType1>, __max_length, __comp,
+	 omp_get_max_threads());
+
+      return __target_end;
+    }
+}       //namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_MERGE_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/multiseq_selection.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/multiseq_selection.h
new file mode 100644
index 0000000..e77653a
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/multiseq_selection.h
@@ -0,0 +1,646 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/multiseq_selection.h
+ *  @brief Functions to find elements of a certain global __rank in
+ *  multiple sorted sequences.  Also serves for splitting such
+ *  sequence sets.
+ *
+ *  The algorithm description can be found in 
+ *
+ *  P. J. Varman, S. D. Scheufler, B. R. Iyer, and G. R. Ricard.
+ *  Merging Multiple Lists on Hierarchical-Memory Multiprocessors.
+ *  Journal of Parallel and Distributed Computing, 12(2):171–177, 1991.
+ *
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_MULTISEQ_SELECTION_H
+#define _GLIBCXX_PARALLEL_MULTISEQ_SELECTION_H 1
+
+#include <vector>
+#include <queue>
+
+#include <bits/stl_algo.h>
+
+#include <parallel/sort.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Compare __a pair of types lexicographically, ascending. */
+  template<typename _T1, typename _T2, typename _Compare>
+    class _Lexicographic
+    : public std::binary_function<std::pair<_T1, _T2>,
+				  std::pair<_T1, _T2>, bool>
+    {
+    private:
+      _Compare& _M_comp;
+
+    public:
+      _Lexicographic(_Compare& __comp) : _M_comp(__comp) { }
+
+      bool
+      operator()(const std::pair<_T1, _T2>& __p1,
+                 const std::pair<_T1, _T2>& __p2) const
+      {
+        if (_M_comp(__p1.first, __p2.first))
+          return true;
+
+        if (_M_comp(__p2.first, __p1.first))
+          return false;
+
+        // Firsts are equal.
+        return __p1.second < __p2.second;
+      }
+    };
+
+  /** @brief Compare __a pair of types lexicographically, descending. */
+  template<typename _T1, typename _T2, typename _Compare>
+    class _LexicographicReverse : public std::binary_function<_T1, _T2, bool>
+    {
+    private:
+      _Compare& _M_comp;
+
+    public:
+      _LexicographicReverse(_Compare& __comp) : _M_comp(__comp) { }
+
+      bool
+      operator()(const std::pair<_T1, _T2>& __p1,
+                 const std::pair<_T1, _T2>& __p2) const
+      {
+        if (_M_comp(__p2.first, __p1.first))
+          return true;
+
+        if (_M_comp(__p1.first, __p2.first))
+          return false;
+
+        // Firsts are equal.
+        return __p2.second < __p1.second;
+      }
+    };
+
+  /** 
+   *  @brief Splits several sorted sequences at a certain global __rank,
+   *  resulting in a splitting point for each sequence.
+   *  The sequences are passed via a sequence of random-access
+   *  iterator pairs, none of the sequences may be empty.  If there
+   *  are several equal elements across the split, the ones on the
+   *  __left side will be chosen from sequences with smaller number.
+   *  @param __begin_seqs Begin of the sequence of iterator pairs.
+   *  @param __end_seqs End of the sequence of iterator pairs.
+   *  @param __rank The global rank to partition at.
+   *  @param __begin_offsets A random-access __sequence __begin where the
+   *  __result will be stored in. Each element of the sequence is an
+   *  iterator that points to the first element on the greater part of
+   *  the respective __sequence.
+   *  @param __comp The ordering functor, defaults to std::less<_Tp>. 
+   */
+  template<typename _RanSeqs, typename _RankType, typename _RankIterator,
+            typename _Compare>
+    void
+    multiseq_partition(_RanSeqs __begin_seqs, _RanSeqs __end_seqs,
+                       _RankType __rank,
+                       _RankIterator __begin_offsets,
+                       _Compare __comp = std::less<
+                       typename std::iterator_traits<typename
+                       std::iterator_traits<_RanSeqs>::value_type::
+                       first_type>::value_type>()) // std::less<_Tp>
+    {
+      _GLIBCXX_CALL(__end_seqs - __begin_seqs)
+
+      typedef typename std::iterator_traits<_RanSeqs>::value_type::first_type
+        _It;
+      typedef typename std::iterator_traits<_RanSeqs>::difference_type
+        _SeqNumber;
+      typedef typename std::iterator_traits<_It>::difference_type
+               _DifferenceType;
+      typedef typename std::iterator_traits<_It>::value_type _ValueType;
+
+      _Lexicographic<_ValueType, _SeqNumber, _Compare> __lcomp(__comp);
+      _LexicographicReverse<_ValueType, _SeqNumber, _Compare> __lrcomp(__comp);
+
+      // Number of sequences, number of elements in total (possibly
+      // including padding).
+      _DifferenceType __m = std::distance(__begin_seqs, __end_seqs), __nn = 0,
+                      __nmax, __n, __r;
+
+      for (_SeqNumber __i = 0; __i < __m; __i++)
+        {
+          __nn += std::distance(__begin_seqs[__i].first,
+                               __begin_seqs[__i].second);
+          _GLIBCXX_PARALLEL_ASSERT(
+            std::distance(__begin_seqs[__i].first,
+                          __begin_seqs[__i].second) > 0);
+        }
+
+      if (__rank == __nn)
+        {
+          for (_SeqNumber __i = 0; __i < __m; __i++)
+            __begin_offsets[__i] = __begin_seqs[__i].second; // Very end.
+          // Return __m - 1;
+          return;
+        }
+
+      _GLIBCXX_PARALLEL_ASSERT(__m != 0);
+      _GLIBCXX_PARALLEL_ASSERT(__nn != 0);
+      _GLIBCXX_PARALLEL_ASSERT(__rank >= 0);
+      _GLIBCXX_PARALLEL_ASSERT(__rank < __nn);
+
+      _DifferenceType* __ns = new _DifferenceType[__m];
+      _DifferenceType* __a = new _DifferenceType[__m];
+      _DifferenceType* __b = new _DifferenceType[__m];
+      _DifferenceType __l;
+
+      __ns[0] = std::distance(__begin_seqs[0].first, __begin_seqs[0].second);
+      __nmax = __ns[0];
+      for (_SeqNumber __i = 0; __i < __m; __i++)
+        {
+          __ns[__i] = std::distance(__begin_seqs[__i].first,
+                                    __begin_seqs[__i].second);
+          __nmax = std::max(__nmax, __ns[__i]);
+        }
+
+      __r = __rd_log2(__nmax) + 1;
+
+      // Pad all lists to this length, at least as long as any ns[__i],
+      // equality iff __nmax = 2^__k - 1.
+      __l = (1ULL << __r) - 1;
+
+      for (_SeqNumber __i = 0; __i < __m; __i++)
+        {
+          __a[__i] = 0;
+          __b[__i] = __l;
+        }
+      __n = __l / 2;
+
+      // Invariants:
+      // 0 <= __a[__i] <= __ns[__i], 0 <= __b[__i] <= __l
+
+#define __S(__i) (__begin_seqs[__i].first)
+
+      // Initial partition.
+      std::vector<std::pair<_ValueType, _SeqNumber> > __sample;
+
+      for (_SeqNumber __i = 0; __i < __m; __i++)
+        if (__n < __ns[__i])    //__sequence long enough
+          __sample.push_back(std::make_pair(__S(__i)[__n], __i));
+      __gnu_sequential::sort(__sample.begin(), __sample.end(), __lcomp);
+
+      for (_SeqNumber __i = 0; __i < __m; __i++)       //conceptual infinity
+        if (__n >= __ns[__i])   //__sequence too short, conceptual infinity
+          __sample.push_back(
+            std::make_pair(__S(__i)[0] /*__dummy element*/, __i));
+
+      _DifferenceType __localrank = __rank / __l;
+
+      _SeqNumber __j;
+      for (__j = 0;
+           __j < __localrank && ((__n + 1) <= __ns[__sample[__j].second]);
+           ++__j)
+        __a[__sample[__j].second] += __n + 1;
+      for (; __j < __m; __j++)
+        __b[__sample[__j].second] -= __n + 1;
+      
+      // Further refinement.
+      while (__n > 0)
+        {
+          __n /= 2;
+
+          _SeqNumber __lmax_seq = -1;  // to avoid warning
+          const _ValueType* __lmax = 0; // impossible to avoid the warning?
+          for (_SeqNumber __i = 0; __i < __m; __i++)
+            {
+              if (__a[__i] > 0)
+                {
+                  if (!__lmax)
+                    {
+                      __lmax = &(__S(__i)[__a[__i] - 1]);
+                      __lmax_seq = __i;
+                    }
+                  else
+                    {
+                      // Max, favor rear sequences.
+                      if (!__comp(__S(__i)[__a[__i] - 1], *__lmax))
+                        {
+                          __lmax = &(__S(__i)[__a[__i] - 1]);
+                          __lmax_seq = __i;
+                        }
+                    }
+                }
+            }
+
+          _SeqNumber __i;
+          for (__i = 0; __i < __m; __i++)
+            {
+              _DifferenceType __middle = (__b[__i] + __a[__i]) / 2;
+              if (__lmax && __middle < __ns[__i] &&
+                  __lcomp(std::make_pair(__S(__i)[__middle], __i),
+                        std::make_pair(*__lmax, __lmax_seq)))
+                __a[__i] = std::min(__a[__i] + __n + 1, __ns[__i]);
+              else
+                __b[__i] -= __n + 1;
+            }
+
+          _DifferenceType __leftsize = 0;
+          for (_SeqNumber __i = 0; __i < __m; __i++)
+              __leftsize += __a[__i] / (__n + 1);
+
+          _DifferenceType __skew = __rank / (__n + 1) - __leftsize;
+
+          if (__skew > 0)
+            {
+              // Move to the left, find smallest.
+              std::priority_queue<std::pair<_ValueType, _SeqNumber>,
+                std::vector<std::pair<_ValueType, _SeqNumber> >,
+                _LexicographicReverse<_ValueType, _SeqNumber, _Compare> >
+                __pq(__lrcomp);
+              
+              for (_SeqNumber __i = 0; __i < __m; __i++)
+                if (__b[__i] < __ns[__i])
+                  __pq.push(std::make_pair(__S(__i)[__b[__i]], __i));
+
+              for (; __skew != 0 && !__pq.empty(); --__skew)
+                {
+                  _SeqNumber __source = __pq.top().second;
+                  __pq.pop();
+
+                  __a[__source]
+                      = std::min(__a[__source] + __n + 1, __ns[__source]);
+                  __b[__source] += __n + 1;
+
+                  if (__b[__source] < __ns[__source])
+                    __pq.push(
+                      std::make_pair(__S(__source)[__b[__source]], __source));
+                }
+            }
+          else if (__skew < 0)
+            {
+              // Move to the right, find greatest.
+              std::priority_queue<std::pair<_ValueType, _SeqNumber>,
+                std::vector<std::pair<_ValueType, _SeqNumber> >,
+                _Lexicographic<_ValueType, _SeqNumber, _Compare> >
+                  __pq(__lcomp);
+
+              for (_SeqNumber __i = 0; __i < __m; __i++)
+                if (__a[__i] > 0)
+                  __pq.push(std::make_pair(__S(__i)[__a[__i] - 1], __i));
+
+              for (; __skew != 0; ++__skew)
+                {
+                  _SeqNumber __source = __pq.top().second;
+                  __pq.pop();
+
+                  __a[__source] -= __n + 1;
+                  __b[__source] -= __n + 1;
+
+                  if (__a[__source] > 0)
+                    __pq.push(std::make_pair(
+                        __S(__source)[__a[__source] - 1], __source));
+                }
+            }
+        }
+
+      // Postconditions:
+      // __a[__i] == __b[__i] in most cases, except when __a[__i] has been
+      // clamped because of having reached the boundary
+
+      // Now return the result, calculate the offset.
+
+      // Compare the keys on both edges of the border.
+
+      // Maximum of left edge, minimum of right edge.
+      _ValueType* __maxleft = 0;
+      _ValueType* __minright = 0;
+      for (_SeqNumber __i = 0; __i < __m; __i++)
+        {
+          if (__a[__i] > 0)
+            {
+              if (!__maxleft)
+                __maxleft = &(__S(__i)[__a[__i] - 1]);
+              else
+                {
+                  // Max, favor rear sequences.
+                  if (!__comp(__S(__i)[__a[__i] - 1], *__maxleft))
+                    __maxleft = &(__S(__i)[__a[__i] - 1]);
+                }
+            }
+          if (__b[__i] < __ns[__i])
+            {
+              if (!__minright)
+                __minright = &(__S(__i)[__b[__i]]);
+              else
+                {
+                  // Min, favor fore sequences.
+                  if (__comp(__S(__i)[__b[__i]], *__minright))
+                    __minright = &(__S(__i)[__b[__i]]);
+                }
+            }
+        }
+
+      _SeqNumber __seq = 0;
+      for (_SeqNumber __i = 0; __i < __m; __i++)
+        __begin_offsets[__i] = __S(__i) + __a[__i];
+
+      delete[] __ns;
+      delete[] __a;
+      delete[] __b;
+    }
+
+
+  /** 
+   *  @brief Selects the element at a certain global __rank from several
+   *  sorted sequences.
+   *
+   *  The sequences are passed via a sequence of random-access
+   *  iterator pairs, none of the sequences may be empty.
+   *  @param __begin_seqs Begin of the sequence of iterator pairs.
+   *  @param __end_seqs End of the sequence of iterator pairs.
+   *  @param __rank The global rank to partition at.
+   *  @param __offset The rank of the selected element in the global
+   *  subsequence of elements equal to the selected element. If the
+   *  selected element is unique, this number is 0.
+   *  @param __comp The ordering functor, defaults to std::less. 
+   */
+  template<typename _Tp, typename _RanSeqs, typename _RankType,
+           typename _Compare>
+    _Tp
+    multiseq_selection(_RanSeqs __begin_seqs, _RanSeqs __end_seqs,
+                       _RankType __rank,
+                       _RankType& __offset, _Compare __comp = std::less<_Tp>())
+    {
+      _GLIBCXX_CALL(__end_seqs - __begin_seqs)
+
+      typedef typename std::iterator_traits<_RanSeqs>::value_type::first_type
+        _It;
+      typedef typename std::iterator_traits<_RanSeqs>::difference_type
+        _SeqNumber;
+      typedef typename std::iterator_traits<_It>::difference_type
+        _DifferenceType;
+
+      _Lexicographic<_Tp, _SeqNumber, _Compare> __lcomp(__comp);
+      _LexicographicReverse<_Tp, _SeqNumber, _Compare> __lrcomp(__comp);
+
+      // Number of sequences, number of elements in total (possibly
+      // including padding).
+      _DifferenceType __m = std::distance(__begin_seqs, __end_seqs);
+      _DifferenceType __nn = 0;
+      _DifferenceType __nmax, __n, __r;
+
+      for (_SeqNumber __i = 0; __i < __m; __i++)
+        __nn += std::distance(__begin_seqs[__i].first,
+			      __begin_seqs[__i].second);
+
+      if (__m == 0 || __nn == 0 || __rank < 0 || __rank >= __nn)
+        {
+          // result undefined if there is no data or __rank is outside bounds
+          throw std::exception();
+        }
+
+
+      _DifferenceType* __ns = new _DifferenceType[__m];
+      _DifferenceType* __a = new _DifferenceType[__m];
+      _DifferenceType* __b = new _DifferenceType[__m];
+      _DifferenceType __l;
+
+      __ns[0] = std::distance(__begin_seqs[0].first, __begin_seqs[0].second);
+      __nmax = __ns[0];
+      for (_SeqNumber __i = 0; __i < __m; ++__i)
+        {
+          __ns[__i] = std::distance(__begin_seqs[__i].first,
+                                    __begin_seqs[__i].second);
+          __nmax = std::max(__nmax, __ns[__i]);
+        }
+
+      __r = __rd_log2(__nmax) + 1;
+
+      // Pad all lists to this length, at least as long as any ns[__i],
+      // equality iff __nmax = 2^__k - 1
+      __l = __round_up_to_pow2(__r) - 1;
+
+      for (_SeqNumber __i = 0; __i < __m; ++__i)
+        {
+          __a[__i] = 0;
+          __b[__i] = __l;
+        }
+      __n = __l / 2;
+
+      // Invariants:
+      // 0 <= __a[__i] <= __ns[__i], 0 <= __b[__i] <= __l
+
+#define __S(__i) (__begin_seqs[__i].first)
+
+      // Initial partition.
+      std::vector<std::pair<_Tp, _SeqNumber> > __sample;
+
+      for (_SeqNumber __i = 0; __i < __m; __i++)
+        if (__n < __ns[__i])
+          __sample.push_back(std::make_pair(__S(__i)[__n], __i));
+      __gnu_sequential::sort(__sample.begin(), __sample.end(),
+                             __lcomp, sequential_tag());
+
+      // Conceptual infinity.
+      for (_SeqNumber __i = 0; __i < __m; __i++)
+        if (__n >= __ns[__i])
+          __sample.push_back(
+            std::make_pair(__S(__i)[0] /*__dummy element*/, __i));
+
+      _DifferenceType __localrank = __rank / __l;
+
+      _SeqNumber __j;
+      for (__j = 0;
+           __j < __localrank && ((__n + 1) <= __ns[__sample[__j].second]);
+           ++__j)
+        __a[__sample[__j].second] += __n + 1;
+      for (; __j < __m; ++__j)
+        __b[__sample[__j].second] -= __n + 1;
+
+      // Further refinement.
+      while (__n > 0)
+        {
+          __n /= 2;
+
+          const _Tp* __lmax = 0;
+          for (_SeqNumber __i = 0; __i < __m; ++__i)
+            {
+              if (__a[__i] > 0)
+                {
+                  if (!__lmax)
+                    __lmax = &(__S(__i)[__a[__i] - 1]);
+                  else
+                    {
+                      if (__comp(*__lmax, __S(__i)[__a[__i] - 1]))      //max
+                        __lmax = &(__S(__i)[__a[__i] - 1]);
+                    }
+                }
+            }
+
+          _SeqNumber __i;
+          for (__i = 0; __i < __m; __i++)
+            {
+              _DifferenceType __middle = (__b[__i] + __a[__i]) / 2;
+              if (__lmax && __middle < __ns[__i]
+                  && __comp(__S(__i)[__middle], *__lmax))
+                __a[__i] = std::min(__a[__i] + __n + 1, __ns[__i]);
+              else
+                __b[__i] -= __n + 1;
+            }
+
+          _DifferenceType __leftsize = 0;
+          for (_SeqNumber __i = 0; __i < __m; ++__i)
+              __leftsize += __a[__i] / (__n + 1);
+
+          _DifferenceType __skew = __rank / (__n + 1) - __leftsize;
+
+          if (__skew > 0)
+            {
+              // Move to the left, find smallest.
+              std::priority_queue<std::pair<_Tp, _SeqNumber>,
+                std::vector<std::pair<_Tp, _SeqNumber> >,
+                _LexicographicReverse<_Tp, _SeqNumber, _Compare> >
+                  __pq(__lrcomp);
+
+              for (_SeqNumber __i = 0; __i < __m; ++__i)
+                if (__b[__i] < __ns[__i])
+                  __pq.push(std::make_pair(__S(__i)[__b[__i]], __i));
+
+              for (; __skew != 0 && !__pq.empty(); --__skew)
+                {
+                  _SeqNumber __source = __pq.top().second;
+                  __pq.pop();
+
+                  __a[__source]
+                      = std::min(__a[__source] + __n + 1, __ns[__source]);
+                  __b[__source] += __n + 1;
+
+                  if (__b[__source] < __ns[__source])
+                    __pq.push(
+                      std::make_pair(__S(__source)[__b[__source]], __source));
+                }
+            }
+          else if (__skew < 0)
+            {
+              // Move to the right, find greatest.
+              std::priority_queue<std::pair<_Tp, _SeqNumber>,
+                std::vector<std::pair<_Tp, _SeqNumber> >,
+                _Lexicographic<_Tp, _SeqNumber, _Compare> > __pq(__lcomp);
+
+              for (_SeqNumber __i = 0; __i < __m; ++__i)
+                if (__a[__i] > 0)
+                  __pq.push(std::make_pair(__S(__i)[__a[__i] - 1], __i));
+
+              for (; __skew != 0; ++__skew)
+                {
+                  _SeqNumber __source = __pq.top().second;
+                  __pq.pop();
+
+                  __a[__source] -= __n + 1;
+                  __b[__source] -= __n + 1;
+
+                  if (__a[__source] > 0)
+                    __pq.push(std::make_pair(
+                        __S(__source)[__a[__source] - 1], __source));
+                }
+            }
+        }
+
+      // Postconditions:
+      // __a[__i] == __b[__i] in most cases, except when __a[__i] has been
+      // clamped because of having reached the boundary
+
+      // Now return the result, calculate the offset.
+
+      // Compare the keys on both edges of the border.
+
+      // Maximum of left edge, minimum of right edge.
+      bool __maxleftset = false, __minrightset = false;
+
+      // Impossible to avoid the warning?
+      _Tp __maxleft, __minright;
+      for (_SeqNumber __i = 0; __i < __m; ++__i)
+        {
+          if (__a[__i] > 0)
+            {
+              if (!__maxleftset)
+                {
+                  __maxleft = __S(__i)[__a[__i] - 1];
+                  __maxleftset = true;
+                }
+              else
+                {
+                  // Max.
+                  if (__comp(__maxleft, __S(__i)[__a[__i] - 1]))
+                    __maxleft = __S(__i)[__a[__i] - 1];
+                }
+            }
+          if (__b[__i] < __ns[__i])
+            {
+              if (!__minrightset)
+                {
+                  __minright = __S(__i)[__b[__i]];
+                  __minrightset = true;
+                }
+              else
+                {
+                  // Min.
+                  if (__comp(__S(__i)[__b[__i]], __minright))
+                    __minright = __S(__i)[__b[__i]];
+                }
+            }
+      }
+
+      // Minright is the __splitter, in any case.
+
+      if (!__maxleftset || __comp(__minright, __maxleft))
+        {
+          // Good luck, everything is split unambiguously.
+          __offset = 0;
+        }
+      else
+        {
+          // We have to calculate an offset.
+          __offset = 0;
+
+          for (_SeqNumber __i = 0; __i < __m; ++__i)
+            {
+              _DifferenceType lb
+                = std::lower_bound(__S(__i), __S(__i) + __ns[__i],
+                                   __minright,
+                                   __comp) - __S(__i);
+              __offset += __a[__i] - lb;
+            }
+        }
+
+      delete[] __ns;
+      delete[] __a;
+      delete[] __b;
+
+      return __minright;
+    }
+}
+
+#undef __S
+
+#endif /* _GLIBCXX_PARALLEL_MULTISEQ_SELECTION_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/multiway_merge.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/multiway_merge.h
new file mode 100644
index 0000000..00df31c
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/multiway_merge.h
@@ -0,0 +1,2069 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/multiway_merge.h
+*  @brief Implementation of sequential and parallel multiway merge.
+*
+*  Explanations on the high-speed merging routines in the appendix of
+*
+*  P. Sanders.
+*  Fast priority queues for cached memory.
+*  ACM Journal of Experimental Algorithmics, 5, 2000.
+*
+*  This file is a GNU parallel extension to the Standard C++ Library.
+*/
+
+// Written by Johannes Singler and Manuel Holtgrewe.
+
+#ifndef _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H
+#define _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H
+
+#include <vector>
+
+#include <bits/stl_algo.h>
+#include <parallel/features.h>
+#include <parallel/parallel.h>
+#include <parallel/losertree.h>
+#if _GLIBCXX_ASSERTIONS
+#include <parallel/checkers.h>
+#endif
+
+/** @brief Length of a sequence described by a pair of iterators. */
+#define _GLIBCXX_PARALLEL_LENGTH(__s) ((__s).second - (__s).first)
+
+namespace __gnu_parallel
+{
+  /** @brief _Iterator wrapper supporting an implicit supremum at the end
+   *         of the sequence, dominating all comparisons.
+   *
+   * The implicit supremum comes with a performance cost.
+   *
+   * Deriving from _RAIter is not possible since
+   * _RAIter need not be a class.
+   */
+  template<typename _RAIter, typename _Compare>
+    class _GuardedIterator
+    {
+    private:
+      /** @brief Current iterator __position. */
+      _RAIter _M_current;
+
+      /** @brief End iterator of the sequence. */
+      _RAIter _M_end;
+
+      /** @brief _Compare. */
+      _Compare& __comp;
+
+    public:
+      /** @brief Constructor. Sets iterator to beginning of sequence.
+      *  @param __begin Begin iterator of sequence.
+      *  @param __end End iterator of sequence.
+      *  @param __comp Comparator provided for associated overloaded
+      *  compare operators. */
+      _GuardedIterator(_RAIter __begin, _RAIter __end, _Compare& __comp)
+      : _M_current(__begin), _M_end(__end), __comp(__comp)
+      { }
+
+      /** @brief Pre-increment operator.
+      *  @return This. */
+      _GuardedIterator<_RAIter, _Compare>&
+      operator++()
+      {
+	++_M_current;
+	return *this;
+      }
+
+      /** @brief Dereference operator.
+      *  @return Referenced element. */
+      typename std::iterator_traits<_RAIter>::value_type&
+      operator*()
+      { return *_M_current; }
+
+      /** @brief Convert to wrapped iterator.
+      *  @return Wrapped iterator. */
+      operator _RAIter()
+      { return _M_current; }
+
+      /** @brief Compare two elements referenced by guarded iterators.
+       *  @param __bi1 First iterator.
+       *  @param __bi2 Second iterator.
+       *  @return @c true if less. */
+      friend bool
+      operator<(_GuardedIterator<_RAIter, _Compare>& __bi1,
+		_GuardedIterator<_RAIter, _Compare>& __bi2)
+      {
+	if (__bi1._M_current == __bi1._M_end)       // __bi1 is sup
+	  return __bi2._M_current == __bi2._M_end;  // __bi2 is not sup
+	if (__bi2._M_current == __bi2._M_end)       // __bi2 is sup
+	  return true;
+	return (__bi1.__comp)(*__bi1, *__bi2);      // normal compare
+      }
+
+      /** @brief Compare two elements referenced by guarded iterators.
+       *  @param __bi1 First iterator.
+       *  @param __bi2 Second iterator.
+       *  @return @c True if less equal. */
+      friend bool
+      operator<=(_GuardedIterator<_RAIter, _Compare>& __bi1,
+		 _GuardedIterator<_RAIter, _Compare>& __bi2)
+      {
+	if (__bi2._M_current == __bi2._M_end)       // __bi1 is sup
+	  return __bi1._M_current != __bi1._M_end;  // __bi2 is not sup
+	if (__bi1._M_current == __bi1._M_end)       // __bi2 is sup
+	  return false;
+	return !(__bi1.__comp)(*__bi2, *__bi1);     // normal compare
+      } 
+    };
+
+  template<typename _RAIter, typename _Compare>
+    class _UnguardedIterator
+    {
+    private:
+      /** @brief Current iterator __position. */
+      _RAIter _M_current;
+      /** @brief _Compare. */
+      _Compare& __comp;
+
+    public:
+      /** @brief Constructor. Sets iterator to beginning of sequence.
+      *  @param __begin Begin iterator of sequence.
+      *  @param __end Unused, only for compatibility.
+      *  @param __comp Unused, only for compatibility. */
+      _UnguardedIterator(_RAIter __begin,
+                	 _RAIter /* __end */, _Compare& __comp)
+      : _M_current(__begin), __comp(__comp)
+      { }
+
+      /** @brief Pre-increment operator.
+      *  @return This. */
+      _UnguardedIterator<_RAIter, _Compare>&
+      operator++()
+      {
+	++_M_current;
+	return *this;
+      }
+
+      /** @brief Dereference operator.
+      *  @return Referenced element. */
+      typename std::iterator_traits<_RAIter>::value_type&
+      operator*()
+      { return *_M_current; }
+
+      /** @brief Convert to wrapped iterator.
+      *  @return Wrapped iterator. */
+      operator _RAIter()
+      { return _M_current; }
+
+      /** @brief Compare two elements referenced by unguarded iterators.
+       *  @param __bi1 First iterator.
+       *  @param __bi2 Second iterator.
+       *  @return @c true if less. */
+      friend bool
+      operator<(_UnguardedIterator<_RAIter, _Compare>& __bi1,
+		_UnguardedIterator<_RAIter, _Compare>& __bi2)
+      {
+	// Normal compare.
+	return (__bi1.__comp)(*__bi1, *__bi2);
+      }
+
+      /** @brief Compare two elements referenced by unguarded iterators.
+       *  @param __bi1 First iterator.
+       *  @param __bi2 Second iterator.
+       *  @return @c True if less equal. */
+      friend bool
+      operator<=(_UnguardedIterator<_RAIter, _Compare>& __bi1,
+		 _UnguardedIterator<_RAIter, _Compare>& __bi2)
+      {
+	// Normal compare.
+	return !(__bi1.__comp)(*__bi2, *__bi1);
+      }
+    };
+
+  /** @brief Highly efficient 3-way merging procedure.
+   *
+   * Merging is done with the algorithm implementation described by Peter
+   * Sanders.  Basically, the idea is to minimize the number of necessary
+   * comparison after merging an element.  The implementation trick
+   * that makes this fast is that the order of the sequences is stored
+   * in the instruction pointer (translated into labels in C++).
+   *
+   * This works well for merging up to 4 sequences.
+   *
+   * Note that making the merging stable does @a not come at a
+   * performance hit.
+   *
+   * Whether the merging is done guarded or unguarded is selected by the
+   * used iterator class.
+   *
+   * @param __seqs_begin Begin iterator of iterator pair input sequence.
+   * @param __seqs_end End iterator of iterator pair input sequence.
+   * @param __target Begin iterator of output sequence.
+   * @param __comp Comparator.
+   * @param __length Maximum length to merge, less equal than the
+   * total number of elements available.
+   *
+   * @return End iterator of output sequence.
+   */
+  template<template<typename RAI, typename C> class iterator,
+           typename _RAIterIterator,
+           typename _RAIter3,
+           typename _DifferenceTp,
+           typename _Compare>
+    _RAIter3
+    multiway_merge_3_variant(_RAIterIterator __seqs_begin,
+			     _RAIterIterator __seqs_end,
+			     _RAIter3 __target,
+			     _DifferenceTp __length, _Compare __comp)
+    {
+      _GLIBCXX_CALL(__length);
+
+      typedef _DifferenceTp _DifferenceType;
+
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::value_type::first_type
+	_RAIter1;
+      typedef typename std::iterator_traits<_RAIter1>::value_type
+	_ValueType;
+
+      if (__length == 0)
+	return __target;
+
+#if _GLIBCXX_ASSERTIONS
+      _DifferenceTp __orig_length = __length;
+#endif
+
+      iterator<_RAIter1, _Compare>
+	__seq0(__seqs_begin[0].first, __seqs_begin[0].second, __comp),
+	__seq1(__seqs_begin[1].first, __seqs_begin[1].second, __comp),
+	__seq2(__seqs_begin[2].first, __seqs_begin[2].second, __comp);
+
+      if (__seq0 <= __seq1)
+	{
+          if (__seq1 <= __seq2)
+            goto __s012;
+          else
+            if (__seq2 <  __seq0)
+              goto __s201;
+            else
+              goto __s021;
+	}
+      else
+	{
+          if (__seq1 <= __seq2)
+            {
+              if (__seq0 <= __seq2)
+        	goto __s102;
+              else
+        	goto __s120;
+            }
+          else
+            goto __s210;
+	}
+#define _GLIBCXX_PARALLEL_MERGE_3_CASE(__a, __b, __c, __c0, __c1) \
+      __s ## __a ## __b ## __c :                            \
+	*__target = *__seq ## __a;                          \
+	++__target;                                         \
+	--__length;                                         \
+	++__seq ## __a;                                     \
+	if (__length == 0) goto __finish;                   \
+	if (__seq ## __a __c0 __seq ## __b) goto __s ## __a ## __b ## __c; \
+	if (__seq ## __a __c1 __seq ## __c) goto __s ## __b ## __a ## __c; \
+	goto __s ## __b ## __c ## __a;
+
+      _GLIBCXX_PARALLEL_MERGE_3_CASE(0, 1, 2, <=, <=);
+      _GLIBCXX_PARALLEL_MERGE_3_CASE(1, 2, 0, <=, < );
+      _GLIBCXX_PARALLEL_MERGE_3_CASE(2, 0, 1, < , < );
+      _GLIBCXX_PARALLEL_MERGE_3_CASE(1, 0, 2, < , <=);
+      _GLIBCXX_PARALLEL_MERGE_3_CASE(0, 2, 1, <=, <=);
+      _GLIBCXX_PARALLEL_MERGE_3_CASE(2, 1, 0, < , < );
+
+#undef _GLIBCXX_PARALLEL_MERGE_3_CASE
+
+    __finish:
+      ;
+
+#if _GLIBCXX_ASSERTIONS
+    _GLIBCXX_PARALLEL_ASSERT(
+	((_RAIter1)__seq0 - __seqs_begin[0].first) +
+	((_RAIter1)__seq1 - __seqs_begin[1].first) +
+	((_RAIter1)__seq2 - __seqs_begin[2].first)
+	== __orig_length);
+#endif
+
+      __seqs_begin[0].first = __seq0;
+      __seqs_begin[1].first = __seq1;
+      __seqs_begin[2].first = __seq2;
+
+      return __target;
+    }
+
+  /**
+   * @brief Highly efficient 4-way merging procedure.
+   *
+   * Merging is done with the algorithm implementation described by Peter
+   * Sanders. Basically, the idea is to minimize the number of necessary
+   * comparison after merging an element.  The implementation trick
+   * that makes this fast is that the order of the sequences is stored
+   * in the instruction pointer (translated into goto labels in C++).
+   *
+   * This works well for merging up to 4 sequences.
+   *
+   * Note that making the merging stable does @a not come at a
+   * performance hit.
+   *
+   * Whether the merging is done guarded or unguarded is selected by the
+   * used iterator class.
+   *
+   * @param __seqs_begin Begin iterator of iterator pair input sequence.
+   * @param __seqs_end End iterator of iterator pair input sequence.
+   * @param __target Begin iterator of output sequence.
+   * @param __comp Comparator.
+   * @param __length Maximum length to merge, less equal than the
+   * total number of elements available.
+   *
+   * @return End iterator of output sequence.
+   */
+  template<template<typename RAI, typename C> class iterator,
+           typename _RAIterIterator,
+           typename _RAIter3,
+           typename _DifferenceTp,
+           typename _Compare>
+    _RAIter3
+    multiway_merge_4_variant(_RAIterIterator __seqs_begin,
+                             _RAIterIterator __seqs_end,
+                             _RAIter3 __target,
+                             _DifferenceTp __length, _Compare __comp)
+    {
+      _GLIBCXX_CALL(__length);
+      typedef _DifferenceTp _DifferenceType;
+
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::value_type::first_type
+	_RAIter1;
+      typedef typename std::iterator_traits<_RAIter1>::value_type
+	_ValueType;
+
+      iterator<_RAIter1, _Compare>
+	__seq0(__seqs_begin[0].first, __seqs_begin[0].second, __comp),
+	__seq1(__seqs_begin[1].first, __seqs_begin[1].second, __comp),
+	__seq2(__seqs_begin[2].first, __seqs_begin[2].second, __comp),
+	__seq3(__seqs_begin[3].first, __seqs_begin[3].second, __comp);
+
+#define _GLIBCXX_PARALLEL_DECISION(__a, __b, __c, __d) {  \
+	if (__seq ## __d < __seq ## __a)		  \
+	  goto __s ## __d ## __a ## __b ## __c;		  \
+	if (__seq ## __d < __seq ## __b)		  \
+	  goto __s ## __a ## __d ## __b ## __c;		  \
+	if (__seq ## __d < __seq ## __c)		  \
+	  goto __s ## __a ## __b ## __d ## __c;		  \
+	goto __s ## __a ## __b ## __c ## __d;  }
+
+      if (__seq0 <= __seq1)
+	{
+          if (__seq1 <= __seq2)
+            _GLIBCXX_PARALLEL_DECISION(0,1,2,3)
+            else
+              if (__seq2 < __seq0)
+        	_GLIBCXX_PARALLEL_DECISION(2,0,1,3)
+        	else
+                  _GLIBCXX_PARALLEL_DECISION(0,2,1,3)
+                    }
+      else
+	{
+          if (__seq1 <= __seq2)
+            {
+              if (__seq0 <= __seq2)
+        	_GLIBCXX_PARALLEL_DECISION(1,0,2,3)
+        	else
+                  _GLIBCXX_PARALLEL_DECISION(1,2,0,3)
+                    }
+          else
+            _GLIBCXX_PARALLEL_DECISION(2,1,0,3)
+              }
+
+#define _GLIBCXX_PARALLEL_MERGE_4_CASE(__a, __b, __c, __d,  \
+				       __c0, __c1, __c2)    \
+      __s ## __a ## __b ## __c ## __d:                      \
+      if (__length == 0) goto __finish;                     \
+      *__target = *__seq ## __a;                            \
+      ++__target;                                           \
+      --__length;                                           \
+      ++__seq ## __a;                                       \
+      if (__seq ## __a __c0 __seq ## __b)      \
+	goto __s ## __a ## __b ## __c ## __d;  \
+      if (__seq ## __a __c1 __seq ## __c)      \
+	goto __s ## __b ## __a ## __c ## __d;  \
+      if (__seq ## __a __c2 __seq ## __d)      \
+	goto __s ## __b ## __c ## __a ## __d;  \
+      goto __s ## __b ## __c ## __d ## __a;
+
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 1, 2, 3, <=, <=, <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 1, 3, 2, <=, <=, <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 2, 1, 3, <=, <=, <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 2, 3, 1, <=, <=, <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 3, 1, 2, <=, <=, <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(0, 3, 2, 1, <=, <=, <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 0, 2, 3, < , <=, <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 0, 3, 2, < , <=, <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 2, 0, 3, <=, < , <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 2, 3, 0, <=, <=, < );
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 3, 0, 2, <=, < , <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(1, 3, 2, 0, <=, <=, < );
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 0, 1, 3, < , < , <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 0, 3, 1, < , <=, < );
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 1, 0, 3, < , < , <=);
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 1, 3, 0, < , <=, < );
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 3, 0, 1, <=, < , < );
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(2, 3, 1, 0, <=, < , < );
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 0, 1, 2, < , < , < );
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 0, 2, 1, < , < , < );
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 1, 0, 2, < , < , < );
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 1, 2, 0, < , < , < );
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 2, 0, 1, < , < , < );
+      _GLIBCXX_PARALLEL_MERGE_4_CASE(3, 2, 1, 0, < , < , < );
+
+#undef _GLIBCXX_PARALLEL_MERGE_4_CASE
+#undef _GLIBCXX_PARALLEL_DECISION
+
+    __finish:
+      ;
+
+      __seqs_begin[0].first = __seq0;
+      __seqs_begin[1].first = __seq1;
+      __seqs_begin[2].first = __seq2;
+      __seqs_begin[3].first = __seq3;
+
+      return __target;
+    }
+
+  /** @brief Multi-way merging procedure for a high branching factor,
+   *         guarded case.
+   *
+   * This merging variant uses a LoserTree class as selected by <tt>_LT</tt>.
+   *
+   * Stability is selected through the used LoserTree class <tt>_LT</tt>.
+   *
+   * At least one non-empty sequence is required.
+   *
+   * @param __seqs_begin Begin iterator of iterator pair input sequence.
+   * @param __seqs_end End iterator of iterator pair input sequence.
+   * @param __target Begin iterator of output sequence.
+   * @param __comp Comparator.
+   * @param __length Maximum length to merge, less equal than the
+   * total number of elements available.
+   *
+   * @return End iterator of output sequence.
+   */
+  template<typename _LT,
+           typename _RAIterIterator,
+           typename _RAIter3,
+           typename _DifferenceTp,
+           typename _Compare>
+    _RAIter3
+    multiway_merge_loser_tree(_RAIterIterator __seqs_begin,
+                              _RAIterIterator __seqs_end,
+                              _RAIter3 __target,
+                              _DifferenceTp __length, _Compare __comp)
+    {
+      _GLIBCXX_CALL(__length)
+
+      typedef _DifferenceTp _DifferenceType;
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::difference_type _SeqNumber;
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::value_type::first_type
+	_RAIter1;
+      typedef typename std::iterator_traits<_RAIter1>::value_type
+	_ValueType;
+
+      _SeqNumber __k = static_cast<_SeqNumber>(__seqs_end - __seqs_begin);
+
+      _LT __lt(__k, __comp);
+
+      // Default value for potentially non-default-constructible types.
+      _ValueType* __arbitrary_element = 0;
+
+      for (_SeqNumber __t = 0; __t < __k; ++__t)
+	{
+          if(!__arbitrary_element
+	     && _GLIBCXX_PARALLEL_LENGTH(__seqs_begin[__t]) > 0)
+            __arbitrary_element = &(*__seqs_begin[__t].first);
+	}
+
+      for (_SeqNumber __t = 0; __t < __k; ++__t)
+	{
+          if (__seqs_begin[__t].first == __seqs_begin[__t].second)
+            __lt.__insert_start(*__arbitrary_element, __t, true);
+          else
+            __lt.__insert_start(*__seqs_begin[__t].first, __t, false);
+	}
+
+      __lt.__init();
+
+      _SeqNumber __source;
+
+      for (_DifferenceType __i = 0; __i < __length; ++__i)
+	{
+          //take out
+          __source = __lt.__get_min_source();
+
+          *(__target++) = *(__seqs_begin[__source].first++);
+
+          // Feed.
+          if (__seqs_begin[__source].first == __seqs_begin[__source].second)
+            __lt.__delete_min_insert(*__arbitrary_element, true);
+          else
+            // Replace from same __source.
+            __lt.__delete_min_insert(*__seqs_begin[__source].first, false);
+	}
+
+      return __target;
+    }
+
+  /** @brief Multi-way merging procedure for a high branching factor,
+   *         unguarded case.
+   *
+   * Merging is done using the LoserTree class <tt>_LT</tt>.
+   *
+   * Stability is selected by the used LoserTrees.
+   *
+   * @pre No input will run out of elements during the merge.
+   *
+   * @param __seqs_begin Begin iterator of iterator pair input sequence.
+   * @param __seqs_end End iterator of iterator pair input sequence.
+   * @param __target Begin iterator of output sequence.
+   * @param __comp Comparator.
+   * @param __length Maximum length to merge, less equal than the
+   * total number of elements available.
+   *
+   * @return End iterator of output sequence.
+   */
+  template<typename _LT,
+	   typename _RAIterIterator,
+	   typename _RAIter3,
+	   typename _DifferenceTp, typename _Compare>
+    _RAIter3
+    multiway_merge_loser_tree_unguarded(_RAIterIterator __seqs_begin,
+					_RAIterIterator __seqs_end,
+					_RAIter3 __target,
+       const typename std::iterator_traits<typename std::iterator_traits<
+	  _RAIterIterator>::value_type::first_type>::value_type&
+					__sentinel,
+					_DifferenceTp __length,
+					_Compare __comp)
+    {
+      _GLIBCXX_CALL(__length)
+      typedef _DifferenceTp _DifferenceType;
+
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::difference_type _SeqNumber;
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::value_type::first_type
+	_RAIter1;
+      typedef typename std::iterator_traits<_RAIter1>::value_type
+	_ValueType;
+
+      _SeqNumber __k = __seqs_end - __seqs_begin;
+
+      _LT __lt(__k, __sentinel, __comp);
+
+      for (_SeqNumber __t = 0; __t < __k; ++__t)
+	{
+#if _GLIBCXX_ASSERTIONS
+          _GLIBCXX_PARALLEL_ASSERT(__seqs_begin[__t].first
+                                   != __seqs_begin[__t].second);
+#endif
+          __lt.__insert_start(*__seqs_begin[__t].first, __t, false);
+	}
+
+      __lt.__init();
+
+      _SeqNumber __source;
+
+#if _GLIBCXX_ASSERTIONS
+      _DifferenceType __i = 0;
+#endif
+
+      _RAIter3 __target_end = __target + __length;
+      while (__target < __target_end)
+	{
+          // Take out.
+          __source = __lt.__get_min_source();
+
+#if _GLIBCXX_ASSERTIONS
+          _GLIBCXX_PARALLEL_ASSERT(0 <= __source && __source < __k);
+          _GLIBCXX_PARALLEL_ASSERT(__i == 0
+              || !__comp(*(__seqs_begin[__source].first), *(__target - 1)));
+#endif
+
+          // Feed.
+          *(__target++) = *(__seqs_begin[__source].first++);
+
+#if _GLIBCXX_ASSERTIONS
+          ++__i;
+#endif
+          // Replace from same __source.
+          __lt.__delete_min_insert(*__seqs_begin[__source].first, false);
+	}
+
+      return __target;
+    }
+
+
+  /** @brief Multi-way merging procedure for a high branching factor,
+   *         requiring sentinels to exist.
+   *
+   * @param __stable The value must the same as for the used LoserTrees.
+   * @param UnguardedLoserTree _Loser Tree variant to use for the unguarded
+   *   merging.
+   * @param GuardedLoserTree _Loser Tree variant to use for the guarded
+   *   merging.
+   *
+   * @param __seqs_begin Begin iterator of iterator pair input sequence.
+   * @param __seqs_end End iterator of iterator pair input sequence.
+   * @param __target Begin iterator of output sequence.
+   * @param __comp Comparator.
+   * @param __length Maximum length to merge, less equal than the
+   * total number of elements available.
+   *
+   * @return End iterator of output sequence.
+   */
+  template<typename UnguardedLoserTree,
+	   typename _RAIterIterator,
+	   typename _RAIter3,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIter3
+    multiway_merge_loser_tree_sentinel(_RAIterIterator __seqs_begin,
+				       _RAIterIterator __seqs_end,
+				       _RAIter3 __target,
+      const typename std::iterator_traits<typename std::iterator_traits<
+	_RAIterIterator>::value_type::first_type>::value_type&
+				       __sentinel,
+				       _DifferenceTp __length,
+				       _Compare __comp)
+    {
+      _GLIBCXX_CALL(__length)
+
+      typedef _DifferenceTp _DifferenceType;
+      typedef std::iterator_traits<_RAIterIterator> _TraitsType;
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::value_type::first_type
+	_RAIter1;
+      typedef typename std::iterator_traits<_RAIter1>::value_type
+	_ValueType;
+
+      _RAIter3 __target_end;
+
+      for (_RAIterIterator __s = __seqs_begin; __s != __seqs_end; ++__s)
+	// Move the sequence ends to the sentinel.  This has the
+	// effect that the sentinel appears to be within the sequence. Then,
+	// we can use the unguarded variant if we merge out as many
+	// non-sentinel elements as we have.
+	++((*__s).second);
+
+      __target_end = multiway_merge_loser_tree_unguarded<UnguardedLoserTree>
+	(__seqs_begin, __seqs_end, __target, __sentinel, __length, __comp);
+
+#if _GLIBCXX_ASSERTIONS
+      _GLIBCXX_PARALLEL_ASSERT(__target_end == __target + __length);
+      _GLIBCXX_PARALLEL_ASSERT(__is_sorted(__target, __target_end, __comp));
+#endif
+
+      // Restore the sequence ends so the sentinels are not contained in the
+      // sequence any more (see comment in loop above).
+      for (_RAIterIterator __s = __seqs_begin; __s != __seqs_end; ++__s)
+	--((*__s).second);
+
+      return __target_end;
+    }
+
+  /**
+   * @brief Traits for determining whether the loser tree should
+   *   use pointers or copies.
+   *
+   * The field "_M_use_pointer" is used to determine whether to use pointers
+   * in he loser trees or whether to copy the values into the loser tree.
+   *
+   * The default behavior is to use pointers if the data type is 4 times as
+   * big as the pointer to it.
+   *
+   * Specialize for your data type to customize the behavior.
+   *
+   * Example:
+   *
+   *   template<>
+   *   struct _LoserTreeTraits<int>
+   *   { static const bool _M_use_pointer = false; };
+   *
+   *   template<>
+   *   struct _LoserTreeTraits<heavyweight_type>
+   *   { static const bool _M_use_pointer = true; };
+   *
+   * @param _Tp type to give the loser tree traits for.
+   */
+  template <typename _Tp>
+    struct _LoserTreeTraits
+    {
+      /**
+       * @brief True iff to use pointers instead of values in loser trees.
+       *
+       * The default behavior is to use pointers if the data type is four
+       * times as big as the pointer to it.
+       */
+      static const bool _M_use_pointer = (sizeof(_Tp) > 4 * sizeof(_Tp*));
+    };
+
+  /**
+   * @brief Switch for 3-way merging with __sentinels turned off.
+   *
+   * Note that 3-way merging is always stable!
+   */
+  template<bool __sentinels /*default == false*/,
+	   typename _RAIterIterator,
+	   typename _RAIter3,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    struct __multiway_merge_3_variant_sentinel_switch
+    {
+      _RAIter3
+      operator()(_RAIterIterator __seqs_begin,
+		 _RAIterIterator __seqs_end,
+		 _RAIter3 __target,
+		 _DifferenceTp __length, _Compare __comp)
+      { return multiway_merge_3_variant<_GuardedIterator>
+	  (__seqs_begin, __seqs_end, __target, __length, __comp); }
+    };
+
+  /**
+   * @brief Switch for 3-way merging with __sentinels turned on.
+   *
+   * Note that 3-way merging is always stable!
+   */
+  template<typename _RAIterIterator,
+	   typename _RAIter3,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    struct __multiway_merge_3_variant_sentinel_switch<true, _RAIterIterator,
+						      _RAIter3, _DifferenceTp,
+						      _Compare>
+    {
+      _RAIter3
+      operator()(_RAIterIterator __seqs_begin,
+		 _RAIterIterator __seqs_end,
+		 _RAIter3 __target,
+		 _DifferenceTp __length, _Compare __comp)
+      { return multiway_merge_3_variant<_UnguardedIterator>
+	  (__seqs_begin, __seqs_end, __target, __length, __comp); }
+    };
+
+  /**
+   * @brief Switch for 4-way merging with __sentinels turned off.
+   *
+   * Note that 4-way merging is always stable!
+   */
+  template<bool __sentinels /*default == false*/,
+	   typename _RAIterIterator,
+	   typename _RAIter3,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    struct __multiway_merge_4_variant_sentinel_switch
+    {
+      _RAIter3
+      operator()(_RAIterIterator __seqs_begin,
+		 _RAIterIterator __seqs_end,
+		 _RAIter3 __target,
+		 _DifferenceTp __length, _Compare __comp)
+      { return multiway_merge_4_variant<_GuardedIterator>
+	  (__seqs_begin, __seqs_end, __target, __length, __comp); }
+    };
+
+  /**
+   * @brief Switch for 4-way merging with __sentinels turned on.
+   *
+   * Note that 4-way merging is always stable!
+   */
+  template<typename _RAIterIterator,
+	   typename _RAIter3,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    struct __multiway_merge_4_variant_sentinel_switch<true, _RAIterIterator,
+						      _RAIter3, _DifferenceTp,
+						      _Compare>
+    {
+      _RAIter3
+      operator()(_RAIterIterator __seqs_begin,
+		 _RAIterIterator __seqs_end,
+		 _RAIter3 __target,
+		 _DifferenceTp __length, _Compare __comp)
+      { return multiway_merge_4_variant<_UnguardedIterator>
+	  (__seqs_begin, __seqs_end, __target, __length, __comp); }
+    };
+
+  /**
+   * @brief Switch for k-way merging with __sentinels turned on.
+   */
+  template<bool __sentinels,
+	   bool __stable,
+	   typename _RAIterIterator,
+	   typename _RAIter3,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    struct __multiway_merge_k_variant_sentinel_switch
+    {
+      _RAIter3
+      operator()(_RAIterIterator __seqs_begin,
+		 _RAIterIterator __seqs_end,
+		 _RAIter3 __target,
+      const typename std::iterator_traits<typename std::iterator_traits<
+      _RAIterIterator>::value_type::first_type>::value_type&
+		 __sentinel,
+		 _DifferenceTp __length, _Compare __comp)
+      {
+	typedef typename std::iterator_traits<_RAIterIterator>
+	  ::value_type::first_type
+	  _RAIter1;
+	typedef typename std::iterator_traits<_RAIter1>::value_type
+	  _ValueType;
+
+	return multiway_merge_loser_tree_sentinel<
+	typename __gnu_cxx::__conditional_type<
+	_LoserTreeTraits<_ValueType>::_M_use_pointer,
+	  _LoserTreePointerUnguarded<__stable, _ValueType, _Compare>,
+	  _LoserTreeUnguarded<__stable, _ValueType, _Compare>
+          >::__type>
+	  (__seqs_begin, __seqs_end, __target, __sentinel, __length, __comp);
+      }
+    };
+
+  /**
+   * @brief Switch for k-way merging with __sentinels turned off.
+   */
+  template<bool __stable,
+	   typename _RAIterIterator,
+	   typename _RAIter3,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    struct __multiway_merge_k_variant_sentinel_switch<false, __stable,
+						      _RAIterIterator,
+						      _RAIter3, _DifferenceTp,
+						      _Compare>
+    {
+      _RAIter3
+      operator()(_RAIterIterator __seqs_begin,
+		 _RAIterIterator __seqs_end,
+		 _RAIter3 __target,
+       const typename std::iterator_traits<typename std::iterator_traits<
+       _RAIterIterator>::value_type::first_type>::value_type&
+		 __sentinel,
+		 _DifferenceTp __length, _Compare __comp)
+      {
+	typedef typename std::iterator_traits<_RAIterIterator>
+	  ::value_type::first_type
+	  _RAIter1;
+	typedef typename std::iterator_traits<_RAIter1>::value_type
+	  _ValueType;
+
+	return multiway_merge_loser_tree<
+	typename __gnu_cxx::__conditional_type<
+	_LoserTreeTraits<_ValueType>::_M_use_pointer,
+	  _LoserTreePointer<__stable, _ValueType, _Compare>,
+	  _LoserTree<__stable, _ValueType, _Compare>
+          >::__type >(__seqs_begin, __seqs_end, __target, __length, __comp);
+      }
+    };
+
+  /** @brief Sequential multi-way merging switch.
+   *
+   *  The _GLIBCXX_PARALLEL_DECISION is based on the branching factor and
+   *  runtime settings.
+   *  @param __seqs_begin Begin iterator of iterator pair input sequence.
+   *  @param __seqs_end End iterator of iterator pair input sequence.
+   *  @param __target Begin iterator of output sequence.
+   *  @param __comp Comparator.
+   *  @param __length Maximum length to merge, possibly larger than the
+   *  number of elements available.
+   *  @param __stable Stable merging incurs a performance penalty.
+   *  @param __sentinel The sequences have __a __sentinel element.
+   *  @return End iterator of output sequence. */
+  template<bool __stable,
+	   bool __sentinels,
+	   typename _RAIterIterator,
+	   typename _RAIter3,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIter3
+    __sequential_multiway_merge(_RAIterIterator __seqs_begin,
+				_RAIterIterator __seqs_end,
+				_RAIter3 __target,
+      const typename std::iterator_traits<typename std::iterator_traits<
+	_RAIterIterator>::value_type::first_type>::value_type&
+				__sentinel,
+				_DifferenceTp __length, _Compare __comp)
+    {
+      _GLIBCXX_CALL(__length)
+
+      typedef _DifferenceTp _DifferenceType;
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::difference_type _SeqNumber;
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::value_type::first_type
+	_RAIter1;
+      typedef typename std::iterator_traits<_RAIter1>::value_type
+	_ValueType;
+
+#if _GLIBCXX_ASSERTIONS
+      for (_RAIterIterator __s = __seqs_begin; __s != __seqs_end; ++__s)
+	{
+          _GLIBCXX_PARALLEL_ASSERT(__is_sorted((*__s).first,
+					       (*__s).second, __comp));
+	}
+#endif
+
+      _DifferenceTp __total_length = 0;
+      for (_RAIterIterator __s = __seqs_begin; __s != __seqs_end; ++__s)
+	__total_length += _GLIBCXX_PARALLEL_LENGTH(*__s);
+
+      __length = std::min<_DifferenceTp>(__length, __total_length);
+
+      if(__length == 0)
+	return __target;
+
+      _RAIter3 __return_target = __target;
+      _SeqNumber __k = static_cast<_SeqNumber>(__seqs_end - __seqs_begin);
+
+      switch (__k)
+	{
+	case 0:
+          break;
+	case 1:
+          __return_target = std::copy(__seqs_begin[0].first,
+				      __seqs_begin[0].first + __length,
+				      __target);
+          __seqs_begin[0].first += __length;
+          break;
+	case 2:
+          __return_target = __merge_advance(__seqs_begin[0].first,
+					    __seqs_begin[0].second,
+					    __seqs_begin[1].first,
+					    __seqs_begin[1].second,
+					    __target, __length, __comp);
+          break;
+	case 3:
+          __return_target = __multiway_merge_3_variant_sentinel_switch
+	    <__sentinels, _RAIterIterator, _RAIter3, _DifferenceTp, _Compare>()
+	    (__seqs_begin, __seqs_end, __target, __length, __comp);
+          break;
+	case 4:
+          __return_target = __multiway_merge_4_variant_sentinel_switch
+	    <__sentinels, _RAIterIterator, _RAIter3, _DifferenceTp, _Compare>()
+	    (__seqs_begin, __seqs_end, __target, __length, __comp);
+          break;
+	default:
+	  __return_target = __multiway_merge_k_variant_sentinel_switch
+	    <__sentinels, __stable, _RAIterIterator, _RAIter3, _DifferenceTp,
+	     _Compare>()
+	    (__seqs_begin, __seqs_end, __target, __sentinel, __length, __comp);
+	  break;
+	}
+#if _GLIBCXX_ASSERTIONS
+      _GLIBCXX_PARALLEL_ASSERT(
+	__is_sorted(__target, __target + __length, __comp));
+#endif
+
+      return __return_target;
+    }
+
+  /**
+   * @brief Stable sorting functor.
+   *
+   * Used to reduce code instanciation in multiway_merge_sampling_splitting.
+   */
+  template<bool __stable, class _RAIter, class _StrictWeakOrdering>
+    struct _SamplingSorter
+    {
+      void
+      operator()(_RAIter __first, _RAIter __last, _StrictWeakOrdering __comp)
+      { __gnu_sequential::stable_sort(__first, __last, __comp); }
+    };
+
+  /**
+   * @brief Non-__stable sorting functor.
+   *
+   * Used to reduce code instantiation in multiway_merge_sampling_splitting.
+   */
+  template<class _RAIter, class _StrictWeakOrdering>
+    struct _SamplingSorter<false, _RAIter, _StrictWeakOrdering>
+    {
+      void
+      operator()(_RAIter __first, _RAIter __last, _StrictWeakOrdering __comp)
+      { __gnu_sequential::sort(__first, __last, __comp); }
+    };
+
+  /**
+   * @brief Sampling based splitting for parallel multiway-merge routine.
+   */
+  template<bool __stable,
+	   typename _RAIterIterator,
+	   typename _Compare,
+	   typename _DifferenceType>
+    void
+    multiway_merge_sampling_splitting(_RAIterIterator __seqs_begin,
+				      _RAIterIterator __seqs_end,
+				      _DifferenceType __length,
+				      _DifferenceType __total_length,
+				      _Compare __comp,
+     std::vector<std::pair<_DifferenceType, _DifferenceType> > *__pieces)
+    {
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::difference_type _SeqNumber;
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::value_type::first_type
+	_RAIter1;
+      typedef typename std::iterator_traits<_RAIter1>::value_type
+	_ValueType;
+
+      // __k sequences.
+      const _SeqNumber __k
+	= static_cast<_SeqNumber>(__seqs_end - __seqs_begin);
+
+      const _ThreadIndex __num_threads = omp_get_num_threads();
+
+      const _DifferenceType __num_samples =
+	__gnu_parallel::_Settings::get().merge_oversampling * __num_threads;
+
+      _ValueType* __samples = static_cast<_ValueType*>
+	(::operator new(sizeof(_ValueType) * __k * __num_samples));
+      // Sample.
+      for (_SeqNumber __s = 0; __s < __k; ++__s)
+	for (_DifferenceType __i = 0; __i < __num_samples; ++__i)
+	  {
+	    _DifferenceType sample_index = static_cast<_DifferenceType>
+	      (_GLIBCXX_PARALLEL_LENGTH(__seqs_begin[__s])
+	       * (double(__i + 1) / (__num_samples + 1))
+	       * (double(__length) / __total_length));
+	    new(&(__samples[__s * __num_samples + __i]))
+              _ValueType(__seqs_begin[__s].first[sample_index]);
+	  }
+
+      // Sort stable or non-stable, depending on value of template parameter
+      // "__stable".
+      _SamplingSorter<__stable, _ValueType*, _Compare>()
+	(__samples, __samples + (__num_samples * __k), __comp);
+
+      for (_ThreadIndex __slab = 0; __slab < __num_threads; ++__slab)
+	// For each slab / processor.
+	for (_SeqNumber __seq = 0; __seq < __k; ++__seq)
+	  {
+	    // For each sequence.
+	    if (__slab > 0)
+	      __pieces[__slab][__seq].first = std::upper_bound
+		(__seqs_begin[__seq].first, __seqs_begin[__seq].second,
+		 __samples[__num_samples * __k * __slab / __num_threads],
+		 __comp)
+		- __seqs_begin[__seq].first;
+	    else
+	      // Absolute beginning.
+	      __pieces[__slab][__seq].first = 0;
+	    if ((__slab + 1) < __num_threads)
+	      __pieces[__slab][__seq].second = std::upper_bound
+		(__seqs_begin[__seq].first, __seqs_begin[__seq].second,
+		 __samples[__num_samples * __k * (__slab + 1) / __num_threads],
+		 __comp)
+		- __seqs_begin[__seq].first;
+	    else
+              // Absolute end.
+	      __pieces[__slab][__seq].second =
+		_GLIBCXX_PARALLEL_LENGTH(__seqs_begin[__seq]);
+	  }
+
+      for (_SeqNumber __s = 0; __s < __k; ++__s)
+	for (_DifferenceType __i = 0; __i < __num_samples; ++__i)
+	  __samples[__s * __num_samples + __i].~_ValueType();
+      ::operator delete(__samples);
+    }
+
+  /**
+   * @brief Exact splitting for parallel multiway-merge routine.
+   *
+   * None of the passed sequences may be empty.
+   */
+  template<bool __stable,
+	   typename _RAIterIterator,
+	   typename _Compare,
+	   typename _DifferenceType>
+    void
+    multiway_merge_exact_splitting(_RAIterIterator __seqs_begin,
+				   _RAIterIterator __seqs_end,
+				   _DifferenceType __length,
+				   _DifferenceType __total_length,
+				   _Compare __comp,
+       std::vector<std::pair<_DifferenceType, _DifferenceType> > *__pieces)
+    {
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::difference_type _SeqNumber;
+      typedef typename std::iterator_traits<_RAIterIterator>
+	::value_type::first_type
+	_RAIter1;
+
+      const bool __tight = (__total_length == __length);
+
+      // __k sequences.
+      const _SeqNumber __k = __seqs_end - __seqs_begin;
+
+      const _ThreadIndex __num_threads = omp_get_num_threads();
+
+      // (Settings::multiway_merge_splitting
+      //  == __gnu_parallel::_Settings::EXACT).
+      std::vector<_RAIter1>* __offsets = 
+	new std::vector<_RAIter1>[__num_threads];
+      std::vector<std::pair<_RAIter1, _RAIter1> > __se(__k);
+
+      copy(__seqs_begin, __seqs_end, __se.begin());
+
+      _DifferenceType* __borders =
+	new _DifferenceType[__num_threads + 1];
+      equally_split(__length, __num_threads, __borders);
+
+      for (_ThreadIndex __s = 0; __s < (__num_threads - 1); ++__s)
+	{
+	  __offsets[__s].resize(__k);
+	  multiseq_partition(__se.begin(), __se.end(), __borders[__s + 1],
+			     __offsets[__s].begin(), __comp);
+
+	  // Last one also needed and available.
+	  if (!__tight)
+	    {
+	      __offsets[__num_threads - 1].resize(__k);
+	      multiseq_partition(__se.begin(), __se.end(),
+				 _DifferenceType(__length),
+				 __offsets[__num_threads - 1].begin(),
+				 __comp);
+	    }
+	}
+      delete[] __borders;
+
+      for (_ThreadIndex __slab = 0; __slab < __num_threads; ++__slab)
+	{
+	  // For each slab / processor.
+	  for (_SeqNumber __seq = 0; __seq < __k; ++__seq)
+	    {
+	      // For each sequence.
+	      if (__slab == 0)
+		{
+		  // Absolute beginning.
+		  __pieces[__slab][__seq].first = 0;
+		}
+	      else
+		__pieces[__slab][__seq].first =
+		  __pieces[__slab - 1][__seq].second;
+	      if (!__tight || __slab < (__num_threads - 1))
+		__pieces[__slab][__seq].second =
+		  __offsets[__slab][__seq] - __seqs_begin[__seq].first;
+	      else
+		{
+		  // __slab == __num_threads - 1
+		  __pieces[__slab][__seq].second =
+                    _GLIBCXX_PARALLEL_LENGTH(__seqs_begin[__seq]);
+		}
+	    }
+	}
+      delete[] __offsets;
+    }
+
+  /** @brief Parallel multi-way merge routine.
+   *
+   * The _GLIBCXX_PARALLEL_DECISION is based on the branching factor
+   * and runtime settings.
+   *
+   * Must not be called if the number of sequences is 1.
+   *
+   * @param _Splitter functor to split input (either __exact or sampling based)
+   *
+   * @param __seqs_begin Begin iterator of iterator pair input sequence.
+   * @param __seqs_end End iterator of iterator pair input sequence.
+   * @param __target Begin iterator of output sequence.
+   * @param __comp Comparator.
+   * @param __length Maximum length to merge, possibly larger than the
+   * number of elements available.
+   * @param __stable Stable merging incurs a performance penalty.
+   * @param __sentinel Ignored.
+   * @return End iterator of output sequence.
+   */
+  template<bool __stable,
+	   bool __sentinels,
+	   typename _RAIterIterator,
+	   typename _RAIter3,
+	   typename _DifferenceTp,
+	   typename _Splitter,
+	   typename _Compare>
+    _RAIter3
+    parallel_multiway_merge(_RAIterIterator __seqs_begin,
+                            _RAIterIterator __seqs_end,
+                            _RAIter3 __target,
+                            _Splitter __splitter,
+                            _DifferenceTp __length,
+                            _Compare __comp,
+                            _ThreadIndex __num_threads)
+      {
+#if _GLIBCXX_ASSERTIONS
+	_GLIBCXX_PARALLEL_ASSERT(__seqs_end - __seqs_begin > 1);
+#endif
+
+	_GLIBCXX_CALL(__length)
+
+	typedef _DifferenceTp _DifferenceType;
+        typedef typename std::iterator_traits<_RAIterIterator>
+	  ::difference_type _SeqNumber;
+	typedef typename std::iterator_traits<_RAIterIterator>
+          ::value_type::first_type
+          _RAIter1;
+	typedef typename
+          std::iterator_traits<_RAIter1>::value_type _ValueType;
+
+	// Leave only non-empty sequences.
+	typedef std::pair<_RAIter1, _RAIter1> seq_type;
+	seq_type* __ne_seqs = new seq_type[__seqs_end - __seqs_begin];
+	_SeqNumber __k = 0;
+	_DifferenceType __total_length = 0;
+	for (_RAIterIterator __raii = __seqs_begin;
+             __raii != __seqs_end; ++__raii)
+          {
+            _DifferenceTp __seq_length = _GLIBCXX_PARALLEL_LENGTH(*__raii);
+            if(__seq_length > 0)
+              {
+        	__total_length += __seq_length;
+        	__ne_seqs[__k++] = *__raii;
+              }
+          }
+
+	_GLIBCXX_CALL(__total_length)
+
+	__length = std::min<_DifferenceTp>(__length, __total_length);
+
+	if (__total_length == 0 || __k == 0)
+	  {
+	    delete[] __ne_seqs;
+	    return __target;
+	  }
+
+	std::vector<std::pair<_DifferenceType, _DifferenceType> >* __pieces;
+
+	__num_threads = static_cast<_ThreadIndex>
+          (std::min<_DifferenceType>(__num_threads, __total_length));
+
+#       pragma omp parallel num_threads (__num_threads)
+	{
+#         pragma omp single
+	  {
+	    __num_threads = omp_get_num_threads();
+	    // Thread __t will have to merge pieces[__iam][0..__k - 1]
+	    __pieces = new std::vector<
+	    std::pair<_DifferenceType, _DifferenceType> >[__num_threads];
+	    for (_ThreadIndex __s = 0; __s < __num_threads; ++__s)
+	      __pieces[__s].resize(__k);
+
+	    _DifferenceType __num_samples =
+	      __gnu_parallel::_Settings::get().merge_oversampling
+	      * __num_threads;
+
+	    __splitter(__ne_seqs, __ne_seqs + __k, __length, __total_length,
+		       __comp, __pieces);
+	  } //single
+
+	  _ThreadIndex __iam = omp_get_thread_num();
+
+	  _DifferenceType __target_position = 0;
+
+	  for (_SeqNumber __c = 0; __c < __k; ++__c)
+	    __target_position += __pieces[__iam][__c].first;
+
+	  seq_type* __chunks = new seq_type[__k];
+
+	  for (_SeqNumber __s = 0; __s < __k; ++__s)
+	    __chunks[__s] = std::make_pair(__ne_seqs[__s].first
+					   + __pieces[__iam][__s].first,
+					   __ne_seqs[__s].first
+					   + __pieces[__iam][__s].second);
+
+	  if(__length > __target_position)
+	    __sequential_multiway_merge<__stable, __sentinels>
+	      (__chunks, __chunks + __k, __target + __target_position,
+	       *(__seqs_begin->second), __length - __target_position, __comp);
+
+	  delete[] __chunks;
+	} // parallel
+
+#if _GLIBCXX_ASSERTIONS
+	_GLIBCXX_PARALLEL_ASSERT(
+          __is_sorted(__target, __target + __length, __comp));
+#endif
+
+	__k = 0;
+	// Update ends of sequences.
+	for (_RAIterIterator __raii = __seqs_begin;
+             __raii != __seqs_end; ++__raii)
+          {
+            _DifferenceTp __length = _GLIBCXX_PARALLEL_LENGTH(*__raii);
+            if(__length > 0)
+              (*__raii).first += __pieces[__num_threads - 1][__k++].second;
+          }
+
+	delete[] __pieces;
+	delete[] __ne_seqs;
+
+	return __target + __length;
+      }
+
+  /**
+   * @brief Multiway Merge Frontend.
+   *
+   * Merge the sequences specified by seqs_begin and __seqs_end into
+   * __target.  __seqs_begin and __seqs_end must point to a sequence of
+   * pairs.  These pairs must contain an iterator to the beginning
+   * of a sequence in their first entry and an iterator the _M_end of
+   * the same sequence in their second entry.
+   *
+   * Ties are broken arbitrarily.  See stable_multiway_merge for a variant
+   * that breaks ties by sequence number but is slower.
+   *
+   * The first entries of the pairs (i.e. the begin iterators) will be moved
+   * forward.
+   *
+   * The output sequence has to provide enough space for all elements
+   * that are written to it.
+   *
+   * This function will merge the input sequences:
+   *
+   * - not stable
+   * - parallel, depending on the input size and Settings
+   * - using sampling for splitting
+   * - not using sentinels
+   *
+   * Example:
+   *
+   * <pre>
+   *   int sequences[10][10];
+   *   for (int __i = 0; __i < 10; ++__i)
+   *     for (int __j = 0; __i < 10; ++__j)
+   *       sequences[__i][__j] = __j;
+   *
+   *   int __out[33];
+   *   std::vector<std::pair<int*> > seqs;
+   *   for (int __i = 0; __i < 10; ++__i)
+   *     { seqs.push(std::make_pair<int*>(sequences[__i],
+   *                                      sequences[__i] + 10)) }
+   *
+   *   multiway_merge(seqs.begin(), seqs.end(), __target, std::less<int>(), 33);
+   * </pre>
+   *
+   * @see stable_multiway_merge
+   *
+   * @pre All input sequences must be sorted.
+   * @pre Target must provide enough space to merge out length elements or
+   *    the number of elements in all sequences, whichever is smaller.
+   *
+   * @post [__target, return __value) contains merged __elements from the
+   *    input sequences.
+   * @post return __value - __target = min(__length, number of elements in all
+   *    sequences).
+   *
+   * @param _RAIterPairIterator iterator over sequence
+   *    of pairs of iterators
+   * @param _RAIterOut iterator over target sequence
+   * @param _DifferenceTp difference type for the sequence
+   * @param _Compare strict weak ordering type to compare elements
+   *    in sequences
+   *
+   * @param __seqs_begin  __begin of sequence __sequence
+   * @param __seqs_end    _M_end of sequence __sequence
+   * @param __target      target sequence to merge to.
+   * @param __comp        strict weak ordering to use for element comparison.
+   * @param __length Maximum length to merge, possibly larger than the
+   * number of elements available.
+   *
+   * @return _M_end iterator of output sequence
+   */
+  // multiway_merge
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    multiway_merge(_RAIterPairIterator __seqs_begin,
+		   _RAIterPairIterator __seqs_end,
+		   _RAIterOut __target,
+		   _DifferenceTp __length, _Compare __comp,
+		   __gnu_parallel::sequential_tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute multiway merge *sequentially*.
+      return __sequential_multiway_merge
+	</* __stable = */ false, /* __sentinels = */ false>
+	(__seqs_begin, __seqs_end, __target,
+	 *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    multiway_merge(_RAIterPairIterator __seqs_begin,
+		   _RAIterPairIterator __seqs_end,
+		   _RAIterOut __target,
+		   _DifferenceTp __length, _Compare __comp,
+		   __gnu_parallel::exact_tag __tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute merge; maybe parallel, depending on the number of merged
+      // elements and the number of sequences and global thresholds in
+      // Settings.
+      if ((__seqs_end - __seqs_begin > 1)
+	  && _GLIBCXX_PARALLEL_CONDITION(
+            ((__seqs_end - __seqs_begin) >=
+               __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+            && ((_SequenceIndex)__length >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+	return parallel_multiway_merge
+	  </* __stable = */ false, /* __sentinels = */ false>
+	  (__seqs_begin, __seqs_end, __target,
+	   multiway_merge_exact_splitting</* __stable = */ false,
+	   typename std::iterator_traits<_RAIterPairIterator>
+	   ::value_type*, _Compare, _DifferenceTp>,
+	   static_cast<_DifferenceType>(__length), __comp,
+	   __tag.__get_num_threads());
+      else
+	return __sequential_multiway_merge
+	  </* __stable = */ false, /* __sentinels = */ false>
+	  (__seqs_begin, __seqs_end, __target,
+	   *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    multiway_merge(_RAIterPairIterator __seqs_begin,
+		   _RAIterPairIterator __seqs_end,
+		   _RAIterOut __target,
+		   _DifferenceTp __length, _Compare __comp,
+		   __gnu_parallel::sampling_tag __tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute merge; maybe parallel, depending on the number of merged
+      // elements and the number of sequences and global thresholds in
+      // Settings.
+      if ((__seqs_end - __seqs_begin > 1)
+	  && _GLIBCXX_PARALLEL_CONDITION(
+            ((__seqs_end - __seqs_begin) >=
+               __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+            && ((_SequenceIndex)__length >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+	return parallel_multiway_merge
+	  </* __stable = */ false, /* __sentinels = */ false>
+	  (__seqs_begin, __seqs_end, __target,
+	   multiway_merge_exact_splitting</* __stable = */ false,
+	   typename std::iterator_traits<_RAIterPairIterator>
+	   ::value_type*, _Compare, _DifferenceTp>,
+	   static_cast<_DifferenceType>(__length), __comp,
+	   __tag.__get_num_threads());
+      else
+	return __sequential_multiway_merge
+	  </* __stable = */ false, /* __sentinels = */ false>
+	  (__seqs_begin, __seqs_end, __target,
+	   *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    multiway_merge(_RAIterPairIterator __seqs_begin,
+		   _RAIterPairIterator __seqs_end,
+		   _RAIterOut __target,
+		   _DifferenceTp __length, _Compare __comp,
+		   parallel_tag __tag = parallel_tag(0))
+    { return multiway_merge(__seqs_begin, __seqs_end, __target, __length,
+			    __comp, exact_tag(__tag.__get_num_threads())); }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    multiway_merge(_RAIterPairIterator __seqs_begin,
+		   _RAIterPairIterator __seqs_end,
+		   _RAIterOut __target,
+		   _DifferenceTp __length, _Compare __comp,
+		   default_parallel_tag __tag)
+    { return multiway_merge(__seqs_begin, __seqs_end, __target, __length,
+			    __comp, exact_tag(__tag.__get_num_threads())); }
+
+  // stable_multiway_merge
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    stable_multiway_merge(_RAIterPairIterator __seqs_begin,
+			  _RAIterPairIterator __seqs_end,
+			  _RAIterOut __target,
+			  _DifferenceTp __length, _Compare __comp,
+			  __gnu_parallel::sequential_tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute multiway merge *sequentially*.
+      return __sequential_multiway_merge
+	</* __stable = */ true, /* __sentinels = */ false>
+          (__seqs_begin, __seqs_end, __target,
+	   *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    stable_multiway_merge(_RAIterPairIterator __seqs_begin,
+			  _RAIterPairIterator __seqs_end,
+			  _RAIterOut __target,
+			  _DifferenceTp __length, _Compare __comp,
+			  __gnu_parallel::exact_tag __tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute merge; maybe parallel, depending on the number of merged
+      // elements and the number of sequences and global thresholds in
+      // Settings.
+      if ((__seqs_end - __seqs_begin > 1)
+	  && _GLIBCXX_PARALLEL_CONDITION(
+            ((__seqs_end - __seqs_begin) >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+            && ((_SequenceIndex)__length >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+	return parallel_multiway_merge
+          </* __stable = */ true, /* __sentinels = */ false>
+	  (__seqs_begin, __seqs_end, __target,
+	   multiway_merge_exact_splitting</* __stable = */ true,
+	   typename std::iterator_traits<_RAIterPairIterator>
+	   ::value_type*, _Compare, _DifferenceTp>,
+	   static_cast<_DifferenceType>(__length), __comp,
+	   __tag.__get_num_threads());
+      else
+	return __sequential_multiway_merge
+	  </* __stable = */ true, /* __sentinels = */ false>
+	  (__seqs_begin, __seqs_end, __target,
+	   *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    stable_multiway_merge(_RAIterPairIterator __seqs_begin,
+			  _RAIterPairIterator __seqs_end,
+			  _RAIterOut __target,
+			  _DifferenceTp __length, _Compare __comp,
+			  sampling_tag __tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute merge; maybe parallel, depending on the number of merged
+      // elements and the number of sequences and global thresholds in
+      // Settings.
+      if ((__seqs_end - __seqs_begin > 1)
+	  && _GLIBCXX_PARALLEL_CONDITION(
+            ((__seqs_end - __seqs_begin) >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+            && ((_SequenceIndex)__length >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+	return parallel_multiway_merge
+          </* __stable = */ true, /* __sentinels = */ false>
+	  (__seqs_begin, __seqs_end, __target,
+	   multiway_merge_sampling_splitting</* __stable = */ true,
+	   typename std::iterator_traits<_RAIterPairIterator>
+	   ::value_type*, _Compare, _DifferenceTp>,
+	   static_cast<_DifferenceType>(__length), __comp,
+	   __tag.__get_num_threads());
+      else
+	return __sequential_multiway_merge
+          </* __stable = */ true, /* __sentinels = */ false>
+	  (__seqs_begin, __seqs_end, __target,
+	   *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    stable_multiway_merge(_RAIterPairIterator __seqs_begin,
+			  _RAIterPairIterator __seqs_end,
+			  _RAIterOut __target,
+			  _DifferenceTp __length, _Compare __comp,
+			  parallel_tag __tag = parallel_tag(0))
+    {
+      return stable_multiway_merge
+	(__seqs_begin, __seqs_end, __target, __length, __comp,
+	 exact_tag(__tag.__get_num_threads()));
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    stable_multiway_merge(_RAIterPairIterator __seqs_begin,
+			  _RAIterPairIterator __seqs_end,
+			  _RAIterOut __target,
+			  _DifferenceTp __length, _Compare __comp,
+			  default_parallel_tag __tag)
+    {
+      return stable_multiway_merge
+	(__seqs_begin, __seqs_end, __target, __length, __comp,
+	 exact_tag(__tag.__get_num_threads()));
+    }
+
+  /**
+   * @brief Multiway Merge Frontend.
+   *
+   * Merge the sequences specified by seqs_begin and __seqs_end into
+   * __target.  __seqs_begin and __seqs_end must point to a sequence of
+   * pairs.  These pairs must contain an iterator to the beginning
+   * of a sequence in their first entry and an iterator the _M_end of
+   * the same sequence in their second entry.
+   *
+   * Ties are broken arbitrarily.  See stable_multiway_merge for a variant
+   * that breaks ties by sequence number but is slower.
+   *
+   * The first entries of the pairs (i.e. the begin iterators) will be moved
+   * forward accordingly.
+   *
+   * The output sequence has to provide enough space for all elements
+   * that are written to it.
+   *
+   * This function will merge the input sequences:
+   *
+   * - not stable
+   * - parallel, depending on the input size and Settings
+   * - using sampling for splitting
+   * - using sentinels
+   *
+   * You have to take care that the element the _M_end iterator points to is
+   * readable and contains a value that is greater than any other non-sentinel
+   * value in all sequences.
+   *
+   * Example:
+   *
+   * <pre>
+   *   int sequences[10][11];
+   *   for (int __i = 0; __i < 10; ++__i)
+   *     for (int __j = 0; __i < 11; ++__j)
+   *       sequences[__i][__j] = __j; // __last one is sentinel!
+   *
+   *   int __out[33];
+   *   std::vector<std::pair<int*> > seqs;
+   *   for (int __i = 0; __i < 10; ++__i)
+   *     { seqs.push(std::make_pair<int*>(sequences[__i],
+   *                                      sequences[__i] + 10)) }
+   *
+   *   multiway_merge(seqs.begin(), seqs.end(), __target, std::less<int>(), 33);
+   * </pre>
+   *
+   * @pre All input sequences must be sorted.
+   * @pre Target must provide enough space to merge out length elements or
+   *    the number of elements in all sequences, whichever is smaller.
+   * @pre For each @c __i, @c __seqs_begin[__i].second must be the end
+   *    marker of the sequence, but also reference the one more __sentinel
+   *    element.
+   *
+   * @post [__target, return __value) contains merged __elements from the
+   *    input sequences.
+   * @post return __value - __target = min(__length, number of elements in all
+   *    sequences).
+   *
+   * @see stable_multiway_merge_sentinels
+   *
+   * @param _RAIterPairIterator iterator over sequence
+   *    of pairs of iterators
+   * @param _RAIterOut iterator over target sequence
+   * @param _DifferenceTp difference type for the sequence
+   * @param _Compare strict weak ordering type to compare elements
+   *    in sequences
+   *
+   * @param __seqs_begin  __begin of sequence __sequence
+   * @param __seqs_end    _M_end of sequence __sequence
+   * @param __target      target sequence to merge to.
+   * @param __comp        strict weak ordering to use for element comparison.
+   * @param __length Maximum length to merge, possibly larger than the
+   * number of elements available.
+   *
+   * @return _M_end iterator of output sequence
+   */
+  // multiway_merge_sentinels
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    multiway_merge_sentinels(_RAIterPairIterator __seqs_begin,
+			     _RAIterPairIterator __seqs_end,
+			     _RAIterOut __target,
+			     _DifferenceTp __length, _Compare __comp,
+			     __gnu_parallel::sequential_tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute multiway merge *sequentially*.
+      return __sequential_multiway_merge
+	</* __stable = */ false, /* __sentinels = */ true>
+          (__seqs_begin, __seqs_end,
+           __target, *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    multiway_merge_sentinels(_RAIterPairIterator __seqs_begin,
+			     _RAIterPairIterator __seqs_end,
+			     _RAIterOut __target,
+			     _DifferenceTp __length, _Compare __comp,
+			     __gnu_parallel::exact_tag __tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute merge; maybe parallel, depending on the number of merged
+      // elements and the number of sequences and global thresholds in
+      // Settings.
+      if ((__seqs_end - __seqs_begin > 1)
+	  && _GLIBCXX_PARALLEL_CONDITION(
+            ((__seqs_end - __seqs_begin) >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+            && ((_SequenceIndex)__length >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+	return parallel_multiway_merge
+          </* __stable = */ false, /* __sentinels = */ true>
+	  (__seqs_begin, __seqs_end, __target,
+	   multiway_merge_exact_splitting</* __stable = */ false,
+	   typename std::iterator_traits<_RAIterPairIterator>
+	   ::value_type*, _Compare, _DifferenceTp>,
+	   static_cast<_DifferenceType>(__length), __comp,
+	   __tag.__get_num_threads());
+      else
+	return __sequential_multiway_merge
+          </* __stable = */ false, /* __sentinels = */ true>
+	  (__seqs_begin, __seqs_end, __target,
+	   *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    multiway_merge_sentinels(_RAIterPairIterator __seqs_begin,
+			     _RAIterPairIterator __seqs_end,
+			     _RAIterOut __target,
+			     _DifferenceTp __length, _Compare __comp,
+			     sampling_tag __tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute merge; maybe parallel, depending on the number of merged
+      // elements and the number of sequences and global thresholds in
+      // Settings.
+      if ((__seqs_end - __seqs_begin > 1)
+	  && _GLIBCXX_PARALLEL_CONDITION(
+            ((__seqs_end - __seqs_begin) >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+            && ((_SequenceIndex)__length >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+	return parallel_multiway_merge
+          </* __stable = */ false, /* __sentinels = */ true>
+	  (__seqs_begin, __seqs_end, __target,
+	   multiway_merge_sampling_splitting</* __stable = */ false,
+	   typename std::iterator_traits<_RAIterPairIterator>
+	   ::value_type*, _Compare, _DifferenceTp>,
+	   static_cast<_DifferenceType>(__length), __comp,
+	   __tag.__get_num_threads());
+      else
+	return __sequential_multiway_merge
+          </* __stable = */false, /* __sentinels = */ true>(
+            __seqs_begin, __seqs_end, __target,
+	    *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    multiway_merge_sentinels(_RAIterPairIterator __seqs_begin,
+			     _RAIterPairIterator __seqs_end,
+			     _RAIterOut __target,
+			     _DifferenceTp __length, _Compare __comp,
+			     parallel_tag __tag = parallel_tag(0))
+    {
+      return multiway_merge_sentinels
+	(__seqs_begin, __seqs_end, __target, __length, __comp,
+	 exact_tag(__tag.__get_num_threads()));
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    multiway_merge_sentinels(_RAIterPairIterator __seqs_begin,
+			     _RAIterPairIterator __seqs_end,
+			     _RAIterOut __target,
+			     _DifferenceTp __length, _Compare __comp,
+			     default_parallel_tag __tag)
+    {
+      return multiway_merge_sentinels
+	(__seqs_begin, __seqs_end, __target, __length, __comp,
+	 exact_tag(__tag.__get_num_threads()));
+    }
+
+  // stable_multiway_merge_sentinels
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    stable_multiway_merge_sentinels(_RAIterPairIterator __seqs_begin,
+				    _RAIterPairIterator __seqs_end,
+				    _RAIterOut __target,
+				    _DifferenceTp __length, _Compare __comp,
+				    __gnu_parallel::sequential_tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute multiway merge *sequentially*.
+      return __sequential_multiway_merge
+	</* __stable = */ true, /* __sentinels = */ true>
+	(__seqs_begin, __seqs_end, __target,
+	 *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    stable_multiway_merge_sentinels(_RAIterPairIterator __seqs_begin,
+				    _RAIterPairIterator __seqs_end,
+				    _RAIterOut __target,
+				    _DifferenceTp __length, _Compare __comp,
+				    __gnu_parallel::exact_tag __tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute merge; maybe parallel, depending on the number of merged
+      // elements and the number of sequences and global thresholds in
+      // Settings.
+      if ((__seqs_end - __seqs_begin > 1)
+	  && _GLIBCXX_PARALLEL_CONDITION(
+            ((__seqs_end - __seqs_begin) >=
+            __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+            && ((_SequenceIndex)__length >=
+            __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+	return parallel_multiway_merge
+          </* __stable = */ true, /* __sentinels = */ true>
+	  (__seqs_begin, __seqs_end, __target,
+	   multiway_merge_exact_splitting</* __stable = */ true,
+	   typename std::iterator_traits<_RAIterPairIterator>
+	   ::value_type*, _Compare, _DifferenceTp>,
+	   static_cast<_DifferenceType>(__length), __comp,
+	   __tag.__get_num_threads());
+      else
+	return __sequential_multiway_merge
+          </* __stable = */ true, /* __sentinels = */ true>
+	  (__seqs_begin, __seqs_end, __target,
+	   *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    stable_multiway_merge_sentinels(_RAIterPairIterator __seqs_begin,
+				    _RAIterPairIterator __seqs_end,
+				    _RAIterOut __target,
+				    _DifferenceTp __length,
+				    _Compare __comp,
+				    sampling_tag __tag)
+    {
+      typedef _DifferenceTp _DifferenceType;
+      _GLIBCXX_CALL(__seqs_end - __seqs_begin)
+
+      // catch special case: no sequences
+      if (__seqs_begin == __seqs_end)
+	return __target;
+
+      // Execute merge; maybe parallel, depending on the number of merged
+      // elements and the number of sequences and global thresholds in
+      // Settings.
+      if ((__seqs_end - __seqs_begin > 1)
+	  && _GLIBCXX_PARALLEL_CONDITION(
+            ((__seqs_end - __seqs_begin) >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_k)
+            && ((_SequenceIndex)__length >=
+              __gnu_parallel::_Settings::get().multiway_merge_minimal_n)))
+	return parallel_multiway_merge
+          </* __stable = */ true, /* __sentinels = */ true>
+	  (__seqs_begin, __seqs_end, __target,
+	   multiway_merge_sampling_splitting</* __stable = */ true,
+	   typename std::iterator_traits<_RAIterPairIterator>
+	   ::value_type*, _Compare, _DifferenceTp>,
+	   static_cast<_DifferenceType>(__length), __comp,
+	   __tag.__get_num_threads());
+      else
+	return __sequential_multiway_merge
+          </* __stable = */ true, /* __sentinels = */ true>
+	  (__seqs_begin, __seqs_end, __target,
+	   *(__seqs_begin->second), __length, __comp);
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    stable_multiway_merge_sentinels(_RAIterPairIterator __seqs_begin,
+				    _RAIterPairIterator __seqs_end,
+				    _RAIterOut __target,
+				    _DifferenceTp __length,
+				    _Compare __comp,
+				    parallel_tag __tag = parallel_tag(0))
+    {
+      return stable_multiway_merge_sentinels
+	(__seqs_begin, __seqs_end, __target, __length, __comp,
+	 exact_tag(__tag.__get_num_threads()));
+    }
+
+  // public interface
+  template<typename _RAIterPairIterator,
+	   typename _RAIterOut,
+	   typename _DifferenceTp,
+	   typename _Compare>
+    _RAIterOut
+    stable_multiway_merge_sentinels(_RAIterPairIterator __seqs_begin,
+				    _RAIterPairIterator __seqs_end,
+				    _RAIterOut __target,
+				    _DifferenceTp __length, _Compare __comp,
+				    default_parallel_tag __tag)
+    {
+      return stable_multiway_merge_sentinels
+	(__seqs_begin, __seqs_end, __target, __length, __comp,
+	 exact_tag(__tag.__get_num_threads()));
+    }
+}; // namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_MULTIWAY_MERGE_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/multiway_mergesort.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/multiway_mergesort.h
new file mode 100644
index 0000000..af7c10a
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/multiway_mergesort.h
@@ -0,0 +1,481 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/multiway_mergesort.h
+ *  @brief Parallel multiway merge sort.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_MULTIWAY_MERGESORT_H
+#define _GLIBCXX_PARALLEL_MULTIWAY_MERGESORT_H 1
+
+#include <vector>
+
+#include <parallel/basic_iterator.h>
+#include <bits/stl_algo.h>
+#include <parallel/parallel.h>
+#include <parallel/multiway_merge.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Subsequence description. */
+  template<typename _DifferenceTp>
+    struct _Piece
+    {
+      typedef _DifferenceTp _DifferenceType;
+
+      /** @brief Begin of subsequence. */
+      _DifferenceType _M_begin;
+
+      /** @brief End of subsequence. */
+      _DifferenceType _M_end;
+    };
+
+  /** @brief Data accessed by all threads.
+   *
+   *  PMWMS = parallel multiway mergesort */
+  template<typename _RAIter>
+    struct _PMWMSSortingData
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      /** @brief Number of threads involved. */
+      _ThreadIndex _M_num_threads;
+
+      /** @brief Input __begin. */
+      _RAIter _M_source;
+
+      /** @brief Start indices, per thread. */
+      _DifferenceType* _M_starts;
+
+      /** @brief Storage in which to sort. */
+      _ValueType** _M_temporary;
+
+      /** @brief Samples. */
+      _ValueType* _M_samples;
+
+      /** @brief Offsets to add to the found positions. */
+      _DifferenceType* _M_offsets;
+
+      /** @brief Pieces of data to merge @c [thread][__sequence] */
+      std::vector<_Piece<_DifferenceType> >* _M_pieces;
+  };
+
+  /**
+   *  @brief Select _M_samples from a sequence.
+   *  @param __sd Pointer to algorithm data. _Result will be placed in
+   *  @c __sd->_M_samples.
+   *  @param __num_samples Number of _M_samples to select.
+   */
+  template<typename _RAIter, typename _DifferenceTp>
+    void
+    __determine_samples(_PMWMSSortingData<_RAIter>* __sd,
+			_DifferenceTp __num_samples)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef _DifferenceTp _DifferenceType;
+
+      _ThreadIndex __iam = omp_get_thread_num();
+
+      _DifferenceType* __es = new _DifferenceType[__num_samples + 2];
+
+      equally_split(__sd->_M_starts[__iam + 1] - __sd->_M_starts[__iam], 
+		    __num_samples + 1, __es);
+
+      for (_DifferenceType __i = 0; __i < __num_samples; ++__i)
+	::new(&(__sd->_M_samples[__iam * __num_samples + __i]))
+	    _ValueType(__sd->_M_source[__sd->_M_starts[__iam]
+				       + __es[__i + 1]]);
+
+      delete[] __es;
+    }
+
+  /** @brief Split consistently. */
+  template<bool __exact, typename _RAIter,
+	   typename _Compare, typename _SortingPlacesIterator>
+    struct _SplitConsistently
+    { };
+
+  /** @brief Split by exact splitting. */
+  template<typename _RAIter, typename _Compare,
+	   typename _SortingPlacesIterator>
+    struct _SplitConsistently<true, _RAIter, _Compare, _SortingPlacesIterator>
+    {
+      void
+      operator()(const _ThreadIndex __iam,
+		 _PMWMSSortingData<_RAIter>* __sd,
+		 _Compare& __comp,
+		 const typename
+		 std::iterator_traits<_RAIter>::difference_type
+		 __num_samples) const
+      {
+#       pragma omp barrier
+
+	std::vector<std::pair<_SortingPlacesIterator,
+	                      _SortingPlacesIterator> >
+	  __seqs(__sd->_M_num_threads);
+	for (_ThreadIndex __s = 0; __s < __sd->_M_num_threads; __s++)
+	  __seqs[__s] = std::make_pair(__sd->_M_temporary[__s],
+				       __sd->_M_temporary[__s]
+				       + (__sd->_M_starts[__s + 1]
+					  - __sd->_M_starts[__s]));
+
+	std::vector<_SortingPlacesIterator> __offsets(__sd->_M_num_threads);
+
+	// if not last thread
+	if (__iam < __sd->_M_num_threads - 1)
+	  multiseq_partition(__seqs.begin(), __seqs.end(),
+			     __sd->_M_starts[__iam + 1], __offsets.begin(),
+			     __comp);
+
+	for (_ThreadIndex __seq = 0; __seq < __sd->_M_num_threads; __seq++)
+	  {
+	    // for each sequence
+	    if (__iam < (__sd->_M_num_threads - 1))
+	      __sd->_M_pieces[__iam][__seq]._M_end
+		= __offsets[__seq] - __seqs[__seq].first;
+	    else
+	      // very end of this sequence
+	      __sd->_M_pieces[__iam][__seq]._M_end =
+		__sd->_M_starts[__seq + 1] - __sd->_M_starts[__seq];
+	  }
+
+#       pragma omp barrier
+
+	for (_ThreadIndex __seq = 0; __seq < __sd->_M_num_threads; __seq++)
+	  {
+	    // For each sequence.
+	    if (__iam > 0)
+	      __sd->_M_pieces[__iam][__seq]._M_begin =
+		__sd->_M_pieces[__iam - 1][__seq]._M_end;
+	    else
+	      // Absolute beginning.
+	      __sd->_M_pieces[__iam][__seq]._M_begin = 0;
+	  }
+      }
+  };
+
+  /** @brief Split by sampling. */ 
+  template<typename _RAIter, typename _Compare,
+	   typename _SortingPlacesIterator>
+    struct _SplitConsistently<false, _RAIter, _Compare, _SortingPlacesIterator>
+    {
+      void
+      operator()(const _ThreadIndex __iam,
+		 _PMWMSSortingData<_RAIter>* __sd,
+		 _Compare& __comp,
+		 const typename
+		 std::iterator_traits<_RAIter>::difference_type
+		 __num_samples) const
+      {
+	typedef std::iterator_traits<_RAIter> _TraitsType;
+	typedef typename _TraitsType::value_type _ValueType;
+	typedef typename _TraitsType::difference_type _DifferenceType;
+
+	__determine_samples(__sd, __num_samples);
+
+#       pragma omp barrier
+
+#       pragma omp single
+	__gnu_sequential::sort(__sd->_M_samples,
+			       __sd->_M_samples
+			       + (__num_samples * __sd->_M_num_threads),
+			       __comp);
+
+#       pragma omp barrier
+
+	for (_ThreadIndex __s = 0; __s < __sd->_M_num_threads; ++__s)
+	  {
+	    // For each sequence.
+	    if (__num_samples * __iam > 0)
+	      __sd->_M_pieces[__iam][__s]._M_begin =
+                std::lower_bound(__sd->_M_temporary[__s],
+				 __sd->_M_temporary[__s]
+				 + (__sd->_M_starts[__s + 1]
+				    - __sd->_M_starts[__s]),
+				 __sd->_M_samples[__num_samples * __iam],
+				 __comp)
+                - __sd->_M_temporary[__s];
+	    else
+	      // Absolute beginning.
+	      __sd->_M_pieces[__iam][__s]._M_begin = 0;
+
+	    if ((__num_samples * (__iam + 1)) <
+		(__num_samples * __sd->_M_num_threads))
+	      __sd->_M_pieces[__iam][__s]._M_end =
+                std::lower_bound(__sd->_M_temporary[__s],
+				 __sd->_M_temporary[__s]
+				 + (__sd->_M_starts[__s + 1]
+				    - __sd->_M_starts[__s]),
+				 __sd->_M_samples[__num_samples * (__iam + 1)],
+				 __comp)
+                - __sd->_M_temporary[__s];
+	    else
+	      // Absolute end.
+	      __sd->_M_pieces[__iam][__s]._M_end = (__sd->_M_starts[__s + 1]
+						    - __sd->_M_starts[__s]);
+	  }
+      }
+  };
+  
+  template<bool __stable, typename _RAIter, typename _Compare>
+    struct __possibly_stable_sort
+    { };
+
+  template<typename _RAIter, typename _Compare>
+    struct __possibly_stable_sort<true, _RAIter, _Compare>
+    {
+      void operator()(const _RAIter& __begin,
+		      const _RAIter& __end, _Compare& __comp) const
+      { __gnu_sequential::stable_sort(__begin, __end, __comp); }
+    };
+
+  template<typename _RAIter, typename _Compare>
+    struct __possibly_stable_sort<false, _RAIter, _Compare>
+    {
+      void operator()(const _RAIter __begin,
+		      const _RAIter __end, _Compare& __comp) const
+      { __gnu_sequential::sort(__begin, __end, __comp); }
+    };
+
+  template<bool __stable, typename Seq_RAIter,
+	   typename _RAIter, typename _Compare,
+	   typename DiffType>
+    struct __possibly_stable_multiway_merge
+    { };
+
+  template<typename Seq_RAIter, typename _RAIter,
+	   typename _Compare, typename _DiffType>
+    struct __possibly_stable_multiway_merge<true, Seq_RAIter,
+					    _RAIter, _Compare, _DiffType>
+    {
+      void operator()(const Seq_RAIter& __seqs_begin,
+		      const Seq_RAIter& __seqs_end,
+		      const _RAIter& __target,
+		      _Compare& __comp,
+		      _DiffType __length_am) const
+      { stable_multiway_merge(__seqs_begin, __seqs_end, __target,
+			      __length_am, __comp, sequential_tag()); }
+    };
+
+  template<typename Seq_RAIter, typename _RAIter,
+	   typename _Compare, typename _DiffType>
+    struct __possibly_stable_multiway_merge<false, Seq_RAIter,
+					    _RAIter, _Compare, _DiffType>
+    {
+      void operator()(const Seq_RAIter& __seqs_begin,
+                      const Seq_RAIter& __seqs_end,
+                      const _RAIter& __target,
+                      _Compare& __comp,
+                      _DiffType __length_am) const
+      { multiway_merge(__seqs_begin, __seqs_end, __target, __length_am,
+		       __comp, sequential_tag()); }
+    };
+
+  /** @brief PMWMS code executed by each thread.
+   *  @param __sd Pointer to algorithm data.
+   *  @param __comp Comparator.
+   */
+  template<bool __stable, bool __exact, typename _RAIter,
+	   typename _Compare>
+    void
+    parallel_sort_mwms_pu(_PMWMSSortingData<_RAIter>* __sd,
+			  _Compare& __comp)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _ThreadIndex __iam = omp_get_thread_num();
+
+      // Length of this thread's chunk, before merging.
+      _DifferenceType __length_local =
+	__sd->_M_starts[__iam + 1] - __sd->_M_starts[__iam];
+
+      // Sort in temporary storage, leave space for sentinel.
+
+      typedef _ValueType* _SortingPlacesIterator;
+
+      __sd->_M_temporary[__iam] =
+        static_cast<_ValueType*>(::operator new(sizeof(_ValueType)
+						* (__length_local + 1)));
+
+      // Copy there.
+      std::uninitialized_copy(__sd->_M_source + __sd->_M_starts[__iam],
+			      __sd->_M_source + __sd->_M_starts[__iam]
+			      + __length_local,
+			      __sd->_M_temporary[__iam]);
+
+      __possibly_stable_sort<__stable, _SortingPlacesIterator, _Compare>()
+        (__sd->_M_temporary[__iam],
+	 __sd->_M_temporary[__iam] + __length_local,
+         __comp);
+
+      // Invariant: locally sorted subsequence in sd->_M_temporary[__iam],
+      // __sd->_M_temporary[__iam] + __length_local.
+
+      // No barrier here: Synchronization is done by the splitting routine.
+
+      _DifferenceType __num_samples =
+        _Settings::get().sort_mwms_oversampling * __sd->_M_num_threads - 1;
+      _SplitConsistently<__exact, _RAIter, _Compare, _SortingPlacesIterator>()
+        (__iam, __sd, __comp, __num_samples);
+
+      // Offset from __target __begin, __length after merging.
+      _DifferenceType __offset = 0, __length_am = 0;
+      for (_ThreadIndex __s = 0; __s < __sd->_M_num_threads; __s++)
+	{
+	  __length_am += (__sd->_M_pieces[__iam][__s]._M_end
+			  - __sd->_M_pieces[__iam][__s]._M_begin);
+	  __offset += __sd->_M_pieces[__iam][__s]._M_begin;
+	}
+
+      typedef std::vector<
+        std::pair<_SortingPlacesIterator, _SortingPlacesIterator> >
+        _SeqVector;
+      _SeqVector __seqs(__sd->_M_num_threads);
+
+      for (_ThreadIndex __s = 0; __s < __sd->_M_num_threads; ++__s)
+	{
+	  __seqs[__s] =
+	    std::make_pair(__sd->_M_temporary[__s]
+			   + __sd->_M_pieces[__iam][__s]._M_begin,
+			   __sd->_M_temporary[__s]
+			   + __sd->_M_pieces[__iam][__s]._M_end);
+	}
+
+      __possibly_stable_multiway_merge<
+        __stable, typename _SeqVector::iterator,
+	_RAIter, _Compare, _DifferenceType>()(__seqs.begin(), __seqs.end(),
+				     __sd->_M_source + __offset, __comp,
+				     __length_am);
+
+#     pragma omp barrier
+
+      for (_DifferenceType __i = 0; __i < __length_local; ++__i)
+	__sd->_M_temporary[__iam][__i].~_ValueType();
+      ::operator delete(__sd->_M_temporary[__iam]);
+    }
+
+  /** @brief PMWMS main call.
+   *  @param __begin Begin iterator of sequence.
+   *  @param __end End iterator of sequence.
+   *  @param __comp Comparator.
+   *  @param __n Length of sequence.
+   *  @param __num_threads Number of threads to use.
+   */
+  template<bool __stable, bool __exact, typename _RAIter,
+           typename _Compare>
+    void
+    parallel_sort_mwms(_RAIter __begin, _RAIter __end,
+		       _Compare __comp,
+		       _ThreadIndex __num_threads)
+    {
+      _GLIBCXX_CALL(__end - __begin)
+
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _DifferenceType __n = __end - __begin;
+
+      if (__n <= 1)
+	return;
+
+      // at least one element per thread
+      if (__num_threads > __n)
+	__num_threads = static_cast<_ThreadIndex>(__n);
+
+      // shared variables
+      _PMWMSSortingData<_RAIter> __sd;
+      _DifferenceType* __starts;
+      _DifferenceType __size;
+
+#     pragma omp parallel num_threads(__num_threads)
+      {
+        __num_threads = omp_get_num_threads(); //no more threads than requested
+
+#       pragma omp single
+	{
+	  __sd._M_num_threads = __num_threads;
+	  __sd._M_source = __begin;
+	  
+	  __sd._M_temporary = new _ValueType*[__num_threads];
+
+	  if (!__exact)
+	    {
+	      __size =
+		(_Settings::get().sort_mwms_oversampling * __num_threads - 1)
+		* __num_threads;
+	      __sd._M_samples = static_cast<_ValueType*>
+		(::operator new(__size * sizeof(_ValueType)));
+	    }
+	  else
+	    __sd._M_samples = 0;
+
+	  __sd._M_offsets = new _DifferenceType[__num_threads - 1];
+	  __sd._M_pieces
+	    = new std::vector<_Piece<_DifferenceType> >[__num_threads];
+	  for (_ThreadIndex __s = 0; __s < __num_threads; ++__s)
+	    __sd._M_pieces[__s].resize(__num_threads);
+	  __starts = __sd._M_starts = new _DifferenceType[__num_threads + 1];
+
+	  _DifferenceType __chunk_length = __n / __num_threads;
+	  _DifferenceType __split = __n % __num_threads;
+	  _DifferenceType __pos = 0;
+	  for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+	    {
+	      __starts[__i] = __pos;
+	      __pos += ((__i < __split)
+			? (__chunk_length + 1) : __chunk_length);
+	    }
+	  __starts[__num_threads] = __pos;
+	} //single
+
+        // Now sort in parallel.
+        parallel_sort_mwms_pu<__stable, __exact>(&__sd, __comp);
+      } //parallel
+
+      delete[] __starts;
+      delete[] __sd._M_temporary;
+
+      if (!__exact)
+	{
+	  for (_DifferenceType __i = 0; __i < __size; ++__i)
+	    __sd._M_samples[__i].~_ValueType();
+	  ::operator delete(__sd._M_samples);
+	}
+
+      delete[] __sd._M_offsets;
+      delete[] __sd._M_pieces;
+    }
+
+} //namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_MULTIWAY_MERGESORT_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/numeric b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/numeric
new file mode 100644
index 0000000..64624a7
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/numeric
@@ -0,0 +1,514 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file parallel/numeric
+*
+ * @brief Parallel STL function calls corresponding to stl_numeric.h.
+ * The functions defined here mainly do case switches and
+ * call the actual parallelized versions in other files.
+ * Inlining policy: Functions that basically only contain one function call,
+ * are declared inline.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_NUMERIC_H
+#define _GLIBCXX_PARALLEL_NUMERIC_H 1
+
+#include <numeric>
+#include <bits/stl_function.h>
+#include <parallel/numericfwd.h>
+#include <parallel/iterator.h>
+#include <parallel/for_each.h>
+#include <parallel/for_each_selectors.h>
+#include <parallel/partial_sum.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __parallel
+{
+  // Sequential fallback.
+  template<typename _IIter, typename _Tp>
+    inline _Tp
+    accumulate(_IIter __begin, _IIter __end, _Tp __init, 
+               __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::accumulate(__begin, __end, __init); }
+
+  template<typename _IIter, typename _Tp, typename _BinaryOperation>
+    inline _Tp
+    accumulate(_IIter __begin, _IIter __end, _Tp __init,
+               _BinaryOperation __binary_op, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::accumulate(__begin, __end, __init, __binary_op); }
+
+  // Sequential fallback for input iterator case.
+  template<typename _IIter, typename _Tp, typename _IteratorTag>
+    inline _Tp
+    __accumulate_switch(_IIter __begin, _IIter __end,
+                      _Tp __init, _IteratorTag) 
+    { return accumulate(__begin, __end, __init,
+			__gnu_parallel::sequential_tag()); }
+
+  template<typename _IIter, typename _Tp, typename _BinaryOperation,
+           typename _IteratorTag>
+    inline _Tp
+    __accumulate_switch(_IIter __begin, _IIter __end, _Tp __init, 
+                      _BinaryOperation __binary_op, _IteratorTag)
+    { return accumulate(__begin, __end, __init, __binary_op, 
+                        __gnu_parallel::sequential_tag()); }
+
+  // Parallel algorithm for random access iterators.
+  template<typename __RAIter, typename _Tp, typename _BinaryOperation>
+    _Tp
+    __accumulate_switch(__RAIter __begin, __RAIter __end, 
+                      _Tp __init, _BinaryOperation __binary_op, 
+                      random_access_iterator_tag, 
+                      __gnu_parallel::_Parallelism __parallelism_tag  
+                      = __gnu_parallel::parallel_unbalanced)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().accumulate_minimal_n
+            && __gnu_parallel::__is_parallel(__parallelism_tag)))
+        {
+          _Tp __res = __init;
+          __gnu_parallel::__accumulate_selector<__RAIter>
+            __my_selector;
+          __gnu_parallel::
+            __for_each_template_random_access_ed(__begin, __end,
+						 __gnu_parallel::_Nothing(),
+						 __my_selector,
+						 __gnu_parallel::
+						 __accumulate_binop_reduct
+					       <_BinaryOperation>(__binary_op),
+						 __res, __res, -1);
+          return __res;
+        }
+      else
+        return accumulate(__begin, __end, __init, __binary_op, 
+                          __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface.
+  template<typename _IIter, typename _Tp>
+    inline _Tp
+    accumulate(_IIter __begin, _IIter __end, _Tp __init, 
+               __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef std::iterator_traits<_IIter> _IteratorTraits;
+      typedef typename _IteratorTraits::value_type _ValueType;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+
+      return __accumulate_switch(__begin, __end, __init,
+				 __gnu_parallel::_Plus<_Tp, _ValueType>(),
+				 _IteratorCategory(), __parallelism_tag);
+    }
+
+  template<typename _IIter, typename _Tp>
+    inline _Tp
+    accumulate(_IIter __begin, _IIter __end, _Tp __init)
+    {
+      typedef std::iterator_traits<_IIter> _IteratorTraits;
+      typedef typename _IteratorTraits::value_type _ValueType;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+
+      return __accumulate_switch(__begin, __end, __init,
+				 __gnu_parallel::_Plus<_Tp, _ValueType>(),
+				 _IteratorCategory());
+    }
+
+  template<typename _IIter, typename _Tp, typename _BinaryOperation>
+    inline _Tp
+    accumulate(_IIter __begin, _IIter __end, _Tp __init, 
+               _BinaryOperation __binary_op, 
+               __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef iterator_traits<_IIter> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      return __accumulate_switch(__begin, __end, __init, __binary_op, 
+				 _IteratorCategory(), __parallelism_tag);
+    }
+
+  template<typename _IIter, typename _Tp, typename _BinaryOperation>
+    inline _Tp
+    accumulate(_IIter __begin, _IIter __end, _Tp __init, 
+               _BinaryOperation __binary_op) 
+    {
+      typedef iterator_traits<_IIter> _IteratorTraits;
+      typedef typename _IteratorTraits::iterator_category _IteratorCategory;
+      return __accumulate_switch(__begin, __end, __init, __binary_op, 
+				 _IteratorCategory());
+    }
+
+
+  // Sequential fallback.
+  template<typename _IIter1, typename _IIter2, typename _Tp>
+    inline _Tp
+    inner_product(_IIter1 __first1, _IIter1 __last1, 
+                  _IIter2 __first2, _Tp __init,
+                  __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::inner_product(
+                               __first1, __last1, __first2, __init); }
+
+  template<typename _IIter1, typename _IIter2, typename _Tp,
+           typename _BinaryFunction1, typename _BinaryFunction2>
+    inline _Tp
+    inner_product(_IIter1 __first1, _IIter1 __last1,
+                  _IIter2 __first2, _Tp __init, _BinaryFunction1 __binary_op1, 
+                  _BinaryFunction2 __binary_op2,
+                  __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::inner_product(__first1, __last1, __first2, __init,
+                                           __binary_op1, __binary_op2); }
+
+  // Parallel algorithm for random access iterators.
+  template<typename _RAIter1, typename _RAIter2,
+           typename _Tp, typename _BinaryFunction1, typename _BinaryFunction2>
+    _Tp
+    __inner_product_switch(_RAIter1 __first1,
+			   _RAIter1 __last1,
+			   _RAIter2 __first2, _Tp __init,
+			   _BinaryFunction1 __binary_op1,
+			   _BinaryFunction2 __binary_op2,
+			   random_access_iterator_tag,
+			   random_access_iterator_tag,
+			   __gnu_parallel::_Parallelism __parallelism_tag
+			   = __gnu_parallel::parallel_unbalanced)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION((__last1 - __first1)
+                                      >= __gnu_parallel::_Settings::get().
+                                      accumulate_minimal_n
+                                      && __gnu_parallel::
+                                      __is_parallel(__parallelism_tag)))
+        {
+          _Tp __res = __init;
+          __gnu_parallel::
+            __inner_product_selector<_RAIter1,
+            _RAIter2, _Tp> __my_selector(__first1, __first2);
+          __gnu_parallel::
+            __for_each_template_random_access_ed(
+                __first1, __last1, __binary_op2, __my_selector, __binary_op1,
+                __res, __res, -1);
+          return __res;
+        }
+      else
+        return inner_product(__first1, __last1, __first2, __init, 
+                             __gnu_parallel::sequential_tag());
+    }
+
+  // No parallelism for input iterators.
+  template<typename _IIter1, typename _IIter2, typename _Tp,
+           typename _BinaryFunction1, typename _BinaryFunction2,
+           typename _IteratorTag1, typename _IteratorTag2>
+    inline _Tp
+    __inner_product_switch(_IIter1 __first1, _IIter1 __last1, 
+			   _IIter2 __first2, _Tp __init, 
+			   _BinaryFunction1 __binary_op1,
+			   _BinaryFunction2 __binary_op2, 
+			   _IteratorTag1, _IteratorTag2)
+    { return inner_product(__first1, __last1, __first2, __init, __binary_op1,
+			   __binary_op2, __gnu_parallel::sequential_tag()); }
+
+  template<typename _IIter1, typename _IIter2, typename _Tp,
+           typename _BinaryFunction1, typename _BinaryFunction2>
+    inline _Tp
+    inner_product(_IIter1 __first1, _IIter1 __last1, 
+                  _IIter2 __first2, _Tp __init, _BinaryFunction1 __binary_op1, 
+                  _BinaryFunction2 __binary_op2, 
+                  __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef iterator_traits<_IIter1> _TraitsType1;
+      typedef typename _TraitsType1::iterator_category _IteratorCategory1;
+
+      typedef iterator_traits<_IIter2> _TraitsType2;
+      typedef typename _TraitsType2::iterator_category _IteratorCategory2;
+
+      return __inner_product_switch(__first1, __last1, __first2, __init,
+				    __binary_op1, __binary_op2,
+				    _IteratorCategory1(), _IteratorCategory2(),
+				    __parallelism_tag);
+    }
+
+  template<typename _IIter1, typename _IIter2, typename _Tp,
+           typename _BinaryFunction1, typename _BinaryFunction2>
+    inline _Tp
+    inner_product(_IIter1 __first1, _IIter1 __last1, 
+                  _IIter2 __first2, _Tp __init, _BinaryFunction1 __binary_op1, 
+                  _BinaryFunction2 __binary_op2)
+    {
+      typedef iterator_traits<_IIter1> _TraitsType1;
+      typedef typename _TraitsType1::iterator_category _IteratorCategory1;
+
+      typedef iterator_traits<_IIter2> _TraitsType2;
+      typedef typename _TraitsType2::iterator_category _IteratorCategory2;
+
+      return __inner_product_switch(__first1, __last1, __first2, __init,
+				    __binary_op1, __binary_op2,
+				    _IteratorCategory1(),
+				    _IteratorCategory2());
+    }
+
+  template<typename _IIter1, typename _IIter2, typename _Tp>
+    inline _Tp
+    inner_product(_IIter1 __first1, _IIter1 __last1, 
+                  _IIter2 __first2, _Tp __init, 
+                  __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef iterator_traits<_IIter1> _TraitsType1;
+      typedef typename _TraitsType1::value_type _ValueType1;
+      typedef iterator_traits<_IIter2> _TraitsType2;
+      typedef typename _TraitsType2::value_type _ValueType2;
+
+      typedef typename
+        __gnu_parallel::_Multiplies<_ValueType1, _ValueType2>::result_type
+        _MultipliesResultType;
+      return __gnu_parallel::inner_product(__first1, __last1, __first2, __init,
+                           __gnu_parallel::_Plus<_Tp, _MultipliesResultType>(),
+                           __gnu_parallel::
+                           _Multiplies<_ValueType1, _ValueType2>(),
+                           __parallelism_tag);
+    }
+
+  template<typename _IIter1, typename _IIter2, typename _Tp>
+    inline _Tp
+    inner_product(_IIter1 __first1, _IIter1 __last1, 
+                  _IIter2 __first2, _Tp __init)
+    {
+      typedef iterator_traits<_IIter1> _TraitsType1;
+      typedef typename _TraitsType1::value_type _ValueType1;
+      typedef iterator_traits<_IIter2> _TraitsType2;
+      typedef typename _TraitsType2::value_type _ValueType2;
+
+      typedef typename
+        __gnu_parallel::_Multiplies<_ValueType1, _ValueType2>::result_type
+        _MultipliesResultType;
+      return __gnu_parallel::inner_product(__first1, __last1, __first2, __init,
+                           __gnu_parallel::_Plus<_Tp, _MultipliesResultType>(),
+                           __gnu_parallel::
+                           _Multiplies<_ValueType1, _ValueType2>());
+    }
+
+  // Sequential fallback.
+  template<typename _IIter, typename _OutputIterator>
+    inline _OutputIterator
+    partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result,
+                __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::partial_sum(__begin, __end, __result); }
+
+  // Sequential fallback.
+  template<typename _IIter, typename _OutputIterator,
+	   typename _BinaryOperation>
+    inline _OutputIterator
+    partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result,
+                _BinaryOperation __bin_op, __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::partial_sum(__begin, __end, __result, __bin_op); }
+
+  // Sequential fallback for input iterator case.
+  template<typename _IIter, typename _OutputIterator,
+           typename _BinaryOperation, typename _IteratorTag1,
+           typename _IteratorTag2>
+    inline _OutputIterator
+    __partial_sum_switch(_IIter __begin, _IIter __end,
+			 _OutputIterator __result, _BinaryOperation __bin_op,
+			 _IteratorTag1, _IteratorTag2)
+    { return _GLIBCXX_STD_A::partial_sum(__begin, __end, __result, __bin_op); }
+
+  // Parallel algorithm for random access iterators.
+  template<typename _IIter, typename _OutputIterator,
+           typename _BinaryOperation>
+    _OutputIterator
+    __partial_sum_switch(_IIter __begin, _IIter __end,
+			 _OutputIterator __result, _BinaryOperation __bin_op,
+			 random_access_iterator_tag,
+			 random_access_iterator_tag)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().partial_sum_minimal_n))
+        return __gnu_parallel::__parallel_partial_sum(__begin, __end,
+						      __result, __bin_op);
+      else
+        return partial_sum(__begin, __end, __result, __bin_op,
+                           __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface.
+  template<typename _IIter, typename _OutputIterator>
+    inline _OutputIterator
+    partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result)
+    {
+      typedef typename iterator_traits<_IIter>::value_type _ValueType;
+      return __gnu_parallel::partial_sum(__begin, __end,
+                                         __result, std::plus<_ValueType>());
+    }
+
+  // Public interface
+  template<typename _IIter, typename _OutputIterator,
+           typename _BinaryOperation>
+    inline _OutputIterator
+    partial_sum(_IIter __begin, _IIter __end, _OutputIterator __result,
+                _BinaryOperation __binary_op)
+    {
+      typedef iterator_traits<_IIter> _ITraitsType;
+      typedef typename _ITraitsType::iterator_category _IIteratorCategory;
+
+      typedef iterator_traits<_OutputIterator> _OTraitsType;
+      typedef typename _OTraitsType::iterator_category _OIterCategory;
+
+      return __partial_sum_switch(__begin, __end, __result, __binary_op,
+				  _IIteratorCategory(), _OIterCategory());
+    }
+
+  // Sequential fallback.
+  template<typename _IIter, typename _OutputIterator>
+    inline _OutputIterator
+    adjacent_difference(_IIter __begin, _IIter __end, _OutputIterator __result,
+                        __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::adjacent_difference(__begin, __end, __result); }
+
+  // Sequential fallback.
+  template<typename _IIter, typename _OutputIterator,
+           typename _BinaryOperation>
+    inline _OutputIterator
+    adjacent_difference(_IIter __begin, _IIter __end,
+                        _OutputIterator __result, _BinaryOperation __bin_op,
+                        __gnu_parallel::sequential_tag)
+    { return _GLIBCXX_STD_A::adjacent_difference(__begin, __end,
+						 __result, __bin_op); }
+
+  // Sequential fallback for input iterator case.
+  template<typename _IIter, typename _OutputIterator,
+           typename _BinaryOperation, typename _IteratorTag1,
+           typename _IteratorTag2>
+    inline _OutputIterator
+    __adjacent_difference_switch(_IIter __begin, _IIter __end,
+				 _OutputIterator __result,
+				 _BinaryOperation __bin_op, _IteratorTag1,
+				 _IteratorTag2)
+    { return adjacent_difference(__begin, __end, __result, __bin_op,
+                                 __gnu_parallel::sequential_tag()); }
+
+  // Parallel algorithm for random access iterators.
+  template<typename _IIter, typename _OutputIterator,
+           typename _BinaryOperation>
+    _OutputIterator
+    __adjacent_difference_switch(_IIter __begin, _IIter __end,
+				 _OutputIterator __result,
+				 _BinaryOperation __bin_op,
+				 random_access_iterator_tag,
+				 random_access_iterator_tag,
+				 __gnu_parallel::_Parallelism
+				 __parallelism_tag
+				 = __gnu_parallel::parallel_balanced)
+    {
+      if (_GLIBCXX_PARALLEL_CONDITION(
+            static_cast<__gnu_parallel::_SequenceIndex>(__end - __begin)
+            >= __gnu_parallel::_Settings::get().adjacent_difference_minimal_n
+            && __gnu_parallel::__is_parallel(__parallelism_tag)))
+        {
+          bool __dummy = true;
+          typedef __gnu_parallel::_IteratorPair<_IIter, _OutputIterator,
+            random_access_iterator_tag> _ItTrip;
+          *__result = *__begin;
+          _ItTrip __begin_pair(__begin + 1, __result + 1),
+            __end_pair(__end, __result + (__end - __begin));
+          __gnu_parallel::__adjacent_difference_selector<_ItTrip>
+                                                            __functionality;
+          __gnu_parallel::
+            __for_each_template_random_access_ed(
+                __begin_pair, __end_pair, __bin_op, __functionality,
+                __gnu_parallel::_DummyReduct(), __dummy, __dummy, -1);
+          return __functionality._M_finish_iterator;
+        }
+      else
+        return adjacent_difference(__begin, __end, __result, __bin_op, 
+                                   __gnu_parallel::sequential_tag());
+    }
+
+  // Public interface.
+  template<typename _IIter, typename _OutputIterator>
+    inline _OutputIterator
+    adjacent_difference(_IIter __begin, _IIter __end,
+                        _OutputIterator __result,
+                        __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      return adjacent_difference(__begin, __end, __result,
+				 std::minus<_ValueType>(),
+				 __parallelism_tag);
+    }
+
+  template<typename _IIter, typename _OutputIterator>
+    inline _OutputIterator
+    adjacent_difference(_IIter __begin, _IIter __end,
+                        _OutputIterator __result)
+    {
+      typedef iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      return adjacent_difference(__begin, __end, __result,
+				 std::minus<_ValueType>());
+    }
+
+  template<typename _IIter, typename _OutputIterator,
+           typename _BinaryOperation>
+    inline _OutputIterator
+    adjacent_difference(_IIter __begin, _IIter __end,
+                        _OutputIterator __result, _BinaryOperation __binary_op,
+                        __gnu_parallel::_Parallelism __parallelism_tag)
+    {
+      typedef iterator_traits<_IIter> _ITraitsType;
+      typedef typename _ITraitsType::iterator_category _IIteratorCategory;
+
+      typedef iterator_traits<_OutputIterator> _OTraitsType;
+      typedef typename _OTraitsType::iterator_category _OIterCategory;
+
+      return __adjacent_difference_switch(__begin, __end, __result,
+					  __binary_op,
+					  _IIteratorCategory(),
+					  _OIterCategory(),
+					  __parallelism_tag);
+    }
+
+  template<typename _IIter, typename _OutputIterator,
+	   typename _BinaryOperation>
+    inline _OutputIterator
+    adjacent_difference(_IIter __begin, _IIter __end,
+			_OutputIterator __result, _BinaryOperation __binary_op)
+    {
+      typedef iterator_traits<_IIter> _ITraitsType;
+      typedef typename _ITraitsType::iterator_category _IIteratorCategory;
+
+      typedef iterator_traits<_OutputIterator> _OTraitsType;
+      typedef typename _OTraitsType::iterator_category _OIterCategory;
+
+      return __adjacent_difference_switch(__begin, __end, __result,
+					  __binary_op,
+					  _IIteratorCategory(),
+					  _OIterCategory());
+    }
+} // end namespace
+} // end namespace
+
+#endif /* _GLIBCXX_NUMERIC_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/numericfwd.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/numericfwd.h
new file mode 100644
index 0000000..5ee3d6d
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/numericfwd.h
@@ -0,0 +1,203 @@
+// <numeric> parallel extensions -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/numericfwd.h
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PARALLEL_NUMERICFWD_H
+#define _GLIBCXX_PARALLEL_NUMERICFWD_H 1
+
+#pragma GCC system_header
+
+#include <parallel/tags.h>
+#include <parallel/settings.h>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace __parallel
+{
+  template<typename _IIter, typename _Tp>
+    _Tp
+    accumulate(_IIter, _IIter, _Tp);
+
+  template<typename _IIter, typename _Tp>
+    _Tp
+    accumulate(_IIter, _IIter, _Tp, __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _Tp>
+    _Tp
+    accumulate(_IIter, _IIter, _Tp, __gnu_parallel::_Parallelism);
+
+  template<typename _IIter, typename _Tp, typename _Tag>
+    _Tp
+    __accumulate_switch(_IIter, _IIter, _Tp, _Tag);
+
+  template<typename _IIter, typename _Tp, typename _BinaryOper>
+    _Tp
+    accumulate(_IIter, _IIter, _Tp, _BinaryOper);
+
+  template<typename _IIter, typename _Tp, typename _BinaryOper>
+    _Tp
+    accumulate(_IIter, _IIter, _Tp, _BinaryOper,
+               __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _Tp, typename _BinaryOper>
+    _Tp
+    accumulate(_IIter, _IIter, _Tp, _BinaryOper,
+               __gnu_parallel::_Parallelism);
+
+  template<typename _IIter, typename _Tp, typename _BinaryOper,
+           typename _Tag>
+    _Tp
+    __accumulate_switch(_IIter, _IIter, _Tp, _BinaryOper, _Tag);
+
+  template<typename _RAIter, typename _Tp, typename _BinaryOper>
+    _Tp
+    __accumulate_switch(_RAIter, _RAIter, _Tp, _BinaryOper,
+                      random_access_iterator_tag,
+                      __gnu_parallel::_Parallelism __parallelism
+                      = __gnu_parallel::parallel_unbalanced);
+
+  template<typename _IIter, typename _OIter>
+    _OIter
+    adjacent_difference(_IIter, _IIter, _OIter);
+
+  template<typename _IIter, typename _OIter, typename _BinaryOper>
+    _OIter
+    adjacent_difference(_IIter, _IIter, _OIter, _BinaryOper);
+
+  template<typename _IIter, typename _OIter>
+    _OIter
+    adjacent_difference(_IIter, _IIter, _OIter,
+                        __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _OIter, typename _BinaryOper>
+    _OIter
+    adjacent_difference(_IIter, _IIter, _OIter, _BinaryOper, 
+                        __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _OIter>
+    _OIter
+    adjacent_difference(_IIter, _IIter, _OIter,
+                        __gnu_parallel::_Parallelism);
+
+  template<typename _IIter, typename _OIter, typename _BinaryOper>
+    _OIter
+    adjacent_difference(_IIter, _IIter, _OIter, _BinaryOper, 
+                        __gnu_parallel::_Parallelism);
+
+  template<typename _IIter, typename _OIter, typename _BinaryOper,
+           typename _Tag1, typename _Tag2>
+    _OIter
+    __adjacent_difference_switch(_IIter, _IIter, _OIter, _BinaryOper,
+                               _Tag1, _Tag2);
+
+  template<typename _IIter, typename _OIter, typename _BinaryOper>
+    _OIter
+    __adjacent_difference_switch(_IIter, _IIter, _OIter, _BinaryOper, 
+                               random_access_iterator_tag, 
+                               random_access_iterator_tag, 
+                               __gnu_parallel::_Parallelism __parallelism
+                               = __gnu_parallel::parallel_unbalanced);
+
+  template<typename _IIter1, typename _IIter2, typename _Tp>
+    _Tp
+    inner_product(_IIter1, _IIter1, _IIter2, _Tp);
+
+  template<typename _IIter1, typename _IIter2, typename _Tp>
+    _Tp
+    inner_product(_IIter1, _IIter1, _IIter2, _Tp,
+                  __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _Tp>
+    _Tp
+    inner_product(_IIter1, _IIter1, _IIter2, _Tp,
+                  __gnu_parallel::_Parallelism);
+
+  template<typename _IIter1, typename _IIter2, typename _Tp,
+           typename _BinaryFunction1, typename _BinaryFunction2>
+    _Tp
+    inner_product(_IIter1, _IIter1, _IIter2, _Tp,
+                  _BinaryFunction1, _BinaryFunction2);
+
+  template<typename _IIter1, typename _IIter2, typename _Tp,
+           typename _BinaryFunction1, typename _BinaryFunction2>
+    _Tp
+    inner_product(_IIter1, _IIter1, _IIter2, _Tp, _BinaryFunction1,
+                  _BinaryFunction2, __gnu_parallel::sequential_tag);
+
+  template<typename _IIter1, typename _IIter2, typename _Tp,
+           typename BinaryFunction1, typename BinaryFunction2>
+    _Tp
+    inner_product(_IIter1, _IIter1, _IIter2, _Tp, BinaryFunction1,
+                  BinaryFunction2, __gnu_parallel::_Parallelism);
+
+  template<typename _RAIter1, typename _RAIter2, typename _Tp,
+           typename BinaryFunction1, typename BinaryFunction2>
+    _Tp
+    __inner_product_switch(_RAIter1, _RAIter1, _RAIter2, _Tp, BinaryFunction1,
+                         BinaryFunction2, random_access_iterator_tag, 
+                         random_access_iterator_tag, 
+                         __gnu_parallel::_Parallelism
+                         = __gnu_parallel::parallel_unbalanced);
+
+  template<typename _IIter1, typename _IIter2, typename _Tp,
+           typename _BinaryFunction1, typename _BinaryFunction2,
+           typename _Tag1, typename _Tag2>
+    _Tp
+    __inner_product_switch(_IIter1, _IIter1, _IIter2, _Tp, _BinaryFunction1, 
+                         _BinaryFunction2, _Tag1, _Tag2);
+
+
+  template<typename _IIter, typename _OIter>
+    _OIter
+    partial_sum(_IIter, _IIter, _OIter, __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _OIter, typename _BinaryOper>
+    _OIter
+    partial_sum(_IIter, _IIter, _OIter, _BinaryOper,
+                __gnu_parallel::sequential_tag);
+
+  template<typename _IIter, typename _OIter>
+    _OIter
+    partial_sum(_IIter, _IIter, _OIter __result);
+
+  template<typename _IIter, typename _OIter, typename _BinaryOper>
+    _OIter
+    partial_sum(_IIter, _IIter, _OIter, _BinaryOper);
+
+  template<typename _IIter, typename _OIter, typename _BinaryOper,
+           typename _Tag1, typename _Tag2>
+    _OIter
+    __partial_sum_switch(_IIter, _IIter, _OIter, _BinaryOper, _Tag1, _Tag2);
+
+  template<typename _IIter, typename _OIter, typename _BinaryOper>
+    _OIter
+    __partial_sum_switch(_IIter, _IIter, _OIter, _BinaryOper,
+                       random_access_iterator_tag, random_access_iterator_tag);
+} // end namespace
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_NUMERICFWD_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/omp_loop.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/omp_loop.h
new file mode 100644
index 0000000..94f9e6b
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/omp_loop.h
@@ -0,0 +1,115 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/omp_loop.h
+ *  @brief Parallelization of embarrassingly parallel execution by
+ *  means of an OpenMP for loop.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_OMP_LOOP_H
+#define _GLIBCXX_PARALLEL_OMP_LOOP_H 1
+
+#include <omp.h>
+
+#include <parallel/settings.h>
+#include <parallel/basic_iterator.h>
+#include <parallel/base.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Embarrassingly parallel algorithm for random access
+   * iterators, using an OpenMP for loop.
+   *
+   *  @param __begin Begin iterator of element sequence.
+   *  @param __end End iterator of element sequence.
+   *  @param __o User-supplied functor (comparator, predicate, adding
+   *  functor, etc.).
+   *  @param __f Functor to @a process an element with __op (depends on
+   *  desired functionality, e. g. for std::for_each(), ...).
+   *  @param __r Functor to @a add a single __result to the already
+   *  processed elements (depends on functionality).
+   *  @param __base Base value for reduction.
+   *  @param __output Pointer to position where final result is written to
+   *  @param __bound Maximum number of elements processed (e. g. for
+   *  std::count_n()).
+   *  @return User-supplied functor (that may contain a part of the result).
+   */
+  template<typename _RAIter,
+	   typename _Op,
+	   typename _Fu,
+	   typename _Red,
+	   typename _Result>
+    _Op
+    __for_each_template_random_access_omp_loop(_RAIter __begin, _RAIter __end,
+					       _Op __o, _Fu& __f, _Red __r,
+					       _Result __base,
+					       _Result& __output,
+      typename std::iterator_traits<_RAIter>::difference_type __bound)
+    {
+      typedef typename std::iterator_traits<_RAIter>::difference_type
+        _DifferenceType;
+
+      _DifferenceType __length = __end - __begin;
+      _ThreadIndex __num_threads = __gnu_parallel::min<_DifferenceType>
+	(__get_max_threads(), __length);
+
+      _Result *__thread_results;
+
+#     pragma omp parallel num_threads(__num_threads)
+      {
+#       pragma omp single
+	{
+	  __num_threads = omp_get_num_threads();
+	  __thread_results = new _Result[__num_threads];
+
+	  for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+	    __thread_results[__i] = _Result();
+	}
+
+        _ThreadIndex __iam = omp_get_thread_num();
+
+#pragma omp for schedule(dynamic, _Settings::get().workstealing_chunk_size)
+        for (_DifferenceType __pos = 0; __pos < __length; ++__pos)
+          __thread_results[__iam] = __r(__thread_results[__iam],
+					__f(__o, __begin+__pos));
+      } //parallel
+
+      for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+        __output = __r(__output, __thread_results[__i]);
+
+      delete [] __thread_results;
+
+      // Points to last element processed (needed as return value for
+      // some algorithms like transform).
+      __f._M_finish_iterator = __begin + __length;
+
+      return __o;
+    }
+
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_OMP_LOOP_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/omp_loop_static.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/omp_loop_static.h
new file mode 100644
index 0000000..ca22d59
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/omp_loop_static.h
@@ -0,0 +1,115 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/omp_loop_static.h
+ *  @brief Parallelization of embarrassingly parallel execution by
+ *  means of an OpenMP for loop with static scheduling.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_OMP_LOOP_STATIC_H
+#define _GLIBCXX_PARALLEL_OMP_LOOP_STATIC_H 1
+
+#include <omp.h>
+
+#include <parallel/settings.h>
+#include <parallel/basic_iterator.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Embarrassingly parallel algorithm for random access
+   * iterators, using an OpenMP for loop with static scheduling.
+   *
+   *  @param __begin Begin iterator of element sequence.
+   *  @param __end End iterator of element sequence.
+   *  @param __o User-supplied functor (comparator, predicate, adding
+   *  functor, ...).
+   *  @param __f Functor to @a process an element with __op (depends on
+   *  desired functionality, e. g. for std::for_each(), ...).
+   *  @param __r Functor to @a add a single __result to the already processed
+   *  __elements (depends on functionality).
+   *  @param __base Base value for reduction.
+   *  @param __output Pointer to position where final result is written to
+   *  @param __bound Maximum number of elements processed (e. g. for
+   *  std::count_n()).
+   *  @return User-supplied functor (that may contain a part of the result).
+   */
+  template<typename _RAIter,
+	   typename _Op,
+	   typename _Fu,
+	   typename _Red,
+	   typename _Result>
+    _Op
+    __for_each_template_random_access_omp_loop_static(_RAIter __begin,
+						      _RAIter __end, _Op __o,
+						      _Fu& __f, _Red __r,
+						      _Result __base,
+						      _Result& __output,
+      typename std::iterator_traits<_RAIter>::difference_type __bound)
+    {
+      typedef typename std::iterator_traits<_RAIter>::difference_type
+	_DifferenceType;
+
+      _DifferenceType __length = __end - __begin;
+      _ThreadIndex __num_threads = std::min<_DifferenceType>
+	(__get_max_threads(), __length);
+
+      _Result *__thread_results;
+
+#     pragma omp parallel num_threads(__num_threads)
+      {
+#       pragma omp single
+	{
+	  __num_threads = omp_get_num_threads();
+	  __thread_results = new _Result[__num_threads];
+
+	  for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+	    __thread_results[__i] = _Result();
+	}
+
+        _ThreadIndex __iam = omp_get_thread_num();
+
+#pragma omp for schedule(static, _Settings::get().workstealing_chunk_size)
+        for (_DifferenceType __pos = 0; __pos < __length; ++__pos)
+          __thread_results[__iam] = __r(__thread_results[__iam],
+                                        __f(__o, __begin+__pos));
+      } //parallel
+
+      for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+	__output = __r(__output, __thread_results[__i]);
+
+      delete [] __thread_results;
+
+      // Points to last element processed (needed as return value for
+      // some algorithms like transform).
+      __f.finish_iterator = __begin + __length;
+
+      return __o;
+    }
+
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_OMP_LOOP_STATIC_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/par_loop.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/par_loop.h
new file mode 100644
index 0000000..b776df4
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/par_loop.h
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/par_loop.h
+ *  @brief Parallelization of embarrassingly parallel execution by
+ *  means of equal splitting.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_PAR_LOOP_H
+#define _GLIBCXX_PARALLEL_PAR_LOOP_H 1
+
+#include <omp.h>
+#include <parallel/settings.h>
+#include <parallel/base.h>
+#include <parallel/equally_split.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Embarrassingly parallel algorithm for random access
+   * iterators, using hand-crafted parallelization by equal splitting
+   * the work.
+   *
+   *  @param __begin Begin iterator of element sequence.
+   *  @param __end End iterator of element sequence.
+   *  @param __o User-supplied functor (comparator, predicate, adding
+   *  functor, ...)
+   *  @param __f Functor to "process" an element with __op (depends on
+   *  desired functionality, e. g. for std::for_each(), ...).
+   *  @param __r Functor to "add" a single __result to the already
+   *  processed elements (depends on functionality).
+   *  @param __base Base value for reduction.
+   *  @param __output Pointer to position where final result is written to
+   *  @param __bound Maximum number of elements processed (e. g. for
+   *  std::count_n()).
+   *  @return User-supplied functor (that may contain a part of the result).
+   */
+  template<typename _RAIter,
+	   typename _Op,
+	   typename _Fu,
+	   typename _Red,
+	   typename _Result>
+    _Op
+    __for_each_template_random_access_ed(_RAIter __begin, _RAIter __end,
+					 _Op __o, _Fu& __f, _Red __r,
+					 _Result __base, _Result& __output,
+      typename std::iterator_traits<_RAIter>::difference_type __bound)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      const _DifferenceType __length = __end - __begin;
+      _Result *__thread_results;
+      bool* __constructed;
+
+      _ThreadIndex __num_threads = __gnu_parallel::min<_DifferenceType>
+	(__get_max_threads(), __length);
+
+#     pragma omp parallel num_threads(__num_threads)
+      {
+#       pragma omp single
+	{
+	  __num_threads = omp_get_num_threads();
+	  __thread_results = static_cast<_Result*>
+	    (::operator new(__num_threads * sizeof(_Result)));
+	  __constructed = new bool[__num_threads];
+	}
+
+	_ThreadIndex __iam = omp_get_thread_num();
+
+	// Neutral element.
+	_Result* __reduct;
+
+	_DifferenceType
+	  __start = equally_split_point(__length, __num_threads, __iam),
+	  __stop = equally_split_point(__length, __num_threads, __iam + 1);
+
+	if (__start < __stop)
+	  {
+	    __reduct = new _Result(__f(__o, __begin + __start));
+	    ++__start;
+	    __constructed[__iam] = true;
+	  }
+	else
+	  __constructed[__iam] = false;
+
+	for (; __start < __stop; ++__start)
+	  *__reduct = __r(*__reduct, __f(__o, __begin + __start));
+
+	if (__constructed[__iam])
+	  {
+	    ::new(&__thread_results[__iam]) _Result(*__reduct);
+	    delete __reduct;
+	  }
+      } //parallel
+
+      for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+	if (__constructed[__i])
+	  {
+	    __output = __r(__output, __thread_results[__i]);
+	    __thread_results[__i].~_Result();
+	  }
+
+      // Points to last element processed (needed as return value for
+      // some algorithms like transform).
+      __f._M_finish_iterator = __begin + __length;
+
+      ::operator delete(__thread_results);
+
+      delete[] __constructed;
+
+      return __o;
+    }
+
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_PAR_LOOP_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/parallel.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/parallel.h
new file mode 100644
index 0000000..c4bfc05
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/parallel.h
@@ -0,0 +1,42 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/parallel.h
+ *  @brief End-user include file. Provides advanced settings and
+ *  tuning options.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze and Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_PARALLEL_H
+#define _GLIBCXX_PARALLEL_PARALLEL_H 1
+
+#include <parallel/features.h>
+#include <parallel/compiletime_settings.h>
+#include <parallel/types.h>
+#include <parallel/tags.h>
+#include <parallel/settings.h>
+
+#endif /* _GLIBCXX_PARALLEL_PARALLEL_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/partial_sum.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/partial_sum.h
new file mode 100644
index 0000000..0be9881
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/partial_sum.h
@@ -0,0 +1,231 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/partial_sum.h
+ *  @brief Parallel implementation of std::partial_sum(), i.e. prefix
+*  sums.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_PARTIAL_SUM_H
+#define _GLIBCXX_PARALLEL_PARTIAL_SUM_H 1
+
+#include <omp.h>
+#include <new>
+#include <bits/stl_algobase.h>
+#include <parallel/parallel.h>
+#include <parallel/numericfwd.h>
+
+namespace __gnu_parallel
+{
+  // Problem: there is no 0-element given.
+
+  /** @brief Base case prefix sum routine.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator of input sequence.
+   *  @param __result Begin iterator of output sequence.
+   *  @param __bin_op Associative binary function.
+   *  @param __value Start value. Must be passed since the neutral
+   *  element is unknown in general.
+   *  @return End iterator of output sequence. */
+  template<typename _IIter,
+	   typename _OutputIterator,
+	   typename _BinaryOperation>
+    _OutputIterator
+    __parallel_partial_sum_basecase(_IIter __begin, _IIter __end,
+				    _OutputIterator __result,
+				    _BinaryOperation __bin_op,
+      typename std::iterator_traits <_IIter>::value_type __value)
+    {
+      if (__begin == __end)
+	return __result;
+
+      while (__begin != __end)
+	{
+	  __value = __bin_op(__value, *__begin);
+	  *__result = __value;
+	  ++__result;
+	  ++__begin;
+	}
+      return __result;
+    }
+
+  /** @brief Parallel partial sum implementation, two-phase approach,
+      no recursion.
+      *  @param __begin Begin iterator of input sequence.
+      *  @param __end End iterator of input sequence.
+      *  @param __result Begin iterator of output sequence.
+      *  @param __bin_op Associative binary function.
+      *  @param __n Length of sequence.
+      *  @param __num_threads Number of threads to use.
+      *  @return End iterator of output sequence.
+      */
+  template<typename _IIter,
+	   typename _OutputIterator,
+	   typename _BinaryOperation>
+    _OutputIterator
+    __parallel_partial_sum_linear(_IIter __begin, _IIter __end,
+				  _OutputIterator __result,
+				  _BinaryOperation __bin_op,
+      typename std::iterator_traits<_IIter>::difference_type __n)
+    {
+      typedef std::iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      if (__begin == __end)
+	return __result;
+
+      _ThreadIndex __num_threads =
+        std::min<_DifferenceType>(__get_max_threads(), __n - 1);
+
+      if (__num_threads < 2)
+	{
+	  *__result = *__begin;
+	  return __parallel_partial_sum_basecase(__begin + 1, __end,
+						 __result + 1, __bin_op,
+						 *__begin);
+	}
+
+      _DifferenceType* __borders;
+      _ValueType* __sums;
+
+      const _Settings& __s = _Settings::get();
+
+#     pragma omp parallel num_threads(__num_threads)
+      {
+#       pragma omp single
+	{
+	  __num_threads = omp_get_num_threads();
+	    
+	  __borders = new _DifferenceType[__num_threads + 2];
+
+	  if (__s.partial_sum_dilation == 1.0f)
+	    equally_split(__n, __num_threads + 1, __borders);
+	  else
+	    {
+	      _DifferenceType __first_part_length =
+		  std::max<_DifferenceType>(1,
+		    __n / (1.0f + __s.partial_sum_dilation * __num_threads));
+	      _DifferenceType __chunk_length =
+		  (__n - __first_part_length) / __num_threads;
+	      _DifferenceType __borderstart =
+		  __n - __num_threads * __chunk_length;
+	      __borders[0] = 0;
+	      for (_ThreadIndex __i = 1; __i < (__num_threads + 1); ++__i)
+		{
+		  __borders[__i] = __borderstart;
+		  __borderstart += __chunk_length;
+		}
+	      __borders[__num_threads + 1] = __n;
+	    }
+
+	  __sums = static_cast<_ValueType*>(::operator new(sizeof(_ValueType)
+                                                           * __num_threads));
+	  _OutputIterator __target_end;
+	} //single
+
+        _ThreadIndex __iam = omp_get_thread_num();
+        if (__iam == 0)
+          {
+            *__result = *__begin;
+            __parallel_partial_sum_basecase(__begin + 1,
+					    __begin + __borders[1],
+					    __result + 1,
+					    __bin_op, *__begin);
+            ::new(&(__sums[__iam])) _ValueType(*(__result + __borders[1] - 1));
+          }
+        else
+          {
+            ::new(&(__sums[__iam]))
+              _ValueType(__gnu_parallel::accumulate(
+                                         __begin + __borders[__iam] + 1,
+                                         __begin + __borders[__iam + 1],
+                                         *(__begin + __borders[__iam]),
+                                         __bin_op,
+                                         __gnu_parallel::sequential_tag()));
+          }
+
+#       pragma omp barrier
+
+#       pragma omp single
+	__parallel_partial_sum_basecase(__sums + 1, __sums + __num_threads,
+					__sums + 1, __bin_op, __sums[0]);
+
+#       pragma omp barrier
+
+	// Still same team.
+        __parallel_partial_sum_basecase(__begin + __borders[__iam + 1],
+					__begin + __borders[__iam + 2],
+					__result + __borders[__iam + 1],
+					__bin_op, __sums[__iam]);
+      } //parallel
+
+      for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+	__sums[__i].~_ValueType();
+      ::operator delete(__sums);
+
+      delete[] __borders;
+
+      return __result + __n;
+    }
+
+  /** @brief Parallel partial sum front-__end.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator of input sequence.
+   *  @param __result Begin iterator of output sequence.
+   *  @param __bin_op Associative binary function.
+   *  @return End iterator of output sequence. */
+  template<typename _IIter,
+	   typename _OutputIterator,
+	   typename _BinaryOperation>
+    _OutputIterator
+    __parallel_partial_sum(_IIter __begin, _IIter __end,
+			   _OutputIterator __result, _BinaryOperation __bin_op)
+    {
+      _GLIBCXX_CALL(__begin - __end)
+
+      typedef std::iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _DifferenceType __n = __end - __begin;
+
+      switch (_Settings::get().partial_sum_algorithm)
+	{
+	case LINEAR:
+	  // Need an initial offset.
+	  return __parallel_partial_sum_linear(__begin, __end, __result,
+					       __bin_op, __n);
+	default:
+	  // Partial_sum algorithm not implemented.
+	  _GLIBCXX_PARALLEL_ASSERT(0);
+	  return __result + __n;
+	}
+    }
+}
+
+#endif /* _GLIBCXX_PARALLEL_PARTIAL_SUM_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/partition.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/partition.h
new file mode 100644
index 0000000..c651321
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/partition.h
@@ -0,0 +1,434 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/partition.h
+ *  @brief Parallel implementation of std::partition(),
+ *  std::nth_element(), and std::partial_sort().
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_PARTITION_H
+#define _GLIBCXX_PARALLEL_PARTITION_H 1
+
+#include <parallel/basic_iterator.h>
+#include <parallel/sort.h>
+#include <parallel/random_number.h>
+#include <bits/stl_algo.h>
+#include <parallel/parallel.h>
+
+/** @brief Decide whether to declare certain variables volatile. */
+#define _GLIBCXX_VOLATILE volatile
+
+namespace __gnu_parallel
+{
+  /** @brief Parallel implementation of std::partition.
+    *  @param __begin Begin iterator of input sequence to split.
+    *  @param __end End iterator of input sequence to split.
+    *  @param __pred Partition predicate, possibly including some kind
+    *         of pivot.
+    *  @param __num_threads Maximum number of threads to use for this task.
+    *  @return Number of elements not fulfilling the predicate. */
+  template<typename _RAIter, typename _Predicate>
+    typename std::iterator_traits<_RAIter>::difference_type
+    __parallel_partition(_RAIter __begin, _RAIter __end,
+			 _Predicate __pred, _ThreadIndex __num_threads)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _DifferenceType __n = __end - __begin;
+
+      _GLIBCXX_CALL(__n)
+
+      const _Settings& __s = _Settings::get();
+
+      // shared
+      _GLIBCXX_VOLATILE _DifferenceType __left = 0, __right = __n - 1,
+                                        __dist = __n,
+                                        __leftover_left, __leftover_right,
+                                        __leftnew, __rightnew;
+
+      // just 0 or 1, but int to allow atomic operations
+      int* __reserved_left = 0, * __reserved_right = 0;
+
+      _DifferenceType __chunk_size = __s.partition_chunk_size;
+
+      //at least two chunks per thread
+      if (__dist >= 2 * __num_threads * __chunk_size)
+#       pragma omp parallel num_threads(__num_threads)
+	{
+#         pragma omp single
+	  {
+	    __num_threads = omp_get_num_threads();
+	    __reserved_left = new int[__num_threads];
+	    __reserved_right = new int[__num_threads];
+
+	    if (__s.partition_chunk_share > 0.0)
+	      __chunk_size = std::max<_DifferenceType>
+		(__s.partition_chunk_size, (double)__n 
+		 * __s.partition_chunk_share / (double)__num_threads);
+	    else
+	      __chunk_size = __s.partition_chunk_size;
+	  }
+
+	  while (__dist >= 2 * __num_threads * __chunk_size)
+	    {
+#             pragma omp single
+	      {
+		_DifferenceType __num_chunks = __dist / __chunk_size;
+
+		for (_ThreadIndex __r = 0; __r < __num_threads; ++__r)
+		  {
+		    __reserved_left [__r] = 0; // false
+		    __reserved_right[__r] = 0; // false
+		  }
+		__leftover_left = 0;
+		__leftover_right = 0;
+	      } //implicit barrier
+
+	      // Private.
+	      _DifferenceType __thread_left, __thread_left_border,
+		              __thread_right, __thread_right_border;
+
+	      __thread_left = __left + 1;
+	      // Just to satisfy the condition below.
+	      __thread_left_border = __thread_left - 1;
+
+	      __thread_right = __n - 1;
+             // Just to satisfy the condition below.
+	      __thread_right_border = __thread_right + 1;
+
+	      bool __iam_finished = false;
+	      while (!__iam_finished)
+		{
+		  if (__thread_left > __thread_left_border)
+		    {
+                      _DifferenceType __former_dist =
+                              __fetch_and_add(&__dist, -__chunk_size);
+                      if (__former_dist < __chunk_size)
+                        {
+                          __fetch_and_add(&__dist, __chunk_size);
+                          __iam_finished = true;
+                          break;
+                        }
+                      else
+                        {
+                          __thread_left =
+                                  __fetch_and_add(&__left, __chunk_size);
+                          __thread_left_border =
+                                  __thread_left + (__chunk_size - 1);
+                        }
+		    }
+
+		  if (__thread_right < __thread_right_border)
+		    {
+                      _DifferenceType __former_dist =
+                              __fetch_and_add(&__dist, -__chunk_size);
+                      if (__former_dist < __chunk_size)
+                        {
+                          __fetch_and_add(&__dist, __chunk_size);
+                          __iam_finished = true;
+                          break;
+                        }
+                      else
+                        {
+                          __thread_right =
+                                  __fetch_and_add(&__right, -__chunk_size);
+                          __thread_right_border =
+                                  __thread_right - (__chunk_size - 1);
+                        }
+		    }
+
+		  // Swap as usual.
+		  while (__thread_left < __thread_right)
+		    {
+		      while (__pred(__begin[__thread_left])
+			     && __thread_left <= __thread_left_border)
+			++__thread_left;
+		      while (!__pred(__begin[__thread_right])
+			     && __thread_right >= __thread_right_border)
+			--__thread_right;
+
+		      if (__thread_left > __thread_left_border
+			  || __thread_right < __thread_right_border)
+			// Fetch new chunk(__s).
+			break;
+
+		      std::iter_swap(__begin + __thread_left,
+                             __begin + __thread_right);
+		      ++__thread_left;
+		      --__thread_right;
+		    }
+		}
+
+	      // Now swap the leftover chunks to the right places.
+	      if (__thread_left <= __thread_left_border)
+#               pragma omp atomic
+		++__leftover_left;
+	      if (__thread_right >= __thread_right_border)
+#               pragma omp atomic
+		++__leftover_right;
+
+#             pragma omp barrier
+
+              _DifferenceType
+                    __leftold = __left,
+                    __leftnew = __left - __leftover_left * __chunk_size,
+                    __rightold = __right,
+                    __rightnew = __right + __leftover_right * __chunk_size;
+
+	      // <=> __thread_left_border + (__chunk_size - 1) >= __leftnew
+	      if (__thread_left <= __thread_left_border
+		  && __thread_left_border >= __leftnew)
+		{
+		  // Chunk already in place, reserve spot.
+		__reserved_left[(__left - (__thread_left_border + 1))
+				/ __chunk_size] = 1;
+		}
+
+	      // <=> __thread_right_border - (__chunk_size - 1) <= __rightnew
+	      if (__thread_right >= __thread_right_border
+		  && __thread_right_border <= __rightnew)
+		{
+		  // Chunk already in place, reserve spot.
+		  __reserved_right[((__thread_right_border - 1) - __right)
+				   / __chunk_size] = 1;
+		}
+
+#             pragma omp barrier
+
+	      if (__thread_left <= __thread_left_border
+		  && __thread_left_border < __leftnew)
+		{
+		  // Find spot and swap.
+		  _DifferenceType __swapstart = -1;
+                  for (int __r = 0; __r < __leftover_left; ++__r)
+                    if (__reserved_left[__r] == 0
+                        && __compare_and_swap(&(__reserved_left[__r]), 0, 1))
+                      {
+                        __swapstart = __leftold - (__r + 1) * __chunk_size;
+                        break;
+                      }
+
+#if _GLIBCXX_ASSERTIONS
+		  _GLIBCXX_PARALLEL_ASSERT(__swapstart != -1);
+#endif
+
+		  std::swap_ranges(__begin + __thread_left_border
+				   - (__chunk_size - 1),
+				   __begin + __thread_left_border + 1,
+				   __begin + __swapstart);
+		}
+
+	      if (__thread_right >= __thread_right_border
+		  && __thread_right_border > __rightnew)
+		{
+		  // Find spot and swap
+		  _DifferenceType __swapstart = -1;
+                  for (int __r = 0; __r < __leftover_right; ++__r)
+                    if (__reserved_right[__r] == 0
+                        && __compare_and_swap(&(__reserved_right[__r]), 0, 1))
+                      {
+                        __swapstart = __rightold + __r * __chunk_size + 1;
+                        break;
+                      }
+
+#if _GLIBCXX_ASSERTIONS
+		  _GLIBCXX_PARALLEL_ASSERT(__swapstart != -1);
+#endif
+
+		  std::swap_ranges(__begin + __thread_right_border,
+				   __begin + __thread_right_border
+				   + __chunk_size, __begin + __swapstart);
+	      }
+#if _GLIBCXX_ASSERTIONS
+#             pragma omp barrier
+
+#             pragma omp single
+	      {
+		for (_DifferenceType __r = 0; __r < __leftover_left; ++__r)
+		  _GLIBCXX_PARALLEL_ASSERT(__reserved_left[__r] == 1);
+		for (_DifferenceType __r = 0; __r < __leftover_right; ++__r)
+		  _GLIBCXX_PARALLEL_ASSERT(__reserved_right[__r] == 1);
+	      }
+#endif
+
+	      __left = __leftnew;
+	      __right = __rightnew;
+              __dist = __right - __left + 1;
+	    }
+
+#           pragma omp flush(__left, __right)
+	} // end "recursion" //parallel
+
+        _DifferenceType __final_left = __left, __final_right = __right;
+
+	while (__final_left < __final_right)
+	  {
+	    // Go right until key is geq than pivot.
+	    while (__pred(__begin[__final_left])
+		   && __final_left < __final_right)
+	      ++__final_left;
+
+	    // Go left until key is less than pivot.
+	    while (!__pred(__begin[__final_right])
+		   && __final_left < __final_right)
+	      --__final_right;
+
+	    if (__final_left == __final_right)
+	      break;
+	    std::iter_swap(__begin + __final_left, __begin + __final_right);
+	    ++__final_left;
+	    --__final_right;
+	  }
+
+	// All elements on the left side are < piv, all elements on the
+	// right are >= piv
+	delete[] __reserved_left;
+	delete[] __reserved_right;
+
+	// Element "between" __final_left and __final_right might not have
+	// been regarded yet
+	if (__final_left < __n && !__pred(__begin[__final_left]))
+	  // Really swapped.
+	  return __final_left;
+	else
+	  return __final_left + 1;
+    }
+
+  /**
+    *  @brief Parallel implementation of std::nth_element().
+    *  @param __begin Begin iterator of input sequence.
+    *  @param __nth _Iterator of element that must be in position afterwards.
+    *  @param __end End iterator of input sequence.
+    *  @param __comp Comparator.
+    */
+  template<typename _RAIter, typename _Compare>
+    void 
+    __parallel_nth_element(_RAIter __begin, _RAIter __nth, 
+			   _RAIter __end, _Compare __comp)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _GLIBCXX_CALL(__end - __begin)
+
+      _RAIter __split;
+      _RandomNumber __rng;
+
+      const _Settings& __s = _Settings::get();
+      _DifferenceType __minimum_length = std::max<_DifferenceType>(2,
+        std::max(__s.nth_element_minimal_n, __s.partition_minimal_n));
+
+      // Break if input range to small.
+      while (static_cast<_SequenceIndex>(__end - __begin) >= __minimum_length)
+	{
+          _DifferenceType __n = __end - __begin;
+
+          _RAIter __pivot_pos = __begin + __rng(__n);
+
+          // Swap __pivot_pos value to end.
+          if (__pivot_pos != (__end - 1))
+            std::iter_swap(__pivot_pos, __end - 1);
+          __pivot_pos = __end - 1;
+
+          // _Compare must have first_value_type, second_value_type,
+          // result_type
+          // _Compare ==
+          // __gnu_parallel::_Lexicographic<S, int,
+	  //                                __gnu_parallel::_Less<S, S> >
+          // __pivot_pos == std::pair<S, int>*
+          __gnu_parallel::__binder2nd<_Compare, _ValueType, _ValueType, bool>
+            __pred(__comp, *__pivot_pos);
+
+          // Divide, leave pivot unchanged in last place.
+          _RAIter __split_pos1, __split_pos2;
+          __split_pos1 = __begin + __parallel_partition(__begin, __end - 1,
+							__pred,
+							__get_max_threads());
+
+          // Left side: < __pivot_pos; __right side: >= __pivot_pos
+
+          // Swap pivot back to middle.
+          if (__split_pos1 != __pivot_pos)
+            std::iter_swap(__split_pos1, __pivot_pos);
+          __pivot_pos = __split_pos1;
+
+          // In case all elements are equal, __split_pos1 == 0
+          if ((__split_pos1 + 1 - __begin) < (__n >> 7)
+              || (__end - __split_pos1) < (__n >> 7))
+            {
+              // Very unequal split, one part smaller than one 128th
+              // elements not strictly larger than the pivot.
+              __gnu_parallel::__unary_negate<__gnu_parallel::
+        	__binder1st<_Compare, _ValueType,
+		            _ValueType, bool>, _ValueType>
+        	__pred(__gnu_parallel::__binder1st<_Compare, _ValueType,
+		       _ValueType, bool>(__comp, *__pivot_pos));
+
+              // Find other end of pivot-equal range.
+              __split_pos2 = __gnu_sequential::partition(__split_pos1 + 1,
+							 __end, __pred);
+            }
+          else
+            // Only skip the pivot.
+            __split_pos2 = __split_pos1 + 1;
+
+          // Compare iterators.
+          if (__split_pos2 <= __nth)
+            __begin = __split_pos2;
+          else if (__nth < __split_pos1)
+            __end = __split_pos1;
+          else
+            break;
+	}
+
+      // Only at most _Settings::partition_minimal_n __elements __left.
+      __gnu_sequential::nth_element(__begin, __nth, __end, __comp);
+    }
+
+  /** @brief Parallel implementation of std::partial_sort().
+  *  @param __begin Begin iterator of input sequence.
+  *  @param __middle Sort until this position.
+  *  @param __end End iterator of input sequence.
+  *  @param __comp Comparator. */
+  template<typename _RAIter, typename _Compare>
+    void
+    __parallel_partial_sort(_RAIter __begin,
+			    _RAIter __middle,
+			    _RAIter __end, _Compare __comp)
+    {
+      __parallel_nth_element(__begin, __middle, __end, __comp);
+      std::sort(__begin, __middle, __comp);
+    }
+
+} //namespace __gnu_parallel
+
+#undef _GLIBCXX_VOLATILE
+
+#endif /* _GLIBCXX_PARALLEL_PARTITION_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/queue.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/queue.h
new file mode 100644
index 0000000..03c1c78
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/queue.h
@@ -0,0 +1,155 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/queue.h
+ *  @brief Lock-free double-ended queue.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_QUEUE_H
+#define _GLIBCXX_PARALLEL_QUEUE_H 1
+
+#include <parallel/types.h>
+#include <parallel/base.h>
+#include <parallel/compatibility.h>
+
+/** @brief Decide whether to declare certain variable volatile in this file. */
+#define _GLIBCXX_VOLATILE volatile
+
+namespace __gnu_parallel
+{
+  /**@brief Double-ended queue of bounded size, allowing lock-free
+   *  atomic access.  push_front() and pop_front() must not be called
+   *  concurrently to each other, while pop_back() can be called
+   *  concurrently at all times.
+   *  @c empty(), @c size(), and @c top() are intentionally not provided.
+   *  Calling them would not make sense in a concurrent setting.
+   *  @param _Tp Contained element type. */
+  template<typename _Tp>
+    class _RestrictedBoundedConcurrentQueue
+    {
+    private:
+      /** @brief Array of elements, seen as cyclic buffer. */
+      _Tp* _M_base;
+
+      /** @brief Maximal number of elements contained at the same time. */
+      _SequenceIndex _M_max_size;
+
+      /** @brief Cyclic __begin and __end pointers contained in one
+          atomically changeable value. */
+      _GLIBCXX_VOLATILE _CASable _M_borders;
+
+    public:
+      /** @brief Constructor. Not to be called concurrent, of course.
+       *  @param _M_max_size Maximal number of elements to be contained. */
+      _RestrictedBoundedConcurrentQueue(_SequenceIndex __max_size)
+      {
+        _M_max_size = __max_size;
+        _M_base = new _Tp[__max_size];
+        _M_borders = __encode2(0, 0);
+#pragma omp flush
+      }
+
+      /** @brief Destructor. Not to be called concurrent, of course. */
+      ~_RestrictedBoundedConcurrentQueue()
+      { delete[] _M_base; }
+
+      /** @brief Pushes one element into the queue at the front end.
+       *  Must not be called concurrently with pop_front(). */
+      void
+      push_front(const _Tp& __t)
+      {
+        _CASable __former_borders = _M_borders;
+        int __former_front, __former_back;
+        __decode2(__former_borders, __former_front, __former_back);
+        *(_M_base + __former_front % _M_max_size) = __t;
+#if _GLIBCXX_ASSERTIONS
+        // Otherwise: front - back > _M_max_size eventually.
+        _GLIBCXX_PARALLEL_ASSERT(((__former_front + 1) - __former_back)
+                                 <= _M_max_size);
+#endif
+        __fetch_and_add(&_M_borders, __encode2(1, 0));
+      }
+
+      /** @brief Pops one element from the queue at the front end.
+       *  Must not be called concurrently with pop_front(). */
+      bool
+      pop_front(_Tp& __t)
+      {
+        int __former_front, __former_back;
+#pragma omp flush
+        __decode2(_M_borders, __former_front, __former_back);
+        while (__former_front > __former_back)
+          {
+            // Chance.
+            _CASable __former_borders = __encode2(__former_front,
+						  __former_back);
+            _CASable __new_borders = __encode2(__former_front - 1,
+					       __former_back);
+            if (__compare_and_swap(&_M_borders, __former_borders,
+				   __new_borders))
+              {
+                __t = *(_M_base + (__former_front - 1) % _M_max_size);
+                return true;
+              }
+#pragma omp flush
+            __decode2(_M_borders, __former_front, __former_back);
+          }
+        return false;
+      }
+
+      /** @brief Pops one element from the queue at the front end.
+       *  Must not be called concurrently with pop_front(). */
+      bool
+      pop_back(_Tp& __t)        //queue behavior
+      {
+        int __former_front, __former_back;
+#pragma omp flush
+        __decode2(_M_borders, __former_front, __former_back);
+        while (__former_front > __former_back)
+          {
+            // Chance.
+            _CASable __former_borders = __encode2(__former_front,
+						  __former_back);
+            _CASable __new_borders = __encode2(__former_front,
+					       __former_back + 1);
+            if (__compare_and_swap(&_M_borders, __former_borders,
+				   __new_borders))
+              {
+                __t = *(_M_base + __former_back % _M_max_size);
+                return true;
+              }
+#pragma omp flush
+            __decode2(_M_borders, __former_front, __former_back);
+          }
+        return false;
+      }
+  };
+}       //namespace __gnu_parallel
+
+#undef _GLIBCXX_VOLATILE
+
+#endif /* _GLIBCXX_PARALLEL_QUEUE_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/quicksort.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/quicksort.h
new file mode 100644
index 0000000..1b4d598
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/quicksort.h
@@ -0,0 +1,176 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/quicksort.h
+ *  @brief Implementation of a unbalanced parallel quicksort (in-place).
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_QUICKSORT_H
+#define _GLIBCXX_PARALLEL_QUICKSORT_H 1
+
+#include <parallel/parallel.h>
+#include <parallel/partition.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Unbalanced quicksort divide step.
+   *  @param __begin Begin iterator of subsequence.
+   *  @param __end End iterator of subsequence.
+   *  @param __comp Comparator.
+   *  @param __pivot_rank Desired __rank of the pivot.
+   *  @param __num_samples Choose pivot from that many samples.
+   *  @param __num_threads Number of threads that are allowed to work on
+   *  this part.
+   */
+  template<typename _RAIter, typename _Compare>
+    typename std::iterator_traits<_RAIter>::difference_type
+    __parallel_sort_qs_divide(_RAIter __begin, _RAIter __end,
+			      _Compare __comp, typename std::iterator_traits
+			      <_RAIter>::difference_type __pivot_rank,
+			      typename std::iterator_traits
+			      <_RAIter>::difference_type
+			      __num_samples, _ThreadIndex __num_threads)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _DifferenceType __n = __end - __begin;
+      __num_samples = std::min(__num_samples, __n);
+
+      // Allocate uninitialized, to avoid default constructor.
+      _ValueType* __samples = static_cast<_ValueType*>
+	(::operator new(__num_samples * sizeof(_ValueType)));
+
+      for (_DifferenceType __s = 0; __s < __num_samples; ++__s)
+        {
+          const unsigned long long __index = static_cast<unsigned long long>
+	    (__s) * __n / __num_samples;
+          ::new(&(__samples[__s])) _ValueType(__begin[__index]);
+        }
+
+      __gnu_sequential::sort(__samples, __samples + __num_samples, __comp);
+
+      _ValueType& __pivot = __samples[__pivot_rank * __num_samples / __n];
+
+      __gnu_parallel::__binder2nd<_Compare, _ValueType, _ValueType, bool>
+        __pred(__comp, __pivot);
+      _DifferenceType __split = __parallel_partition(__begin, __end,
+						     __pred, __num_threads);
+
+      for (_DifferenceType __s = 0; __s < __num_samples; ++__s)
+	__samples[__s].~_ValueType();
+      ::operator delete(__samples);
+
+      return __split;
+    }
+
+  /** @brief Unbalanced quicksort conquer step.
+   *  @param __begin Begin iterator of subsequence.
+   *  @param __end End iterator of subsequence.
+   *  @param __comp Comparator.
+   *  @param __num_threads Number of threads that are allowed to work on
+   *  this part.
+   */
+  template<typename _RAIter, typename _Compare>
+    void
+    __parallel_sort_qs_conquer(_RAIter __begin, _RAIter __end,
+			       _Compare __comp,
+			       _ThreadIndex __num_threads)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      if (__num_threads <= 1)
+        {
+          __gnu_sequential::sort(__begin, __end, __comp);
+          return;
+        }
+
+      _DifferenceType __n = __end - __begin, __pivot_rank;
+
+      if (__n <= 1)
+        return;
+
+      _ThreadIndex __num_threads_left;
+
+      if ((__num_threads % 2) == 1)
+        __num_threads_left = __num_threads / 2 + 1;
+      else
+        __num_threads_left = __num_threads / 2;
+
+      __pivot_rank = __n * __num_threads_left / __num_threads;
+
+      _DifferenceType __split = __parallel_sort_qs_divide
+	(__begin, __end, __comp, __pivot_rank,
+	 _Settings::get().sort_qs_num_samples_preset, __num_threads);
+
+#pragma omp parallel sections num_threads(2)
+      {
+#pragma omp section
+        __parallel_sort_qs_conquer(__begin, __begin + __split,
+				   __comp, __num_threads_left);
+#pragma omp section
+        __parallel_sort_qs_conquer(__begin + __split, __end,
+				   __comp, __num_threads - __num_threads_left);
+      }
+    }
+
+
+  /** @brief Unbalanced quicksort main call.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator input sequence, ignored.
+   *  @param __comp Comparator.
+   *  @param __num_threads Number of threads that are allowed to work on
+   *  this part.
+   */
+  template<typename _RAIter, typename _Compare>
+    void
+    __parallel_sort_qs(_RAIter __begin, _RAIter __end,
+		       _Compare __comp,
+		       _ThreadIndex __num_threads)
+    {
+      _GLIBCXX_CALL(__n)
+
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _DifferenceType __n = __end - __begin;
+
+      // At least one element per processor.
+      if (__num_threads > __n)
+        __num_threads = static_cast<_ThreadIndex>(__n);
+
+      __parallel_sort_qs_conquer(
+        __begin, __begin + __n, __comp, __num_threads);
+    }
+
+} //namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_QUICKSORT_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/random_number.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/random_number.h
new file mode 100644
index 0000000..c39f15e
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/random_number.h
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/random_number.h
+ *  @brief Random number generator based on the Mersenne twister.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_RANDOM_NUMBER_H
+#define _GLIBCXX_PARALLEL_RANDOM_NUMBER_H 1
+
+#include <parallel/types.h>
+#include <tr1/random>
+#include <limits>
+
+namespace __gnu_parallel
+{
+  /** @brief Random number generator, based on the Mersenne twister. */
+  class _RandomNumber
+  {
+  private:
+    std::tr1::mt19937   _M_mt;
+    uint64_t            _M_supremum;
+    uint64_t            _M_rand_sup;
+    double              _M_supremum_reciprocal;
+    double              _M_rand_sup_reciprocal;
+
+    // Assumed to be twice as long as the usual random number.
+    uint64_t              __cache;
+
+    // Bit results.
+    int __bits_left;
+    
+    static uint32_t
+    __scale_down(uint64_t __x,
+#if _GLIBCXX_SCALE_DOWN_FPU
+               uint64_t /*_M_supremum*/, double _M_supremum_reciprocal)
+#else
+               uint64_t _M_supremum, double /*_M_supremum_reciprocal*/)
+#endif
+        {
+#if _GLIBCXX_SCALE_DOWN_FPU
+          return uint32_t(__x * _M_supremum_reciprocal);
+#else
+          return static_cast<uint32_t>(__x % _M_supremum);
+#endif
+        }
+
+  public:
+    /** @brief Default constructor. Seed with 0. */
+    _RandomNumber()
+    : _M_mt(0), _M_supremum(0x100000000ULL),
+      _M_rand_sup(1ULL << std::numeric_limits<uint32_t>::digits),
+      _M_supremum_reciprocal(double(_M_supremum) / double(_M_rand_sup)),
+      _M_rand_sup_reciprocal(1.0 / double(_M_rand_sup)),
+      __cache(0), __bits_left(0) { }
+
+    /** @brief Constructor.
+     *  @param __seed Random __seed.
+     *  @param _M_supremum Generate integer random numbers in the
+     *                  interval @c [0,_M_supremum). */
+    _RandomNumber(uint32_t __seed, uint64_t _M_supremum = 0x100000000ULL)
+    : _M_mt(__seed), _M_supremum(_M_supremum),
+      _M_rand_sup(1ULL << std::numeric_limits<uint32_t>::digits),
+      _M_supremum_reciprocal(double(_M_supremum) / double(_M_rand_sup)),
+      _M_rand_sup_reciprocal(1.0 / double(_M_rand_sup)),
+      __cache(0), __bits_left(0) { }
+
+    /** @brief Generate unsigned random 32-bit integer. */
+    uint32_t
+    operator()()
+    { return __scale_down(_M_mt(), _M_supremum, _M_supremum_reciprocal); }
+
+    /** @brief Generate unsigned random 32-bit integer in the
+        interval @c [0,local_supremum). */
+    uint32_t
+    operator()(uint64_t local_supremum)
+    {
+      return __scale_down(_M_mt(), local_supremum,
+                        double(local_supremum * _M_rand_sup_reciprocal));
+    }
+
+    /** @brief Generate a number of random bits, run-time parameter.
+     *  @param bits Number of bits to generate. */
+    unsigned long
+    __genrand_bits(int __bits)
+    {
+      unsigned long __res = __cache & ((1 << __bits) - 1);
+      __cache = __cache >> __bits;
+      __bits_left -= __bits;
+      if (__bits_left < 32)
+        {
+          __cache |= ((uint64_t(_M_mt())) << __bits_left);
+          __bits_left += 32;
+        }
+      return __res;
+    }
+};
+
+} // namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_RANDOM_NUMBER_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/random_shuffle.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/random_shuffle.h
new file mode 100644
index 0000000..c3967c2
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/random_shuffle.h
@@ -0,0 +1,533 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/random_shuffle.h
+ *  @brief Parallel implementation of std::random_shuffle().
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_RANDOM_SHUFFLE_H
+#define _GLIBCXX_PARALLEL_RANDOM_SHUFFLE_H 1
+
+#include <limits>
+#include <bits/stl_numeric.h>
+#include <parallel/parallel.h>
+#include <parallel/random_number.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Type to hold the index of a bin.
+    *
+    *  Since many variables of this type are allocated, it should be
+    *  chosen as small as possible.
+    */
+  typedef unsigned short _BinIndex;
+
+  /** @brief Data known to every thread participating in
+      __gnu_parallel::__parallel_random_shuffle(). */
+  template<typename _RAIter>
+    struct _DRandomShufflingGlobalData
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      /** @brief Begin iterator of the __source. */
+      _RAIter& _M_source;
+
+      /** @brief Temporary arrays for each thread. */
+      _ValueType** _M_temporaries;
+
+      /** @brief Two-dimensional array to hold the thread-bin distribution.
+       *
+       *  Dimensions (_M_num_threads + 1) __x (_M_num_bins + 1). */
+      _DifferenceType** _M_dist;
+
+      /** @brief Start indexes of the threads' __chunks. */
+      _DifferenceType* _M_starts;
+
+      /** @brief Number of the thread that will further process the
+          corresponding bin. */
+      _ThreadIndex* _M_bin_proc;
+
+      /** @brief Number of bins to distribute to. */
+      int _M_num_bins;
+
+      /** @brief Number of bits needed to address the bins. */
+      int _M_num_bits;
+
+      /** @brief Constructor. */
+      _DRandomShufflingGlobalData(_RAIter& __source)
+      : _M_source(__source) { }
+    };
+
+  /** @brief Local data for a thread participating in
+      __gnu_parallel::__parallel_random_shuffle().
+    */
+  template<typename _RAIter, typename _RandomNumberGenerator>
+    struct _DRSSorterPU
+    {
+      /** @brief Number of threads participating in total. */
+      int _M_num_threads;
+
+      /** @brief Begin index for bins taken care of by this thread. */
+      _BinIndex _M_bins_begin;
+
+      /** @brief End index for bins taken care of by this thread. */
+      _BinIndex __bins_end;
+
+      /** @brief Random _M_seed for this thread. */
+      uint32_t _M_seed;
+
+      /** @brief Pointer to global data. */
+      _DRandomShufflingGlobalData<_RAIter>* _M_sd;
+    };
+
+  /** @brief Generate a random number in @c [0,2^__logp).
+    *  @param __logp Logarithm (basis 2) of the upper range __bound.
+    *  @param __rng Random number generator to use.
+    */
+  template<typename _RandomNumberGenerator>
+    inline int
+    __random_number_pow2(int __logp, _RandomNumberGenerator& __rng)
+    { return __rng.__genrand_bits(__logp); }
+
+  /** @brief Random shuffle code executed by each thread.
+    *  @param __pus Array of thread-local data records. */
+  template<typename _RAIter, typename _RandomNumberGenerator>
+    void 
+    __parallel_random_shuffle_drs_pu(_DRSSorterPU<_RAIter,
+				     _RandomNumberGenerator>* __pus)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _ThreadIndex __iam = omp_get_thread_num();
+      _DRSSorterPU<_RAIter, _RandomNumberGenerator>* __d = &__pus[__iam];
+      _DRandomShufflingGlobalData<_RAIter>* __sd = __d->_M_sd;
+
+      // Indexing: _M_dist[bin][processor]
+      _DifferenceType __length = (__sd->_M_starts[__iam + 1]
+				  - __sd->_M_starts[__iam]);
+      _BinIndex* __oracles = new _BinIndex[__length];
+      _DifferenceType* __dist = new _DifferenceType[__sd->_M_num_bins + 1];
+      _BinIndex* __bin_proc = new _BinIndex[__sd->_M_num_bins];
+      _ValueType** __temporaries = new _ValueType*[__d->_M_num_threads];
+
+      // Compute oracles and count appearances.
+      for (_BinIndex __b = 0; __b < __sd->_M_num_bins + 1; ++__b)
+	__dist[__b] = 0;
+      int __num_bits = __sd->_M_num_bits;
+
+      _RandomNumber __rng(__d->_M_seed);
+
+      // First main loop.
+      for (_DifferenceType __i = 0; __i < __length; ++__i)
+	{
+          _BinIndex __oracle = __random_number_pow2(__num_bits, __rng);
+          __oracles[__i] = __oracle;
+
+          // To allow prefix (partial) sum.
+          ++(__dist[__oracle + 1]);
+	}
+
+      for (_BinIndex __b = 0; __b < __sd->_M_num_bins + 1; ++__b)
+	__sd->_M_dist[__b][__iam + 1] = __dist[__b];
+
+#     pragma omp barrier
+
+#     pragma omp single
+      {
+	// Sum up bins, __sd->_M_dist[__s + 1][__d->_M_num_threads] now
+	// contains the total number of items in bin __s
+	for (_BinIndex __s = 0; __s < __sd->_M_num_bins; ++__s)
+          __gnu_sequential::partial_sum(__sd->_M_dist[__s + 1],
+					__sd->_M_dist[__s + 1]
+					+ __d->_M_num_threads + 1,
+					__sd->_M_dist[__s + 1]);
+      }
+
+#     pragma omp barrier
+
+      _SequenceIndex __offset = 0, __global_offset = 0;
+      for (_BinIndex __s = 0; __s < __d->_M_bins_begin; ++__s)
+	__global_offset += __sd->_M_dist[__s + 1][__d->_M_num_threads];
+
+#     pragma omp barrier
+
+      for (_BinIndex __s = __d->_M_bins_begin; __s < __d->__bins_end; ++__s)
+	{
+          for (int __t = 0; __t < __d->_M_num_threads + 1; ++__t)
+            __sd->_M_dist[__s + 1][__t] += __offset;
+          __offset = __sd->_M_dist[__s + 1][__d->_M_num_threads];
+	}
+
+      __sd->_M_temporaries[__iam] = static_cast<_ValueType*>
+	(::operator new(sizeof(_ValueType) * __offset));
+
+#     pragma omp barrier
+
+      // Draw local copies to avoid false sharing.
+      for (_BinIndex __b = 0; __b < __sd->_M_num_bins + 1; ++__b)
+	__dist[__b] = __sd->_M_dist[__b][__iam];
+      for (_BinIndex __b = 0; __b < __sd->_M_num_bins; ++__b)
+	__bin_proc[__b] = __sd->_M_bin_proc[__b];
+      for (_ThreadIndex __t = 0; __t < __d->_M_num_threads; ++__t)
+	__temporaries[__t] = __sd->_M_temporaries[__t];
+
+      _RAIter __source = __sd->_M_source;
+      _DifferenceType __start = __sd->_M_starts[__iam];
+
+      // Distribute according to oracles, second main loop.
+      for (_DifferenceType __i = 0; __i < __length; ++__i)
+	{
+          _BinIndex __target_bin = __oracles[__i];
+          _ThreadIndex __target_p = __bin_proc[__target_bin];
+
+          // Last column [__d->_M_num_threads] stays unchanged.
+	  ::new(&(__temporaries[__target_p][__dist[__target_bin + 1]++]))
+              _ValueType(*(__source + __i + __start));
+	}
+
+      delete[] __oracles;
+      delete[] __dist;
+      delete[] __bin_proc;
+      delete[] __temporaries;
+
+#     pragma omp barrier
+
+      // Shuffle bins internally.
+      for (_BinIndex __b = __d->_M_bins_begin; __b < __d->__bins_end; ++__b)
+	{
+          _ValueType* __begin =
+	    (__sd->_M_temporaries[__iam]
+	     + (__b == __d->_M_bins_begin
+		? 0 : __sd->_M_dist[__b][__d->_M_num_threads])),
+	    *__end = (__sd->_M_temporaries[__iam]
+		      + __sd->_M_dist[__b + 1][__d->_M_num_threads]);
+
+          __sequential_random_shuffle(__begin, __end, __rng);
+          std::copy(__begin, __end, __sd->_M_source + __global_offset
+		    + (__b == __d->_M_bins_begin
+		       ? 0 : __sd->_M_dist[__b][__d->_M_num_threads]));
+	}
+
+      for (_SequenceIndex __i = 0; __i < __offset; ++__i)
+	__sd->_M_temporaries[__iam][__i].~_ValueType();
+      ::operator delete(__sd->_M_temporaries[__iam]);
+    }
+
+  /** @brief Round up to the next greater power of 2.
+    *  @param __x _Integer to round up */
+  template<typename _Tp>
+    _Tp 
+    __round_up_to_pow2(_Tp __x)
+    {
+      if (__x <= 1)
+	return 1;
+      else
+	return (_Tp)1 << (__rd_log2(__x - 1) + 1);
+    }
+
+  /** @brief Main parallel random shuffle step.
+    *  @param __begin Begin iterator of sequence.
+    *  @param __end End iterator of sequence.
+    *  @param __n Length of sequence.
+    *  @param __num_threads Number of threads to use.
+    *  @param __rng Random number generator to use.
+    */
+  template<typename _RAIter, typename _RandomNumberGenerator>
+    void
+    __parallel_random_shuffle_drs(_RAIter __begin, _RAIter __end,
+				  typename std::iterator_traits
+				  <_RAIter>::difference_type __n,
+				  _ThreadIndex __num_threads,
+				  _RandomNumberGenerator& __rng)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _GLIBCXX_CALL(__n)
+
+      const _Settings& __s = _Settings::get();
+
+      if (__num_threads > __n)
+	__num_threads = static_cast<_ThreadIndex>(__n);
+
+      _BinIndex __num_bins, __num_bins_cache;
+
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1
+      // Try the L1 cache first.
+
+      // Must fit into L1.
+      __num_bins_cache =
+	std::max<_DifferenceType>(1, __n / (__s.L1_cache_size_lb
+					    / sizeof(_ValueType)));
+      __num_bins_cache = __round_up_to_pow2(__num_bins_cache);
+
+      // No more buckets than TLB entries, power of 2
+      // Power of 2 and at least one element per bin, at most the TLB size.
+      __num_bins = std::min<_DifferenceType>(__n, __num_bins_cache);
+
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB
+      // 2 TLB entries needed per bin.
+      __num_bins = std::min<_DifferenceType>(__s.TLB_size / 2, __num_bins);
+#endif
+      __num_bins = __round_up_to_pow2(__num_bins);
+
+      if (__num_bins < __num_bins_cache)
+	{
+#endif
+          // Now try the L2 cache
+          // Must fit into L2
+          __num_bins_cache = static_cast<_BinIndex>
+	    (std::max<_DifferenceType>(1, __n / (__s.L2_cache_size
+						 / sizeof(_ValueType))));
+          __num_bins_cache = __round_up_to_pow2(__num_bins_cache);
+
+          // No more buckets than TLB entries, power of 2.
+          __num_bins = static_cast<_BinIndex>
+	    (std::min(__n, static_cast<_DifferenceType>(__num_bins_cache)));
+          // Power of 2 and at least one element per bin, at most the TLB size.
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB
+          // 2 TLB entries needed per bin.
+          __num_bins = std::min(static_cast<_DifferenceType>(__s.TLB_size / 2),
+				__num_bins);
+#endif
+            __num_bins = __round_up_to_pow2(__num_bins);
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1
+	}
+#endif
+
+      __num_bins = __round_up_to_pow2(
+                        std::max<_BinIndex>(__num_threads, __num_bins));
+
+      if (__num_threads <= 1)
+      {
+        _RandomNumber __derived_rng(
+                            __rng(std::numeric_limits<uint32_t>::max()));
+	__sequential_random_shuffle(__begin, __end, __derived_rng);
+        return;
+      }
+
+      _DRandomShufflingGlobalData<_RAIter> __sd(__begin);
+      _DRSSorterPU<_RAIter, _RandomNumber >* __pus;
+      _DifferenceType* __starts;
+
+#     pragma omp parallel num_threads(__num_threads)
+      {
+	_ThreadIndex __num_threads = omp_get_num_threads();
+#       pragma omp single
+	{
+	  __pus = new _DRSSorterPU<_RAIter, _RandomNumber>[__num_threads];
+	  
+	  __sd._M_temporaries = new _ValueType*[__num_threads];
+	  __sd._M_dist = new _DifferenceType*[__num_bins + 1];
+	  __sd._M_bin_proc = new _ThreadIndex[__num_bins];
+	  for (_BinIndex __b = 0; __b < __num_bins + 1; ++__b)
+	    __sd._M_dist[__b] = new _DifferenceType[__num_threads + 1];
+	  for (_BinIndex __b = 0; __b < (__num_bins + 1); ++__b)
+	    {
+	      __sd._M_dist[0][0] = 0;
+	      __sd._M_dist[__b][0] = 0;
+	    }
+	  __starts = __sd._M_starts = new _DifferenceType[__num_threads + 1];
+	  int __bin_cursor = 0;
+	  __sd._M_num_bins = __num_bins;
+	  __sd._M_num_bits = __rd_log2(__num_bins);
+
+	  _DifferenceType __chunk_length = __n / __num_threads,
+	                         __split = __n % __num_threads,
+	                         __start = 0;
+	  _DifferenceType __bin_chunk_length = __num_bins / __num_threads,
+	                         __bin_split = __num_bins % __num_threads;
+	  for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+	    {
+	      __starts[__i] = __start;
+	      __start += (__i < __split
+			  ? (__chunk_length + 1) : __chunk_length);
+	      int __j = __pus[__i]._M_bins_begin = __bin_cursor;
+
+	      // Range of bins for this processor.
+	      __bin_cursor += (__i < __bin_split
+			       ? (__bin_chunk_length + 1)
+			       : __bin_chunk_length);
+	      __pus[__i].__bins_end = __bin_cursor;
+	      for (; __j < __bin_cursor; ++__j)
+		__sd._M_bin_proc[__j] = __i;
+	      __pus[__i]._M_num_threads = __num_threads;
+	      __pus[__i]._M_seed = __rng(std::numeric_limits<uint32_t>::max());
+	      __pus[__i]._M_sd = &__sd;
+	    }
+	  __starts[__num_threads] = __start;
+	} //single
+          // Now shuffle in parallel.
+	__parallel_random_shuffle_drs_pu(__pus);
+      }  // parallel
+
+      delete[] __starts;
+      delete[] __sd._M_bin_proc;
+      for (int __s = 0; __s < (__num_bins + 1); ++__s)
+	delete[] __sd._M_dist[__s];
+      delete[] __sd._M_dist;
+      delete[] __sd._M_temporaries;
+
+      delete[] __pus;
+    }
+
+  /** @brief Sequential cache-efficient random shuffle.
+   *  @param __begin Begin iterator of sequence.
+   *  @param __end End iterator of sequence.
+   *  @param __rng Random number generator to use.
+   */
+  template<typename _RAIter, typename _RandomNumberGenerator>
+    void
+    __sequential_random_shuffle(_RAIter __begin, _RAIter __end,
+				_RandomNumberGenerator& __rng)
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _DifferenceType __n = __end - __begin;
+      const _Settings& __s = _Settings::get();
+
+      _BinIndex __num_bins, __num_bins_cache;
+
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1
+      // Try the L1 cache first, must fit into L1.
+      __num_bins_cache = std::max<_DifferenceType>
+	(1, __n / (__s.L1_cache_size_lb / sizeof(_ValueType)));
+      __num_bins_cache = __round_up_to_pow2(__num_bins_cache);
+
+      // No more buckets than TLB entries, power of 2
+      // Power of 2 and at least one element per bin, at most the TLB size
+      __num_bins = std::min(__n, (_DifferenceType)__num_bins_cache);
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB
+      // 2 TLB entries needed per bin
+      __num_bins = std::min((_DifferenceType)__s.TLB_size / 2, __num_bins);
+#endif
+      __num_bins = __round_up_to_pow2(__num_bins);
+
+      if (__num_bins < __num_bins_cache)
+	{
+#endif
+          // Now try the L2 cache, must fit into L2.
+          __num_bins_cache = static_cast<_BinIndex>
+	    (std::max<_DifferenceType>(1, __n / (__s.L2_cache_size
+						 / sizeof(_ValueType))));
+          __num_bins_cache = __round_up_to_pow2(__num_bins_cache);
+
+          // No more buckets than TLB entries, power of 2
+          // Power of 2 and at least one element per bin, at most the TLB size.
+          __num_bins = static_cast<_BinIndex>
+	    (std::min(__n, static_cast<_DifferenceType>(__num_bins_cache)));
+
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_TLB
+          // 2 TLB entries needed per bin
+          __num_bins = std::min<_DifferenceType>(__s.TLB_size / 2, __num_bins);
+#endif
+          __num_bins = __round_up_to_pow2(__num_bins);
+#if _GLIBCXX_RANDOM_SHUFFLE_CONSIDER_L1
+	}
+#endif
+
+      int __num_bits = __rd_log2(__num_bins);
+
+      if (__num_bins > 1)
+	{
+          _ValueType* __target =
+	    static_cast<_ValueType*>(::operator new(sizeof(_ValueType) * __n));
+          _BinIndex* __oracles = new _BinIndex[__n];
+          _DifferenceType* __dist0 = new _DifferenceType[__num_bins + 1],
+                	 * __dist1 = new _DifferenceType[__num_bins + 1];
+
+          for (int __b = 0; __b < __num_bins + 1; ++__b)
+            __dist0[__b] = 0;
+
+          _RandomNumber __bitrng(__rng(0xFFFFFFFF));
+
+          for (_DifferenceType __i = 0; __i < __n; ++__i)
+            {
+              _BinIndex __oracle = __random_number_pow2(__num_bits, __bitrng);
+              __oracles[__i] = __oracle;
+
+              // To allow prefix (partial) sum.
+              ++(__dist0[__oracle + 1]);
+            }
+
+          // Sum up bins.
+          __gnu_sequential::partial_sum(__dist0, __dist0 + __num_bins + 1,
+					__dist0);
+
+          for (int __b = 0; __b < __num_bins + 1; ++__b)
+            __dist1[__b] = __dist0[__b];
+
+          // Distribute according to oracles.
+          for (_DifferenceType __i = 0; __i < __n; ++__i)
+            ::new(&(__target[(__dist0[__oracles[__i]])++])) 
+		_ValueType(*(__begin + __i));
+
+          for (int __b = 0; __b < __num_bins; ++__b)
+	    __sequential_random_shuffle(__target + __dist1[__b],
+					__target + __dist1[__b + 1], __rng);
+
+          // Copy elements back.
+          std::copy(__target, __target + __n, __begin);
+
+          delete[] __dist0;
+          delete[] __dist1;
+          delete[] __oracles;
+	  
+	  for (_DifferenceType __i = 0; __i < __n; ++__i)
+	    __target[__i].~_ValueType();
+          ::operator delete(__target);
+	}
+      else
+	__gnu_sequential::random_shuffle(__begin, __end, __rng);
+    }
+
+  /** @brief Parallel random public call.
+   *  @param __begin Begin iterator of sequence.
+   *  @param __end End iterator of sequence.
+   *  @param __rng Random number generator to use.
+   */
+  template<typename _RAIter, typename _RandomNumberGenerator>
+    inline void
+    __parallel_random_shuffle(_RAIter __begin, _RAIter __end,
+			      _RandomNumberGenerator __rng = _RandomNumber())
+    {
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      _DifferenceType __n = __end - __begin;
+      __parallel_random_shuffle_drs(__begin, __end, __n,
+				    __get_max_threads(), __rng);
+    }
+}
+
+#endif /* _GLIBCXX_PARALLEL_RANDOM_SHUFFLE_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/search.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/search.h
new file mode 100644
index 0000000..9709925
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/search.h
@@ -0,0 +1,172 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/search.h
+ *  @brief Parallel implementation base for std::search() and
+ *  std::search_n().
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_SEARCH_H
+#define _GLIBCXX_PARALLEL_SEARCH_H 1
+
+#include <bits/stl_algobase.h>
+
+#include <parallel/parallel.h>
+#include <parallel/equally_split.h>
+
+namespace __gnu_parallel
+{
+  /**
+   *  @brief Precalculate __advances for Knuth-Morris-Pratt algorithm.
+   *  @param __elements Begin iterator of sequence to search for.
+   *  @param __length Length of sequence to search for.
+   *  @param __advances Returned __offsets. 
+   */
+  template<typename _RAIter, typename _DifferenceTp>
+    void
+    __calc_borders(_RAIter __elements, _DifferenceTp __length, 
+		   _DifferenceTp* __off)
+    {
+      typedef _DifferenceTp _DifferenceType;
+
+      __off[0] = -1;
+      if (__length > 1)
+	__off[1] = 0;
+      _DifferenceType __k = 0;
+      for (_DifferenceType __j = 2; __j <= __length; __j++)
+	{
+          while ((__k >= 0) && !(__elements[__k] == __elements[__j-1]))
+            __k = __off[__k];
+          __off[__j] = ++__k;
+	}
+    }
+
+  // Generic parallel find algorithm (requires random access iterator).
+
+  /** @brief Parallel std::search.
+   *  @param __begin1 Begin iterator of first sequence.
+   *  @param __end1 End iterator of first sequence.
+   *  @param __begin2 Begin iterator of second sequence.
+   *  @param __end2 End iterator of second sequence.
+   *  @param __pred Find predicate.
+   *  @return Place of finding in first sequences. */
+  template<typename __RAIter1,
+           typename __RAIter2,
+           typename _Pred>
+    __RAIter1
+    __search_template(__RAIter1 __begin1, __RAIter1 __end1,
+		      __RAIter2 __begin2, __RAIter2 __end2,
+		      _Pred __pred)
+    {
+      typedef std::iterator_traits<__RAIter1> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _GLIBCXX_CALL((__end1 - __begin1) + (__end2 - __begin2));
+
+      _DifferenceType __pattern_length = __end2 - __begin2;
+
+      // Pattern too short.
+      if(__pattern_length <= 0)
+	return __end1;
+
+      // Last point to start search.
+      _DifferenceType __input_length = (__end1 - __begin1) - __pattern_length;
+
+      // Where is first occurrence of pattern? defaults to end.
+      _DifferenceType __result = (__end1 - __begin1);
+      _DifferenceType *__splitters;
+
+      // Pattern too long.
+      if (__input_length < 0)
+	return __end1;
+
+      omp_lock_t __result_lock;
+      omp_init_lock(&__result_lock);
+
+      _ThreadIndex __num_threads = std::max<_DifferenceType>
+	(1, std::min<_DifferenceType>(__input_length,
+				      __get_max_threads()));
+
+      _DifferenceType __advances[__pattern_length];
+      __calc_borders(__begin2, __pattern_length, __advances);
+
+#     pragma omp parallel num_threads(__num_threads)
+      {
+#       pragma omp single
+	{
+	  __num_threads = omp_get_num_threads();
+	  __splitters = new _DifferenceType[__num_threads + 1];
+	  equally_split(__input_length, __num_threads, __splitters);
+	}
+
+	_ThreadIndex __iam = omp_get_thread_num();
+
+	_DifferenceType __start = __splitters[__iam],
+	                 __stop = __splitters[__iam + 1];
+
+	_DifferenceType __pos_in_pattern = 0;
+	bool __found_pattern = false;
+
+	while (__start <= __stop && !__found_pattern)
+	  {
+	    // Get new value of result.
+#pragma omp flush(__result)
+	    // No chance for this thread to find first occurrence.
+	    if (__result < __start)
+	      break;
+	    while (__pred(__begin1[__start + __pos_in_pattern],
+			  __begin2[__pos_in_pattern]))
+	      {
+		++__pos_in_pattern;
+		if (__pos_in_pattern == __pattern_length)
+		  {
+		    // Found new candidate for result.
+		    omp_set_lock(&__result_lock);
+		    __result = std::min(__result, __start);
+		    omp_unset_lock(&__result_lock);
+
+		    __found_pattern = true;
+		    break;
+		  }
+	      }
+	    // Make safe jump.
+	    __start += (__pos_in_pattern - __advances[__pos_in_pattern]);
+	    __pos_in_pattern = (__advances[__pos_in_pattern] < 0
+				? 0 : __advances[__pos_in_pattern]);
+	  }
+      } //parallel
+
+      omp_destroy_lock(&__result_lock);
+
+      delete[] __splitters;
+      
+      // Return iterator on found element.
+      return (__begin1 + __result);
+    }
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_SEARCH_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/set_operations.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/set_operations.h
new file mode 100644
index 0000000..f552c1d
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/set_operations.h
@@ -0,0 +1,529 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file parallel/set_operations.h
+ * @brief Parallel implementations of set operations for random-access
+ * iterators.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Marius Elvert and Felix Bondarenko.
+
+#ifndef _GLIBCXX_PARALLEL_SET_OPERATIONS_H
+#define _GLIBCXX_PARALLEL_SET_OPERATIONS_H 1
+
+#include <omp.h>
+
+#include <parallel/settings.h>
+#include <parallel/multiseq_selection.h>
+
+namespace __gnu_parallel
+{
+  template<typename _IIter, typename _OutputIterator>
+    _OutputIterator
+    __copy_tail(std::pair<_IIter, _IIter> __b,
+		std::pair<_IIter, _IIter> __e, _OutputIterator __r)
+    {
+      if (__b.first != __e.first)
+	{
+          do
+            {
+              *__r++ = *__b.first++;
+            }
+          while (__b.first != __e.first);
+	}
+      else
+	{
+          while (__b.second != __e.second)
+            *__r++ = *__b.second++;
+	}
+      return __r;
+    }
+
+  template<typename _IIter,
+           typename _OutputIterator,
+           typename _Compare>
+    struct __symmetric_difference_func
+    {
+      typedef std::iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      typedef typename std::pair<_IIter, _IIter> _IteratorPair;
+
+      __symmetric_difference_func(_Compare __comp) : _M_comp(__comp) {}
+
+      _Compare _M_comp;
+
+      _OutputIterator
+      _M_invoke(_IIter __a, _IIter __b, _IIter __c, _IIter __d,
+		_OutputIterator __r) const
+      {
+	while (__a != __b && __c != __d)
+          {
+            if (_M_comp(*__a, *__c))
+              {
+        	*__r = *__a;
+        	++__a;
+        	++__r;
+              }
+            else if (_M_comp(*__c, *__a))
+              {
+        	*__r = *__c;
+        	++__c;
+        	++__r;
+              }
+            else
+              {
+        	++__a;
+        	++__c;
+              }
+          }
+	return std::copy(__c, __d, std::copy(__a, __b, __r));
+      }
+
+      _DifferenceType
+      __count(_IIter __a, _IIter __b, _IIter __c, _IIter __d) const
+      {
+	_DifferenceType __counter = 0;
+
+	while (__a != __b && __c != __d)
+          {
+            if (_M_comp(*__a, *__c))
+              {
+        	++__a;
+        	++__counter;
+              }
+            else if (_M_comp(*__c, *__a))
+              {
+        	++__c;
+        	++__counter;
+              }
+            else
+              {
+        	++__a;
+        	++__c;
+              }
+          }
+
+	return __counter + (__b - __a) + (__d - __c);
+      }
+
+      _OutputIterator
+      __first_empty(_IIter __c, _IIter __d, _OutputIterator __out) const
+      { return std::copy(__c, __d, __out); }
+
+      _OutputIterator
+      __second_empty(_IIter __a, _IIter __b, _OutputIterator __out) const
+      { return std::copy(__a, __b, __out); }
+    };
+
+
+  template<typename _IIter,
+           typename _OutputIterator,
+           typename _Compare>
+    struct __difference_func
+    {
+      typedef std::iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      typedef typename std::pair<_IIter, _IIter> _IteratorPair;
+
+      __difference_func(_Compare __comp) : _M_comp(__comp) {}
+
+      _Compare _M_comp;
+
+      _OutputIterator
+      _M_invoke(_IIter __a, _IIter __b, _IIter __c, _IIter __d,
+		_OutputIterator __r) const
+      {
+	while (__a != __b && __c != __d)
+          {
+            if (_M_comp(*__a, *__c))
+              {
+        	*__r = *__a;
+        	++__a;
+        	++__r;
+              }
+            else if (_M_comp(*__c, *__a))
+              { ++__c; }
+            else
+              {
+        	++__a;
+        	++__c;
+              }
+          }
+	return std::copy(__a, __b, __r);
+      }
+
+      _DifferenceType
+      __count(_IIter __a, _IIter __b,
+	      _IIter __c, _IIter __d) const
+      {
+	_DifferenceType __counter = 0;
+
+	while (__a != __b && __c != __d)
+          {
+            if (_M_comp(*__a, *__c))
+              {
+        	++__a;
+        	++__counter;
+              }
+            else if (_M_comp(*__c, *__a))
+              { ++__c; }
+            else
+              { ++__a; ++__c; }
+          }
+
+	return __counter + (__b - __a);
+      }
+
+      _OutputIterator
+      __first_empty(_IIter, _IIter, _OutputIterator __out) const
+      { return __out; }
+
+      _OutputIterator
+      __second_empty(_IIter __a, _IIter __b, _OutputIterator __out) const
+      { return std::copy(__a, __b, __out); }
+    };
+
+
+  template<typename _IIter,
+           typename _OutputIterator,
+           typename _Compare>
+    struct __intersection_func
+    {
+      typedef std::iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      typedef typename std::pair<_IIter, _IIter> _IteratorPair;
+
+      __intersection_func(_Compare __comp) : _M_comp(__comp) {}
+
+      _Compare _M_comp;
+
+      _OutputIterator
+      _M_invoke(_IIter __a, _IIter __b, _IIter __c, _IIter __d,
+		_OutputIterator __r) const
+      {
+	while (__a != __b && __c != __d)
+          {
+            if (_M_comp(*__a, *__c))
+              { ++__a; }
+            else if (_M_comp(*__c, *__a))
+              { ++__c; }
+            else
+              {
+        	*__r = *__a;
+        	++__a;
+        	++__c;
+        	++__r;
+              }
+          }
+
+	return __r;
+      }
+
+      _DifferenceType
+      __count(_IIter __a, _IIter __b, _IIter __c, _IIter __d) const
+      {
+	_DifferenceType __counter = 0;
+
+	while (__a != __b && __c != __d)
+          {
+            if (_M_comp(*__a, *__c))
+              { ++__a; }
+            else if (_M_comp(*__c, *__a))
+              { ++__c; }
+            else
+              {
+        	++__a;
+        	++__c;
+        	++__counter;
+              }
+          }
+
+	return __counter;
+      }
+
+      _OutputIterator
+      __first_empty(_IIter, _IIter, _OutputIterator __out) const
+      { return __out; }
+
+      _OutputIterator
+      __second_empty(_IIter, _IIter, _OutputIterator __out) const
+      { return __out; }
+    };
+
+  template<class _IIter, class _OutputIterator, class _Compare>
+    struct __union_func
+    {
+      typedef typename std::iterator_traits<_IIter>::difference_type
+      _DifferenceType;
+
+      __union_func(_Compare __comp) : _M_comp(__comp) {}
+
+      _Compare _M_comp;
+
+      _OutputIterator
+      _M_invoke(_IIter __a, const _IIter __b, _IIter __c,
+		const _IIter __d, _OutputIterator __r) const
+      {
+	while (__a != __b && __c != __d)
+          {
+            if (_M_comp(*__a, *__c))
+              {
+        	*__r = *__a;
+        	++__a;
+              }
+            else if (_M_comp(*__c, *__a))
+              {
+        	*__r = *__c;
+        	++__c;
+              }
+            else
+              {
+        	*__r = *__a;
+        	++__a;
+        	++__c;
+              }
+            ++__r;
+          }
+	return std::copy(__c, __d, std::copy(__a, __b, __r));
+      }
+
+      _DifferenceType
+      __count(_IIter __a, _IIter __b, _IIter __c, _IIter __d) const
+      {
+	_DifferenceType __counter = 0;
+
+	while (__a != __b && __c != __d)
+          {
+            if (_M_comp(*__a, *__c))
+              { ++__a; }
+            else if (_M_comp(*__c, *__a))
+              { ++__c; }
+            else
+              {
+        	++__a;
+        	++__c;
+              }
+            ++__counter;
+          }
+
+	__counter += (__b - __a);
+	__counter += (__d - __c);
+	return __counter;
+      }
+
+      _OutputIterator
+      __first_empty(_IIter __c, _IIter __d, _OutputIterator __out) const
+      { return std::copy(__c, __d, __out); }
+
+      _OutputIterator
+      __second_empty(_IIter __a, _IIter __b, _OutputIterator __out) const
+      { return std::copy(__a, __b, __out); }
+    };
+
+  template<typename _IIter,
+           typename _OutputIterator,
+           typename _Operation>
+    _OutputIterator
+    __parallel_set_operation(_IIter __begin1, _IIter __end1,
+			     _IIter __begin2, _IIter __end2,
+			     _OutputIterator __result, _Operation __op)
+    {
+      _GLIBCXX_CALL((__end1 - __begin1) + (__end2 - __begin2))
+
+      typedef std::iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+      typedef typename std::pair<_IIter, _IIter> _IteratorPair;
+
+      if (__begin1 == __end1)
+	return __op.__first_empty(__begin2, __end2, __result);
+
+      if (__begin2 == __end2)
+	return __op.__second_empty(__begin1, __end1, __result);
+
+      const _DifferenceType __size = (__end1 - __begin1) + (__end2 - __begin2);
+
+      const _IteratorPair __sequence[2] = { std::make_pair(__begin1, __end1),
+					    std::make_pair(__begin2, __end2) };
+      _OutputIterator __return_value = __result;
+      _DifferenceType *__borders;
+      _IteratorPair *__block_begins;
+      _DifferenceType* __lengths;
+
+      _ThreadIndex __num_threads =
+          std::min<_DifferenceType>(__get_max_threads(),
+              std::min(__end1 - __begin1, __end2 - __begin2));
+
+#     pragma omp parallel num_threads(__num_threads)
+      {
+#       pragma omp single
+	{
+	  __num_threads = omp_get_num_threads();
+
+	  __borders = new _DifferenceType[__num_threads + 2];
+	  equally_split(__size, __num_threads + 1, __borders);
+	  __block_begins = new _IteratorPair[__num_threads + 1];
+	  // Very __start.
+	  __block_begins[0] = std::make_pair(__begin1, __begin2);
+	  __lengths = new _DifferenceType[__num_threads];
+	} //single
+
+	_ThreadIndex __iam = omp_get_thread_num();
+
+	// _Result from multiseq_partition.
+	_IIter __offset[2];
+	const _DifferenceType __rank = __borders[__iam + 1];
+
+	multiseq_partition(__sequence, __sequence + 2,
+			   __rank, __offset, __op._M_comp);
+
+	// allowed to read?
+	// together
+	// *(__offset[ 0 ] - 1) == *__offset[ 1 ]
+	if (__offset[ 0 ] != __begin1 && __offset[1] != __end2
+	    && !__op._M_comp(*(__offset[0] - 1), *__offset[1])
+	    && !__op._M_comp(*__offset[1], *(__offset[0] - 1)))
+	  {
+	    // Avoid split between globally equal elements: move one to
+	    // front in first sequence.
+              --__offset[0];
+	  }
+
+	_IteratorPair __block_end = __block_begins[__iam + 1] =
+	  _IteratorPair(__offset[0], __offset[1]);
+
+	// Make sure all threads have their block_begin result written out.
+#       pragma omp barrier
+
+	_IteratorPair __block_begin = __block_begins[__iam];
+
+	// Begin working for the first block, while the others except
+	// the last start to count.
+	if (__iam == 0)
+	  {
+	    // The first thread can copy already.
+	    __lengths[ __iam ] =
+	      __op._M_invoke(__block_begin.first, __block_end.first,
+			     __block_begin.second, __block_end.second,
+			     __result) - __result;
+	  }
+	else
+	  {
+	    __lengths[ __iam ] =
+	      __op.__count(__block_begin.first, __block_end.first,
+			   __block_begin.second, __block_end.second);
+	  }
+
+	// Make sure everyone wrote their lengths.
+#       pragma omp barrier
+
+	_OutputIterator __r = __result;
+
+	if (__iam == 0)
+	  {
+	    // Do the last block.
+	    for (_ThreadIndex __i = 0; __i < __num_threads; ++__i)
+	      __r += __lengths[__i];
+
+	    __block_begin = __block_begins[__num_threads];
+
+	    // Return the result iterator of the last block.
+	    __return_value =
+	      __op._M_invoke(__block_begin.first, __end1,
+			     __block_begin.second, __end2, __r);
+
+	  }
+          else
+            {
+              for (_ThreadIndex __i = 0; __i < __iam; ++__i)
+        	__r += __lengths[ __i ];
+
+              // Reset begins for copy pass.
+              __op._M_invoke(__block_begin.first, __block_end.first,
+			     __block_begin.second, __block_end.second, __r);
+            }
+	}
+      return __return_value;
+    }
+
+  template<typename _IIter,
+           typename _OutputIterator,
+           typename _Compare>
+    inline _OutputIterator
+    __parallel_set_union(_IIter __begin1, _IIter __end1,
+			 _IIter __begin2, _IIter __end2,
+			 _OutputIterator __result, _Compare __comp)
+    {
+      return __parallel_set_operation(__begin1, __end1, __begin2, __end2,
+				      __result,
+				      __union_func< _IIter, _OutputIterator,
+				      _Compare>(__comp));
+    }
+
+  template<typename _IIter,
+           typename _OutputIterator,
+           typename _Compare>
+    inline _OutputIterator
+    __parallel_set_intersection(_IIter __begin1, _IIter __end1,
+                        	_IIter __begin2, _IIter __end2,
+                        	_OutputIterator __result, _Compare __comp)
+    {
+      return __parallel_set_operation(__begin1, __end1, __begin2, __end2,
+				      __result,
+				      __intersection_func<_IIter,
+				      _OutputIterator, _Compare>(__comp));
+    }
+
+  template<typename _IIter,
+           typename _OutputIterator,
+           typename _Compare>
+    inline _OutputIterator
+    __parallel_set_difference(_IIter __begin1, _IIter __end1,
+                              _IIter __begin2, _IIter __end2,
+                              _OutputIterator __result, _Compare __comp)
+    {
+      return __parallel_set_operation(__begin1, __end1, __begin2, __end2,
+				      __result,
+				      __difference_func<_IIter,
+				      _OutputIterator, _Compare>(__comp));
+    }
+
+  template<typename _IIter,
+           typename _OutputIterator,
+           typename _Compare>
+    inline _OutputIterator
+    __parallel_set_symmetric_difference(_IIter __begin1, _IIter __end1,
+                                	_IIter __begin2, _IIter __end2,
+                                	_OutputIterator __result,
+                                	_Compare __comp)
+    {
+      return __parallel_set_operation(__begin1, __end1, __begin2, __end2,
+				      __result,
+				      __symmetric_difference_func<_IIter,
+				      _OutputIterator, _Compare>(__comp));
+    }
+}
+
+#endif /* _GLIBCXX_PARALLEL_SET_OPERATIONS_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/settings.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/settings.h
new file mode 100644
index 0000000..5fc6a75
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/settings.h
@@ -0,0 +1,343 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/settings.h
+ *  @brief Runtime settings and tuning parameters, heuristics to decide
+ *  whether to use parallelized algorithms.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ *
+ *  @section parallelization_decision 
+ *  The decision whether to run an algorithm in parallel.
+ *
+ *  There are several ways the user can switch on and __off the parallel
+ *  execution of an algorithm, both at compile- and run-time.
+ *
+ *  Only sequential execution can be forced at compile-time.  This
+ *  reduces code size and protects code parts that have
+ *  non-thread-safe side effects.
+ *
+ *  Ultimately, forcing parallel execution at compile-time makes
+ *  sense.  Often, the sequential algorithm implementation is used as
+ *  a subroutine, so no reduction in code size can be achieved.  Also,
+ *  the machine the program is run on might have only one processor
+ *  core, so to avoid overhead, the algorithm is executed
+ *  sequentially.
+ *
+ *  To force sequential execution of an algorithm ultimately at
+ *  compile-time, the user must add the tag
+*  gnu_parallel::sequential_tag() to the end of the parameter list,
+ *  e. g.
+ *
+ *  \code
+ *  std::sort(__v.begin(), __v.end(), __gnu_parallel::sequential_tag());
+ *  \endcode
+ *
+ *  This is compatible with all overloaded algorithm variants.  No
+ *  additional code will be instantiated, at all.  The same holds for
+ *  most algorithm calls with iterators not providing random access.
+ *
+ *  If the algorithm call is not forced to be executed sequentially
+ *  at compile-time, the decision is made at run-time.
+ *  The global variable __gnu_parallel::_Settings::algorithm_strategy
+ *  is checked. _It is a tristate variable corresponding to:
+ *
+ *  a. force_sequential, meaning the sequential algorithm is executed.
+*  b. force_parallel, meaning the parallel algorithm is executed.
+*  c. heuristic
+ *
+ *  For heuristic, the parallel algorithm implementation is called
+ *  only if the input size is sufficiently large.  For most
+ *  algorithms, the input size is the (combined) length of the input
+*  sequence(__s).  The threshold can be set by the user, individually
+ *  for each algorithm.  The according variables are called
+*  gnu_parallel::_Settings::[algorithm]_minimal_n .
+ *
+ *  For some of the algorithms, there are even more tuning options,
+ *  e. g. the ability to choose from multiple algorithm variants.  See
+ *  below for details.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_SETTINGS_H
+#define _GLIBCXX_PARALLEL_SETTINGS_H 1
+
+#include <parallel/types.h>
+
+/** 
+  * @brief Determine at compile(?)-time if the parallel variant of an
+  * algorithm should be called.
+  * @param __c A condition that is convertible to bool that is overruled by
+  * __gnu_parallel::_Settings::algorithm_strategy. Usually a decision
+  * based on the input size.
+  */
+#define _GLIBCXX_PARALLEL_CONDITION(__c) \
+  (__gnu_parallel::_Settings::get().algorithm_strategy \
+    != __gnu_parallel::force_sequential \
+  && ((__gnu_parallel::__get_max_threads() > 1 && (__c)) \
+     || __gnu_parallel::_Settings::get().algorithm_strategy \
+        == __gnu_parallel::force_parallel))
+
+/*
+inline bool
+parallel_condition(bool __c)
+{
+  bool ret = false;
+  const _Settings& __s = _Settings::get();
+  if (__s.algorithm_strategy != force_seqential)
+    {
+      if (__s.algorithm_strategy == force_parallel)
+        ret = true;
+      else
+        ret = __get_max_threads() > 1 && __c;
+    }
+  return ret;
+}
+*/
+
+namespace __gnu_parallel
+{
+  /// class _Settings
+  /// Run-time settings for the parallel mode including all tunable parameters.
+  struct _Settings
+  {
+    _AlgorithmStrategy          algorithm_strategy;
+    
+    _SortAlgorithm              sort_algorithm;
+    _PartialSumAlgorithm        partial_sum_algorithm;
+    _MultiwayMergeAlgorithm     multiway_merge_algorithm;
+    _FindAlgorithm              find_algorithm;
+
+    _SplittingAlgorithm         sort_splitting;
+    _SplittingAlgorithm         merge_splitting;
+    _SplittingAlgorithm         multiway_merge_splitting;
+
+    // Per-algorithm settings.
+
+    /// Minimal input size for accumulate.
+    _SequenceIndex              accumulate_minimal_n;
+
+    /// Minimal input size for adjacent_difference.
+    unsigned int                adjacent_difference_minimal_n;
+
+    /// Minimal input size for count and count_if.
+    _SequenceIndex              count_minimal_n;
+
+    /// Minimal input size for fill.
+    _SequenceIndex              fill_minimal_n;
+
+    /// Block size increase factor for find.
+    double                      find_increasing_factor;
+
+    /// Initial block size for find.
+    _SequenceIndex              find_initial_block_size;
+
+    /// Maximal block size for find.
+    _SequenceIndex              find_maximum_block_size;
+
+    /// Start with looking for this many elements sequentially, for find.
+    _SequenceIndex              find_sequential_search_size;
+
+    /// Minimal input size for for_each.
+    _SequenceIndex              for_each_minimal_n;
+
+    /// Minimal input size for generate.
+    _SequenceIndex              generate_minimal_n;
+
+    /// Minimal input size for max_element.
+    _SequenceIndex              max_element_minimal_n;
+
+    /// Minimal input size for merge.
+    _SequenceIndex              merge_minimal_n;
+
+    /// Oversampling factor for merge.
+    unsigned int                merge_oversampling;
+
+    /// Minimal input size for min_element.
+    _SequenceIndex              min_element_minimal_n;
+
+    /// Minimal input size for multiway_merge.
+    _SequenceIndex              multiway_merge_minimal_n;
+
+    /// Oversampling factor for multiway_merge.
+    int                         multiway_merge_minimal_k;
+
+    /// Oversampling factor for multiway_merge.
+    unsigned int                multiway_merge_oversampling;
+
+    /// Minimal input size for nth_element.
+    _SequenceIndex              nth_element_minimal_n;
+
+    /// Chunk size for partition.
+    _SequenceIndex              partition_chunk_size;
+
+    /// Chunk size for partition, relative to input size.  If > 0.0,
+    /// this value overrides partition_chunk_size.
+    double                      partition_chunk_share;
+
+    /// Minimal input size for partition.
+    _SequenceIndex              partition_minimal_n;
+
+    /// Minimal input size for partial_sort.
+    _SequenceIndex              partial_sort_minimal_n;
+
+    /// Ratio for partial_sum. Assume "sum and write result" to be
+    /// this factor slower than just "sum".
+    float                       partial_sum_dilation;
+
+    /// Minimal input size for partial_sum.
+    unsigned int                partial_sum_minimal_n;
+
+    /// Minimal input size for random_shuffle.
+    unsigned int                random_shuffle_minimal_n;
+
+    /// Minimal input size for replace and replace_if.
+    _SequenceIndex              replace_minimal_n;
+
+    /// Minimal input size for set_difference.
+    _SequenceIndex              set_difference_minimal_n;
+
+    /// Minimal input size for set_intersection.
+    _SequenceIndex              set_intersection_minimal_n;
+
+    /// Minimal input size for set_symmetric_difference.
+    _SequenceIndex              set_symmetric_difference_minimal_n;
+
+    /// Minimal input size for set_union.
+    _SequenceIndex              set_union_minimal_n;
+
+    /// Minimal input size for parallel sorting.
+    _SequenceIndex              sort_minimal_n;
+
+    /// Oversampling factor for parallel std::sort (MWMS).
+    unsigned int                sort_mwms_oversampling;
+
+    /// Such many samples to take to find a good pivot (quicksort).
+    unsigned int                sort_qs_num_samples_preset;
+
+    /// Maximal subsequence __length to switch to unbalanced __base case.
+    /// Applies to std::sort with dynamically load-balanced quicksort.
+    _SequenceIndex              sort_qsb_base_case_maximal_n;
+
+    /// Minimal input size for parallel std::transform.
+    _SequenceIndex              transform_minimal_n;
+
+    /// Minimal input size for unique_copy. 
+    _SequenceIndex              unique_copy_minimal_n;
+
+    _SequenceIndex              workstealing_chunk_size;
+
+    // Hardware dependent tuning parameters.
+
+    /// size of the L1 cache in bytes (underestimation).
+    unsigned long long          L1_cache_size;
+
+    /// size of the L2 cache in bytes (underestimation).
+    unsigned long long          L2_cache_size;
+
+    /// size of the Translation Lookaside Buffer (underestimation).
+    unsigned int                TLB_size;
+
+    /// Overestimation of cache line size.  Used to avoid false
+    /// sharing, i.e. elements of different threads are at least this
+    /// amount apart.
+    unsigned int                cache_line_size;
+
+    // Statistics.
+
+    /// The number of stolen ranges in load-balanced quicksort.
+    _SequenceIndex              qsb_steals;
+
+    /// Minimal input size for search and search_n.
+    _SequenceIndex              search_minimal_n;
+
+    /// Block size scale-down factor with respect to current position.
+    float                       find_scale_factor;
+
+    /// Get the global settings.
+    _GLIBCXX_CONST static const _Settings&
+    get() throw();
+
+    /// Set the global settings.
+    static void
+    set(_Settings&) throw();
+
+    explicit 
+    _Settings() :
+            algorithm_strategy(heuristic),
+            sort_algorithm(MWMS),
+            partial_sum_algorithm(LINEAR),
+            multiway_merge_algorithm(LOSER_TREE),
+            find_algorithm(CONSTANT_SIZE_BLOCKS),
+            sort_splitting(EXACT),
+            merge_splitting(EXACT),
+            multiway_merge_splitting(EXACT),
+            accumulate_minimal_n(1000),
+            adjacent_difference_minimal_n(1000),
+            count_minimal_n(1000),
+            fill_minimal_n(1000),
+            find_increasing_factor(2.0),
+            find_initial_block_size(256),
+            find_maximum_block_size(8192),
+            find_sequential_search_size(256),
+            for_each_minimal_n(1000),
+            generate_minimal_n(1000),
+            max_element_minimal_n(1000),
+            merge_minimal_n(1000),
+            merge_oversampling(10),
+            min_element_minimal_n(1000),
+            multiway_merge_minimal_n(1000),
+            multiway_merge_minimal_k(2), multiway_merge_oversampling(10),
+            nth_element_minimal_n(1000),
+            partition_chunk_size(1000),
+            partition_chunk_share(0.0),
+            partition_minimal_n(1000),
+            partial_sort_minimal_n(1000),
+            partial_sum_dilation(1.0f),
+            partial_sum_minimal_n(1000),
+            random_shuffle_minimal_n(1000),
+            replace_minimal_n(1000),
+            set_difference_minimal_n(1000),
+            set_intersection_minimal_n(1000),
+            set_symmetric_difference_minimal_n(1000),
+            set_union_minimal_n(1000),
+            sort_minimal_n(1000),
+            sort_mwms_oversampling(10),
+            sort_qs_num_samples_preset(100),
+            sort_qsb_base_case_maximal_n(100),
+            transform_minimal_n(1000),
+            unique_copy_minimal_n(10000),
+            workstealing_chunk_size(100),
+            L1_cache_size(16 << 10),
+            L2_cache_size(256 << 10),
+            TLB_size(128),
+            cache_line_size(64),
+            qsb_steals(0),
+            search_minimal_n(1000),
+            find_scale_factor(0.01f)
+    { }
+  };
+}
+
+#endif /* _GLIBCXX_PARALLEL_SETTINGS_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/sort.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/sort.h
new file mode 100644
index 0000000..f1a163c
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/sort.h
@@ -0,0 +1,233 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/sort.h
+ *  @brief Parallel sorting algorithm switch.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PARALLEL_SORT_H
+#define _GLIBCXX_PARALLEL_SORT_H 1
+
+#include <parallel/basic_iterator.h>
+#include <parallel/features.h>
+#include <parallel/parallel.h>
+
+#if _GLIBCXX_ASSERTIONS
+#include <parallel/checkers.h>
+#endif
+
+#if _GLIBCXX_MERGESORT
+#include <parallel/multiway_mergesort.h>
+#endif
+
+#if _GLIBCXX_QUICKSORT
+#include <parallel/quicksort.h>
+#endif
+
+#if _GLIBCXX_BAL_QUICKSORT
+#include <parallel/balanced_quicksort.h>
+#endif
+
+namespace __gnu_parallel
+{
+  //prototype
+  template<bool __stable, typename _RAIter,
+           typename _Compare, typename _Parallelism>
+    void
+    __parallel_sort(_RAIter __begin, _RAIter __end,
+		    _Compare __comp, _Parallelism __parallelism);
+        
+  /** 
+   *  @brief Choose multiway mergesort, splitting variant at run-time,
+   *  for parallel sorting.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator of input sequence.
+   *  @param __comp Comparator.
+   *  @callgraph 
+   */
+  template<bool __stable, typename _RAIter, typename _Compare>
+    inline void
+    __parallel_sort(_RAIter __begin, _RAIter __end,
+		    _Compare __comp, multiway_mergesort_tag __parallelism)
+    {
+      _GLIBCXX_CALL(__end - __begin)
+
+      if(_Settings::get().sort_splitting == EXACT)
+	parallel_sort_mwms<__stable, true>
+	  (__begin, __end, __comp, __parallelism.__get_num_threads());
+      else
+	parallel_sort_mwms<__stable, false>
+	  (__begin, __end, __comp, __parallelism.__get_num_threads());
+    }
+
+  /** 
+   *  @brief Choose multiway mergesort with exact splitting,
+   *  for parallel sorting.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator of input sequence.
+   *  @param __comp Comparator.
+   *  @callgraph 
+   */
+  template<bool __stable, typename _RAIter, typename _Compare>
+    inline void
+    __parallel_sort(_RAIter __begin, _RAIter __end,
+		    _Compare __comp,
+		    multiway_mergesort_exact_tag __parallelism)
+    {
+      _GLIBCXX_CALL(__end - __begin)
+
+      parallel_sort_mwms<__stable, true>
+        (__begin, __end, __comp, __parallelism.__get_num_threads());
+    }
+
+  /** 
+   *  @brief Choose multiway mergesort with splitting by sampling,
+   *  for parallel sorting.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator of input sequence.
+   *  @param __comp Comparator.
+   *  @callgraph 
+   */
+  template<bool __stable, typename _RAIter, typename _Compare>
+    inline void
+    __parallel_sort(_RAIter __begin, _RAIter __end,
+		    _Compare __comp,
+		    multiway_mergesort_sampling_tag __parallelism)
+    {
+      _GLIBCXX_CALL(__end - __begin)
+
+      parallel_sort_mwms<__stable, false>
+      (__begin, __end, __comp, __parallelism.__get_num_threads());
+    }
+
+  /**
+   *  @brief Choose quicksort for parallel sorting.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator of input sequence.
+   *  @param __comp Comparator.
+   *  @callgraph 
+   */
+  template<bool __stable, typename _RAIter, typename _Compare>
+    inline void
+    __parallel_sort(_RAIter __begin, _RAIter __end,
+		    _Compare __comp, quicksort_tag __parallelism)
+    {
+      _GLIBCXX_CALL(__end - __begin)
+
+      _GLIBCXX_PARALLEL_ASSERT(__stable == false);
+
+      __parallel_sort_qs(__begin, __end, __comp,
+			 __parallelism.__get_num_threads());
+    }
+
+  /**
+   *  @brief Choose balanced quicksort for parallel sorting.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator of input sequence.
+   *  @param __comp Comparator.
+   *  @param __stable Sort __stable.
+   *  @callgraph 
+   */
+   template<bool __stable, typename _RAIter, typename _Compare>
+     inline void
+     __parallel_sort(_RAIter __begin, _RAIter __end,
+		     _Compare __comp, balanced_quicksort_tag __parallelism)
+     {
+       _GLIBCXX_CALL(__end - __begin)
+
+       _GLIBCXX_PARALLEL_ASSERT(__stable == false);
+
+       __parallel_sort_qsb(__begin, __end, __comp,
+			   __parallelism.__get_num_threads());
+     }
+
+  /** 
+   *  @brief Choose multiway mergesort with exact splitting,
+   *  for parallel sorting.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator of input sequence.
+   *  @param __comp Comparator.
+   *  @callgraph 
+   */
+  template<bool __stable, typename _RAIter, typename _Compare>
+    inline void
+    __parallel_sort(_RAIter __begin, _RAIter __end,
+		    _Compare __comp, default_parallel_tag __parallelism)
+    {
+      _GLIBCXX_CALL(__end - __begin)
+
+      __parallel_sort<__stable>
+	(__begin, __end, __comp,
+	 multiway_mergesort_exact_tag(__parallelism.__get_num_threads()));
+    }
+
+  /**
+   *  @brief Choose a parallel sorting algorithm.
+   *  @param __begin Begin iterator of input sequence.
+   *  @param __end End iterator of input sequence.
+   *  @param __comp Comparator.
+   *  @param __stable Sort __stable.
+   *  @callgraph 
+   */
+  template<bool __stable, typename _RAIter, typename _Compare>
+    inline void
+    __parallel_sort(_RAIter __begin, _RAIter __end,
+		    _Compare __comp, parallel_tag __parallelism)
+    {
+      _GLIBCXX_CALL(__end - __begin)
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      if (false) ;
+#if _GLIBCXX_MERGESORT
+      else if (__stable || _Settings::get().sort_algorithm == MWMS)
+        {
+          if(_Settings::get().sort_splitting == EXACT)
+            parallel_sort_mwms<__stable, true>
+              (__begin, __end, __comp, __parallelism.__get_num_threads());
+          else
+            parallel_sort_mwms<false, false>
+              (__begin, __end, __comp, __parallelism.__get_num_threads());
+        }
+#endif
+#if _GLIBCXX_QUICKSORT
+      else if (_Settings::get().sort_algorithm == QS)
+        __parallel_sort_qs(__begin, __end, __comp,
+                           __parallelism.__get_num_threads());
+#endif
+#if _GLIBCXX_BAL_QUICKSORT
+      else if (_Settings::get().sort_algorithm == QS_BALANCED)
+        __parallel_sort_qsb(__begin, __end, __comp,
+                            __parallelism.__get_num_threads());
+#endif
+      else
+        __gnu_sequential::sort(__begin, __end, __comp);
+    }
+} // end namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_SORT_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/tags.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/tags.h
new file mode 100644
index 0000000..bc47b26
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/tags.h
@@ -0,0 +1,185 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/**
+ * @file parallel/tags.h
+ * @brief Tags for compile-time selection.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_TAGS_H
+#define _GLIBCXX_PARALLEL_TAGS_H 1
+
+#include <omp.h>
+#include <parallel/types.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Forces sequential execution at compile time. */
+  struct sequential_tag { };
+
+  /** @brief Recommends parallel execution at compile time,
+   *  optionally using a user-specified number of threads. */
+  struct parallel_tag
+  {
+    private:
+      _ThreadIndex _M_num_threads;
+
+    public:
+      /** @brief Default constructor. Use default number of threads. */
+      parallel_tag()
+      { _M_num_threads = 0; }
+
+      /** @brief Default constructor. Recommend number of threads to use.
+       *  @param __num_threads Desired number of threads. */
+      parallel_tag(_ThreadIndex __num_threads)
+      { _M_num_threads = __num_threads; }
+
+      /** @brief Find out desired number of threads.
+       *  @return Desired number of threads. */
+      _ThreadIndex __get_num_threads()
+      {
+        if(_M_num_threads == 0)
+          return omp_get_max_threads();
+        else
+          return _M_num_threads;
+      }
+
+      /** @brief Set the desired number of threads.
+       *  @param __num_threads Desired number of threads. */
+      void set_num_threads(_ThreadIndex __num_threads)
+      { _M_num_threads = __num_threads; }
+  };
+
+  /** @brief Recommends parallel execution using the
+      default parallel algorithm. */
+  struct default_parallel_tag : public parallel_tag
+  {
+    default_parallel_tag() { }
+    default_parallel_tag(_ThreadIndex __num_threads)
+    : parallel_tag(__num_threads) { }
+  };
+
+  /** @brief Recommends parallel execution using dynamic
+      load-balancing at compile time. */
+  struct balanced_tag : public parallel_tag { };
+
+  /** @brief Recommends parallel execution using static
+      load-balancing at compile time. */
+  struct unbalanced_tag : public parallel_tag { };
+
+  /** @brief Recommends parallel execution using OpenMP dynamic
+      load-balancing at compile time. */
+  struct omp_loop_tag : public parallel_tag { };
+
+  /** @brief Recommends parallel execution using OpenMP static
+      load-balancing at compile time. */
+  struct omp_loop_static_tag : public parallel_tag { };
+
+
+  /** @brief Base class for for std::find() variants. */
+  struct find_tag { };
+
+
+  /** @brief Forces parallel merging
+   *  with exact splitting, at compile time. */
+  struct exact_tag : public parallel_tag
+  {
+    exact_tag() { }
+    exact_tag(_ThreadIndex __num_threads)
+    : parallel_tag(__num_threads) { }
+  };
+
+  /** @brief Forces parallel merging
+   *  with exact splitting, at compile time. */
+  struct sampling_tag : public parallel_tag
+  {
+    sampling_tag() { }
+    sampling_tag(_ThreadIndex __num_threads)
+    : parallel_tag(__num_threads) { }
+  };
+
+
+  /** @brief Forces parallel sorting using multiway mergesort
+   *  at compile time. */
+  struct multiway_mergesort_tag : public parallel_tag
+  {
+    multiway_mergesort_tag() { }
+    multiway_mergesort_tag(_ThreadIndex __num_threads)
+    : parallel_tag(__num_threads) { }
+  };
+
+  /** @brief Forces parallel sorting using multiway mergesort
+   *  with exact splitting at compile time. */
+  struct multiway_mergesort_exact_tag : public parallel_tag
+  {
+    multiway_mergesort_exact_tag() { }
+    multiway_mergesort_exact_tag(_ThreadIndex __num_threads)
+    : parallel_tag(__num_threads) { }
+  };
+
+  /** @brief Forces parallel sorting using multiway mergesort
+   *  with splitting by sampling at compile time. */
+  struct multiway_mergesort_sampling_tag : public parallel_tag
+  {
+    multiway_mergesort_sampling_tag() { }
+    multiway_mergesort_sampling_tag(_ThreadIndex __num_threads)
+    : parallel_tag(__num_threads) { }
+  };
+
+  /** @brief Forces parallel sorting using unbalanced quicksort
+   *  at compile time. */
+  struct quicksort_tag : public parallel_tag
+  {
+    quicksort_tag() { }
+    quicksort_tag(_ThreadIndex __num_threads)
+    : parallel_tag(__num_threads) { }
+  };
+
+  /** @brief Forces parallel sorting using balanced quicksort
+   *  at compile time. */
+  struct balanced_quicksort_tag : public parallel_tag
+  {
+    balanced_quicksort_tag() { }
+    balanced_quicksort_tag(_ThreadIndex __num_threads)
+    : parallel_tag(__num_threads) { }
+  };
+
+
+  /** @brief Selects the growing block size variant for std::find().
+      @see _GLIBCXX_FIND_GROWING_BLOCKS */
+  struct growing_blocks_tag : public find_tag { };
+
+  /** @brief Selects the constant block size variant for std::find().
+      @see _GLIBCXX_FIND_CONSTANT_SIZE_BLOCKS */
+  struct constant_size_blocks_tag : public find_tag { };
+
+  /** @brief Selects the equal splitting variant for std::find().
+      @see _GLIBCXX_FIND_EQUAL_SPLIT */
+  struct equal_split_tag : public find_tag { };
+}
+
+#endif /* _GLIBCXX_PARALLEL_TAGS_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/types.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/types.h
new file mode 100644
index 0000000..bb6eaa5
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/types.h
@@ -0,0 +1,137 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/types.h
+ *  @brief Basic types and typedefs.
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler and Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_TYPES_H
+#define _GLIBCXX_PARALLEL_TYPES_H 1
+
+#include <cstdlib>
+#include <limits>
+#include <tr1/cstdint>
+
+namespace __gnu_parallel
+{
+  // Enumerated types.
+
+  /// Run-time equivalents for the compile-time tags.
+  enum _Parallelism
+    {
+      /// Not parallel.
+      sequential,
+
+      /// Parallel unbalanced (equal-sized chunks).
+      parallel_unbalanced,
+
+      /// Parallel balanced (work-stealing).
+      parallel_balanced,
+
+      /// Parallel with OpenMP dynamic load-balancing.
+      parallel_omp_loop,
+
+      /// Parallel with OpenMP static load-balancing.
+      parallel_omp_loop_static,
+
+      /// Parallel with OpenMP taskqueue construct.
+      parallel_taskqueue
+    };
+
+  /// Strategies for run-time algorithm selection: 
+  // force_sequential, force_parallel, heuristic.
+  enum _AlgorithmStrategy
+    {
+      heuristic,
+      force_sequential,
+      force_parallel
+    };
+
+  /// Sorting algorithms: 
+  // multi-way mergesort, quicksort, load-balanced quicksort.
+  enum _SortAlgorithm 
+    { 
+      MWMS, 
+      QS, 
+      QS_BALANCED 
+    };
+
+  /// Merging algorithms: 
+  // bubblesort-alike, loser-tree variants, enum __sentinel.
+  enum _MultiwayMergeAlgorithm
+    {
+      LOSER_TREE
+    };
+
+  /// Partial sum algorithms: recursive, linear.
+  enum _PartialSumAlgorithm 
+    { 
+      RECURSIVE, 
+      LINEAR 
+    };
+
+  /// Sorting/merging algorithms: sampling, __exact.
+  enum _SplittingAlgorithm 
+    { 
+      SAMPLING, 
+      EXACT 
+    };
+
+  /// Find algorithms:
+  // growing blocks, equal-sized blocks, equal splitting.
+  enum _FindAlgorithm 
+    { 
+      GROWING_BLOCKS, 
+      CONSTANT_SIZE_BLOCKS, 
+      EQUAL_SPLIT 
+    };
+
+  /**
+   * @brief Unsigned integer to index __elements.
+   * The total number of elements for each algorithm must fit into this type.
+   */
+  typedef uint64_t _SequenceIndex;
+
+  /**
+   * @brief Unsigned integer to index a thread number.
+   * The maximum thread number (for each processor) must fit into this type.
+   */
+  typedef uint16_t _ThreadIndex;
+
+  // XXX atomics interface?
+  /// Longest compare-and-swappable integer type on this platform.
+  typedef int64_t _CASable;
+
+  /// Number of bits of _CASable.
+  static const int _CASable_bits = std::numeric_limits<_CASable>::digits;
+
+  /// ::_CASable with the right half of bits set to 1.
+  static const _CASable _CASable_mask =
+                            ((_CASable(1) << (_CASable_bits / 2)) - 1);
+}
+
+#endif /* _GLIBCXX_PARALLEL_TYPES_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/unique_copy.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/unique_copy.h
new file mode 100644
index 0000000..72c84a9
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/unique_copy.h
@@ -0,0 +1,197 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/unique_copy.h
+ *  @brief Parallel implementations of std::unique_copy().
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Robert Geisberger and Robin Dapp.
+
+#ifndef _GLIBCXX_PARALLEL_UNIQUE_COPY_H
+#define _GLIBCXX_PARALLEL_UNIQUE_COPY_H 1
+
+#include <parallel/parallel.h>
+#include <parallel/multiseq_selection.h>
+
+namespace __gnu_parallel
+{
+  /** @brief Parallel std::unique_copy(), w/__o explicit equality predicate.
+    *  @param __first Begin iterator of input sequence.
+    *  @param __last End iterator of input sequence.
+    *  @param __result Begin iterator of result __sequence.
+    *  @param __binary_pred Equality predicate.
+    *  @return End iterator of result __sequence. */
+  template<typename _IIter,
+           class _OutputIterator,
+           class _BinaryPredicate>
+    _OutputIterator
+    __parallel_unique_copy(_IIter __first, _IIter __last,
+			   _OutputIterator __result,
+			   _BinaryPredicate __binary_pred)
+    {
+      _GLIBCXX_CALL(__last - __first)
+
+      typedef std::iterator_traits<_IIter> _TraitsType;
+      typedef typename _TraitsType::value_type _ValueType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      _DifferenceType __size = __last - __first;
+
+      if (__size == 0)
+	return __result;
+
+      // Let the first thread process two parts.
+      _DifferenceType *__counter;
+      _DifferenceType *__borders;
+
+      _ThreadIndex __num_threads = __get_max_threads();
+      // First part contains at least one element.
+#     pragma omp parallel num_threads(__num_threads)
+      {
+#       pragma omp single
+	{
+	  __num_threads = omp_get_num_threads();
+	  __borders = new _DifferenceType[__num_threads + 2];
+	  equally_split(__size, __num_threads + 1, __borders);
+	  __counter = new _DifferenceType[__num_threads + 1];
+	}
+
+	_ThreadIndex __iam = omp_get_thread_num();
+
+	_DifferenceType __begin, __end;
+
+	// Check for length without duplicates
+	// Needed for position in output
+	_DifferenceType __i = 0;
+	_OutputIterator __out = __result;
+
+	if (__iam == 0)
+          {
+            __begin = __borders[0] + 1;   // == 1
+            __end = __borders[__iam + 1];
+
+            ++__i;
+            *__out++ = *__first;
+
+            for (_IIter __iter = __first + __begin; __iter < __first + __end;
+		 ++__iter)
+              {
+        	if (!__binary_pred(*__iter, *(__iter - 1)))
+                  {
+                    ++__i;
+                    *__out++ = *__iter;
+                  }
+              }
+          }
+	else
+          {
+            __begin = __borders[__iam]; //one part
+            __end = __borders[__iam + 1];
+
+            for (_IIter __iter = __first + __begin; __iter < __first + __end;
+		 ++__iter)
+              {
+        	if (!__binary_pred(*__iter, *(__iter - 1)))
+                  ++__i;
+              }
+          }
+	__counter[__iam] = __i;
+
+	// Last part still untouched.
+	_DifferenceType __begin_output;
+
+#       pragma omp barrier
+
+	// Store result in output on calculated positions.
+	__begin_output = 0;
+
+	if (__iam == 0)
+          {
+            for (_ThreadIndex __t = 0; __t < __num_threads; ++__t)
+              __begin_output += __counter[__t];
+
+            __i = 0;
+
+            _OutputIterator __iter_out = __result + __begin_output;
+
+            __begin = __borders[__num_threads];
+            __end = __size;
+
+            for (_IIter __iter = __first + __begin; __iter < __first + __end;
+		 ++__iter)
+              {
+        	if (__iter == __first
+		    || !__binary_pred(*__iter, *(__iter - 1)))
+                  {
+                    ++__i;
+                    *__iter_out++ = *__iter;
+                  }
+              }
+
+            __counter[__num_threads] = __i;
+          }
+	else
+          {
+            for (_ThreadIndex __t = 0; __t < __iam; __t++)
+              __begin_output += __counter[__t];
+
+            _OutputIterator __iter_out = __result + __begin_output;
+            for (_IIter __iter = __first + __begin; __iter < __first + __end;
+		 ++__iter)
+              {
+        	if (!__binary_pred(*__iter, *(__iter - 1)))
+                  *__iter_out++ = *__iter;
+              }
+          }
+      }
+
+      _DifferenceType __end_output = 0;
+      for (_ThreadIndex __t = 0; __t < __num_threads + 1; __t++)
+	__end_output += __counter[__t];
+
+      delete[] __borders;
+
+      return __result + __end_output;
+    }
+
+  /** @brief Parallel std::unique_copy(), without explicit equality predicate
+    *  @param __first Begin iterator of input sequence.
+    *  @param __last End iterator of input sequence.
+    *  @param __result Begin iterator of result __sequence.
+    *  @return End iterator of result __sequence. */
+  template<typename _IIter, class _OutputIterator>
+    inline _OutputIterator
+    __parallel_unique_copy(_IIter __first, _IIter __last,
+			   _OutputIterator __result)
+    {
+      typedef typename std::iterator_traits<_IIter>::value_type
+	_ValueType;
+      return __parallel_unique_copy(__first, __last, __result,
+				    std::equal_to<_ValueType>());
+    }
+
+}//namespace __gnu_parallel
+
+#endif /* _GLIBCXX_PARALLEL_UNIQUE_COPY_H */
diff --git a/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/workstealing.h b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/workstealing.h
new file mode 100644
index 0000000..5e90ae9
--- /dev/null
+++ b/mips-qca-linux-uclibc/include/c++/4.6.4/parallel/workstealing.h
@@ -0,0 +1,312 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library 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 3, or (at your option) any later
+// version.
+
+// This library 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file parallel/workstealing.h
+ *  @brief Parallelization of embarrassingly parallel execution by
+ *  means of work-stealing.
+ *
+ *  Work stealing is described in
+ *
+ *  R. D. Blumofe and C. E. Leiserson.
+ *  Scheduling multithreaded computations by work stealing.
+ *  Journal of the ACM, 46(5):720–748, 1999.
+ *
+ *  This file is a GNU parallel extension to the Standard C++ Library.
+ */
+
+// Written by Felix Putze.
+
+#ifndef _GLIBCXX_PARALLEL_WORKSTEALING_H
+#define _GLIBCXX_PARALLEL_WORKSTEALING_H 1
+
+#include <parallel/parallel.h>
+#include <parallel/random_number.h>
+#include <parallel/compatibility.h>
+
+namespace __gnu_parallel
+{
+
+#define _GLIBCXX_JOB_VOLATILE volatile
+
+  /** @brief One __job for a certain thread. */
+  template<typename _DifferenceTp>
+    struct _Job
+    {
+      typedef _DifferenceTp _DifferenceType;
+
+      /** @brief First element.
+       *
+       *  Changed by owning and stealing thread. By stealing thread,
+       *  always incremented. */
+      _GLIBCXX_JOB_VOLATILE _DifferenceType _M_first;
+
+      /** @brief Last element.
+       *
+       *  Changed by owning thread only. */
+      _GLIBCXX_JOB_VOLATILE _DifferenceType _M_last;
+
+      /** @brief Number of elements, i.e. @c _M_last-_M_first+1.
+       *
+       *  Changed by owning thread only. */
+      _GLIBCXX_JOB_VOLATILE _DifferenceType _M_load;
+    };
+
+  /** @brief Work stealing algorithm for random access iterators.
+    *
+    *  Uses O(1) additional memory. Synchronization at job lists is
+    *  done with atomic operations.
+    *  @param __begin Begin iterator of element sequence.
+    *  @param __end End iterator of element sequence.
+    *  @param __op User-supplied functor (comparator, predicate, adding
+    *  functor, ...).
+    *  @param __f Functor to @a process an element with __op (depends on
+    *  desired functionality, e. g. for std::for_each(), ...).
+    *  @param __r Functor to @a add a single __result to the already
+    *  processed elements (depends on functionality).
+    *  @param __base Base value for reduction.
+    *  @param __output Pointer to position where final result is written to
+    *  @param __bound Maximum number of elements processed (e. g. for
+    *  std::count_n()).
+    *  @return User-supplied functor (that may contain a part of the result).
+    */
+  template<typename _RAIter,
+           typename _Op,
+           typename _Fu,
+           typename _Red,
+           typename _Result>
+    _Op
+    __for_each_template_random_access_workstealing(_RAIter __begin,
+						   _RAIter __end, _Op __op,
+						   _Fu& __f, _Red __r,
+						   _Result __base,
+						   _Result& __output,
+      typename std::iterator_traits<_RAIter>::difference_type __bound)
+    {
+      _GLIBCXX_CALL(__end - __begin)
+
+      typedef std::iterator_traits<_RAIter> _TraitsType;
+      typedef typename _TraitsType::difference_type _DifferenceType;
+
+      const _Settings& __s = _Settings::get();
+
+      _DifferenceType __chunk_size =
+          static_cast<_DifferenceType>(__s.workstealing_chunk_size);
+
+      // How many jobs?
+      _DifferenceType __length = (__bound < 0) ? (__end - __begin) : __bound;
+
+      // To avoid false sharing in a cache line.
+      const int __stride = (__s.cache_line_size * 10
+			    / sizeof(_Job<_DifferenceType>) + 1);
+
+      // Total number of threads currently working.
+      _ThreadIndex __busy = 0;
+
+      _Job<_DifferenceType> *__job;
+
+      omp_lock_t __output_lock;
+      omp_init_lock(&__output_lock);
+
+      // Write base value to output.
+      __output = __base;
+
+      // No more threads than jobs, at least one thread.
+      _ThreadIndex __num_threads = __gnu_parallel::max<_ThreadIndex>
+	(1, __gnu_parallel::min<_DifferenceType>(__length,
+						 __get_max_threads()));
+
+#     pragma omp parallel shared(__busy) num_threads(__num_threads)
+      {
+#       pragma omp single
+	{
+	  __num_threads = omp_get_num_threads();
+
+	  // Create job description array.
+	  __job = new _Job<_DifferenceType>[__num_threads * __stride];
+	}
+
+	// Initialization phase.
+
+	// Flags for every thread if it is doing productive work.
+	bool __iam_working = false;
+
+	// Thread id.
+	_ThreadIndex __iam = omp_get_thread_num();
+
+	// This job.
+	_Job<_DifferenceType>& __my_job = __job[__iam * __stride];
+
+	// Random number (for work stealing).
+	_ThreadIndex __victim;
+
+	// Local value for reduction.
+	_Result __result = _Result();
+
+	// Number of elements to steal in one attempt.
+	_DifferenceType __steal;
+
+	// Every thread has its own random number generator
+	// (modulo __num_threads).
+	_RandomNumber __rand_gen(__iam, __num_threads);
+
+	// This thread is currently working.
+#       pragma omp atomic
+	++__busy;
+
+	__iam_working = true;
+
+	// How many jobs per thread? last thread gets the rest.
+	__my_job._M_first = static_cast<_DifferenceType>
+	  (__iam * (__length / __num_threads));
+
+	__my_job._M_last = (__iam == (__num_threads - 1)
+			    ? (__length - 1)
+			    : ((__iam + 1) * (__length / __num_threads) - 1));
+	__my_job._M_load = __my_job._M_last - __my_job._M_first + 1;
+
+	// Init result with _M_first value (to have a base value for reduction)
+	if (__my_job._M_first <= __my_job._M_last)
+	  {
+	    // Cannot use volatile variable directly.
+	    _DifferenceType __my_first = __my_job._M_first;
+	    __result = __f(__op, __begin + __my_first);
+	    ++__my_job._M_first;
+	    --__my_job._M_load;
+	  }
+
+	_RAIter __current;
+
+#       pragma omp barrier
+
+	// Actual work phase
+	// Work on own or stolen current start
+	while (__busy > 0)
+	  {
+	    // Work until no productive thread left.
+#           pragma omp flush(__busy)
+
+	    // Thread has own work to do
+	    while (__my_job._M_first <= __my_job._M_last)
+	      {
+		// fetch-and-add call
+		// Reserve current job block (size __chunk_size) in my queue.
+		_DifferenceType __current_job =
+		  __fetch_and_add<_DifferenceType>(&(__my_job._M_first),
+						   __chunk_size);
+
+		// Update _M_load, to make the three values consistent,
+		// _M_first might have been changed in the meantime
+		__my_job._M_load = __my_job._M_last - __my_job._M_first + 1;
+		for (_DifferenceType __job_counter = 0;
+		     __job_counter < __chunk_size
+		       && __current_job <= __my_job._M_last;
+		     ++__job_counter)
+		  {
+		    // Yes: process it!
+		    __current = __begin + __current_job;
+		    ++__current_job;
+
+		    // Do actual work.
+		    __result = __r(__result, __f(__op, __current));
+		  }
+
+#               pragma omp flush(__busy)
+	      }
+
+	    // After reaching this point, a thread's __job list is empty.
+	    if (__iam_working)
+	      {
+		// This thread no longer has work.
+#               pragma omp atomic
+		--__busy;
+
+		__iam_working = false;
+	      }
+
+	    _DifferenceType __supposed_first, __supposed_last,
+	                    __supposed_load;
+	    do
+	      {
+		// Find random nonempty deque (not own), do consistency check.
+		__yield();
+#               pragma omp flush(__busy)
+		__victim = __rand_gen();
+		__supposed_first = __job[__victim * __stride]._M_first;
+		__supposed_last = __job[__victim * __stride]._M_last;
+		__supposed_load = __job[__victim * __stride]._M_load;
+	      }
+	    while (__busy > 0
+		   && ((__supposed_load <= 0)
+		       || ((__supposed_first + __supposed_load - 1)
+			   != __supposed_last)));
+
+	    if (__busy == 0)
+	      break;
+
+	    if (__supposed_load > 0)
+	      {
+		// Has work and work to do.
+		// Number of elements to steal (at least one).
+		__steal = (__supposed_load < 2) ? 1 : __supposed_load / 2;
+
+		// Push __victim's current start forward.
+		_DifferenceType __stolen_first =
+		  __fetch_and_add<_DifferenceType>
+		  (&(__job[__victim * __stride]._M_first), __steal);
+		_DifferenceType __stolen_try = (__stolen_first + __steal
+						- _DifferenceType(1));
+
+		__my_job._M_first = __stolen_first;
+		__my_job._M_last = __gnu_parallel::min(__stolen_try,
+						       __supposed_last);
+		__my_job._M_load = __my_job._M_last - __my_job._M_first + 1;
+
+		// Has potential work again.
+#               pragma omp atomic
+		++__busy;
+		__iam_working = true;
+
+#               pragma omp flush(__busy)
+	      }
+#           pragma omp flush(__busy)
+	  } // end while __busy > 0
+	// Add accumulated result to output.
+	omp_set_lock(&__output_lock);
+	__output = __r(__output, __result);
+	omp_unset_lock(&__output_lock);
+      }
+
+      delete[] __job;
+
+      // Points to last element processed (needed as return value for
+      // some algorithms like transform)
+      __f._M_finish_iterator = __begin + __length;
+
+      omp_destroy_lock(&__output_lock);
+
+      return __op;
+    }
+} // end namespace
+
+#endif /* _GLIBCXX_PARALLEL_WORKSTEALING_H */
diff --git a/mips-qca-linux-uclibc/sysroot/lib/ld-uClibc-0.9.33.2.so b/mips-qca-linux-uclibc/sysroot/lib/ld-uClibc-0.9.33.2.so
index 90e0c78..7a2545c 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/ld-uClibc-0.9.33.2.so
+++ b/mips-qca-linux-uclibc/sysroot/lib/ld-uClibc-0.9.33.2.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libcrypt-0.9.33.2.so b/mips-qca-linux-uclibc/sysroot/lib/libcrypt-0.9.33.2.so
index f42abf4..af45234 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/libcrypt-0.9.33.2.so
+++ b/mips-qca-linux-uclibc/sysroot/lib/libcrypt-0.9.33.2.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libdl-0.9.33.2.so b/mips-qca-linux-uclibc/sysroot/lib/libdl-0.9.33.2.so
index c6c306c..6643db2 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/libdl-0.9.33.2.so
+++ b/mips-qca-linux-uclibc/sysroot/lib/libdl-0.9.33.2.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libgcc_s.so.1 b/mips-qca-linux-uclibc/sysroot/lib/libgcc_s.so.1
index f62bff1..1fc9999 100644
--- a/mips-qca-linux-uclibc/sysroot/lib/libgcc_s.so.1
+++ b/mips-qca-linux-uclibc/sysroot/lib/libgcc_s.so.1
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libgomp.a b/mips-qca-linux-uclibc/sysroot/lib/libgomp.a
new file mode 100644
index 0000000..487cb09
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/lib/libgomp.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libmudflap.la b/mips-qca-linux-uclibc/sysroot/lib/libgomp.la
similarity index 77%
rename from mips-qca-linux-uclibc/sysroot/lib/libmudflap.la
rename to mips-qca-linux-uclibc/sysroot/lib/libgomp.la
index 4bf73d9..5bf8de0 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/libmudflap.la
+++ b/mips-qca-linux-uclibc/sysroot/lib/libgomp.la
@@ -1,29 +1,29 @@
-# libmudflap.la - a libtool library file
+# libgomp.la - a libtool library file
 # Generated by libtool (GNU libtool 1.3134 2009-11-29) 2.2.7a
 #
 # Please DO NOT delete this file!
 # It is necessary for linking the library.
 
 # The name that we can dlopen(3).
-dlname='libmudflap.so.0'
+dlname='libgomp.so.1'
 
 # Names of this library.
-library_names='libmudflap.so.0.0.0 libmudflap.so.0 libmudflap.so'
+library_names='libgomp.so.1.0.0 libgomp.so.1 libgomp.so'
 
 # The name of the static archive.
-old_library='libmudflap.a'
+old_library='libgomp.a'
 
 # Linker flags that can not go in dependency_libs.
 inherited_linker_flags=''
 
 # Libraries that this one depends upon.
-dependency_libs=' -ldl'
+dependency_libs=''
 
 # Names of additional weak libraries provided by this library
 weak_library_names=''
 
-# Version information for libmudflap.
-current=0
+# Version information for libgomp.
+current=1
 age=0
 revision=0
 
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libgomp.so b/mips-qca-linux-uclibc/sysroot/lib/libgomp.so
new file mode 120000
index 0000000..c5be39e
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/lib/libgomp.so
@@ -0,0 +1 @@
+libgomp.so.1.0.0
\ No newline at end of file
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libgomp.so.1 b/mips-qca-linux-uclibc/sysroot/lib/libgomp.so.1
new file mode 120000
index 0000000..c5be39e
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/lib/libgomp.so.1
@@ -0,0 +1 @@
+libgomp.so.1.0.0
\ No newline at end of file
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libgomp.so.1.0.0 b/mips-qca-linux-uclibc/sysroot/lib/libgomp.so.1.0.0
new file mode 100755
index 0000000..4cdd5a2
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/lib/libgomp.so.1.0.0
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libgomp.spec b/mips-qca-linux-uclibc/sysroot/lib/libgomp.spec
new file mode 100644
index 0000000..7102255
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/lib/libgomp.spec
@@ -0,0 +1,3 @@
+# This spec file is read by gcc when linking.  It is used to specify the
+# standard libraries we need in order to link with -fopenmp.
+*link_gomp: -lgomp %{static: }
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libm-0.9.33.2.so b/mips-qca-linux-uclibc/sysroot/lib/libm-0.9.33.2.so
index cafefa2..51cd794 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/libm-0.9.33.2.so
+++ b/mips-qca-linux-uclibc/sysroot/lib/libm-0.9.33.2.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libmudflap.a b/mips-qca-linux-uclibc/sysroot/lib/libmudflap.a
deleted file mode 100644
index 45969ab..0000000
--- a/mips-qca-linux-uclibc/sysroot/lib/libmudflap.a
+++ /dev/null
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libmudflap.so b/mips-qca-linux-uclibc/sysroot/lib/libmudflap.so
deleted file mode 120000
index 7e6932a..0000000
--- a/mips-qca-linux-uclibc/sysroot/lib/libmudflap.so
+++ /dev/null
@@ -1 +0,0 @@
-libmudflap.so.0.0.0
\ No newline at end of file
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libmudflap.so.0 b/mips-qca-linux-uclibc/sysroot/lib/libmudflap.so.0
deleted file mode 120000
index 7e6932a..0000000
--- a/mips-qca-linux-uclibc/sysroot/lib/libmudflap.so.0
+++ /dev/null
@@ -1 +0,0 @@
-libmudflap.so.0.0.0
\ No newline at end of file
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libmudflap.so.0.0.0 b/mips-qca-linux-uclibc/sysroot/lib/libmudflap.so.0.0.0
deleted file mode 100755
index 2a2646d..0000000
--- a/mips-qca-linux-uclibc/sysroot/lib/libmudflap.so.0.0.0
+++ /dev/null
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.a b/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.a
deleted file mode 100644
index a4d7a47..0000000
--- a/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.a
+++ /dev/null
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.la b/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.la
deleted file mode 100755
index 1520b50..0000000
--- a/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.la
+++ /dev/null
@@ -1,41 +0,0 @@
-# libmudflapth.la - a libtool library file
-# Generated by libtool (GNU libtool 1.3134 2009-11-29) 2.2.7a
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='libmudflapth.so.0'
-
-# Names of this library.
-library_names='libmudflapth.so.0.0.0 libmudflapth.so.0 libmudflapth.so'
-
-# The name of the static archive.
-old_library='libmudflapth.a'
-
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags=''
-
-# Libraries that this one depends upon.
-dependency_libs=' -ldl'
-
-# Names of additional weak libraries provided by this library
-weak_library_names=''
-
-# Version information for libmudflapth.
-current=0
-age=0
-revision=0
-
-# Is this an already installed library?
-installed=yes
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=no
-
-# Files to dlopen/dlpreopen
-dlopen=''
-dlpreopen=''
-
-# Directory that this library needs to be installed in:
-libdir='/usr/local/google/home/awdavies/x-tools/mips-qca-linux-uclibc/mips-qca-linux-uclibc/lib'
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.so b/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.so
deleted file mode 120000
index 2857f7e..0000000
--- a/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.so
+++ /dev/null
@@ -1 +0,0 @@
-libmudflapth.so.0.0.0
\ No newline at end of file
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.so.0 b/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.so.0
deleted file mode 120000
index 2857f7e..0000000
--- a/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.so.0
+++ /dev/null
@@ -1 +0,0 @@
-libmudflapth.so.0.0.0
\ No newline at end of file
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.so.0.0.0 b/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.so.0.0.0
deleted file mode 100755
index f11839e..0000000
--- a/mips-qca-linux-uclibc/sysroot/lib/libmudflapth.so.0.0.0
+++ /dev/null
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libnsl-0.9.33.2.so b/mips-qca-linux-uclibc/sysroot/lib/libnsl-0.9.33.2.so
index e23f55f..93a17b8 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/libnsl-0.9.33.2.so
+++ b/mips-qca-linux-uclibc/sysroot/lib/libnsl-0.9.33.2.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libpthread-0.9.33.2.so b/mips-qca-linux-uclibc/sysroot/lib/libpthread-0.9.33.2.so
index 2d85ac6..e325ea8 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/libpthread-0.9.33.2.so
+++ b/mips-qca-linux-uclibc/sysroot/lib/libpthread-0.9.33.2.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libresolv-0.9.33.2.so b/mips-qca-linux-uclibc/sysroot/lib/libresolv-0.9.33.2.so
index 1b9d85b..d88f1e5 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/libresolv-0.9.33.2.so
+++ b/mips-qca-linux-uclibc/sysroot/lib/libresolv-0.9.33.2.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/librt-0.9.33.2.so b/mips-qca-linux-uclibc/sysroot/lib/librt-0.9.33.2.so
index 1590228..39a6c8c 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/librt-0.9.33.2.so
+++ b/mips-qca-linux-uclibc/sysroot/lib/librt-0.9.33.2.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libstdc++.a b/mips-qca-linux-uclibc/sysroot/lib/libstdc++.a
index da08684..e46758d 100644
--- a/mips-qca-linux-uclibc/sysroot/lib/libstdc++.a
+++ b/mips-qca-linux-uclibc/sysroot/lib/libstdc++.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libstdc++.so.6.0.16 b/mips-qca-linux-uclibc/sysroot/lib/libstdc++.so.6.0.16
index b3a0351..71a0813 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/libstdc++.so.6.0.16
+++ b/mips-qca-linux-uclibc/sysroot/lib/libstdc++.so.6.0.16
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libsupc++.a b/mips-qca-linux-uclibc/sysroot/lib/libsupc++.a
index 9ac4c75..667117b 100644
--- a/mips-qca-linux-uclibc/sysroot/lib/libsupc++.a
+++ b/mips-qca-linux-uclibc/sysroot/lib/libsupc++.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libthread_db-0.9.33.2.so b/mips-qca-linux-uclibc/sysroot/lib/libthread_db-0.9.33.2.so
index a38344f..b877a2d 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/libthread_db-0.9.33.2.so
+++ b/mips-qca-linux-uclibc/sysroot/lib/libthread_db-0.9.33.2.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libuClibc-0.9.33.2.so b/mips-qca-linux-uclibc/sysroot/lib/libuClibc-0.9.33.2.so
index cb429d1..4754fd2 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/libuClibc-0.9.33.2.so
+++ b/mips-qca-linux-uclibc/sysroot/lib/libuClibc-0.9.33.2.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/lib/libutil-0.9.33.2.so b/mips-qca-linux-uclibc/sysroot/lib/libutil-0.9.33.2.so
index 2d12a63..af48fb5 100755
--- a/mips-qca-linux-uclibc/sysroot/lib/libutil-0.9.33.2.so
+++ b/mips-qca-linux-uclibc/sysroot/lib/libutil-0.9.33.2.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/errno.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/errno.h
index 28cc03b..a1331ce 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/errno.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/errno.h
@@ -108,4 +108,6 @@
 
 #define ERFKILL		132	/* Operation not possible due to RF-kill */
 
+#define EHWPOISON	133	/* Memory page has hardware error */
+
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/fcntl.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/fcntl.h
index 4d3e483..9e5b035 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/fcntl.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/fcntl.h
@@ -3,8 +3,18 @@
 
 #include <linux/types.h>
 
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
+/*
+ * FMODE_EXEC is 0x20
+ * FMODE_NONOTIFY is 0x1000000
+ * These cannot be used by userspace O_* until internal and external open
+ * flags are split.
+ * -Eric Paris
+ */
+
+/*
+ * When introducing new O_* bits, please check its uniqueness in fcntl_init().
+ */
+
 #define O_ACCMODE	00000003
 #define O_RDONLY	00000000
 #define O_WRONLY	00000001
@@ -27,8 +37,8 @@
 #ifndef O_NONBLOCK
 #define O_NONBLOCK	00004000
 #endif
-#ifndef O_SYNC
-#define O_SYNC		00010000
+#ifndef O_DSYNC
+#define O_DSYNC		00010000	/* used to be O_SYNC, see below */
 #endif
 #ifndef FASYNC
 #define FASYNC		00020000	/* fcntl, for BSD compatibility */
@@ -51,6 +61,29 @@
 #ifndef O_CLOEXEC
 #define O_CLOEXEC	02000000	/* set close_on_exec */
 #endif
+
+/*
+ * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
+ * the O_SYNC flag.  We continue to use the existing numerical value
+ * for O_DSYNC semantics now, but using the correct symbolic name for it.
+ * This new value is used to request true Posix O_SYNC semantics.  It is
+ * defined in this strange way to make sure applications compiled against
+ * new headers get at least O_DSYNC semantics on older kernels.
+ *
+ * This has the nice side-effect that we can simply test for O_DSYNC
+ * wherever we do not care if O_DSYNC or O_SYNC is used.
+ *
+ * Note: __O_SYNC must never be used directly.
+ */
+#ifndef O_SYNC
+#define __O_SYNC	04000000
+#define O_SYNC		(__O_SYNC|O_DSYNC)
+#endif
+
+#ifndef O_PATH
+#define O_PATH		010000000
+#endif
+
 #ifndef O_NDELAY
 #define O_NDELAY	O_NONBLOCK
 #endif
@@ -74,6 +107,28 @@
 #define F_GETSIG	11	/* for sockets. */
 #endif
 
+#ifndef CONFIG_64BIT
+#ifndef F_GETLK64
+#define F_GETLK64	12	/*  using 'struct flock64' */
+#define F_SETLK64	13
+#define F_SETLKW64	14
+#endif
+#endif
+
+#ifndef F_SETOWN_EX
+#define F_SETOWN_EX	15
+#define F_GETOWN_EX	16
+#endif
+
+#define F_OWNER_TID	0
+#define F_OWNER_PID	1
+#define F_OWNER_PGRP	2
+
+struct f_owner_ex {
+	int	type;
+	__kernel_pid_t	pid;
+};
+
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
 
@@ -90,11 +145,6 @@
 #define F_SHLCK		8	/* or 4 */
 #endif
 
-/* for leases */
-#ifndef F_INPROGRESS
-#define F_INPROGRESS	16
-#endif
-
 /* operations for bsd flock(), also used by the kernel implementation */
 #define LOCK_SH		1	/* shared lock */
 #define LOCK_EX		2	/* exclusive lock */
@@ -126,12 +176,6 @@
 
 #ifndef CONFIG_64BIT
 
-#ifndef F_GETLK64
-#define F_GETLK64	12	/*  using 'struct flock64' */
-#define F_SETLK64	13
-#define F_SETLKW64	14
-#endif
-
 #ifndef HAVE_ARCH_STRUCT_FLOCK64
 #ifndef __ARCH_FLOCK64_PAD
 #define __ARCH_FLOCK64_PAD
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/ioctls.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/ioctls.h
index 2cb472f..8f439cc 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/ioctls.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/ioctls.h
@@ -62,13 +62,18 @@
 #define TCSETSW2	_IOW('T', 0x2C, struct termios2)
 #define TCSETSF2	_IOW('T', 0x2D, struct termios2)
 #define TIOCGRS485	0x542E
+#ifndef TIOCSRS485
 #define TIOCSRS485	0x542F
+#endif
 #define TIOCGPTN	_IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
 #define TIOCSPTLCK	_IOW('T', 0x31, int)  /* Lock/unlock Pty */
+#define TIOCGDEV	_IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
 #define TCGETX		0x5432 /* SYS5 TCGETX compatibility */
 #define TCSETX		0x5433
 #define TCSETXF		0x5434
 #define TCSETXW		0x5435
+#define TIOCSIG		_IOW('T', 0x36, int)  /* pty: generate signal */
+#define TIOCVHANGUP	0x5437
 
 #define FIONCLEX	0x5450
 #define FIOCLEX		0x5451
@@ -87,12 +92,10 @@
 #define TIOCGICOUNT	0x545D	/* read serial port __inline__ interrupt counts */
 
 /*
- * some architectures define FIOQSIZE as 0x545E, which is used for
- * TIOCGHAYESESP on others
+ * Some arches already define FIOQSIZE due to a historical
+ * conflict with a Hayes modem-specific ioctl value.
  */
 #ifndef FIOQSIZE
-# define TIOCGHAYESESP	0x545E  /* Get Hayes ESP configuration */
-# define TIOCSHAYESESP	0x545F  /* Set Hayes ESP configuration */
 # define FIOQSIZE	0x5460
 #endif
 
@@ -104,6 +107,7 @@
 #define TIOCPKT_START		 8
 #define TIOCPKT_NOSTOP		16
 #define TIOCPKT_DOSTOP		32
+#define TIOCPKT_IOCTL		64
 
 #define TIOCSER_TEMT	0x01	/* Transmitter physically empty */
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/mman-common.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/mman-common.h
index 3b69ad3..787abbb 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/mman-common.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/mman-common.h
@@ -19,6 +19,11 @@
 #define MAP_TYPE	0x0f		/* Mask for type of mapping */
 #define MAP_FIXED	0x10		/* Interpret addr exactly */
 #define MAP_ANONYMOUS	0x20		/* don't use a file */
+#ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED
+# define MAP_UNINITIALIZED 0x4000000	/* For anonymous mmap, memory could be uninitialized */
+#else
+# define MAP_UNINITIALIZED 0x0		/* Don't support this flag */
+#endif
 
 #define MS_ASYNC	1		/* sync memory asynchronously */
 #define MS_INVALIDATE	2		/* invalidate the caches */
@@ -34,6 +39,14 @@
 #define MADV_REMOVE	9		/* remove these pages & resources */
 #define MADV_DONTFORK	10		/* don't inherit across fork */
 #define MADV_DOFORK	11		/* do inherit across fork */
+#define MADV_HWPOISON	100		/* poison a page for testing */
+#define MADV_SOFT_OFFLINE 101		/* soft offline page for testing */
+
+#define MADV_MERGEABLE   12		/* KSM may merge identical pages */
+#define MADV_UNMERGEABLE 13		/* KSM may not merge identical pages */
+
+#define MADV_HUGEPAGE	14		/* Worth backing with hugepages */
+#define MADV_NOHUGEPAGE	15		/* Not worth backing with hugepages */
 
 /* compatibility flags */
 #define MAP_FILE	0
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/mman.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/mman.h
index 7cab4de..32c8bd6 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/mman.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/mman.h
@@ -11,6 +11,7 @@
 #define MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
 #define MAP_NONBLOCK	0x10000		/* do not block on IO */
 #define MAP_STACK	0x20000		/* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB	0x40000		/* create a huge page mapping */
 
 #define MCL_CURRENT	1		/* lock all current mappings */
 #define MCL_FUTURE	2		/* lock all future mappings */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/param.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/param.h
index b74eece..bd69ff3 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/param.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/param.h
@@ -1,7 +1,6 @@
 #ifndef __ASM_GENERIC_PARAM_H
 #define __ASM_GENERIC_PARAM_H
 
-
 #ifndef HZ
 #define HZ 100
 #endif
@@ -16,4 +15,5 @@
 
 #define MAXHOSTNAMELEN	64	/* max length of hostname */
 
+
 #endif /* __ASM_GENERIC_PARAM_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/poll.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/poll.h
index 44bce83..9ce7f44 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/poll.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/poll.h
@@ -28,6 +28,8 @@
 #define POLLRDHUP       0x2000
 #endif
 
+#define POLLFREE	0x4000	/* currently only for epoll */
+
 struct pollfd {
 	int fd;
 	short events;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/siginfo.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/siginfo.h
index f6d812f..dcb0cc5 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/siginfo.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/siginfo.h
@@ -82,6 +82,7 @@
 #ifdef __ARCH_SI_TRAPNO
 			int _trapno;	/* TRAP # which caused the signal */
 #endif
+			short _addr_lsb; /* LSB of the reported address */
 		} _sigfault;
 
 		/* SIGPOLL */
@@ -112,6 +113,7 @@
 #ifdef __ARCH_SI_TRAPNO
 #define si_trapno	_sifields._sigfault._trapno
 #endif
+#define si_addr_lsb	_sifields._sigfault._addr_lsb
 #define si_band		_sifields._sigpoll._band
 #define si_fd		_sifields._sigpoll._fd
 
@@ -178,9 +180,13 @@
  * SIGBUS si_codes
  */
 #define BUS_ADRALN	(__SI_FAULT|1)	/* invalid address alignment */
-#define BUS_ADRERR	(__SI_FAULT|2)	/* non-existant physical address */
+#define BUS_ADRERR	(__SI_FAULT|2)	/* non-existent physical address */
 #define BUS_OBJERR	(__SI_FAULT|3)	/* object specific hardware error */
-#define NSIGBUS		3
+/* hardware memory error consumed on a machine check: action required */
+#define BUS_MCEERR_AR	(__SI_FAULT|4)
+/* hardware memory error detected in process but not consumed: action optional*/
+#define BUS_MCEERR_AO	(__SI_FAULT|5)
+#define NSIGBUS		5
 
 /*
  * SIGTRAP si_codes
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/socket.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/socket.h
index 5d79e40..49c1704 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/socket.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/socket.h
@@ -60,4 +60,11 @@
 #define SO_TIMESTAMPING		37
 #define SCM_TIMESTAMPING	SO_TIMESTAMPING
 
+#define SO_PROTOCOL		38
+#define SO_DOMAIN		39
+
+#define SO_RXQ_OVFL             40
+
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS	SO_WIFI_STATUS
 #endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/stat.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/stat.h
index 47e6417..bd8cad2 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/stat.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/stat.h
@@ -33,18 +33,18 @@
 	int		st_blksize;	/* Optimal block size for I/O.  */
 	int		__pad2;
 	long		st_blocks;	/* Number 512-byte blocks allocated. */
-	int		st_atime;	/* Time of last access.  */
-	unsigned int	st_atime_nsec;
-	int		st_mtime;	/* Time of last modification.  */
-	unsigned int	st_mtime_nsec;
-	int		st_ctime;	/* Time of last status change.  */
-	unsigned int	st_ctime_nsec;
+	long		st_atime;	/* Time of last access.  */
+	unsigned long	st_atime_nsec;
+	long		st_mtime;	/* Time of last modification.  */
+	unsigned long	st_mtime_nsec;
+	long		st_ctime;	/* Time of last status change.  */
+	unsigned long	st_ctime_nsec;
 	unsigned int	__unused4;
 	unsigned int	__unused5;
 };
 
-#if __BITS_PER_LONG != 64
 /* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
+#if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64)
 struct stat64 {
 	unsigned long long st_dev;	/* Device.  */
 	unsigned long long st_ino;	/* File serial number.  */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/statfs.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/statfs.h
index 86798cc..30be87e 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/statfs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/statfs.h
@@ -12,7 +12,7 @@
  * with a 10' pole.
  */
 #ifndef __statfs_word
-#if BITS_PER_LONG == 64
+#if __BITS_PER_LONG == 64
 #define __statfs_word long
 #else
 #define __statfs_word __u32
@@ -30,7 +30,8 @@
 	__kernel_fsid_t f_fsid;
 	__statfs_word f_namelen;
 	__statfs_word f_frsize;
-	__statfs_word f_spare[5];
+	__statfs_word f_flags;
+	__statfs_word f_spare[4];
 };
 
 /*
@@ -52,7 +53,8 @@
 	__kernel_fsid_t f_fsid;
 	__statfs_word f_namelen;
 	__statfs_word f_frsize;
-	__statfs_word f_spare[5];
+	__statfs_word f_flags;
+	__statfs_word f_spare[4];
 } ARCH_PACK_STATFS64;
 
 /* 
@@ -74,7 +76,8 @@
 	__kernel_fsid_t f_fsid;
 	__u32 f_namelen;
 	__u32 f_frsize;
-	__u32 f_spare[5];
+	__u32 f_flags;
+	__u32 f_spare[4];
 } ARCH_PACK_COMPAT_STATFS64;
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/termbits.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/termbits.h
index 1c9773d..232b478 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/termbits.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/termbits.h
@@ -178,6 +178,7 @@
 #define FLUSHO	0010000
 #define PENDIN	0040000
 #define IEXTEN	0100000
+#define EXTPROC	0200000
 
 /* tcflow() and TCXONC use these */
 #define	TCOOFF		0
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/types.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/types.h
index f16dfb3..bd39806 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/types.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/types.h
@@ -6,14 +6,4 @@
  */
 #include <asm-generic/int-ll64.h>
 
-#ifndef __ASSEMBLY__
-
-typedef unsigned short umode_t;
-
-#endif /* __ASSEMBLY__ */
-
-/*
- * These aren't exported outside the kernel to avoid name space clashes
- */
-
 #endif /* _ASM_GENERIC_TYPES_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/unistd.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/unistd.h
index 2dde505..742ccd4 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/unistd.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm-generic/unistd.h
@@ -18,22 +18,30 @@
 #define __SYSCALL(x, y)
 #endif
 
-#if __BITS_PER_LONG == 32
+#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)
 #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
 #else
 #define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
 #endif
 
+#ifdef __SYSCALL_COMPAT
+#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp)
+#define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp)
+#else
+#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
+#define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64)
+#endif
+
 #define __NR_io_setup 0
-__SYSCALL(__NR_io_setup, sys_io_setup)
+__SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
 #define __NR_io_destroy 1
 __SYSCALL(__NR_io_destroy, sys_io_destroy)
 #define __NR_io_submit 2
-__SYSCALL(__NR_io_submit, sys_io_submit)
+__SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit)
 #define __NR_io_cancel 3
 __SYSCALL(__NR_io_cancel, sys_io_cancel)
 #define __NR_io_getevents 4
-__SYSCALL(__NR_io_getevents, sys_io_getevents)
+__SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents)
 
 /* fs/xattr.c */
 #define __NR_setxattr 5
@@ -67,7 +75,7 @@
 
 /* fs/cookies.c */
 #define __NR_lookup_dcookie 18
-__SYSCALL(__NR_lookup_dcookie, sys_lookup_dcookie)
+__SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie)
 
 /* fs/eventfd.c */
 #define __NR_eventfd2 19
@@ -79,7 +87,7 @@
 #define __NR_epoll_ctl 21
 __SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
 #define __NR_epoll_pwait 22
-__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
+__SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait)
 
 /* fs/fcntl.c */
 #define __NR_dup 23
@@ -87,7 +95,7 @@
 #define __NR_dup3 24
 __SYSCALL(__NR_dup3, sys_dup3)
 #define __NR3264_fcntl 25
-__SC_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl)
+__SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64)
 
 /* fs/inotify_user.c */
 #define __NR_inotify_init1 26
@@ -99,7 +107,7 @@
 
 /* fs/ioctl.c */
 #define __NR_ioctl 29
-__SYSCALL(__NR_ioctl, sys_ioctl)
+__SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl)
 
 /* fs/ioprio.c */
 #define __NR_ioprio_set 30
@@ -129,26 +137,30 @@
 #define __NR_umount2 39
 __SYSCALL(__NR_umount2, sys_umount)
 #define __NR_mount 40
-__SYSCALL(__NR_mount, sys_mount)
+__SC_COMP(__NR_mount, sys_mount, compat_sys_mount)
 #define __NR_pivot_root 41
 __SYSCALL(__NR_pivot_root, sys_pivot_root)
 
 /* fs/nfsctl.c */
 #define __NR_nfsservctl 42
-__SYSCALL(__NR_nfsservctl, sys_nfsservctl)
+__SYSCALL(__NR_nfsservctl, sys_ni_syscall)
 
 /* fs/open.c */
 #define __NR3264_statfs 43
-__SC_3264(__NR3264_statfs, sys_statfs64, sys_statfs)
+__SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \
+	       compat_sys_statfs64)
 #define __NR3264_fstatfs 44
-__SC_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs)
+__SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \
+	       compat_sys_fstatfs64)
 #define __NR3264_truncate 45
-__SC_3264(__NR3264_truncate, sys_truncate64, sys_truncate)
+__SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \
+	       compat_sys_truncate64)
 #define __NR3264_ftruncate 46
-__SC_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate)
+__SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \
+	       compat_sys_ftruncate64)
 
 #define __NR_fallocate 47
-__SYSCALL(__NR_fallocate, sys_fallocate)
+__SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate)
 #define __NR_faccessat 48
 __SYSCALL(__NR_faccessat, sys_faccessat)
 #define __NR_chdir 49
@@ -166,7 +178,7 @@
 #define __NR_fchown 55
 __SYSCALL(__NR_fchown, sys_fchown)
 #define __NR_openat 56
-__SYSCALL(__NR_openat, sys_openat)
+__SC_COMP(__NR_openat, sys_openat, compat_sys_openat)
 #define __NR_close 57
 __SYSCALL(__NR_close, sys_close)
 #define __NR_vhangup 58
@@ -182,7 +194,7 @@
 
 /* fs/readdir.c */
 #define __NR_getdents64 61
-__SYSCALL(__NR_getdents64, sys_getdents64)
+__SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64)
 
 /* fs/read_write.c */
 #define __NR3264_lseek 62
@@ -192,35 +204,35 @@
 #define __NR_write 64
 __SYSCALL(__NR_write, sys_write)
 #define __NR_readv 65
-__SYSCALL(__NR_readv, sys_readv)
+__SC_COMP(__NR_readv, sys_readv, compat_sys_readv)
 #define __NR_writev 66
-__SYSCALL(__NR_writev, sys_writev)
+__SC_COMP(__NR_writev, sys_writev, compat_sys_writev)
 #define __NR_pread64 67
-__SYSCALL(__NR_pread64, sys_pread64)
+__SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64)
 #define __NR_pwrite64 68
-__SYSCALL(__NR_pwrite64, sys_pwrite64)
+__SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64)
 #define __NR_preadv 69
-__SYSCALL(__NR_preadv, sys_preadv)
+__SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv)
 #define __NR_pwritev 70
-__SYSCALL(__NR_pwritev, sys_pwritev)
+__SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev)
 
 /* fs/sendfile.c */
 #define __NR3264_sendfile 71
-__SC_3264(__NR3264_sendfile, sys_sendfile64, sys_sendfile)
+__SYSCALL(__NR3264_sendfile, sys_sendfile64)
 
 /* fs/select.c */
 #define __NR_pselect6 72
-__SYSCALL(__NR_pselect6, sys_pselect6)
+__SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6)
 #define __NR_ppoll 73
-__SYSCALL(__NR_ppoll, sys_ppoll)
+__SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll)
 
 /* fs/signalfd.c */
 #define __NR_signalfd4 74
-__SYSCALL(__NR_signalfd4, sys_signalfd4)
+__SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4)
 
 /* fs/splice.c */
 #define __NR_vmsplice 75
-__SYSCALL(__NR_vmsplice, sys_vmsplice)
+__SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice)
 #define __NR_splice 76
 __SYSCALL(__NR_splice, sys_splice)
 #define __NR_tee 77
@@ -241,20 +253,29 @@
 __SYSCALL(__NR_fsync, sys_fsync)
 #define __NR_fdatasync 83
 __SYSCALL(__NR_fdatasync, sys_fdatasync)
+#ifdef __ARCH_WANT_SYNC_FILE_RANGE2
+#define __NR_sync_file_range2 84
+__SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \
+	  compat_sys_sync_file_range2)
+#else
 #define __NR_sync_file_range 84
-__SYSCALL(__NR_sync_file_range, sys_sync_file_range) /* .long sys_sync_file_range2, */
+__SC_COMP(__NR_sync_file_range, sys_sync_file_range, \
+	  compat_sys_sync_file_range)
+#endif
 
 /* fs/timerfd.c */
 #define __NR_timerfd_create 85
 __SYSCALL(__NR_timerfd_create, sys_timerfd_create)
 #define __NR_timerfd_settime 86
-__SYSCALL(__NR_timerfd_settime, sys_timerfd_settime)
+__SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \
+	  compat_sys_timerfd_settime)
 #define __NR_timerfd_gettime 87
-__SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime)
+__SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \
+	  compat_sys_timerfd_gettime)
 
 /* fs/utimes.c */
 #define __NR_utimensat 88
-__SYSCALL(__NR_utimensat, sys_utimensat)
+__SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat)
 
 /* kernel/acct.c */
 #define __NR_acct 89
@@ -276,7 +297,7 @@
 #define __NR_exit_group 94
 __SYSCALL(__NR_exit_group, sys_exit_group)
 #define __NR_waitid 95
-__SYSCALL(__NR_waitid, sys_waitid)
+__SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid)
 
 /* kernel/fork.c */
 #define __NR_set_tid_address 96
@@ -286,25 +307,27 @@
 
 /* kernel/futex.c */
 #define __NR_futex 98
-__SYSCALL(__NR_futex, sys_futex)
+__SC_COMP(__NR_futex, sys_futex, compat_sys_futex)
 #define __NR_set_robust_list 99
-__SYSCALL(__NR_set_robust_list, sys_set_robust_list)
+__SC_COMP(__NR_set_robust_list, sys_set_robust_list, \
+	  compat_sys_set_robust_list)
 #define __NR_get_robust_list 100
-__SYSCALL(__NR_get_robust_list, sys_get_robust_list)
+__SC_COMP(__NR_get_robust_list, sys_get_robust_list, \
+	  compat_sys_get_robust_list)
 
 /* kernel/hrtimer.c */
 #define __NR_nanosleep 101
-__SYSCALL(__NR_nanosleep, sys_nanosleep)
+__SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep)
 
 /* kernel/itimer.c */
 #define __NR_getitimer 102
-__SYSCALL(__NR_getitimer, sys_getitimer)
+__SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer)
 #define __NR_setitimer 103
-__SYSCALL(__NR_setitimer, sys_setitimer)
+__SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer)
 
 /* kernel/kexec.c */
 #define __NR_kexec_load 104
-__SYSCALL(__NR_kexec_load, sys_kexec_load)
+__SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load)
 
 /* kernel/module.c */
 #define __NR_init_module 105
@@ -314,23 +337,24 @@
 
 /* kernel/posix-timers.c */
 #define __NR_timer_create 107
-__SYSCALL(__NR_timer_create, sys_timer_create)
+__SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create)
 #define __NR_timer_gettime 108
-__SYSCALL(__NR_timer_gettime, sys_timer_gettime)
+__SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime)
 #define __NR_timer_getoverrun 109
 __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
 #define __NR_timer_settime 110
-__SYSCALL(__NR_timer_settime, sys_timer_settime)
+__SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime)
 #define __NR_timer_delete 111
 __SYSCALL(__NR_timer_delete, sys_timer_delete)
 #define __NR_clock_settime 112
-__SYSCALL(__NR_clock_settime, sys_clock_settime)
+__SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime)
 #define __NR_clock_gettime 113
-__SYSCALL(__NR_clock_gettime, sys_clock_gettime)
+__SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime)
 #define __NR_clock_getres 114
-__SYSCALL(__NR_clock_getres, sys_clock_getres)
+__SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres)
 #define __NR_clock_nanosleep 115
-__SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep)
+__SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \
+	  compat_sys_clock_nanosleep)
 
 /* kernel/printk.c */
 #define __NR_syslog 116
@@ -350,9 +374,11 @@
 #define __NR_sched_getparam 121
 __SYSCALL(__NR_sched_getparam, sys_sched_getparam)
 #define __NR_sched_setaffinity 122
-__SYSCALL(__NR_sched_setaffinity, sys_sched_setaffinity)
+__SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \
+	  compat_sys_sched_setaffinity)
 #define __NR_sched_getaffinity 123
-__SYSCALL(__NR_sched_getaffinity, sys_sched_getaffinity)
+__SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \
+	  compat_sys_sched_getaffinity)
 #define __NR_sched_yield 124
 __SYSCALL(__NR_sched_yield, sys_sched_yield)
 #define __NR_sched_get_priority_max 125
@@ -360,7 +386,8 @@
 #define __NR_sched_get_priority_min 126
 __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
 #define __NR_sched_rr_get_interval 127
-__SYSCALL(__NR_sched_rr_get_interval, sys_sched_rr_get_interval)
+__SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \
+	  compat_sys_sched_rr_get_interval)
 
 /* kernel/signal.c */
 #define __NR_restart_syscall 128
@@ -372,21 +399,23 @@
 #define __NR_tgkill 131
 __SYSCALL(__NR_tgkill, sys_tgkill)
 #define __NR_sigaltstack 132
-__SYSCALL(__NR_sigaltstack, sys_sigaltstack)
+__SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack)
 #define __NR_rt_sigsuspend 133
-__SYSCALL(__NR_rt_sigsuspend, sys_rt_sigsuspend) /* __ARCH_WANT_SYS_RT_SIGSUSPEND */
+__SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend)
 #define __NR_rt_sigaction 134
-__SYSCALL(__NR_rt_sigaction, sys_rt_sigaction) /* __ARCH_WANT_SYS_RT_SIGACTION */
+__SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction)
 #define __NR_rt_sigprocmask 135
 __SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask)
 #define __NR_rt_sigpending 136
 __SYSCALL(__NR_rt_sigpending, sys_rt_sigpending)
 #define __NR_rt_sigtimedwait 137
-__SYSCALL(__NR_rt_sigtimedwait, sys_rt_sigtimedwait)
+__SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \
+	  compat_sys_rt_sigtimedwait)
 #define __NR_rt_sigqueueinfo 138
-__SYSCALL(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo)
+__SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \
+	  compat_sys_rt_sigqueueinfo)
 #define __NR_rt_sigreturn 139
-__SYSCALL(__NR_rt_sigreturn, sys_rt_sigreturn) /* sys_rt_sigreturn_wrapper, */
+__SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn)
 
 /* kernel/sys.c */
 #define __NR_setpriority 140
@@ -416,7 +445,7 @@
 #define __NR_setfsgid 152
 __SYSCALL(__NR_setfsgid, sys_setfsgid)
 #define __NR_times 153
-__SYSCALL(__NR_times, sys_times)
+__SC_COMP(__NR_times, sys_times, compat_sys_times)
 #define __NR_setpgid 154
 __SYSCALL(__NR_setpgid, sys_setpgid)
 #define __NR_getpgid 155
@@ -436,11 +465,11 @@
 #define __NR_setdomainname 162
 __SYSCALL(__NR_setdomainname, sys_setdomainname)
 #define __NR_getrlimit 163
-__SYSCALL(__NR_getrlimit, sys_getrlimit)
+__SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
 #define __NR_setrlimit 164
-__SYSCALL(__NR_setrlimit, sys_setrlimit)
+__SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
 #define __NR_getrusage 165
-__SYSCALL(__NR_getrusage, sys_getrusage)
+__SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage)
 #define __NR_umask 166
 __SYSCALL(__NR_umask, sys_umask)
 #define __NR_prctl 167
@@ -450,11 +479,11 @@
 
 /* kernel/time.c */
 #define __NR_gettimeofday 169
-__SYSCALL(__NR_gettimeofday, sys_gettimeofday)
+__SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday)
 #define __NR_settimeofday 170
-__SYSCALL(__NR_settimeofday, sys_settimeofday)
+__SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday)
 #define __NR_adjtimex 171
-__SYSCALL(__NR_adjtimex, sys_adjtimex)
+__SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex)
 
 /* kernel/timer.c */
 #define __NR_getpid 172
@@ -472,39 +501,40 @@
 #define __NR_gettid 178
 __SYSCALL(__NR_gettid, sys_gettid)
 #define __NR_sysinfo 179
-__SYSCALL(__NR_sysinfo, sys_sysinfo)
+__SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo)
 
 /* ipc/mqueue.c */
 #define __NR_mq_open 180
-__SYSCALL(__NR_mq_open, sys_mq_open)
+__SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open)
 #define __NR_mq_unlink 181
 __SYSCALL(__NR_mq_unlink, sys_mq_unlink)
 #define __NR_mq_timedsend 182
-__SYSCALL(__NR_mq_timedsend, sys_mq_timedsend)
+__SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend)
 #define __NR_mq_timedreceive 183
-__SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive)
+__SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \
+	  compat_sys_mq_timedreceive)
 #define __NR_mq_notify 184
-__SYSCALL(__NR_mq_notify, sys_mq_notify)
+__SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify)
 #define __NR_mq_getsetattr 185
-__SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr)
+__SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr)
 
 /* ipc/msg.c */
 #define __NR_msgget 186
 __SYSCALL(__NR_msgget, sys_msgget)
 #define __NR_msgctl 187
-__SYSCALL(__NR_msgctl, sys_msgctl)
+__SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl)
 #define __NR_msgrcv 188
-__SYSCALL(__NR_msgrcv, sys_msgrcv)
+__SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv)
 #define __NR_msgsnd 189
-__SYSCALL(__NR_msgsnd, sys_msgsnd)
+__SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd)
 
 /* ipc/sem.c */
 #define __NR_semget 190
 __SYSCALL(__NR_semget, sys_semget)
 #define __NR_semctl 191
-__SYSCALL(__NR_semctl, sys_semctl)
+__SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl)
 #define __NR_semtimedop 192
-__SYSCALL(__NR_semtimedop, sys_semtimedop)
+__SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop)
 #define __NR_semop 193
 __SYSCALL(__NR_semop, sys_semop)
 
@@ -512,9 +542,9 @@
 #define __NR_shmget 194
 __SYSCALL(__NR_shmget, sys_shmget)
 #define __NR_shmctl 195
-__SYSCALL(__NR_shmctl, sys_shmctl)
+__SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl)
 #define __NR_shmat 196
-__SYSCALL(__NR_shmat, sys_shmat)
+__SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat)
 #define __NR_shmdt 197
 __SYSCALL(__NR_shmdt, sys_shmdt)
 
@@ -538,21 +568,21 @@
 #define __NR_sendto 206
 __SYSCALL(__NR_sendto, sys_sendto)
 #define __NR_recvfrom 207
-__SYSCALL(__NR_recvfrom, sys_recvfrom)
+__SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom)
 #define __NR_setsockopt 208
-__SYSCALL(__NR_setsockopt, sys_setsockopt)
+__SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt)
 #define __NR_getsockopt 209
-__SYSCALL(__NR_getsockopt, sys_getsockopt)
+__SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt)
 #define __NR_shutdown 210
 __SYSCALL(__NR_shutdown, sys_shutdown)
 #define __NR_sendmsg 211
-__SYSCALL(__NR_sendmsg, sys_sendmsg)
+__SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg)
 #define __NR_recvmsg 212
-__SYSCALL(__NR_recvmsg, sys_recvmsg)
+__SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg)
 
 /* mm/filemap.c */
 #define __NR_readahead 213
-__SYSCALL(__NR_readahead, sys_readahead)
+__SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead)
 
 /* mm/nommu.c, also with MMU */
 #define __NR_brk 214
@@ -568,19 +598,19 @@
 #define __NR_request_key 218
 __SYSCALL(__NR_request_key, sys_request_key)
 #define __NR_keyctl 219
-__SYSCALL(__NR_keyctl, sys_keyctl)
+__SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl)
 
 /* arch/example/kernel/sys_example.c */
 #define __NR_clone 220
-__SYSCALL(__NR_clone, sys_clone)	/* .long sys_clone_wrapper */
+__SYSCALL(__NR_clone, sys_clone)
 #define __NR_execve 221
-__SYSCALL(__NR_execve, sys_execve)	/* .long sys_execve_wrapper */
+__SC_COMP(__NR_execve, sys_execve, compat_sys_execve)
 
 #define __NR3264_mmap 222
 __SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
 /* mm/fadvise.c */
 #define __NR3264_fadvise64 223
-__SC_3264(__NR3264_fadvise64, sys_fadvise64_64, sys_fadvise64)
+__SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64)
 
 /* mm/, CONFIG_MMU only */
 #ifndef __ARCH_NOMMU
@@ -607,31 +637,70 @@
 #define __NR_remap_file_pages 234
 __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
 #define __NR_mbind 235
-__SYSCALL(__NR_mbind, sys_mbind)
+__SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind)
 #define __NR_get_mempolicy 236
-__SYSCALL(__NR_get_mempolicy, sys_get_mempolicy)
+__SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy)
 #define __NR_set_mempolicy 237
-__SYSCALL(__NR_set_mempolicy, sys_set_mempolicy)
+__SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy)
 #define __NR_migrate_pages 238
-__SYSCALL(__NR_migrate_pages, sys_migrate_pages)
+__SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages)
 #define __NR_move_pages 239
-__SYSCALL(__NR_move_pages, sys_move_pages)
+__SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages)
 #endif
 
 #define __NR_rt_tgsigqueueinfo 240
-__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo)
-#define __NR_perf_counter_open 241
-__SYSCALL(__NR_perf_counter_open, sys_perf_counter_open)
+__SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \
+	  compat_sys_rt_tgsigqueueinfo)
+#define __NR_perf_event_open 241
+__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
+#define __NR_accept4 242
+__SYSCALL(__NR_accept4, sys_accept4)
+#define __NR_recvmmsg 243
+__SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg)
+
+/*
+ * Architectures may provide up to 16 syscalls of their own
+ * starting with this value.
+ */
+#define __NR_arch_specific_syscall 244
+
+#define __NR_wait4 260
+__SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4)
+#define __NR_prlimit64 261
+__SYSCALL(__NR_prlimit64, sys_prlimit64)
+#define __NR_fanotify_init 262
+__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
+#define __NR_fanotify_mark 263
+__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
+#define __NR_name_to_handle_at         264
+__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
+#define __NR_open_by_handle_at         265
+__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \
+	  compat_sys_open_by_handle_at)
+#define __NR_clock_adjtime 266
+__SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime)
+#define __NR_syncfs 267
+__SYSCALL(__NR_syncfs, sys_syncfs)
+#define __NR_setns 268
+__SYSCALL(__NR_setns, sys_setns)
+#define __NR_sendmmsg 269
+__SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg)
+#define __NR_process_vm_readv 270
+__SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \
+          compat_sys_process_vm_readv)
+#define __NR_process_vm_writev 271
+__SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \
+          compat_sys_process_vm_writev)
 
 #undef __NR_syscalls
-#define __NR_syscalls 242
+#define __NR_syscalls 272
 
 /*
  * All syscalls below here should go away really,
  * these are provided for both review and as a porting
  * help for the C library version.
 *
- * Last chance: are any of these important enought to
+ * Last chance: are any of these important enough to
  * enable by default?
  */
 #ifdef __ARCH_WANT_SYSCALL_NO_AT
@@ -690,7 +759,8 @@
 #define __NR_syscalls (__NR_signalfd+1)
 #endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
 
-#if __BITS_PER_LONG == 32 && defined(__ARCH_WANT_SYSCALL_OFF_T)
+#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \
+     defined(__ARCH_WANT_SYSCALL_OFF_T)
 #define __NR_sendfile 1046
 __SYSCALL(__NR_sendfile, sys_sendfile)
 #define __NR_ftruncate 1047
@@ -736,6 +806,7 @@
 __SYSCALL(__NR_pause, sys_pause)
 #define __NR_time 1062
 #define __ARCH_WANT_SYS_TIME
+#define __ARCH_WANT_COMPAT_SYS_TIME
 __SYSCALL(__NR_time, sys_time)
 #define __NR_utime 1063
 #define __ARCH_WANT_SYS_UTIME
@@ -759,8 +830,8 @@
 __SYSCALL(__NR_ustat, sys_ustat)
 #define __NR_vfork 1071
 __SYSCALL(__NR_vfork, sys_vfork)
-#define __NR_wait4 1072
-__SYSCALL(__NR_wait4, sys_wait4)
+#define __NR_oldwait4 1072
+__SYSCALL(__NR_oldwait4, sys_wait4)
 #define __NR_recv 1073
 __SYSCALL(__NR_recv, sys_recv)
 #define __NR_send 1074
@@ -797,12 +868,12 @@
  * Here we map the numbers so that both versions
  * use the same syscall table layout.
  */
-#if __BITS_PER_LONG == 64
+#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
 #define __NR_fcntl __NR3264_fcntl
 #define __NR_statfs __NR3264_statfs
 #define __NR_fstatfs __NR3264_fstatfs
 #define __NR_truncate __NR3264_truncate
-#define __NR_ftruncate __NR3264_truncate
+#define __NR_ftruncate __NR3264_ftruncate
 #define __NR_lseek __NR3264_lseek
 #define __NR_sendfile __NR3264_sendfile
 #define __NR_newfstatat __NR3264_fstatat
@@ -818,7 +889,7 @@
 #define __NR_statfs64 __NR3264_statfs
 #define __NR_fstatfs64 __NR3264_fstatfs
 #define __NR_truncate64 __NR3264_truncate
-#define __NR_ftruncate64 __NR3264_truncate
+#define __NR_ftruncate64 __NR3264_ftruncate
 #define __NR_llseek __NR3264_lseek
 #define __NR_sendfile64 __NR3264_sendfile
 #define __NR_fstatat64 __NR3264_fstatat
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/errno.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/errno.h
index 0e3e0d2..a86aa10 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/errno.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/errno.h
@@ -121,6 +121,8 @@
 
 #define	ERFKILL		167	/* Operation not possible due to RF-kill */
 
+#define EHWPOISON	168	/* Memory page has hardware error */
+
 #define EDQUOT		1133	/* Quota exceeded */
 
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/fcntl.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/fcntl.h
index 2a52333..75edded 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/fcntl.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/fcntl.h
@@ -10,7 +10,7 @@
 
 
 #define O_APPEND	0x0008
-#define O_SYNC		0x0010
+#define O_DSYNC		0x0010	/* used to be O_SYNC, see below */
 #define O_NONBLOCK	0x0080
 #define O_CREAT         0x0100	/* not fcntl */
 #define O_TRUNC		0x0200	/* not fcntl */
@@ -18,6 +18,21 @@
 #define O_NOCTTY	0x0800	/* not fcntl */
 #define FASYNC		0x1000	/* fcntl, for BSD compatibility */
 #define O_LARGEFILE	0x2000	/* allow large file opens */
+/*
+ * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
+ * the O_SYNC flag.  We continue to use the existing numerical value
+ * for O_DSYNC semantics now, but using the correct symbolic name for it.
+ * This new value is used to request true Posix O_SYNC semantics.  It is
+ * defined in this strange way to make sure applications compiled against
+ * new headers get at least O_DSYNC semantics on older kernels.
+ *
+ * This has the nice side-effect that we can simply test for O_DSYNC
+ * wherever we do not care if O_DSYNC or O_SYNC is used.
+ *
+ * Note: __O_SYNC must never be used directly.
+ */
+#define __O_SYNC	0x4000
+#define O_SYNC		(__O_SYNC|O_DSYNC)
 #define O_DIRECT	0x8000	/* direct disk access hint */
 
 #define F_GETLK		14
@@ -41,6 +56,7 @@
  */
 
 #ifdef CONFIG_32BIT
+#include <linux/types.h>
 
 struct flock {
 	short	l_type;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/ioctls.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/ioctls.h
index a8fed70..9223ab3 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/ioctls.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/ioctls.h
@@ -41,7 +41,7 @@
 #define	 TIOCPKT_START		0x08	/* start output */
 #define	 TIOCPKT_NOSTOP		0x10	/* no more ^S, ^Q */
 #define	 TIOCPKT_DOSTOP		0x20	/* now do ^S ^Q */
-/* #define  TIOCPKT_IOCTL		0x40	state change of pty driver */
+#define  TIOCPKT_IOCTL		0x40	/* state change of pty driver */
 #define TIOCSWINSZ	_IOW('t', 103, struct winsize)	/* set window size */
 #define TIOCGWINSZ	_IOR('t', 104, struct winsize)	/* get window size */
 #define TIOCNOTTY	0x5471		/* void tty association */
@@ -83,6 +83,9 @@
 #define TCSETSF2	_IOW('T', 0x2D, struct termios2)
 #define TIOCGPTN	_IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
 #define TIOCSPTLCK	_IOW('T', 0x31, int)  /* Lock/unlock Pty */
+#define TIOCGDEV	_IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
+#define TIOCSIG		_IOW('T', 0x36, int)  /* Generate signal on Pty slave */
+#define TIOCVHANGUP	0x5437
 
 /* I hope the range from 0x5480 on is free ... */
 #define TIOCSCTTY	0x5480		/* become controlling tty */
@@ -103,7 +106,5 @@
 #define TIOCSERSETMULTI 0x5490 /* Set multiport config */
 #define TIOCMIWAIT      0x5491 /* wait for a change on serial input line(s) */
 #define TIOCGICOUNT     0x5492 /* read serial port __inline__ interrupt counts */
-#define TIOCGHAYESESP	0x5493 /* Get Hayes ESP configuration */
-#define TIOCSHAYESESP	0x5494 /* Set Hayes ESP configuration */
 
 #endif /* __ASM_IOCTLS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/ipcbuf.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/ipcbuf.h
index d47d08f..84c7e51 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/ipcbuf.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/ipcbuf.h
@@ -1,28 +1 @@
-#ifndef _ASM_IPCBUF_H
-#define _ASM_IPCBUF_H
-
-/*
- * The ipc64_perm structure for alpha architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 32-bit seq
- * - 2 miscellaneous 64-bit values
- */
-
-struct ipc64_perm
-{
-	__kernel_key_t	key;
-	__kernel_uid_t	uid;
-	__kernel_gid_t	gid;
-	__kernel_uid_t	cuid;
-	__kernel_gid_t	cgid;
-	__kernel_mode_t	mode;
-	unsigned short	seq;
-	unsigned short	__pad1;
-	unsigned long	__unused1;
-	unsigned long	__unused2;
-};
-
-#endif /* _ASM_IPCBUF_H */
+#include <asm-generic/ipcbuf.h>
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/mman.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/mman.h
index e4d6f1f..785b4ea 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/mman.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/mman.h
@@ -46,6 +46,8 @@
 #define MAP_LOCKED	0x8000		/* pages are locked */
 #define MAP_POPULATE	0x10000		/* populate (prefault) pagetables */
 #define MAP_NONBLOCK	0x20000		/* do not block on IO */
+#define MAP_STACK	0x40000		/* give out an address that is best suited for process/thread stacks */
+#define MAP_HUGETLB	0x80000		/* create a huge page mapping */
 
 /*
  * Flags for msync
@@ -71,6 +73,13 @@
 #define MADV_DONTFORK	10		/* don't inherit across fork */
 #define MADV_DOFORK	11		/* do inherit across fork */
 
+#define MADV_MERGEABLE   12		/* KSM may merge identical pages */
+#define MADV_UNMERGEABLE 13		/* KSM may not merge identical pages */
+#define MADV_HWPOISON    100		/* poison a page for testing */
+
+#define MADV_HUGEPAGE	14		/* Worth backing with hugepages */
+#define MADV_NOHUGEPAGE	15		/* Not worth backing with hugepages */
+
 /* compatibility flags */
 #define MAP_FILE	0
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/param.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/param.h
index b5b7262..da3920f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/param.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/param.h
@@ -9,17 +9,8 @@
 #ifndef _ASM_PARAM_H
 #define _ASM_PARAM_H
 
-
-#ifndef HZ
-#define HZ 100
-#endif
-
 #define EXEC_PAGESIZE	65536
 
-#ifndef NOGROUP
-#define NOGROUP		(-1)
-#endif
-
-#define MAXHOSTNAMELEN	64	/* max length of hostname */
+#include <asm-generic/param.h>
 
 #endif /* _ASM_PARAM_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/setup.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/setup.h
index 7c12a41..4f9ea8c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/setup.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/setup.h
@@ -1,7 +1,7 @@
 #ifndef _MIPS_SETUP_H
 #define _MIPS_SETUP_H
 
-#define COMMAND_LINE_SIZE	256
+#define COMMAND_LINE_SIZE	4096
 
 
 #endif /* __SETUP_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/siginfo.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/siginfo.h
index f6828f2..567646a 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/siginfo.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/siginfo.h
@@ -88,6 +88,7 @@
 #ifdef __ARCH_SI_TRAPNO
 			int _trapno;	/* TRAP # which caused the signal */
 #endif
+			short _addr_lsb;
 		} _sigfault;
 
 		/* SIGPOLL, SIGXFSZ (To do ...)  */
@@ -100,7 +101,7 @@
 
 /*
  * si_code values
- * Again these have been choosen to be IRIX compatible.
+ * Again these have been chosen to be IRIX compatible.
  */
 #undef SI_ASYNCIO
 #undef SI_TIMER
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/socket.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/socket.h
index 73a5b70..049a014 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/socket.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/socket.h
@@ -42,6 +42,8 @@
 #define SO_SNDTIMEO	0x1005	/* send timeout */
 #define SO_RCVTIMEO 	0x1006	/* receive timeout */
 #define SO_ACCEPTCONN	0x1009
+#define SO_PROTOCOL	0x1028	/* protocol type */
+#define SO_DOMAIN	0x1029	/* domain/socket family */
 
 /* linux-specific, might as well be the same as on i386 */
 #define SO_NO_CHECK	11
@@ -78,5 +80,10 @@
 #define SO_TIMESTAMPING		37
 #define SCM_TIMESTAMPING	SO_TIMESTAMPING
 
+#define SO_RXQ_OVFL             40
+
+#define SO_WIFI_STATUS		41
+#define SCM_WIFI_STATUS		SO_WIFI_STATUS
+
 
 #endif /* _ASM_SOCKET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/statfs.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/statfs.h
index c3ddf97..0f805c7 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/statfs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/statfs.h
@@ -33,7 +33,8 @@
 	/* Linux specials */
 	__kernel_fsid_t	f_fsid;
 	long		f_namelen;
-	long		f_spare[6];
+	long		f_flags;
+	long		f_spare[5];
 };
 
 #if (_MIPS_SIM == _MIPS_SIM_ABI32) || (_MIPS_SIM == _MIPS_SIM_NABI32)
@@ -53,7 +54,8 @@
 	__u64	f_bavail;
 	__kernel_fsid_t f_fsid;
 	__u32	f_namelen;
-	__u32	f_spare[6];
+	__u32	f_flags;
+	__u32	f_spare[5];
 };
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
@@ -73,7 +75,8 @@
 	/* Linux specials */
 	__kernel_fsid_t	f_fsid;
 	long		f_namelen;
-	long		f_spare[6];
+	long		f_flags;
+	long		f_spare[5];
 };
 
 struct compat_statfs64 {
@@ -88,7 +91,8 @@
 	__u64	f_bavail;
 	__kernel_fsid_t f_fsid;
 	__u32	f_namelen;
-	__u32	f_spare[6];
+	__u32	f_flags;
+	__u32	f_spare[5];
 };
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/termbits.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/termbits.h
index c83c684..76630b3 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/termbits.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/termbits.h
@@ -203,6 +203,7 @@
 #define PENDIN	0040000		/* Retype pending input (state).  */
 #define TOSTOP	0100000		/* Send SIGTTOU for background output.  */
 #define ITOSTOP	TOSTOP
+#define EXTPROC	0200000		/* External processing on pty */
 
 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
 #define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/types.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/types.h
index 6e0e3e7..855c63f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/types.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/types.h
@@ -15,17 +15,11 @@
  * We don't use int-l64.h for the kernel anymore but still use it for
  * userspace to avoid code changes.
  */
-#if (_MIPS_SZLONG == 64) && !defined(__KERNEL__)
-# include <asm-generic/int-l64.h>
-#else
-# include <asm-generic/int-ll64.h>
-#endif
-
-#ifndef __ASSEMBLY__
-
-typedef unsigned short umode_t;
-
-#endif /* __ASSEMBLY__ */
+# if _MIPS_SZLONG == 64
+#  include <asm-generic/int-l64.h>
+# else
+#  include <asm-generic/int-ll64.h>
+# endif
 
 /*
  * These aren't exported outside the kernel to avoid name space clashes
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/asm/unistd.h b/mips-qca-linux-uclibc/sysroot/usr/include/asm/unistd.h
index c713e16..0667b6b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/asm/unistd.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/asm/unistd.h
@@ -353,18 +353,30 @@
 #define __NR_preadv			(__NR_Linux + 330)
 #define __NR_pwritev			(__NR_Linux + 331)
 #define __NR_rt_tgsigqueueinfo		(__NR_Linux + 332)
-#define __NR_perf_counter_open		(__NR_Linux + 333)
+#define __NR_perf_event_open		(__NR_Linux + 333)
 #define __NR_accept4			(__NR_Linux + 334)
+#define __NR_recvmmsg			(__NR_Linux + 335)
+#define __NR_fanotify_init		(__NR_Linux + 336)
+#define __NR_fanotify_mark		(__NR_Linux + 337)
+#define __NR_prlimit64			(__NR_Linux + 338)
+#define __NR_name_to_handle_at		(__NR_Linux + 339)
+#define __NR_open_by_handle_at		(__NR_Linux + 340)
+#define __NR_clock_adjtime		(__NR_Linux + 341)
+#define __NR_syncfs			(__NR_Linux + 342)
+#define __NR_sendmmsg			(__NR_Linux + 343)
+#define __NR_setns			(__NR_Linux + 344)
+#define __NR_process_vm_readv		(__NR_Linux + 345)
+#define __NR_process_vm_writev		(__NR_Linux + 346)
 
 /*
  * Offset of the last Linux o32 flavoured syscall
  */
-#define __NR_Linux_syscalls		334
+#define __NR_Linux_syscalls		346
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
 #define __NR_O32_Linux			4000
-#define __NR_O32_Linux_syscalls		334
+#define __NR_O32_Linux_syscalls		346
 
 #if _MIPS_SIM == _MIPS_SIM_ABI64
 
@@ -664,18 +676,30 @@
 #define __NR_preadv			(__NR_Linux + 289)
 #define __NR_pwritev			(__NR_Linux + 290)
 #define __NR_rt_tgsigqueueinfo		(__NR_Linux + 291)
-#define __NR_perf_counter_open		(__NR_Linux + 292)
+#define __NR_perf_event_open		(__NR_Linux + 292)
 #define __NR_accept4			(__NR_Linux + 293)
+#define __NR_recvmmsg			(__NR_Linux + 294)
+#define __NR_fanotify_init		(__NR_Linux + 295)
+#define __NR_fanotify_mark		(__NR_Linux + 296)
+#define __NR_prlimit64			(__NR_Linux + 297)
+#define __NR_name_to_handle_at		(__NR_Linux + 298)
+#define __NR_open_by_handle_at		(__NR_Linux + 299)
+#define __NR_clock_adjtime		(__NR_Linux + 300)
+#define __NR_syncfs			(__NR_Linux + 301)
+#define __NR_sendmmsg			(__NR_Linux + 302)
+#define __NR_setns			(__NR_Linux + 303)
+#define __NR_process_vm_readv		(__NR_Linux + 304)
+#define __NR_process_vm_writev		(__NR_Linux + 305)
 
 /*
  * Offset of the last Linux 64-bit flavoured syscall
  */
-#define __NR_Linux_syscalls		293
+#define __NR_Linux_syscalls		305
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
 
 #define __NR_64_Linux			5000
-#define __NR_64_Linux_syscalls		293
+#define __NR_64_Linux_syscalls		305
 
 #if _MIPS_SIM == _MIPS_SIM_NABI32
 
@@ -979,17 +1003,30 @@
 #define __NR_preadv			(__NR_Linux + 293)
 #define __NR_pwritev			(__NR_Linux + 294)
 #define __NR_rt_tgsigqueueinfo		(__NR_Linux + 295)
-#define __NR_perf_counter_open		(__NR_Linux + 296)
+#define __NR_perf_event_open		(__NR_Linux + 296)
 #define __NR_accept4			(__NR_Linux + 297)
+#define __NR_recvmmsg			(__NR_Linux + 298)
+#define __NR_getdents64			(__NR_Linux + 299)
+#define __NR_fanotify_init		(__NR_Linux + 300)
+#define __NR_fanotify_mark		(__NR_Linux + 301)
+#define __NR_prlimit64			(__NR_Linux + 302)
+#define __NR_name_to_handle_at		(__NR_Linux + 303)
+#define __NR_open_by_handle_at		(__NR_Linux + 304)
+#define __NR_clock_adjtime		(__NR_Linux + 305)
+#define __NR_syncfs			(__NR_Linux + 306)
+#define __NR_sendmmsg			(__NR_Linux + 307)
+#define __NR_setns			(__NR_Linux + 308)
+#define __NR_process_vm_readv		(__NR_Linux + 309)
+#define __NR_process_vm_writev		(__NR_Linux + 310)
 
 /*
  * Offset of the last N32 flavoured syscall
  */
-#define __NR_Linux_syscalls		297
+#define __NR_Linux_syscalls		310
 
 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 #define __NR_N32_Linux			6000
-#define __NR_N32_Linux_syscalls		297
+#define __NR_N32_Linux_syscalls		310
 
 #endif /* _ASM_UNISTD_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/bits/sysnum.h b/mips-qca-linux-uclibc/sysroot/usr/include/bits/sysnum.h
index e5c017d..f48869c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/bits/sysnum.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/bits/sysnum.h
@@ -1006,32 +1006,68 @@
 #undef __NR_rt_tgsigqueueinfo
 #define __NR_rt_tgsigqueueinfo (4000 + 332)
 #define SYS_rt_tgsigqueueinfo __NR_rt_tgsigqueueinfo
-#undef __NR_perf_counter_open
-#define __NR_perf_counter_open (4000 + 333)
-#define SYS_perf_counter_open __NR_perf_counter_open
+#undef __NR_perf_event_open
+#define __NR_perf_event_open (4000 + 333)
+#define SYS_perf_event_open __NR_perf_event_open
 #undef __NR_accept4
 #define __NR_accept4 (4000 + 334)
 #define SYS_accept4 __NR_accept4
+#undef __NR_recvmmsg
+#define __NR_recvmmsg (4000 + 335)
+#define SYS_recvmmsg __NR_recvmmsg
+#undef __NR_fanotify_init
+#define __NR_fanotify_init (4000 + 336)
+#define SYS_fanotify_init __NR_fanotify_init
+#undef __NR_fanotify_mark
+#define __NR_fanotify_mark (4000 + 337)
+#define SYS_fanotify_mark __NR_fanotify_mark
+#undef __NR_prlimit64
+#define __NR_prlimit64 (4000 + 338)
+#define SYS_prlimit64 __NR_prlimit64
+#undef __NR_name_to_handle_at
+#define __NR_name_to_handle_at (4000 + 339)
+#define SYS_name_to_handle_at __NR_name_to_handle_at
+#undef __NR_open_by_handle_at
+#define __NR_open_by_handle_at (4000 + 340)
+#define SYS_open_by_handle_at __NR_open_by_handle_at
+#undef __NR_clock_adjtime
+#define __NR_clock_adjtime (4000 + 341)
+#define SYS_clock_adjtime __NR_clock_adjtime
+#undef __NR_syncfs
+#define __NR_syncfs (4000 + 342)
+#define SYS_syncfs __NR_syncfs
+#undef __NR_sendmmsg
+#define __NR_sendmmsg (4000 + 343)
+#define SYS_sendmmsg __NR_sendmmsg
+#undef __NR_setns
+#define __NR_setns (4000 + 344)
+#define SYS_setns __NR_setns
+#undef __NR_process_vm_readv
+#define __NR_process_vm_readv (4000 + 345)
+#define SYS_process_vm_readv __NR_process_vm_readv
+#undef __NR_process_vm_writev
+#define __NR_process_vm_writev (4000 + 346)
+#define SYS_process_vm_writev __NR_process_vm_writev
 #undef __NR_Linux_syscalls
-#define __NR_Linux_syscalls 334
+#define __NR_Linux_syscalls 346
 #define SYS_Linux_syscalls __NR_Linux_syscalls
 #undef __NR_O32_Linux
 #define __NR_O32_Linux 4000
 #define SYS_O32_Linux __NR_O32_Linux
 #undef __NR_O32_Linux_syscalls
-#define __NR_O32_Linux_syscalls 334
+#define __NR_O32_Linux_syscalls 346
 #define SYS_O32_Linux_syscalls __NR_O32_Linux_syscalls
 #undef __NR_64_Linux
 #define __NR_64_Linux 5000
 #define SYS_64_Linux __NR_64_Linux
 #undef __NR_64_Linux_syscalls
-#define __NR_64_Linux_syscalls 293
+#define __NR_64_Linux_syscalls 305
 #define SYS_64_Linux_syscalls __NR_64_Linux_syscalls
 #undef __NR_N32_Linux
 #define __NR_N32_Linux 6000
 #define SYS_N32_Linux __NR_N32_Linux
 #undef __NR_N32_Linux_syscalls
-#define __NR_N32_Linux_syscalls 297
+#define __NR_N32_Linux_syscalls 310
 #define SYS_N32_Linux_syscalls __NR_N32_Linux_syscalls
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/bits/uClibc_config.h b/mips-qca-linux-uclibc/sysroot/usr/include/bits/uClibc_config.h
index a013481..a5080dc 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/bits/uClibc_config.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/bits/uClibc_config.h
@@ -7,7 +7,7 @@
 #define __UCLIBC_SUBLEVEL__ 33
 /* Automatically generated make config: don't edit */
 /* Version: 0.9.33.2 */
-/* Wed Feb 18 14:40:03 2015 */
+/* Mon Jun  8 14:32:49 2015 */
 #undef __TARGET_alpha__
 #undef __TARGET_arm__
 #undef __TARGET_avr32__
@@ -150,7 +150,7 @@
 #define __UCLIBC_HAS_FULL_RPC__ 1
 #define __UCLIBC_HAS_REENTRANT_RPC__ 1
 #define __UCLIBC_USE_NETLINK__ 1
-#undef __UCLIBC_SUPPORT_AI_ADDRCONFIG__
+#define __UCLIBC_SUPPORT_AI_ADDRCONFIG__ 1
 #undef __UCLIBC_HAS_BSD_RES_CLOSE__
 #define __UCLIBC_HAS_COMPAT_RES_STATE__ 1
 #undef __UCLIBC_HAS_EXTRA_COMPAT_RES_STATE__
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/drm.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/drm.h
index cb1ec51..17f74c4 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/drm/drm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/drm.h
@@ -36,17 +36,27 @@
 #ifndef _DRM_H_
 #define _DRM_H_
 
-#include <linux/types.h>
-#include <asm/ioctl.h>		/* For _IO* macros */
-#define DRM_IOCTL_NR(n)		_IOC_NR(n)
-#define DRM_IOC_VOID		_IOC_NONE
-#define DRM_IOC_READ		_IOC_READ
-#define DRM_IOC_WRITE		_IOC_WRITE
-#define DRM_IOC_READWRITE	_IOC_READ|_IOC_WRITE
-#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
+#if defined(__linux__)
 
-#define DRM_MAJOR       226
-#define DRM_MAX_MINOR   15
+#include <linux/types.h>
+#include <asm/ioctl.h>
+typedef unsigned int drm_handle_t;
+
+#else /* One of the BSDs */
+
+#include <sys/ioccom.h>
+#include <sys/types.h>
+typedef int8_t   __s8;
+typedef uint8_t  __u8;
+typedef int16_t  __s16;
+typedef uint16_t __u16;
+typedef int32_t  __s32;
+typedef uint32_t __u32;
+typedef int64_t  __s64;
+typedef uint64_t __u64;
+typedef unsigned long drm_handle_t;
+
+#endif
 
 #define DRM_NAME	"drm"	  /**< Name in kernel, /dev, and /proc */
 #define DRM_MIN_ORDER	5	  /**< At least 2^5 bytes = 32 bytes */
@@ -59,7 +69,6 @@
 #define _DRM_LOCK_IS_CONT(lock)	   ((lock) & _DRM_LOCK_CONT)
 #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
 
-typedef unsigned int drm_handle_t;
 typedef unsigned int drm_context_t;
 typedef unsigned int drm_drawable_t;
 typedef unsigned int drm_magic_t;
@@ -454,15 +463,19 @@
 enum drm_vblank_seq_type {
 	_DRM_VBLANK_ABSOLUTE = 0x0,	/**< Wait for specific vblank sequence number */
 	_DRM_VBLANK_RELATIVE = 0x1,	/**< Wait for given number of vblanks */
+	/* bits 1-6 are reserved for high crtcs */
+	_DRM_VBLANK_HIGH_CRTC_MASK = 0x0000003e,
+	_DRM_VBLANK_EVENT = 0x4000000,   /**< Send event instead of blocking */
 	_DRM_VBLANK_FLIP = 0x8000000,   /**< Scheduled buffer swap should flip */
 	_DRM_VBLANK_NEXTONMISS = 0x10000000,	/**< If missed, wait for next vblank */
 	_DRM_VBLANK_SECONDARY = 0x20000000,	/**< Secondary display controller */
 	_DRM_VBLANK_SIGNAL = 0x40000000	/**< Send signal instead of blocking, unsupported */
 };
+#define _DRM_VBLANK_HIGH_CRTC_SHIFT 1
 
 #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE)
-#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \
-				_DRM_VBLANK_NEXTONMISS)
+#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_EVENT | _DRM_VBLANK_SIGNAL | \
+				_DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)
 
 struct drm_wait_vblank_request {
 	enum drm_vblank_seq_type type;
@@ -598,6 +611,12 @@
 	__u64 size;
 };
 
+/** DRM_IOCTL_GET_CAP ioctl argument type */
+struct drm_get_cap {
+	__u64 capability;
+	__u64 value;
+};
+
 #include "drm_mode.h"
 
 #define DRM_IOCTL_BASE			'd'
@@ -618,6 +637,7 @@
 #define DRM_IOCTL_GEM_CLOSE		DRM_IOW (0x09, struct drm_gem_close)
 #define DRM_IOCTL_GEM_FLINK		DRM_IOWR(0x0a, struct drm_gem_flink)
 #define DRM_IOCTL_GEM_OPEN		DRM_IOWR(0x0b, struct drm_gem_open)
+#define DRM_IOCTL_GET_CAP		DRM_IOWR(0x0c, struct drm_get_cap)
 
 #define DRM_IOCTL_SET_UNIQUE		DRM_IOW( 0x10, struct drm_unique)
 #define DRM_IOCTL_AUTH_MAGIC		DRM_IOW( 0x11, struct drm_auth)
@@ -653,6 +673,8 @@
 #define DRM_IOCTL_UNLOCK		DRM_IOW( 0x2b, struct drm_lock)
 #define DRM_IOCTL_FINISH		DRM_IOW( 0x2c, struct drm_lock)
 
+#define DRM_IOCTL_GEM_PRIME_OPEN        DRM_IOWR(0x2e, struct drm_gem_open)
+
 #define DRM_IOCTL_AGP_ACQUIRE		DRM_IO(  0x30)
 #define DRM_IOCTL_AGP_RELEASE		DRM_IO(  0x31)
 #define DRM_IOCTL_AGP_ENABLE		DRM_IOW( 0x32, struct drm_agp_mode)
@@ -686,6 +708,16 @@
 #define DRM_IOCTL_MODE_GETFB		DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
 #define DRM_IOCTL_MODE_ADDFB		DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
 #define DRM_IOCTL_MODE_RMFB		DRM_IOWR(0xAF, unsigned int)
+#define DRM_IOCTL_MODE_PAGE_FLIP	DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip)
+#define DRM_IOCTL_MODE_DIRTYFB		DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
+
+#define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb)
+#define DRM_IOCTL_MODE_MAP_DUMB    DRM_IOWR(0xB3, struct drm_mode_map_dumb)
+#define DRM_IOCTL_MODE_DESTROY_DUMB    DRM_IOWR(0xB4, struct drm_mode_destroy_dumb)
+#define DRM_IOCTL_MODE_GETPLANERESOURCES DRM_IOWR(0xB5, struct drm_mode_get_plane_res)
+#define DRM_IOCTL_MODE_GETPLANE	DRM_IOWR(0xB6, struct drm_mode_get_plane)
+#define DRM_IOCTL_MODE_SETPLANE	DRM_IOWR(0xB7, struct drm_mode_set_plane)
+#define DRM_IOCTL_MODE_ADDFB2		DRM_IOWR(0xB8, struct drm_mode_fb_cmd2)
 
 /**
  * Device specific ioctls should only be in their respective headers
@@ -698,6 +730,38 @@
 #define DRM_COMMAND_BASE                0x40
 #define DRM_COMMAND_END			0xA0
 
+/**
+ * Header for events written back to userspace on the drm fd.  The
+ * type defines the type of event, the length specifies the total
+ * length of the event (including the header), and user_data is
+ * typically a 64 bit value passed with the ioctl that triggered the
+ * event.  A read on the drm fd will always only return complete
+ * events, that is, if for example the read buffer is 100 bytes, and
+ * there are two 64 byte events pending, only one will be returned.
+ *
+ * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and
+ * up are chipset specific.
+ */
+struct drm_event {
+	__u32 type;
+	__u32 length;
+};
+
+#define DRM_EVENT_VBLANK 0x01
+#define DRM_EVENT_FLIP_COMPLETE 0x02
+
+struct drm_event_vblank {
+	struct drm_event base;
+	__u64 user_data;
+	__u32 tv_sec;
+	__u32 tv_usec;
+	__u32 sequence;
+	__u32 reserved;
+};
+
+#define DRM_CAP_DUMB_BUFFER 0x1
+#define DRM_CAP_VBLANK_HIGH_CRTC 0x2
+
 /* typedef area */
 typedef struct drm_clip_rect drm_clip_rect_t;
 typedef struct drm_drawable_info drm_drawable_info_t;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/drm_fourcc.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/drm_fourcc.h
new file mode 100644
index 0000000..bdf0152
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/drm_fourcc.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2011 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS 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 DRM_FOURCC_H
+#define DRM_FOURCC_H
+
+#include <linux/types.h>
+
+#define fourcc_code(a, b, c, d) ((__u32)(a) | ((__u32)(b) << 8) | \
+				 ((__u32)(c) << 16) | ((__u32)(d) << 24))
+
+#define DRM_FORMAT_BIG_ENDIAN (1<<31) /* format is big endian instead of little endian */
+
+/* color index */
+#define DRM_FORMAT_C8		fourcc_code('C', '8', ' ', ' ') /* [7:0] C */
+
+/* 8 bpp RGB */
+#define DRM_FORMAT_RGB332	fourcc_code('R', 'G', 'B', '8') /* [7:0] R:G:B 3:3:2 */
+#define DRM_FORMAT_BGR233	fourcc_code('B', 'G', 'R', '8') /* [7:0] B:G:R 2:3:3 */
+
+/* 16 bpp RGB */
+#define DRM_FORMAT_XRGB4444	fourcc_code('X', 'R', '1', '2') /* [15:0] x:R:G:B 4:4:4:4 little endian */
+#define DRM_FORMAT_XBGR4444	fourcc_code('X', 'B', '1', '2') /* [15:0] x:B:G:R 4:4:4:4 little endian */
+#define DRM_FORMAT_RGBX4444	fourcc_code('R', 'X', '1', '2') /* [15:0] R:G:B:x 4:4:4:4 little endian */
+#define DRM_FORMAT_BGRX4444	fourcc_code('B', 'X', '1', '2') /* [15:0] B:G:R:x 4:4:4:4 little endian */
+
+#define DRM_FORMAT_ARGB4444	fourcc_code('A', 'R', '1', '2') /* [15:0] A:R:G:B 4:4:4:4 little endian */
+#define DRM_FORMAT_ABGR4444	fourcc_code('A', 'B', '1', '2') /* [15:0] A:B:G:R 4:4:4:4 little endian */
+#define DRM_FORMAT_RGBA4444	fourcc_code('R', 'A', '1', '2') /* [15:0] R:G:B:A 4:4:4:4 little endian */
+#define DRM_FORMAT_BGRA4444	fourcc_code('B', 'A', '1', '2') /* [15:0] B:G:R:A 4:4:4:4 little endian */
+
+#define DRM_FORMAT_XRGB1555	fourcc_code('X', 'R', '1', '5') /* [15:0] x:R:G:B 1:5:5:5 little endian */
+#define DRM_FORMAT_XBGR1555	fourcc_code('X', 'B', '1', '5') /* [15:0] x:B:G:R 1:5:5:5 little endian */
+#define DRM_FORMAT_RGBX5551	fourcc_code('R', 'X', '1', '5') /* [15:0] R:G:B:x 5:5:5:1 little endian */
+#define DRM_FORMAT_BGRX5551	fourcc_code('B', 'X', '1', '5') /* [15:0] B:G:R:x 5:5:5:1 little endian */
+
+#define DRM_FORMAT_ARGB1555	fourcc_code('A', 'R', '1', '5') /* [15:0] A:R:G:B 1:5:5:5 little endian */
+#define DRM_FORMAT_ABGR1555	fourcc_code('A', 'B', '1', '5') /* [15:0] A:B:G:R 1:5:5:5 little endian */
+#define DRM_FORMAT_RGBA5551	fourcc_code('R', 'A', '1', '5') /* [15:0] R:G:B:A 5:5:5:1 little endian */
+#define DRM_FORMAT_BGRA5551	fourcc_code('B', 'A', '1', '5') /* [15:0] B:G:R:A 5:5:5:1 little endian */
+
+#define DRM_FORMAT_RGB565	fourcc_code('R', 'G', '1', '6') /* [15:0] R:G:B 5:6:5 little endian */
+#define DRM_FORMAT_BGR565	fourcc_code('B', 'G', '1', '6') /* [15:0] B:G:R 5:6:5 little endian */
+
+/* 24 bpp RGB */
+#define DRM_FORMAT_RGB888	fourcc_code('R', 'G', '2', '4') /* [23:0] R:G:B little endian */
+#define DRM_FORMAT_BGR888	fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */
+
+/* 32 bpp RGB */
+#define DRM_FORMAT_XRGB8888	fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */
+#define DRM_FORMAT_XBGR8888	fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */
+#define DRM_FORMAT_RGBX8888	fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
+#define DRM_FORMAT_BGRX8888	fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */
+
+#define DRM_FORMAT_ARGB8888	fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */
+#define DRM_FORMAT_ABGR8888	fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */
+#define DRM_FORMAT_RGBA8888	fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
+#define DRM_FORMAT_BGRA8888	fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
+
+#define DRM_FORMAT_XRGB2101010	fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */
+#define DRM_FORMAT_XBGR2101010	fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */
+#define DRM_FORMAT_RGBX1010102	fourcc_code('R', 'X', '3', '0') /* [31:0] R:G:B:x 10:10:10:2 little endian */
+#define DRM_FORMAT_BGRX1010102	fourcc_code('B', 'X', '3', '0') /* [31:0] B:G:R:x 10:10:10:2 little endian */
+
+#define DRM_FORMAT_ARGB2101010	fourcc_code('A', 'R', '3', '0') /* [31:0] A:R:G:B 2:10:10:10 little endian */
+#define DRM_FORMAT_ABGR2101010	fourcc_code('A', 'B', '3', '0') /* [31:0] A:B:G:R 2:10:10:10 little endian */
+#define DRM_FORMAT_RGBA1010102	fourcc_code('R', 'A', '3', '0') /* [31:0] R:G:B:A 10:10:10:2 little endian */
+#define DRM_FORMAT_BGRA1010102	fourcc_code('B', 'A', '3', '0') /* [31:0] B:G:R:A 10:10:10:2 little endian */
+
+/* packed YCbCr */
+#define DRM_FORMAT_YUYV		fourcc_code('Y', 'U', 'Y', 'V') /* [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian */
+#define DRM_FORMAT_YVYU		fourcc_code('Y', 'V', 'Y', 'U') /* [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian */
+#define DRM_FORMAT_UYVY		fourcc_code('U', 'Y', 'V', 'Y') /* [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian */
+#define DRM_FORMAT_VYUY		fourcc_code('V', 'Y', 'U', 'Y') /* [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian */
+
+#define DRM_FORMAT_AYUV		fourcc_code('A', 'Y', 'U', 'V') /* [31:0] A:Y:Cb:Cr 8:8:8:8 little endian */
+
+/*
+ * 2 plane YCbCr
+ * index 0 = Y plane, [7:0] Y
+ * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
+ * or
+ * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
+ */
+#define DRM_FORMAT_NV12		fourcc_code('N', 'V', '1', '2') /* 2x2 subsampled Cr:Cb plane */
+#define DRM_FORMAT_NV21		fourcc_code('N', 'V', '2', '1') /* 2x2 subsampled Cb:Cr plane */
+#define DRM_FORMAT_NV16		fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */
+#define DRM_FORMAT_NV61		fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */
+
+/* 2 non contiguous plane YCbCr */
+#define DRM_FORMAT_NV12M	fourcc_code('N', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane */
+#define DRM_FORMAT_NV12MT	fourcc_code('T', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane 64x32 macroblocks */
+
+/*
+ * 3 plane YCbCr
+ * index 0: Y plane, [7:0] Y
+ * index 1: Cb plane, [7:0] Cb
+ * index 2: Cr plane, [7:0] Cr
+ * or
+ * index 1: Cr plane, [7:0] Cr
+ * index 2: Cb plane, [7:0] Cb
+ */
+#define DRM_FORMAT_YUV410	fourcc_code('Y', 'U', 'V', '9') /* 4x4 subsampled Cb (1) and Cr (2) planes */
+#define DRM_FORMAT_YVU410	fourcc_code('Y', 'V', 'U', '9') /* 4x4 subsampled Cr (1) and Cb (2) planes */
+#define DRM_FORMAT_YUV411	fourcc_code('Y', 'U', '1', '1') /* 4x1 subsampled Cb (1) and Cr (2) planes */
+#define DRM_FORMAT_YVU411	fourcc_code('Y', 'V', '1', '1') /* 4x1 subsampled Cr (1) and Cb (2) planes */
+#define DRM_FORMAT_YUV420	fourcc_code('Y', 'U', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
+#define DRM_FORMAT_YVU420	fourcc_code('Y', 'V', '1', '2') /* 2x2 subsampled Cr (1) and Cb (2) planes */
+#define DRM_FORMAT_YUV422	fourcc_code('Y', 'U', '1', '6') /* 2x1 subsampled Cb (1) and Cr (2) planes */
+#define DRM_FORMAT_YVU422	fourcc_code('Y', 'V', '1', '6') /* 2x1 subsampled Cr (1) and Cb (2) planes */
+#define DRM_FORMAT_YUV444	fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
+#define DRM_FORMAT_YVU444	fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
+
+/* 3 non contiguous plane YCbCr */
+#define DRM_FORMAT_YUV420M	fourcc_code('Y', 'M', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
+
+#endif /* DRM_FOURCC_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/drm_mode.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/drm_mode.h
index ae304cc..2a2acda 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/drm/drm_mode.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/drm_mode.h
@@ -27,9 +27,6 @@
 #ifndef _DRM_MODE_H
 #define _DRM_MODE_H
 
-#include <linux/kernel.h>
-#include <linux/types.h>
-
 #define DRM_DISPLAY_INFO_LEN	32
 #define DRM_CONNECTOR_NAME_LEN	32
 #define DRM_DISPLAY_MODE_LEN	32
@@ -68,21 +65,28 @@
 #define DRM_MODE_DPMS_OFF	3
 
 /* Scaling mode options */
-#define DRM_MODE_SCALE_NON_GPU		0
-#define DRM_MODE_SCALE_FULLSCREEN	1
-#define DRM_MODE_SCALE_NO_SCALE		2
-#define DRM_MODE_SCALE_ASPECT		3
+#define DRM_MODE_SCALE_NONE		0 /* Unmodified timing (display or
+					     software can still scale) */
+#define DRM_MODE_SCALE_FULLSCREEN	1 /* Full screen, ignore aspect */
+#define DRM_MODE_SCALE_CENTER		2 /* Centered, no scaling */
+#define DRM_MODE_SCALE_ASPECT		3 /* Full screen, preserve aspect */
 
 /* Dithering mode options */
 #define DRM_MODE_DITHERING_OFF	0
 #define DRM_MODE_DITHERING_ON	1
+#define DRM_MODE_DITHERING_AUTO 2
+
+/* Dirty info options */
+#define DRM_MODE_DIRTY_OFF      0
+#define DRM_MODE_DIRTY_ON       1
+#define DRM_MODE_DIRTY_ANNOTATE 2
 
 struct drm_mode_modeinfo {
 	__u32 clock;
 	__u16 hdisplay, hsync_start, hsync_end, htotal, hskew;
 	__u16 vdisplay, vsync_start, vsync_end, vtotal, vscan;
 
-	__u32 vrefresh; /* vertical refresh * 1000 */
+	__u32 vrefresh;
 
 	__u32 flags;
 	__u32 type;
@@ -116,11 +120,49 @@
 	struct drm_mode_modeinfo mode;
 };
 
+#define DRM_MODE_PRESENT_TOP_FIELD	(1<<0)
+#define DRM_MODE_PRESENT_BOTTOM_FIELD	(1<<1)
+
+/* Planes blend with or override other bits on the CRTC */
+struct drm_mode_set_plane {
+	__u32 plane_id;
+	__u32 crtc_id;
+	__u32 fb_id; /* fb object contains surface format type */
+	__u32 flags; /* see above flags */
+
+	/* Signed dest location allows it to be partially off screen */
+	__s32 crtc_x, crtc_y;
+	__u32 crtc_w, crtc_h;
+
+	/* Source values are 16.16 fixed point */
+	__u32 src_x, src_y;
+	__u32 src_h, src_w;
+};
+
+struct drm_mode_get_plane {
+	__u32 plane_id;
+
+	__u32 crtc_id;
+	__u32 fb_id;
+
+	__u32 possible_crtcs;
+	__u32 gamma_size;
+
+	__u32 count_format_types;
+	__u64 format_type_ptr;
+};
+
+struct drm_mode_get_plane_res {
+	__u64 plane_id_ptr;
+	__u32 count_planes;
+};
+
 #define DRM_MODE_ENCODER_NONE	0
 #define DRM_MODE_ENCODER_DAC	1
 #define DRM_MODE_ENCODER_TMDS	2
 #define DRM_MODE_ENCODER_LVDS	3
 #define DRM_MODE_ENCODER_TVDAC	4
+#define DRM_MODE_ENCODER_VIRTUAL 5
 
 struct drm_mode_get_encoder {
 	__u32 encoder_id;
@@ -141,6 +183,7 @@
 #define DRM_MODE_SUBCONNECTOR_Composite	5
 #define DRM_MODE_SUBCONNECTOR_SVIDEO	6
 #define DRM_MODE_SUBCONNECTOR_Component	8
+#define DRM_MODE_SUBCONNECTOR_SCART	9
 
 #define DRM_MODE_CONNECTOR_Unknown	0
 #define DRM_MODE_CONNECTOR_VGA		1
@@ -155,6 +198,9 @@
 #define DRM_MODE_CONNECTOR_DisplayPort	10
 #define DRM_MODE_CONNECTOR_HDMIA	11
 #define DRM_MODE_CONNECTOR_HDMIB	12
+#define DRM_MODE_CONNECTOR_TV		13
+#define DRM_MODE_CONNECTOR_eDP		14
+#define DRM_MODE_CONNECTOR_VIRTUAL      15
 
 struct drm_mode_get_connector {
 
@@ -222,6 +268,74 @@
 	__u32 handle;
 };
 
+#define DRM_MODE_FB_INTERLACED	(1<<0) /* for interlaced framebuffers */
+
+struct drm_mode_fb_cmd2 {
+	__u32 fb_id;
+	__u32 width, height;
+	__u32 pixel_format; /* fourcc code from drm_fourcc.h */
+	__u32 flags; /* see above flags */
+
+	/*
+	 * In case of planar formats, this ioctl allows up to 4
+	 * buffer objects with offets and pitches per plane.
+	 * The pitch and offset order is dictated by the fourcc,
+	 * e.g. NV12 (http://fourcc.org/yuv.php#NV12) is described as:
+	 *
+	 *   YUV 4:2:0 image with a plane of 8 bit Y samples
+	 *   followed by an interleaved U/V plane containing
+	 *   8 bit 2x2 subsampled colour difference samples.
+	 *
+	 * So it would consist of Y as offset[0] and UV as
+	 * offeset[1].  Note that offset[0] will generally
+	 * be 0.
+	 */
+	__u32 handles[4];
+	__u32 pitches[4]; /* pitch for each plane */
+	__u32 offsets[4]; /* offset of each plane */
+};
+
+#define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01
+#define DRM_MODE_FB_DIRTY_ANNOTATE_FILL 0x02
+#define DRM_MODE_FB_DIRTY_FLAGS         0x03
+
+#define DRM_MODE_FB_DIRTY_MAX_CLIPS     256
+
+/*
+ * Mark a region of a framebuffer as dirty.
+ *
+ * Some hardware does not automatically update display contents
+ * as a hardware or software draw to a framebuffer. This ioctl
+ * allows userspace to tell the kernel and the hardware what
+ * regions of the framebuffer have changed.
+ *
+ * The kernel or hardware is free to update more then just the
+ * region specified by the clip rects. The kernel or hardware
+ * may also delay and/or coalesce several calls to dirty into a
+ * single update.
+ *
+ * Userspace may annotate the updates, the annotates are a
+ * promise made by the caller that the change is either a copy
+ * of pixels or a fill of a single color in the region specified.
+ *
+ * If the DRM_MODE_FB_DIRTY_ANNOTATE_COPY flag is given then
+ * the number of updated regions are half of num_clips given,
+ * where the clip rects are paired in src and dst. The width and
+ * height of each one of the pairs must match.
+ *
+ * If the DRM_MODE_FB_DIRTY_ANNOTATE_FILL flag is given the caller
+ * promises that the region specified of the clip rects is filled
+ * completely with a single color as given in the color argument.
+ */
+
+struct drm_mode_fb_dirty_cmd {
+	__u32 fb_id;
+	__u32 flags;
+	__u32 color;
+	__u32 num_clips;
+	__u64 clips_ptr;
+};
+
 struct drm_mode_mode_cmd {
 	__u32 connector_id;
 	struct drm_mode_modeinfo mode;
@@ -231,7 +345,7 @@
 #define DRM_MODE_CURSOR_MOVE	(1<<1)
 
 /*
- * depending on the value in flags diffrent members are used.
+ * depending on the value in flags different members are used.
  *
  * CURSOR_BO uses
  *    crtc
@@ -265,4 +379,66 @@
 	__u64 blue;
 };
 
+#define DRM_MODE_PAGE_FLIP_EVENT 0x01
+#define DRM_MODE_PAGE_FLIP_FLAGS DRM_MODE_PAGE_FLIP_EVENT
+
+/*
+ * Request a page flip on the specified crtc.
+ *
+ * This ioctl will ask KMS to schedule a page flip for the specified
+ * crtc.  Once any pending rendering targeting the specified fb (as of
+ * ioctl time) has completed, the crtc will be reprogrammed to display
+ * that fb after the next vertical refresh.  The ioctl returns
+ * immediately, but subsequent rendering to the current fb will block
+ * in the execbuffer ioctl until the page flip happens.  If a page
+ * flip is already pending as the ioctl is called, EBUSY will be
+ * returned.
+ *
+ * The ioctl supports one flag, DRM_MODE_PAGE_FLIP_EVENT, which will
+ * request that drm sends back a vblank event (see drm.h: struct
+ * drm_event_vblank) when the page flip is done.  The user_data field
+ * passed in with this ioctl will be returned as the user_data field
+ * in the vblank event struct.
+ *
+ * The reserved field must be zero until we figure out something
+ * clever to use it for.
+ */
+
+struct drm_mode_crtc_page_flip {
+	__u32 crtc_id;
+	__u32 fb_id;
+	__u32 flags;
+	__u32 reserved;
+	__u64 user_data;
+};
+
+/* create a dumb scanout buffer */
+struct drm_mode_create_dumb {
+	uint32_t height;
+	uint32_t width;
+	uint32_t bpp;
+	uint32_t flags;
+	/* handle, pitch, size will be returned */
+	uint32_t handle;
+	uint32_t pitch;
+	uint64_t size;
+};
+
+/* set up for mmap of a dumb scanout buffer */
+struct drm_mode_map_dumb {
+	/** Handle for the object being mapped. */
+	__u32 handle;
+	__u32 pad;
+	/**
+	 * Fake offset to use for subsequent mmap call
+	 *
+	 * This is a fixed-size type for 32/64 compatibility.
+	 */
+	__u64 offset;
+};
+
+struct drm_mode_destroy_dumb {
+	uint32_t handle;
+};
+
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/exynos_drm.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/exynos_drm.h
new file mode 100644
index 0000000..b1f820c
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/exynos_drm.h
@@ -0,0 +1,100 @@
+/* exynos_drm.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * Authors:
+ *	Inki Dae <inki.dae@samsung.com>
+ *	Joonyoung Shim <jy0922.shim@samsung.com>
+ *	Seung-Woo Kim <sw0312.kim@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS 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 _EXYNOS_DRM_H_
+#define _EXYNOS_DRM_H_
+
+/**
+ * User-desired buffer creation information structure.
+ *
+ * @size: user-desired memory allocation size.
+ *	- this size value would be page-aligned internally.
+ * @flags: user request for setting memory type or cache attributes.
+ * @handle: returned a handle to created gem object.
+ *	- this handle will be set by gem module of kernel side.
+ */
+struct drm_exynos_gem_create {
+	uint64_t size;
+	unsigned int flags;
+	unsigned int handle;
+};
+
+/**
+ * A structure for getting buffer offset.
+ *
+ * @handle: a pointer to gem object created.
+ * @pad: just padding to be 64-bit aligned.
+ * @offset: relatived offset value of the memory region allocated.
+ *	- this value should be set by user.
+ */
+struct drm_exynos_gem_map_off {
+	unsigned int handle;
+	unsigned int pad;
+	uint64_t offset;
+};
+
+/**
+ * A structure for mapping buffer.
+ *
+ * @handle: a handle to gem object created.
+ * @size: memory size to be mapped.
+ * @mapped: having user virtual address mmaped.
+ *	- this variable would be filled by exynos gem module
+ *	of kernel side with user virtual address which is allocated
+ *	by do_mmap().
+ */
+struct drm_exynos_gem_mmap {
+	unsigned int handle;
+	unsigned int size;
+	uint64_t mapped;
+};
+
+struct drm_exynos_plane_set_zpos {
+	__u32 plane_id;
+	__s32 zpos;
+};
+
+#define DRM_EXYNOS_GEM_CREATE		0x00
+#define DRM_EXYNOS_GEM_MAP_OFFSET	0x01
+#define DRM_EXYNOS_GEM_MMAP		0x02
+/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
+#define DRM_EXYNOS_PLANE_SET_ZPOS	0x06
+
+#define DRM_IOCTL_EXYNOS_GEM_CREATE		DRM_IOWR(DRM_COMMAND_BASE + \
+		DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
+
+#define DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET	DRM_IOWR(DRM_COMMAND_BASE + \
+		DRM_EXYNOS_GEM_MAP_OFFSET, struct drm_exynos_gem_map_off)
+
+#define DRM_IOCTL_EXYNOS_GEM_MMAP	DRM_IOWR(DRM_COMMAND_BASE + \
+		DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
+
+#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS	DRM_IOWR(DRM_COMMAND_BASE + \
+		DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
+
+#endif	/* _EXYNOS_DRM_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/i830_drm.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/i830_drm.h
deleted file mode 100644
index e1b08e4..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/drm/i830_drm.h
+++ /dev/null
@@ -1,342 +0,0 @@
-#ifndef _I830_DRM_H_
-#define _I830_DRM_H_
-
-/* WARNING: These defines must be the same as what the Xserver uses.
- * if you change them, you must change the defines in the Xserver.
- *
- * KW: Actually, you can't ever change them because doing so would
- * break backwards compatibility.
- */
-
-#ifndef _I830_DEFINES_
-#define _I830_DEFINES_
-
-#define I830_DMA_BUF_ORDER		12
-#define I830_DMA_BUF_SZ			(1<<I830_DMA_BUF_ORDER)
-#define I830_DMA_BUF_NR			256
-#define I830_NR_SAREA_CLIPRECTS		8
-
-/* Each region is a minimum of 64k, and there are at most 64 of them.
- */
-#define I830_NR_TEX_REGIONS 64
-#define I830_LOG_MIN_TEX_REGION_SIZE 16
-
-/* KW: These aren't correct but someone set them to two and then
- * released the module.  Now we can't change them as doing so would
- * break backwards compatibility.
- */
-#define I830_TEXTURE_COUNT	2
-#define I830_TEXBLEND_COUNT	I830_TEXTURE_COUNT
-
-#define I830_TEXBLEND_SIZE	12	/* (4 args + op) * 2 + COLOR_FACTOR */
-
-#define I830_UPLOAD_CTX			0x1
-#define I830_UPLOAD_BUFFERS		0x2
-#define I830_UPLOAD_CLIPRECTS		0x4
-#define I830_UPLOAD_TEX0_IMAGE		0x100	/* handled clientside */
-#define I830_UPLOAD_TEX0_CUBE		0x200	/* handled clientside */
-#define I830_UPLOAD_TEX1_IMAGE		0x400	/* handled clientside */
-#define I830_UPLOAD_TEX1_CUBE		0x800	/* handled clientside */
-#define I830_UPLOAD_TEX2_IMAGE		0x1000	/* handled clientside */
-#define I830_UPLOAD_TEX2_CUBE		0x2000	/* handled clientside */
-#define I830_UPLOAD_TEX3_IMAGE		0x4000	/* handled clientside */
-#define I830_UPLOAD_TEX3_CUBE		0x8000	/* handled clientside */
-#define I830_UPLOAD_TEX_N_IMAGE(n)	(0x100 << (n * 2))
-#define I830_UPLOAD_TEX_N_CUBE(n)	(0x200 << (n * 2))
-#define I830_UPLOAD_TEXIMAGE_MASK	0xff00
-#define I830_UPLOAD_TEX0			0x10000
-#define I830_UPLOAD_TEX1			0x20000
-#define I830_UPLOAD_TEX2			0x40000
-#define I830_UPLOAD_TEX3			0x80000
-#define I830_UPLOAD_TEX_N(n)		(0x10000 << (n))
-#define I830_UPLOAD_TEX_MASK		0xf0000
-#define I830_UPLOAD_TEXBLEND0		0x100000
-#define I830_UPLOAD_TEXBLEND1		0x200000
-#define I830_UPLOAD_TEXBLEND2		0x400000
-#define I830_UPLOAD_TEXBLEND3		0x800000
-#define I830_UPLOAD_TEXBLEND_N(n)	(0x100000 << (n))
-#define I830_UPLOAD_TEXBLEND_MASK	0xf00000
-#define I830_UPLOAD_TEX_PALETTE_N(n)    (0x1000000 << (n))
-#define I830_UPLOAD_TEX_PALETTE_SHARED	0x4000000
-#define I830_UPLOAD_STIPPLE		0x8000000
-
-/* Indices into buf.Setup where various bits of state are mirrored per
- * context and per buffer.  These can be fired at the card as a unit,
- * or in a piecewise fashion as required.
- */
-
-/* Destbuffer state
- *    - backbuffer linear offset and pitch -- invarient in the current dri
- *    - zbuffer linear offset and pitch -- also invarient
- *    - drawing origin in back and depth buffers.
- *
- * Keep the depth/back buffer state here to accommodate private buffers
- * in the future.
- */
-
-#define I830_DESTREG_CBUFADDR 0
-#define I830_DESTREG_DBUFADDR 1
-#define I830_DESTREG_DV0 2
-#define I830_DESTREG_DV1 3
-#define I830_DESTREG_SENABLE 4
-#define I830_DESTREG_SR0 5
-#define I830_DESTREG_SR1 6
-#define I830_DESTREG_SR2 7
-#define I830_DESTREG_DR0 8
-#define I830_DESTREG_DR1 9
-#define I830_DESTREG_DR2 10
-#define I830_DESTREG_DR3 11
-#define I830_DESTREG_DR4 12
-#define I830_DEST_SETUP_SIZE 13
-
-/* Context state
- */
-#define I830_CTXREG_STATE1		0
-#define I830_CTXREG_STATE2		1
-#define I830_CTXREG_STATE3		2
-#define I830_CTXREG_STATE4		3
-#define I830_CTXREG_STATE5		4
-#define I830_CTXREG_IALPHAB		5
-#define I830_CTXREG_STENCILTST		6
-#define I830_CTXREG_ENABLES_1		7
-#define I830_CTXREG_ENABLES_2		8
-#define I830_CTXREG_AA			9
-#define I830_CTXREG_FOGCOLOR		10
-#define I830_CTXREG_BLENDCOLR0		11
-#define I830_CTXREG_BLENDCOLR		12	/* Dword 1 of 2 dword command */
-#define I830_CTXREG_VF			13
-#define I830_CTXREG_VF2			14
-#define I830_CTXREG_MCSB0		15
-#define I830_CTXREG_MCSB1		16
-#define I830_CTX_SETUP_SIZE		17
-
-/* 1.3: Stipple state
- */
-#define I830_STPREG_ST0 0
-#define I830_STPREG_ST1 1
-#define I830_STP_SETUP_SIZE 2
-
-/* Texture state (per tex unit)
- */
-
-#define I830_TEXREG_MI0	0	/* GFX_OP_MAP_INFO (6 dwords) */
-#define I830_TEXREG_MI1	1
-#define I830_TEXREG_MI2	2
-#define I830_TEXREG_MI3	3
-#define I830_TEXREG_MI4	4
-#define I830_TEXREG_MI5	5
-#define I830_TEXREG_MF	6	/* GFX_OP_MAP_FILTER */
-#define I830_TEXREG_MLC	7	/* GFX_OP_MAP_LOD_CTL */
-#define I830_TEXREG_MLL	8	/* GFX_OP_MAP_LOD_LIMITS */
-#define I830_TEXREG_MCS	9	/* GFX_OP_MAP_COORD_SETS */
-#define I830_TEX_SETUP_SIZE 10
-
-#define I830_TEXREG_TM0LI      0	/* load immediate 2 texture map n */
-#define I830_TEXREG_TM0S0      1
-#define I830_TEXREG_TM0S1      2
-#define I830_TEXREG_TM0S2      3
-#define I830_TEXREG_TM0S3      4
-#define I830_TEXREG_TM0S4      5
-#define I830_TEXREG_NOP0       6	/* noop */
-#define I830_TEXREG_NOP1       7	/* noop */
-#define I830_TEXREG_NOP2       8	/* noop */
-#define __I830_TEXREG_MCS      9	/* GFX_OP_MAP_COORD_SETS -- shared */
-#define __I830_TEX_SETUP_SIZE   10
-
-#define I830_FRONT   0x1
-#define I830_BACK    0x2
-#define I830_DEPTH   0x4
-
-#endif				/* _I830_DEFINES_ */
-
-typedef struct _drm_i830_init {
-	enum {
-		I830_INIT_DMA = 0x01,
-		I830_CLEANUP_DMA = 0x02
-	} func;
-	unsigned int mmio_offset;
-	unsigned int buffers_offset;
-	int sarea_priv_offset;
-	unsigned int ring_start;
-	unsigned int ring_end;
-	unsigned int ring_size;
-	unsigned int front_offset;
-	unsigned int back_offset;
-	unsigned int depth_offset;
-	unsigned int w;
-	unsigned int h;
-	unsigned int pitch;
-	unsigned int pitch_bits;
-	unsigned int back_pitch;
-	unsigned int depth_pitch;
-	unsigned int cpp;
-} drm_i830_init_t;
-
-/* Warning: If you change the SAREA structure you must change the Xserver
- * structure as well */
-
-typedef struct _drm_i830_tex_region {
-	unsigned char next, prev;	/* indices to form a circular LRU  */
-	unsigned char in_use;	/* owned by a client, or free? */
-	int age;		/* tracked by clients to update local LRU's */
-} drm_i830_tex_region_t;
-
-typedef struct _drm_i830_sarea {
-	unsigned int ContextState[I830_CTX_SETUP_SIZE];
-	unsigned int BufferState[I830_DEST_SETUP_SIZE];
-	unsigned int TexState[I830_TEXTURE_COUNT][I830_TEX_SETUP_SIZE];
-	unsigned int TexBlendState[I830_TEXBLEND_COUNT][I830_TEXBLEND_SIZE];
-	unsigned int TexBlendStateWordsUsed[I830_TEXBLEND_COUNT];
-	unsigned int Palette[2][256];
-	unsigned int dirty;
-
-	unsigned int nbox;
-	struct drm_clip_rect boxes[I830_NR_SAREA_CLIPRECTS];
-
-	/* Maintain an LRU of contiguous regions of texture space.  If
-	 * you think you own a region of texture memory, and it has an
-	 * age different to the one you set, then you are mistaken and
-	 * it has been stolen by another client.  If global texAge
-	 * hasn't changed, there is no need to walk the list.
-	 *
-	 * These regions can be used as a proxy for the fine-grained
-	 * texture information of other clients - by maintaining them
-	 * in the same lru which is used to age their own textures,
-	 * clients have an approximate lru for the whole of global
-	 * texture space, and can make informed decisions as to which
-	 * areas to kick out.  There is no need to choose whether to
-	 * kick out your own texture or someone else's - simply eject
-	 * them all in LRU order.
-	 */
-
-	drm_i830_tex_region_t texList[I830_NR_TEX_REGIONS + 1];
-	/* Last elt is sentinal */
-	int texAge;		/* last time texture was uploaded */
-	int last_enqueue;	/* last time a buffer was enqueued */
-	int last_dispatch;	/* age of the most recently dispatched buffer */
-	int last_quiescent;	/*  */
-	int ctxOwner;		/* last context to upload state */
-
-	int vertex_prim;
-
-	int pf_enabled;		/* is pageflipping allowed? */
-	int pf_active;
-	int pf_current_page;	/* which buffer is being displayed? */
-
-	int perf_boxes;		/* performance boxes to be displayed */
-
-	/* Here's the state for texunits 2,3:
-	 */
-	unsigned int TexState2[I830_TEX_SETUP_SIZE];
-	unsigned int TexBlendState2[I830_TEXBLEND_SIZE];
-	unsigned int TexBlendStateWordsUsed2;
-
-	unsigned int TexState3[I830_TEX_SETUP_SIZE];
-	unsigned int TexBlendState3[I830_TEXBLEND_SIZE];
-	unsigned int TexBlendStateWordsUsed3;
-
-	unsigned int StippleState[I830_STP_SETUP_SIZE];
-} drm_i830_sarea_t;
-
-/* Flags for perf_boxes
- */
-#define I830_BOX_RING_EMPTY    0x1	/* populated by kernel */
-#define I830_BOX_FLIP          0x2	/* populated by kernel */
-#define I830_BOX_WAIT          0x4	/* populated by kernel & client */
-#define I830_BOX_TEXTURE_LOAD  0x8	/* populated by kernel */
-#define I830_BOX_LOST_CONTEXT  0x10	/* populated by client */
-
-/* I830 specific ioctls
- * The device specific ioctl range is 0x40 to 0x79.
- */
-#define DRM_I830_INIT	0x00
-#define DRM_I830_VERTEX	0x01
-#define DRM_I830_CLEAR	0x02
-#define DRM_I830_FLUSH	0x03
-#define DRM_I830_GETAGE	0x04
-#define DRM_I830_GETBUF	0x05
-#define DRM_I830_SWAP	0x06
-#define DRM_I830_COPY	0x07
-#define DRM_I830_DOCOPY	0x08
-#define DRM_I830_FLIP	0x09
-#define DRM_I830_IRQ_EMIT	0x0a
-#define DRM_I830_IRQ_WAIT	0x0b
-#define DRM_I830_GETPARAM	0x0c
-#define DRM_I830_SETPARAM	0x0d
-
-#define DRM_IOCTL_I830_INIT		DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_INIT, drm_i830_init_t)
-#define DRM_IOCTL_I830_VERTEX		DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_VERTEX, drm_i830_vertex_t)
-#define DRM_IOCTL_I830_CLEAR		DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_CLEAR, drm_i830_clear_t)
-#define DRM_IOCTL_I830_FLUSH		DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_FLUSH)
-#define DRM_IOCTL_I830_GETAGE		DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_GETAGE)
-#define DRM_IOCTL_I830_GETBUF		DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_GETBUF, drm_i830_dma_t)
-#define DRM_IOCTL_I830_SWAP		DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_SWAP)
-#define DRM_IOCTL_I830_COPY		DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_COPY, drm_i830_copy_t)
-#define DRM_IOCTL_I830_DOCOPY		DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_DOCOPY)
-#define DRM_IOCTL_I830_FLIP		DRM_IO ( DRM_COMMAND_BASE + DRM_IOCTL_I830_FLIP)
-#define DRM_IOCTL_I830_IRQ_EMIT         DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_IRQ_EMIT, drm_i830_irq_emit_t)
-#define DRM_IOCTL_I830_IRQ_WAIT         DRM_IOW( DRM_COMMAND_BASE + DRM_IOCTL_I830_IRQ_WAIT, drm_i830_irq_wait_t)
-#define DRM_IOCTL_I830_GETPARAM         DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_GETPARAM, drm_i830_getparam_t)
-#define DRM_IOCTL_I830_SETPARAM         DRM_IOWR(DRM_COMMAND_BASE + DRM_IOCTL_I830_SETPARAM, drm_i830_setparam_t)
-
-typedef struct _drm_i830_clear {
-	int clear_color;
-	int clear_depth;
-	int flags;
-	unsigned int clear_colormask;
-	unsigned int clear_depthmask;
-} drm_i830_clear_t;
-
-/* These may be placeholders if we have more cliprects than
- * I830_NR_SAREA_CLIPRECTS.  In that case, the client sets discard to
- * false, indicating that the buffer will be dispatched again with a
- * new set of cliprects.
- */
-typedef struct _drm_i830_vertex {
-	int idx;		/* buffer index */
-	int used;		/* nr bytes in use */
-	int discard;		/* client is finished with the buffer? */
-} drm_i830_vertex_t;
-
-typedef struct _drm_i830_copy_t {
-	int idx;		/* buffer index */
-	int used;		/* nr bytes in use */
-	void *address;	/* Address to copy from */
-} drm_i830_copy_t;
-
-typedef struct drm_i830_dma {
-	void *virtual;
-	int request_idx;
-	int request_size;
-	int granted;
-} drm_i830_dma_t;
-
-/* 1.3: Userspace can request & wait on irq's:
- */
-typedef struct drm_i830_irq_emit {
-	int *irq_seq;
-} drm_i830_irq_emit_t;
-
-typedef struct drm_i830_irq_wait {
-	int irq_seq;
-} drm_i830_irq_wait_t;
-
-/* 1.3: New ioctl to query kernel params:
- */
-#define I830_PARAM_IRQ_ACTIVE            1
-
-typedef struct drm_i830_getparam {
-	int param;
-	int *value;
-} drm_i830_getparam_t;
-
-/* 1.3: New ioctl to set kernel params:
- */
-#define I830_SETPARAM_USE_MI_BATCHBUFFER_START            1
-
-typedef struct drm_i830_setparam {
-	int param;
-	int value;
-} drm_i830_setparam_t;
-
-#endif				/* _I830_DRM_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/i915_drm.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/i915_drm.h
index da7b995..3b50705 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/drm/i915_drm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/i915_drm.h
@@ -27,11 +27,12 @@
 #ifndef _I915_DRM_H_
 #define _I915_DRM_H_
 
+#include "drm.h"
+
 /* Please note that modifications to all structs defined here are
  * subject to backwards-compatibility constraints.
  */
-#include <linux/types.h>
-#include "drm.h"
+
 
 /* Each region is a minimum of 16k, and there are at most 255 of them.
  */
@@ -185,6 +186,12 @@
 #define DRM_I915_GEM_GET_APERTURE 0x23
 #define DRM_I915_GEM_MMAP_GTT	0x24
 #define DRM_I915_GET_PIPE_FROM_CRTC_ID	0x25
+#define DRM_I915_GEM_MADVISE	0x26
+#define DRM_I915_OVERLAY_PUT_IMAGE	0x27
+#define DRM_I915_OVERLAY_ATTRS	0x28
+#define DRM_I915_GEM_EXECBUFFER2	0x29
+#define DRM_I915_GET_SPRITE_COLORKEY	0x2a
+#define DRM_I915_SET_SPRITE_COLORKEY	0x2b
 
 #define DRM_IOCTL_I915_INIT		DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
 #define DRM_IOCTL_I915_FLUSH		DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
@@ -202,8 +209,10 @@
 #define DRM_IOCTL_I915_SET_VBLANK_PIPE	DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
 #define DRM_IOCTL_I915_GET_VBLANK_PIPE	DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
 #define DRM_IOCTL_I915_VBLANK_SWAP	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
+#define DRM_IOCTL_I915_HWS_ADDR		DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
 #define DRM_IOCTL_I915_GEM_INIT		DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
 #define DRM_IOCTL_I915_GEM_EXECBUFFER	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
+#define DRM_IOCTL_I915_GEM_EXECBUFFER2	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
 #define DRM_IOCTL_I915_GEM_PIN		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
 #define DRM_IOCTL_I915_GEM_UNPIN	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
 #define DRM_IOCTL_I915_GEM_BUSY		DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
@@ -220,7 +229,12 @@
 #define DRM_IOCTL_I915_GEM_SET_TILING	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
 #define DRM_IOCTL_I915_GEM_GET_TILING	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
 #define DRM_IOCTL_I915_GEM_GET_APERTURE	DRM_IOR  (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
-#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_intel_get_pipe_from_crtc_id)
+#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id)
+#define DRM_IOCTL_I915_GEM_MADVISE	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
+#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE	DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
+#define DRM_IOCTL_I915_OVERLAY_ATTRS	DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
+#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
+#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
 
 /* Allow drivers to submit batchbuffers directly to hardware, relying
  * on the security mechanisms provided by hardware.
@@ -264,6 +278,16 @@
 #define I915_PARAM_CHIPSET_ID            4
 #define I915_PARAM_HAS_GEM               5
 #define I915_PARAM_NUM_FENCES_AVAIL      6
+#define I915_PARAM_HAS_OVERLAY           7
+#define I915_PARAM_HAS_PAGEFLIPPING	 8
+#define I915_PARAM_HAS_EXECBUF2          9
+#define I915_PARAM_HAS_BSD		 10
+#define I915_PARAM_HAS_BLT		 11
+#define I915_PARAM_HAS_RELAXED_FENCING	 12
+#define I915_PARAM_HAS_COHERENT_RINGS	 13
+#define I915_PARAM_HAS_EXEC_CONSTANTS	 14
+#define I915_PARAM_HAS_RELAXED_DELTA	 15
+#define I915_PARAM_HAS_GEN7_SOL_RESET	 16
 
 typedef struct drm_i915_getparam {
 	int param;
@@ -559,6 +583,76 @@
 	__u64 cliprects_ptr;
 };
 
+struct drm_i915_gem_exec_object2 {
+	/**
+	 * User's handle for a buffer to be bound into the GTT for this
+	 * operation.
+	 */
+	__u32 handle;
+
+	/** Number of relocations to be performed on this buffer */
+	__u32 relocation_count;
+	/**
+	 * Pointer to array of struct drm_i915_gem_relocation_entry containing
+	 * the relocations to be performed in this buffer.
+	 */
+	__u64 relocs_ptr;
+
+	/** Required alignment in graphics aperture */
+	__u64 alignment;
+
+	/**
+	 * Returned value of the updated offset of the object, for future
+	 * presumed_offset writes.
+	 */
+	__u64 offset;
+
+#define EXEC_OBJECT_NEEDS_FENCE (1<<0)
+	__u64 flags;
+	__u64 rsvd1;
+	__u64 rsvd2;
+};
+
+struct drm_i915_gem_execbuffer2 {
+	/**
+	 * List of gem_exec_object2 structs
+	 */
+	__u64 buffers_ptr;
+	__u32 buffer_count;
+
+	/** Offset in the batchbuffer to start execution from. */
+	__u32 batch_start_offset;
+	/** Bytes used in batchbuffer from batch_start_offset */
+	__u32 batch_len;
+	__u32 DR1;
+	__u32 DR4;
+	__u32 num_cliprects;
+	/** This is a struct drm_clip_rect *cliprects */
+	__u64 cliprects_ptr;
+#define I915_EXEC_RING_MASK              (7<<0)
+#define I915_EXEC_DEFAULT                (0<<0)
+#define I915_EXEC_RENDER                 (1<<0)
+#define I915_EXEC_BSD                    (2<<0)
+#define I915_EXEC_BLT                    (3<<0)
+
+/* Used for switching the constants addressing mode on gen4+ RENDER ring.
+ * Gen6+ only supports relative addressing to dynamic state (default) and
+ * absolute addressing.
+ *
+ * These flags are ignored for the BSD and BLT rings.
+ */
+#define I915_EXEC_CONSTANTS_MASK 	(3<<6)
+#define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */
+#define I915_EXEC_CONSTANTS_ABSOLUTE 	(1<<6)
+#define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */
+	__u64 flags;
+	__u64 rsvd1;
+	__u64 rsvd2;
+};
+
+/** Resets the SO write offset registers for transform feedback on gen7. */
+#define I915_EXEC_GEN7_SOL_RESET	(1<<8)
+
 struct drm_i915_gem_pin {
 	/** Handle of the buffer to be pinned. */
 	__u32 handle;
@@ -667,4 +761,119 @@
 	__u32 pipe;
 };
 
+#define I915_MADV_WILLNEED 0
+#define I915_MADV_DONTNEED 1
+#define __I915_MADV_PURGED 2 /* internal state */
+
+struct drm_i915_gem_madvise {
+	/** Handle of the buffer to change the backing store advice */
+	__u32 handle;
+
+	/* Advice: either the buffer will be needed again in the near future,
+	 *         or wont be and could be discarded under memory pressure.
+	 */
+	__u32 madv;
+
+	/** Whether the backing store still exists. */
+	__u32 retained;
+};
+
+/* flags */
+#define I915_OVERLAY_TYPE_MASK 		0xff
+#define I915_OVERLAY_YUV_PLANAR 	0x01
+#define I915_OVERLAY_YUV_PACKED 	0x02
+#define I915_OVERLAY_RGB		0x03
+
+#define I915_OVERLAY_DEPTH_MASK		0xff00
+#define I915_OVERLAY_RGB24		0x1000
+#define I915_OVERLAY_RGB16		0x2000
+#define I915_OVERLAY_RGB15		0x3000
+#define I915_OVERLAY_YUV422		0x0100
+#define I915_OVERLAY_YUV411		0x0200
+#define I915_OVERLAY_YUV420		0x0300
+#define I915_OVERLAY_YUV410		0x0400
+
+#define I915_OVERLAY_SWAP_MASK		0xff0000
+#define I915_OVERLAY_NO_SWAP		0x000000
+#define I915_OVERLAY_UV_SWAP		0x010000
+#define I915_OVERLAY_Y_SWAP		0x020000
+#define I915_OVERLAY_Y_AND_UV_SWAP	0x030000
+
+#define I915_OVERLAY_FLAGS_MASK		0xff000000
+#define I915_OVERLAY_ENABLE		0x01000000
+
+struct drm_intel_overlay_put_image {
+	/* various flags and src format description */
+	__u32 flags;
+	/* source picture description */
+	__u32 bo_handle;
+	/* stride values and offsets are in bytes, buffer relative */
+	__u16 stride_Y; /* stride for packed formats */
+	__u16 stride_UV;
+	__u32 offset_Y; /* offset for packet formats */
+	__u32 offset_U;
+	__u32 offset_V;
+	/* in pixels */
+	__u16 src_width;
+	__u16 src_height;
+	/* to compensate the scaling factors for partially covered surfaces */
+	__u16 src_scan_width;
+	__u16 src_scan_height;
+	/* output crtc description */
+	__u32 crtc_id;
+	__u16 dst_x;
+	__u16 dst_y;
+	__u16 dst_width;
+	__u16 dst_height;
+};
+
+/* flags */
+#define I915_OVERLAY_UPDATE_ATTRS	(1<<0)
+#define I915_OVERLAY_UPDATE_GAMMA	(1<<1)
+struct drm_intel_overlay_attrs {
+	__u32 flags;
+	__u32 color_key;
+	__s32 brightness;
+	__u32 contrast;
+	__u32 saturation;
+	__u32 gamma0;
+	__u32 gamma1;
+	__u32 gamma2;
+	__u32 gamma3;
+	__u32 gamma4;
+	__u32 gamma5;
+};
+
+/*
+ * Intel sprite handling
+ *
+ * Color keying works with a min/mask/max tuple.  Both source and destination
+ * color keying is allowed.
+ *
+ * Source keying:
+ * Sprite pixels within the min & max values, masked against the color channels
+ * specified in the mask field, will be transparent.  All other pixels will
+ * be displayed on top of the primary plane.  For RGB surfaces, only the min
+ * and mask fields will be used; ranged compares are not allowed.
+ *
+ * Destination keying:
+ * Primary plane pixels that match the min value, masked against the color
+ * channels specified in the mask field, will be replaced by corresponding
+ * pixels from the sprite plane.
+ *
+ * Note that source & destination keying are exclusive; only one can be
+ * active on a given plane.
+ */
+
+#define I915_SET_COLORKEY_NONE		(1<<0) /* disable color key matching */
+#define I915_SET_COLORKEY_DESTINATION	(1<<1)
+#define I915_SET_COLORKEY_SOURCE	(1<<2)
+struct drm_intel_sprite_colorkey {
+	__u32 plane_id;
+	__u32 min_value;
+	__u32 channel_mask;
+	__u32 max_value;
+	__u32 flags;
+};
+
 #endif				/* _I915_DRM_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/mga_drm.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/mga_drm.h
index 52632bb..ff812de 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/drm/mga_drm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/mga_drm.h
@@ -35,7 +35,7 @@
 #ifndef __MGA_DRM_H__
 #define __MGA_DRM_H__
 
-#include <linux/types.h>
+#include "drm.h"
 
 /* WARNING: If you change any of these defines, make sure to change the
  * defines in the Xserver file (mga_sarea.h)
@@ -107,7 +107,7 @@
  */
 #define MGA_NR_SAREA_CLIPRECTS	8
 
-/* 2 heaps (1 for card, 1 for agp), each divided into upto 128
+/* 2 heaps (1 for card, 1 for agp), each divided into up to 128
  * regions, subject to a minimum region size of (1<<16) == 64k.
  *
  * Clients may subdivide regions internally, but when sharing between
@@ -248,7 +248,7 @@
 #define DRM_MGA_DMA_BOOTSTRAP  0x0c
 
 #define DRM_IOCTL_MGA_INIT     DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t)
-#define DRM_IOCTL_MGA_FLUSH    DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, drm_lock_t)
+#define DRM_IOCTL_MGA_FLUSH    DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, struct drm_lock)
 #define DRM_IOCTL_MGA_RESET    DRM_IO(  DRM_COMMAND_BASE + DRM_MGA_RESET)
 #define DRM_IOCTL_MGA_SWAP     DRM_IO(  DRM_COMMAND_BASE + DRM_MGA_SWAP)
 #define DRM_IOCTL_MGA_CLEAR    DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_CLEAR, drm_mga_clear_t)
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/nouveau_drm.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/nouveau_drm.h
new file mode 100644
index 0000000..5edd3a7
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/nouveau_drm.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2005 Stephane Marchesin.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * 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
+ * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS 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 __NOUVEAU_DRM_H__
+#define __NOUVEAU_DRM_H__
+
+#define NOUVEAU_DRM_HEADER_PATCHLEVEL 16
+
+struct drm_nouveau_channel_alloc {
+	uint32_t     fb_ctxdma_handle;
+	uint32_t     tt_ctxdma_handle;
+
+	int          channel;
+	uint32_t     pushbuf_domains;
+
+	/* Notifier memory */
+	uint32_t     notifier_handle;
+
+	/* DRM-enforced subchannel assignments */
+	struct {
+		uint32_t handle;
+		uint32_t grclass;
+	} subchan[8];
+	uint32_t nr_subchan;
+};
+
+struct drm_nouveau_channel_free {
+	int channel;
+};
+
+struct drm_nouveau_grobj_alloc {
+	int      channel;
+	uint32_t handle;
+	int      class;
+};
+
+struct drm_nouveau_notifierobj_alloc {
+	uint32_t channel;
+	uint32_t handle;
+	uint32_t size;
+	uint32_t offset;
+};
+
+struct drm_nouveau_gpuobj_free {
+	int      channel;
+	uint32_t handle;
+};
+
+/* FIXME : maybe unify {GET,SET}PARAMs */
+#define NOUVEAU_GETPARAM_PCI_VENDOR      3
+#define NOUVEAU_GETPARAM_PCI_DEVICE      4
+#define NOUVEAU_GETPARAM_BUS_TYPE        5
+#define NOUVEAU_GETPARAM_FB_SIZE         8
+#define NOUVEAU_GETPARAM_AGP_SIZE        9
+#define NOUVEAU_GETPARAM_CHIPSET_ID      11
+#define NOUVEAU_GETPARAM_VM_VRAM_BASE    12
+#define NOUVEAU_GETPARAM_GRAPH_UNITS     13
+#define NOUVEAU_GETPARAM_PTIMER_TIME     14
+#define NOUVEAU_GETPARAM_HAS_BO_USAGE    15
+#define NOUVEAU_GETPARAM_HAS_PAGEFLIP    16
+struct drm_nouveau_getparam {
+	uint64_t param;
+	uint64_t value;
+};
+
+struct drm_nouveau_setparam {
+	uint64_t param;
+	uint64_t value;
+};
+
+#define NOUVEAU_GEM_DOMAIN_CPU       (1 << 0)
+#define NOUVEAU_GEM_DOMAIN_VRAM      (1 << 1)
+#define NOUVEAU_GEM_DOMAIN_GART      (1 << 2)
+#define NOUVEAU_GEM_DOMAIN_MAPPABLE  (1 << 3)
+
+#define NOUVEAU_GEM_TILE_COMP        0x00030000 /* nv50-only */
+#define NOUVEAU_GEM_TILE_LAYOUT_MASK 0x0000ff00
+#define NOUVEAU_GEM_TILE_16BPP       0x00000001
+#define NOUVEAU_GEM_TILE_32BPP       0x00000002
+#define NOUVEAU_GEM_TILE_ZETA        0x00000004
+#define NOUVEAU_GEM_TILE_NONCONTIG   0x00000008
+
+struct drm_nouveau_gem_info {
+	uint32_t handle;
+	uint32_t domain;
+	uint64_t size;
+	uint64_t offset;
+	uint64_t map_handle;
+	uint32_t tile_mode;
+	uint32_t tile_flags;
+};
+
+struct drm_nouveau_gem_new {
+	struct drm_nouveau_gem_info info;
+	uint32_t channel_hint;
+	uint32_t align;
+};
+
+#define NOUVEAU_GEM_MAX_BUFFERS 1024
+struct drm_nouveau_gem_pushbuf_bo_presumed {
+	uint32_t valid;
+	uint32_t domain;
+	uint64_t offset;
+};
+
+struct drm_nouveau_gem_pushbuf_bo {
+	uint64_t user_priv;
+	uint32_t handle;
+	uint32_t read_domains;
+	uint32_t write_domains;
+	uint32_t valid_domains;
+	struct drm_nouveau_gem_pushbuf_bo_presumed presumed;
+};
+
+#define NOUVEAU_GEM_RELOC_LOW  (1 << 0)
+#define NOUVEAU_GEM_RELOC_HIGH (1 << 1)
+#define NOUVEAU_GEM_RELOC_OR   (1 << 2)
+#define NOUVEAU_GEM_MAX_RELOCS 1024
+struct drm_nouveau_gem_pushbuf_reloc {
+	uint32_t reloc_bo_index;
+	uint32_t reloc_bo_offset;
+	uint32_t bo_index;
+	uint32_t flags;
+	uint32_t data;
+	uint32_t vor;
+	uint32_t tor;
+};
+
+#define NOUVEAU_GEM_MAX_PUSH 512
+struct drm_nouveau_gem_pushbuf_push {
+	uint32_t bo_index;
+	uint32_t pad;
+	uint64_t offset;
+	uint64_t length;
+};
+
+struct drm_nouveau_gem_pushbuf {
+	uint32_t channel;
+	uint32_t nr_buffers;
+	uint64_t buffers;
+	uint32_t nr_relocs;
+	uint32_t nr_push;
+	uint64_t relocs;
+	uint64_t push;
+	uint32_t suffix0;
+	uint32_t suffix1;
+	uint64_t vram_available;
+	uint64_t gart_available;
+};
+
+#define NOUVEAU_GEM_CPU_PREP_NOWAIT                                  0x00000001
+#define NOUVEAU_GEM_CPU_PREP_WRITE                                   0x00000004
+struct drm_nouveau_gem_cpu_prep {
+	uint32_t handle;
+	uint32_t flags;
+};
+
+struct drm_nouveau_gem_cpu_fini {
+	uint32_t handle;
+};
+
+enum nouveau_bus_type {
+	NV_AGP     = 0,
+	NV_PCI     = 1,
+	NV_PCIE    = 2,
+};
+
+struct drm_nouveau_sarea {
+};
+
+#define DRM_NOUVEAU_GETPARAM           0x00
+#define DRM_NOUVEAU_SETPARAM           0x01
+#define DRM_NOUVEAU_CHANNEL_ALLOC      0x02
+#define DRM_NOUVEAU_CHANNEL_FREE       0x03
+#define DRM_NOUVEAU_GROBJ_ALLOC        0x04
+#define DRM_NOUVEAU_NOTIFIEROBJ_ALLOC  0x05
+#define DRM_NOUVEAU_GPUOBJ_FREE        0x06
+#define DRM_NOUVEAU_GEM_NEW            0x40
+#define DRM_NOUVEAU_GEM_PUSHBUF        0x41
+#define DRM_NOUVEAU_GEM_CPU_PREP       0x42
+#define DRM_NOUVEAU_GEM_CPU_FINI       0x43
+#define DRM_NOUVEAU_GEM_INFO           0x44
+
+#define DRM_IOCTL_NOUVEAU_GETPARAM           DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GETPARAM, struct drm_nouveau_getparam)
+#define DRM_IOCTL_NOUVEAU_SETPARAM           DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_SETPARAM, struct drm_nouveau_setparam)
+#define DRM_IOCTL_NOUVEAU_CHANNEL_ALLOC      DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_ALLOC, struct drm_nouveau_channel_alloc)
+#define DRM_IOCTL_NOUVEAU_CHANNEL_FREE       DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_CHANNEL_FREE, struct drm_nouveau_channel_free)
+#define DRM_IOCTL_NOUVEAU_GROBJ_ALLOC        DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GROBJ_ALLOC, struct drm_nouveau_grobj_alloc)
+#define DRM_IOCTL_NOUVEAU_NOTIFIEROBJ_ALLOC  DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_NOTIFIEROBJ_ALLOC, struct drm_nouveau_notifierobj_alloc)
+#define DRM_IOCTL_NOUVEAU_GPUOBJ_FREE        DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GPUOBJ_FREE, struct drm_nouveau_gpuobj_free)
+#define DRM_IOCTL_NOUVEAU_GEM_NEW            DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_NEW, struct drm_nouveau_gem_new)
+#define DRM_IOCTL_NOUVEAU_GEM_PUSHBUF        DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_PUSHBUF, struct drm_nouveau_gem_pushbuf)
+#define DRM_IOCTL_NOUVEAU_GEM_CPU_PREP       DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_PREP, struct drm_nouveau_gem_cpu_prep)
+#define DRM_IOCTL_NOUVEAU_GEM_CPU_FINI       DRM_IOW (DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_CPU_FINI, struct drm_nouveau_gem_cpu_fini)
+#define DRM_IOCTL_NOUVEAU_GEM_INFO           DRM_IOWR(DRM_COMMAND_BASE + DRM_NOUVEAU_GEM_INFO, struct drm_nouveau_gem_info)
+
+#endif /* __NOUVEAU_DRM_H__ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/radeon_drm.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/radeon_drm.h
index 8d375d6..b394796 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/drm/radeon_drm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/radeon_drm.h
@@ -33,7 +33,7 @@
 #ifndef __RADEON_DRM_H__
 #define __RADEON_DRM_H__
 
-#include <linux/types.h>
+#include "drm.h"
 
 /* WARNING: If you change any of these defines, make sure to change the
  * defines in the X server file (radeon_sarea.h)
@@ -509,6 +509,7 @@
 #define DRM_RADEON_GEM_SET_TILING	0x28
 #define DRM_RADEON_GEM_GET_TILING	0x29
 #define DRM_RADEON_GEM_BUSY		0x2a
+#define DRM_RADEON_GEM_VA		0x2b
 
 #define DRM_IOCTL_RADEON_CP_INIT    DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
 #define DRM_IOCTL_RADEON_CP_START   DRM_IO(  DRM_COMMAND_BASE + DRM_RADEON_CP_START)
@@ -547,9 +548,10 @@
 #define DRM_IOCTL_RADEON_GEM_WAIT_IDLE	DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle)
 #define DRM_IOCTL_RADEON_CS		DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs)
 #define DRM_IOCTL_RADEON_INFO		DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info)
-#define DRM_IOCTL_RADEON_SET_TILING	DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling)
-#define DRM_IOCTL_RADEON_GET_TILING	DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling)
+#define DRM_IOCTL_RADEON_GEM_SET_TILING	DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_TILING, struct drm_radeon_gem_set_tiling)
+#define DRM_IOCTL_RADEON_GEM_GET_TILING	DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_GET_TILING, struct drm_radeon_gem_get_tiling)
 #define DRM_IOCTL_RADEON_GEM_BUSY	DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_BUSY, struct drm_radeon_gem_busy)
+#define DRM_IOCTL_RADEON_GEM_VA		DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_VA, struct drm_radeon_gem_va)
 
 typedef struct drm_radeon_init {
 	enum {
@@ -641,7 +643,7 @@
 } drm_radeon_vertex2_t;
 
 /* v1.3 - obsoletes drm_radeon_vertex2
- *      - allows arbitarily large cliprect list
+ *      - allows arbitrarily large cliprect list
  *      - allows updating of tcl packet, vector and scalar state
  *      - allows memory-efficient description of state updates
  *      - allows state to be emitted without a primitive
@@ -802,11 +804,13 @@
 	uint32_t	flags;
 };
 
-#define RADEON_TILING_MACRO 0x1
-#define RADEON_TILING_MICRO 0x2
-#define RADEON_TILING_SWAP  0x4
-#define RADEON_TILING_SURFACE  0x8 /* this object requires a surface
-				    * when mapped - i.e. front buffer */
+#define RADEON_TILING_MACRO       0x1
+#define RADEON_TILING_MICRO       0x2
+#define RADEON_TILING_SWAP_16BIT  0x4
+#define RADEON_TILING_SWAP_32BIT  0x8
+#define RADEON_TILING_SURFACE     0x10 /* this object requires a surface
+					* when mapped - i.e. front buffer */
+#define RADEON_TILING_MICRO_SQUARE 0x20
 
 struct drm_radeon_gem_set_tiling {
 	uint32_t	handle;
@@ -870,8 +874,39 @@
 	uint64_t data_ptr;
 };
 
+#define RADEON_VA_MAP			1
+#define RADEON_VA_UNMAP			2
+
+#define RADEON_VA_RESULT_OK		0
+#define RADEON_VA_RESULT_ERROR		1
+#define RADEON_VA_RESULT_VA_EXIST	2
+
+#define RADEON_VM_PAGE_VALID		(1 << 0)
+#define RADEON_VM_PAGE_READABLE		(1 << 1)
+#define RADEON_VM_PAGE_WRITEABLE	(1 << 2)
+#define RADEON_VM_PAGE_SYSTEM		(1 << 3)
+#define RADEON_VM_PAGE_SNOOPED		(1 << 4)
+
+struct drm_radeon_gem_va {
+	uint32_t		handle;
+	uint32_t		operation;
+	uint32_t		vm_id;
+	uint32_t		flags;
+	uint64_t		offset;
+};
+
 #define RADEON_CHUNK_ID_RELOCS	0x01
 #define RADEON_CHUNK_ID_IB	0x02
+#define RADEON_CHUNK_ID_FLAGS	0x03
+
+/* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */
+#define RADEON_CS_KEEP_TILING_FLAGS 0x01
+#define RADEON_CS_USE_VM            0x02
+/* The second dword of RADEON_CHUNK_ID_FLAGS is a uint32 that sets the ring type */
+#define RADEON_CS_RING_GFX          0
+#define RADEON_CS_RING_COMPUTE      1
+/* The third dword of RADEON_CHUNK_ID_FLAGS is a sint32 that sets the priority */
+/* 0 = normal, + = higher priority, - = lower priority */
 
 struct drm_radeon_cs_chunk {
 	uint32_t		chunk_id;
@@ -879,6 +914,9 @@
 	uint64_t		chunk_data;
 };
 
+/* drm_radeon_cs_reloc.flags */
+#define RADEON_RELOC_DONT_SYNC		0x01
+
 struct drm_radeon_cs_reloc {
 	uint32_t		handle;
 	uint32_t		read_domains;
@@ -899,6 +937,21 @@
 #define RADEON_INFO_DEVICE_ID		0x00
 #define RADEON_INFO_NUM_GB_PIPES	0x01
 #define RADEON_INFO_NUM_Z_PIPES 	0x02
+#define RADEON_INFO_ACCEL_WORKING	0x03
+#define RADEON_INFO_CRTC_FROM_ID	0x04
+#define RADEON_INFO_ACCEL_WORKING2	0x05
+#define RADEON_INFO_TILING_CONFIG	0x06
+#define RADEON_INFO_WANT_HYPERZ		0x07
+#define RADEON_INFO_WANT_CMASK		0x08 /* get access to CMASK on r300 */
+#define RADEON_INFO_CLOCK_CRYSTAL_FREQ	0x09 /* clock crystal frequency */
+#define RADEON_INFO_NUM_BACKENDS	0x0a /* DB/backends for r600+ - need for OQ */
+#define RADEON_INFO_NUM_TILE_PIPES	0x0b /* tile pipes for r600+ */
+#define RADEON_INFO_FUSION_GART_WORKING	0x0c /* fusion writes to GTT were broken before this */
+#define RADEON_INFO_BACKEND_MAP		0x0d /* pipe to backend map, needed by mesa */
+/* virtual address start, va < start are reserved by the kernel */
+#define RADEON_INFO_VA_START		0x0e
+/* maximum size of ib using the virtual memory cs */
+#define RADEON_INFO_IB_VM_MAX_SIZE	0x0f
 
 struct drm_radeon_info {
 	uint32_t		request;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/savage_drm.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/savage_drm.h
index f7a75ef..a1df939 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/drm/savage_drm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/savage_drm.h
@@ -29,7 +29,7 @@
 #ifndef __SAVAGE_SAREA_DEFINES__
 #define __SAVAGE_SAREA_DEFINES__
 
-/* 2 heaps (1 for card, 1 for agp), each divided into upto 128
+/* 2 heaps (1 for card, 1 for agp), each divided into up to 128
  * regions, subject to a minimum region size of (1<<16) == 64k.
  *
  * Clients may subdivide regions internally, but when sharing between
@@ -63,10 +63,10 @@
 #define DRM_SAVAGE_BCI_EVENT_EMIT	0x02
 #define DRM_SAVAGE_BCI_EVENT_WAIT	0x03
 
-#define DRM_IOCTL_SAVAGE_INIT		DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_INIT, drm_savage_init_t)
-#define DRM_IOCTL_SAVAGE_CMDBUF		DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_CMDBUF, drm_savage_cmdbuf_t)
-#define DRM_IOCTL_SAVAGE_EVENT_EMIT	DRM_IOWR(DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_EMIT, drm_savage_event_emit_t)
-#define DRM_IOCTL_SAVAGE_EVENT_WAIT	DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_WAIT, drm_savage_event_wait_t)
+#define DRM_IOCTL_SAVAGE_BCI_INIT		DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_INIT, drm_savage_init_t)
+#define DRM_IOCTL_SAVAGE_BCI_CMDBUF		DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_CMDBUF, drm_savage_cmdbuf_t)
+#define DRM_IOCTL_SAVAGE_BCI_EVENT_EMIT	DRM_IOWR(DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_EMIT, drm_savage_event_emit_t)
+#define DRM_IOCTL_SAVAGE_BCI_EVENT_WAIT	DRM_IOW( DRM_COMMAND_BASE + DRM_SAVAGE_BCI_EVENT_WAIT, drm_savage_event_wait_t)
 
 #define SAVAGE_DMA_PCI	1
 #define SAVAGE_DMA_AGP	3
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/sis_drm.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/sis_drm.h
index 30f7b38..035b804 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/drm/sis_drm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/sis_drm.h
@@ -64,4 +64,8 @@
 	unsigned int offset, size;
 } drm_sis_fb_t;
 
+struct sis_file_private {
+	struct list_head obj_list;
+};
+
 #endif				/* __SIS_DRM_H__ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/via_drm.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/via_drm.h
index 535b558..44eafda 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/drm/via_drm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/via_drm.h
@@ -24,7 +24,7 @@
 #ifndef _VIA_DRM_H_
 #define _VIA_DRM_H_
 
-#include <linux/types.h>
+#include "drm.h"
 
 /* WARNING: These defines must be the same as what the Xserver uses.
  * if you change them, you must change the defines in the Xserver.
@@ -272,4 +272,8 @@
 	drm_via_blitsync_t sync;
 } drm_via_dmablit_t;
 
+struct via_file_private {
+	struct list_head obj_list;
+};
+
 #endif				/* _VIA_DRM_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/drm/vmwgfx_drm.h b/mips-qca-linux-uclibc/sysroot/usr/include/drm/vmwgfx_drm.h
new file mode 100644
index 0000000..bcb0912
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/drm/vmwgfx_drm.h
@@ -0,0 +1,790 @@
+/**************************************************************************
+ *
+ * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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 __VMWGFX_DRM_H__
+#define __VMWGFX_DRM_H__
+
+#define DRM_VMW_MAX_SURFACE_FACES 6
+#define DRM_VMW_MAX_MIP_LEVELS 24
+
+
+#define DRM_VMW_GET_PARAM            0
+#define DRM_VMW_ALLOC_DMABUF         1
+#define DRM_VMW_UNREF_DMABUF         2
+#define DRM_VMW_CURSOR_BYPASS        3
+/* guarded by DRM_VMW_PARAM_NUM_STREAMS != 0*/
+#define DRM_VMW_CONTROL_STREAM       4
+#define DRM_VMW_CLAIM_STREAM         5
+#define DRM_VMW_UNREF_STREAM         6
+/* guarded by DRM_VMW_PARAM_3D == 1 */
+#define DRM_VMW_CREATE_CONTEXT       7
+#define DRM_VMW_UNREF_CONTEXT        8
+#define DRM_VMW_CREATE_SURFACE       9
+#define DRM_VMW_UNREF_SURFACE        10
+#define DRM_VMW_REF_SURFACE          11
+#define DRM_VMW_EXECBUF              12
+#define DRM_VMW_GET_3D_CAP           13
+#define DRM_VMW_FENCE_WAIT           14
+#define DRM_VMW_FENCE_SIGNALED       15
+#define DRM_VMW_FENCE_UNREF          16
+#define DRM_VMW_FENCE_EVENT          17
+#define DRM_VMW_PRESENT              18
+#define DRM_VMW_PRESENT_READBACK     19
+#define DRM_VMW_UPDATE_LAYOUT        20
+
+/*************************************************************************/
+/**
+ * DRM_VMW_GET_PARAM - get device information.
+ *
+ * DRM_VMW_PARAM_FIFO_OFFSET:
+ * Offset to use to map the first page of the FIFO read-only.
+ * The fifo is mapped using the mmap() system call on the drm device.
+ *
+ * DRM_VMW_PARAM_OVERLAY_IOCTL:
+ * Does the driver support the overlay ioctl.
+ */
+
+#define DRM_VMW_PARAM_NUM_STREAMS      0
+#define DRM_VMW_PARAM_NUM_FREE_STREAMS 1
+#define DRM_VMW_PARAM_3D               2
+#define DRM_VMW_PARAM_HW_CAPS          3
+#define DRM_VMW_PARAM_FIFO_CAPS        4
+#define DRM_VMW_PARAM_MAX_FB_SIZE      5
+#define DRM_VMW_PARAM_FIFO_HW_VERSION  6
+
+/**
+ * struct drm_vmw_getparam_arg
+ *
+ * @value: Returned value. //Out
+ * @param: Parameter to query. //In.
+ *
+ * Argument to the DRM_VMW_GET_PARAM Ioctl.
+ */
+
+struct drm_vmw_getparam_arg {
+	uint64_t value;
+	uint32_t param;
+	uint32_t pad64;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_CREATE_CONTEXT - Create a host context.
+ *
+ * Allocates a device unique context id, and queues a create context command
+ * for the host. Does not wait for host completion.
+ */
+
+/**
+ * struct drm_vmw_context_arg
+ *
+ * @cid: Device unique context ID.
+ *
+ * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
+ * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
+ */
+
+struct drm_vmw_context_arg {
+	int32_t cid;
+	uint32_t pad64;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_UNREF_CONTEXT - Create a host context.
+ *
+ * Frees a global context id, and queues a destroy host command for the host.
+ * Does not wait for host completion. The context ID can be used directly
+ * in the command stream and shows up as the same context ID on the host.
+ */
+
+/*************************************************************************/
+/**
+ * DRM_VMW_CREATE_SURFACE - Create a host suface.
+ *
+ * Allocates a device unique surface id, and queues a create surface command
+ * for the host. Does not wait for host completion. The surface ID can be
+ * used directly in the command stream and shows up as the same surface
+ * ID on the host.
+ */
+
+/**
+ * struct drm_wmv_surface_create_req
+ *
+ * @flags: Surface flags as understood by the host.
+ * @format: Surface format as understood by the host.
+ * @mip_levels: Number of mip levels for each face.
+ * An unused face should have 0 encoded.
+ * @size_addr: Address of a user-space array of sruct drm_vmw_size
+ * cast to an uint64_t for 32-64 bit compatibility.
+ * The size of the array should equal the total number of mipmap levels.
+ * @shareable: Boolean whether other clients (as identified by file descriptors)
+ * may reference this surface.
+ * @scanout: Boolean whether the surface is intended to be used as a
+ * scanout.
+ *
+ * Input data to the DRM_VMW_CREATE_SURFACE Ioctl.
+ * Output data from the DRM_VMW_REF_SURFACE Ioctl.
+ */
+
+struct drm_vmw_surface_create_req {
+	uint32_t flags;
+	uint32_t format;
+	uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES];
+	uint64_t size_addr;
+	int32_t shareable;
+	int32_t scanout;
+};
+
+/**
+ * struct drm_wmv_surface_arg
+ *
+ * @sid: Surface id of created surface or surface to destroy or reference.
+ *
+ * Output data from the DRM_VMW_CREATE_SURFACE Ioctl.
+ * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl.
+ * Input argument to the DRM_VMW_REF_SURFACE Ioctl.
+ */
+
+struct drm_vmw_surface_arg {
+	int32_t sid;
+	uint32_t pad64;
+};
+
+/**
+ * struct drm_vmw_size ioctl.
+ *
+ * @width - mip level width
+ * @height - mip level height
+ * @depth - mip level depth
+ *
+ * Description of a mip level.
+ * Input data to the DRM_WMW_CREATE_SURFACE Ioctl.
+ */
+
+struct drm_vmw_size {
+	uint32_t width;
+	uint32_t height;
+	uint32_t depth;
+	uint32_t pad64;
+};
+
+/**
+ * union drm_vmw_surface_create_arg
+ *
+ * @rep: Output data as described above.
+ * @req: Input data as described above.
+ *
+ * Argument to the DRM_VMW_CREATE_SURFACE Ioctl.
+ */
+
+union drm_vmw_surface_create_arg {
+	struct drm_vmw_surface_arg rep;
+	struct drm_vmw_surface_create_req req;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_REF_SURFACE - Reference a host surface.
+ *
+ * Puts a reference on a host surface with a give sid, as previously
+ * returned by the DRM_VMW_CREATE_SURFACE ioctl.
+ * A reference will make sure the surface isn't destroyed while we hold
+ * it and will allow the calling client to use the surface ID in the command
+ * stream.
+ *
+ * On successful return, the Ioctl returns the surface information given
+ * in the DRM_VMW_CREATE_SURFACE ioctl.
+ */
+
+/**
+ * union drm_vmw_surface_reference_arg
+ *
+ * @rep: Output data as described above.
+ * @req: Input data as described above.
+ *
+ * Argument to the DRM_VMW_REF_SURFACE Ioctl.
+ */
+
+union drm_vmw_surface_reference_arg {
+	struct drm_vmw_surface_create_req rep;
+	struct drm_vmw_surface_arg req;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_UNREF_SURFACE - Unreference a host surface.
+ *
+ * Clear a reference previously put on a host surface.
+ * When all references are gone, including the one implicitly placed
+ * on creation,
+ * a destroy surface command will be queued for the host.
+ * Does not wait for completion.
+ */
+
+/*************************************************************************/
+/**
+ * DRM_VMW_EXECBUF
+ *
+ * Submit a command buffer for execution on the host, and return a
+ * fence seqno that when signaled, indicates that the command buffer has
+ * executed.
+ */
+
+/**
+ * struct drm_vmw_execbuf_arg
+ *
+ * @commands: User-space address of a command buffer cast to an uint64_t.
+ * @command-size: Size in bytes of the command buffer.
+ * @throttle-us: Sleep until software is less than @throttle_us
+ * microseconds ahead of hardware. The driver may round this value
+ * to the nearest kernel tick.
+ * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an
+ * uint64_t.
+ * @version: Allows expanding the execbuf ioctl parameters without breaking
+ * backwards compatibility, since user-space will always tell the kernel
+ * which version it uses.
+ * @flags: Execbuf flags. None currently.
+ *
+ * Argument to the DRM_VMW_EXECBUF Ioctl.
+ */
+
+#define DRM_VMW_EXECBUF_VERSION 1
+
+struct drm_vmw_execbuf_arg {
+	uint64_t commands;
+	uint32_t command_size;
+	uint32_t throttle_us;
+	uint64_t fence_rep;
+	uint32_t version;
+	uint32_t flags;
+};
+
+/**
+ * struct drm_vmw_fence_rep
+ *
+ * @handle: Fence object handle for fence associated with a command submission.
+ * @mask: Fence flags relevant for this fence object.
+ * @seqno: Fence sequence number in fifo. A fence object with a lower
+ * seqno will signal the EXEC flag before a fence object with a higher
+ * seqno. This can be used by user-space to avoid kernel calls to determine
+ * whether a fence has signaled the EXEC flag. Note that @seqno will
+ * wrap at 32-bit.
+ * @passed_seqno: The highest seqno number processed by the hardware
+ * so far. This can be used to mark user-space fence objects as signaled, and
+ * to determine whether a fence seqno might be stale.
+ * @error: This member should've been set to -EFAULT on submission.
+ * The following actions should be take on completion:
+ * error == -EFAULT: Fence communication failed. The host is synchronized.
+ * Use the last fence id read from the FIFO fence register.
+ * error != 0 && error != -EFAULT:
+ * Fence submission failed. The host is synchronized. Use the fence_seq member.
+ * error == 0: All is OK, The host may not be synchronized.
+ * Use the fence_seq member.
+ *
+ * Input / Output data to the DRM_VMW_EXECBUF Ioctl.
+ */
+
+struct drm_vmw_fence_rep {
+	uint32_t handle;
+	uint32_t mask;
+	uint32_t seqno;
+	uint32_t passed_seqno;
+	uint32_t pad64;
+	int32_t error;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_ALLOC_DMABUF
+ *
+ * Allocate a DMA buffer that is visible also to the host.
+ * NOTE: The buffer is
+ * identified by a handle and an offset, which are private to the guest, but
+ * useable in the command stream. The guest kernel may translate these
+ * and patch up the command stream accordingly. In the future, the offset may
+ * be zero at all times, or it may disappear from the interface before it is
+ * fixed.
+ *
+ * The DMA buffer may stay user-space mapped in the guest at all times,
+ * and is thus suitable for sub-allocation.
+ *
+ * DMA buffers are mapped using the mmap() syscall on the drm device.
+ */
+
+/**
+ * struct drm_vmw_alloc_dmabuf_req
+ *
+ * @size: Required minimum size of the buffer.
+ *
+ * Input data to the DRM_VMW_ALLOC_DMABUF Ioctl.
+ */
+
+struct drm_vmw_alloc_dmabuf_req {
+	uint32_t size;
+	uint32_t pad64;
+};
+
+/**
+ * struct drm_vmw_dmabuf_rep
+ *
+ * @map_handle: Offset to use in the mmap() call used to map the buffer.
+ * @handle: Handle unique to this buffer. Used for unreferencing.
+ * @cur_gmr_id: GMR id to use in the command stream when this buffer is
+ * referenced. See not above.
+ * @cur_gmr_offset: Offset to use in the command stream when this buffer is
+ * referenced. See note above.
+ *
+ * Output data from the DRM_VMW_ALLOC_DMABUF Ioctl.
+ */
+
+struct drm_vmw_dmabuf_rep {
+	uint64_t map_handle;
+	uint32_t handle;
+	uint32_t cur_gmr_id;
+	uint32_t cur_gmr_offset;
+	uint32_t pad64;
+};
+
+/**
+ * union drm_vmw_dmabuf_arg
+ *
+ * @req: Input data as described above.
+ * @rep: Output data as described above.
+ *
+ * Argument to the DRM_VMW_ALLOC_DMABUF Ioctl.
+ */
+
+union drm_vmw_alloc_dmabuf_arg {
+	struct drm_vmw_alloc_dmabuf_req req;
+	struct drm_vmw_dmabuf_rep rep;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_UNREF_DMABUF - Free a DMA buffer.
+ *
+ */
+
+/**
+ * struct drm_vmw_unref_dmabuf_arg
+ *
+ * @handle: Handle indicating what buffer to free. Obtained from the
+ * DRM_VMW_ALLOC_DMABUF Ioctl.
+ *
+ * Argument to the DRM_VMW_UNREF_DMABUF Ioctl.
+ */
+
+struct drm_vmw_unref_dmabuf_arg {
+	uint32_t handle;
+	uint32_t pad64;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_CONTROL_STREAM - Control overlays, aka streams.
+ *
+ * This IOCTL controls the overlay units of the svga device.
+ * The SVGA overlay units does not work like regular hardware units in
+ * that they do not automaticaly read back the contents of the given dma
+ * buffer. But instead only read back for each call to this ioctl, and
+ * at any point between this call being made and a following call that
+ * either changes the buffer or disables the stream.
+ */
+
+/**
+ * struct drm_vmw_rect
+ *
+ * Defines a rectangle. Used in the overlay ioctl to define
+ * source and destination rectangle.
+ */
+
+struct drm_vmw_rect {
+	int32_t x;
+	int32_t y;
+	uint32_t w;
+	uint32_t h;
+};
+
+/**
+ * struct drm_vmw_control_stream_arg
+ *
+ * @stream_id: Stearm to control
+ * @enabled: If false all following arguments are ignored.
+ * @handle: Handle to buffer for getting data from.
+ * @format: Format of the overlay as understood by the host.
+ * @width: Width of the overlay.
+ * @height: Height of the overlay.
+ * @size: Size of the overlay in bytes.
+ * @pitch: Array of pitches, the two last are only used for YUV12 formats.
+ * @offset: Offset from start of dma buffer to overlay.
+ * @src: Source rect, must be within the defined area above.
+ * @dst: Destination rect, x and y may be negative.
+ *
+ * Argument to the DRM_VMW_CONTROL_STREAM Ioctl.
+ */
+
+struct drm_vmw_control_stream_arg {
+	uint32_t stream_id;
+	uint32_t enabled;
+
+	uint32_t flags;
+	uint32_t color_key;
+
+	uint32_t handle;
+	uint32_t offset;
+	int32_t format;
+	uint32_t size;
+	uint32_t width;
+	uint32_t height;
+	uint32_t pitch[3];
+
+	uint32_t pad64;
+	struct drm_vmw_rect src;
+	struct drm_vmw_rect dst;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass.
+ *
+ */
+
+#define DRM_VMW_CURSOR_BYPASS_ALL    (1 << 0)
+#define DRM_VMW_CURSOR_BYPASS_FLAGS       (1)
+
+/**
+ * struct drm_vmw_cursor_bypass_arg
+ *
+ * @flags: Flags.
+ * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed.
+ * @xpos: X position of cursor.
+ * @ypos: Y position of cursor.
+ * @xhot: X hotspot.
+ * @yhot: Y hotspot.
+ *
+ * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl.
+ */
+
+struct drm_vmw_cursor_bypass_arg {
+	uint32_t flags;
+	uint32_t crtc_id;
+	int32_t xpos;
+	int32_t ypos;
+	int32_t xhot;
+	int32_t yhot;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_CLAIM_STREAM - Claim a single stream.
+ */
+
+/**
+ * struct drm_vmw_context_arg
+ *
+ * @stream_id: Device unique context ID.
+ *
+ * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl.
+ * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl.
+ */
+
+struct drm_vmw_stream_arg {
+	uint32_t stream_id;
+	uint32_t pad64;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_UNREF_STREAM - Unclaim a stream.
+ *
+ * Return a single stream that was claimed by this process. Also makes
+ * sure that the stream has been stopped.
+ */
+
+/*************************************************************************/
+/**
+ * DRM_VMW_GET_3D_CAP
+ *
+ * Read 3D capabilities from the FIFO
+ *
+ */
+
+/**
+ * struct drm_vmw_get_3d_cap_arg
+ *
+ * @buffer: Pointer to a buffer for capability data, cast to an uint64_t
+ * @size: Max size to copy
+ *
+ * Input argument to the DRM_VMW_GET_3D_CAP_IOCTL
+ * ioctls.
+ */
+
+struct drm_vmw_get_3d_cap_arg {
+	uint64_t buffer;
+	uint32_t max_size;
+	uint32_t pad64;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_FENCE_WAIT
+ *
+ * Waits for a fence object to signal. The wait is interruptible, so that
+ * signals may be delivered during the interrupt. The wait may timeout,
+ * in which case the calls returns -EBUSY. If the wait is restarted,
+ * that is restarting without resetting @cookie_valid to zero,
+ * the timeout is computed from the first call.
+ *
+ * The flags argument to the DRM_VMW_FENCE_WAIT ioctl indicates what to wait
+ * on:
+ * DRM_VMW_FENCE_FLAG_EXEC: All commands ahead of the fence in the command
+ * stream
+ * have executed.
+ * DRM_VMW_FENCE_FLAG_QUERY: All query results resulting from query finish
+ * commands
+ * in the buffer given to the EXECBUF ioctl returning the fence object handle
+ * are available to user-space.
+ *
+ * DRM_VMW_WAIT_OPTION_UNREF: If this wait option is given, and the
+ * fenc wait ioctl returns 0, the fence object has been unreferenced after
+ * the wait.
+ */
+
+#define DRM_VMW_FENCE_FLAG_EXEC   (1 << 0)
+#define DRM_VMW_FENCE_FLAG_QUERY  (1 << 1)
+
+#define DRM_VMW_WAIT_OPTION_UNREF (1 << 0)
+
+/**
+ * struct drm_vmw_fence_wait_arg
+ *
+ * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
+ * @cookie_valid: Must be reset to 0 on first call. Left alone on restart.
+ * @kernel_cookie: Set to 0 on first call. Left alone on restart.
+ * @timeout_us: Wait timeout in microseconds. 0 for indefinite timeout.
+ * @lazy: Set to 1 if timing is not critical. Allow more than a kernel tick
+ * before returning.
+ * @flags: Fence flags to wait on.
+ * @wait_options: Options that control the behaviour of the wait ioctl.
+ *
+ * Input argument to the DRM_VMW_FENCE_WAIT ioctl.
+ */
+
+struct drm_vmw_fence_wait_arg {
+	uint32_t handle;
+	int32_t  cookie_valid;
+	uint64_t kernel_cookie;
+	uint64_t timeout_us;
+	int32_t lazy;
+	int32_t flags;
+	int32_t wait_options;
+	int32_t pad64;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_FENCE_SIGNALED
+ *
+ * Checks if a fence object is signaled..
+ */
+
+/**
+ * struct drm_vmw_fence_signaled_arg
+ *
+ * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
+ * @flags: Fence object flags input to DRM_VMW_FENCE_SIGNALED ioctl
+ * @signaled: Out: Flags signaled.
+ * @sequence: Out: Highest sequence passed so far. Can be used to signal the
+ * EXEC flag of user-space fence objects.
+ *
+ * Input/Output argument to the DRM_VMW_FENCE_SIGNALED and DRM_VMW_FENCE_UNREF
+ * ioctls.
+ */
+
+struct drm_vmw_fence_signaled_arg {
+	 uint32_t handle;
+	 uint32_t flags;
+	 int32_t signaled;
+	 uint32_t passed_seqno;
+	 uint32_t signaled_flags;
+	 uint32_t pad64;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_FENCE_UNREF
+ *
+ * Unreferences a fence object, and causes it to be destroyed if there are no
+ * other references to it.
+ *
+ */
+
+/**
+ * struct drm_vmw_fence_arg
+ *
+ * @handle: Fence object handle as returned by the DRM_VMW_EXECBUF ioctl.
+ *
+ * Input/Output argument to the DRM_VMW_FENCE_UNREF ioctl..
+ */
+
+struct drm_vmw_fence_arg {
+	 uint32_t handle;
+	 uint32_t pad64;
+};
+
+
+/*************************************************************************/
+/**
+ * DRM_VMW_FENCE_EVENT
+ *
+ * Queues an event on a fence to be delivered on the drm character device
+ * when the fence has signaled the DRM_VMW_FENCE_FLAG_EXEC flag.
+ * Optionally the approximate time when the fence signaled is
+ * given by the event.
+ */
+
+/*
+ * The event type
+ */
+#define DRM_VMW_EVENT_FENCE_SIGNALED 0x80000000
+
+struct drm_vmw_event_fence {
+	struct drm_event base;
+	uint64_t user_data;
+	uint32_t tv_sec;
+	uint32_t tv_usec;
+};
+
+/*
+ * Flags that may be given to the command.
+ */
+/* Request fence signaled time on the event. */
+#define DRM_VMW_FE_FLAG_REQ_TIME (1 << 0)
+
+/**
+ * struct drm_vmw_fence_event_arg
+ *
+ * @fence_rep: Pointer to fence_rep structure cast to uint64_t or 0 if
+ * the fence is not supposed to be referenced by user-space.
+ * @user_info: Info to be delivered with the event.
+ * @handle: Attach the event to this fence only.
+ * @flags: A set of flags as defined above.
+ */
+struct drm_vmw_fence_event_arg {
+	uint64_t fence_rep;
+	uint64_t user_data;
+	uint32_t handle;
+	uint32_t flags;
+};
+
+
+/*************************************************************************/
+/**
+ * DRM_VMW_PRESENT
+ *
+ * Executes an SVGA present on a given fb for a given surface. The surface
+ * is placed on the framebuffer. Cliprects are given relative to the given
+ * point (the point disignated by dest_{x|y}).
+ *
+ */
+
+/**
+ * struct drm_vmw_present_arg
+ * @fb_id: framebuffer id to present / read back from.
+ * @sid: Surface id to present from.
+ * @dest_x: X placement coordinate for surface.
+ * @dest_y: Y placement coordinate for surface.
+ * @clips_ptr: Pointer to an array of clip rects cast to an uint64_t.
+ * @num_clips: Number of cliprects given relative to the framebuffer origin,
+ * in the same coordinate space as the frame buffer.
+ * @pad64: Unused 64-bit padding.
+ *
+ * Input argument to the DRM_VMW_PRESENT ioctl.
+ */
+
+struct drm_vmw_present_arg {
+	uint32_t fb_id;
+	uint32_t sid;
+	int32_t dest_x;
+	int32_t dest_y;
+	uint64_t clips_ptr;
+	uint32_t num_clips;
+	uint32_t pad64;
+};
+
+
+/*************************************************************************/
+/**
+ * DRM_VMW_PRESENT_READBACK
+ *
+ * Executes an SVGA present readback from a given fb to the dma buffer
+ * currently bound as the fb. If there is no dma buffer bound to the fb,
+ * an error will be returned.
+ *
+ */
+
+/**
+ * struct drm_vmw_present_arg
+ * @fb_id: fb_id to present / read back from.
+ * @num_clips: Number of cliprects.
+ * @clips_ptr: Pointer to an array of clip rects cast to an uint64_t.
+ * @fence_rep: Pointer to a struct drm_vmw_fence_rep, cast to an uint64_t.
+ * If this member is NULL, then the ioctl should not return a fence.
+ */
+
+struct drm_vmw_present_readback_arg {
+	 uint32_t fb_id;
+	 uint32_t num_clips;
+	 uint64_t clips_ptr;
+	 uint64_t fence_rep;
+};
+
+/*************************************************************************/
+/**
+ * DRM_VMW_UPDATE_LAYOUT - Update layout
+ *
+ * Updates the preferred modes and connection status for connectors. The
+ * command consists of one drm_vmw_update_layout_arg pointing to an array
+ * of num_outputs drm_vmw_rect's.
+ */
+
+/**
+ * struct drm_vmw_update_layout_arg
+ *
+ * @num_outputs: number of active connectors
+ * @rects: pointer to array of drm_vmw_rect cast to an uint64_t
+ *
+ * Input argument to the DRM_VMW_UPDATE_LAYOUT Ioctl.
+ */
+struct drm_vmw_update_layout_arg {
+	uint32_t num_outputs;
+	uint32_t pad64;
+	uint64_t rects;
+};
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/ifaddrs.h b/mips-qca-linux-uclibc/sysroot/usr/include/ifaddrs.h
new file mode 100644
index 0000000..ba6a155
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/ifaddrs.h
@@ -0,0 +1,74 @@
+/* ifaddrs.h -- declarations for getting network interface addresses
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _IFADDRS_H
+#define _IFADDRS_H	1
+
+#include <features.h>
+#include <sys/socket.h>
+
+__BEGIN_DECLS
+
+/* The `getifaddrs' function generates a linked list of these structures.
+   Each element of the list describes one network interface.  */
+struct ifaddrs
+{
+  struct ifaddrs *ifa_next;	/* Pointer to the next structure.  */
+
+  char *ifa_name;		/* Name of this network interface.  */
+  unsigned int ifa_flags;	/* Flags as from SIOCGIFFLAGS ioctl.  */
+
+  struct sockaddr *ifa_addr;	/* Network address of this interface.  */
+  struct sockaddr *ifa_netmask; /* Netmask of this interface.  */
+  union
+  {
+    /* At most one of the following two is valid.  If the IFF_BROADCAST
+       bit is set in `ifa_flags', then `ifa_broadaddr' is valid.  If the
+       IFF_POINTOPOINT bit is set, then `ifa_dstaddr' is valid.
+       It is never the case that both these bits are set at once.  */
+    struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */
+    struct sockaddr *ifu_dstaddr; /* Point-to-point destination address.  */
+  } ifa_ifu;
+  /* These very same macros are defined by <net/if.h> for `struct ifaddr'.
+     So if they are defined already, the existing definitions will be fine.  */
+# ifndef ifa_broadaddr
+#  define ifa_broadaddr	ifa_ifu.ifu_broadaddr
+# endif
+# ifndef ifa_dstaddr
+#  define ifa_dstaddr	ifa_ifu.ifu_dstaddr
+# endif
+
+  void *ifa_data;		/* Address-specific data (may be unused).  */
+};
+
+
+/* Create a linked list of `struct ifaddrs' structures, one for each
+   network interface on the host machine.  If successful, store the
+   list in *IFAP and return 0.  On errors, return -1 and set `errno'.
+
+   The storage returned in *IFAP is allocated dynamically and can
+   only be properly freed by passing it to `freeifaddrs'.  */
+extern int getifaddrs (struct ifaddrs **__ifap) __THROW;
+
+/* Reclaim the storage allocated by a previous `getifaddrs' call.  */
+extern void freeifaddrs (struct ifaddrs *__ifa)  __THROW;
+
+__END_DECLS
+
+#endif /* ifaddrs.h */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/atalk.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/atalk.h
index 801c3e3..4e5eefe 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/atalk.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/atalk.h
@@ -3,6 +3,7 @@
 
 #include <linux/types.h>
 #include <asm/byteorder.h>
+#include <linux/socket.h>
 
 /*
  * AppleTalk networking structures
@@ -28,7 +29,7 @@
 };
 
 struct sockaddr_at {
-	sa_family_t	  sat_family;
+	__kernel_sa_family_t sat_family;
 	__u8		  sat_port;
 	struct atalk_addr sat_addr;
 	char		  sat_zero[8];
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/atm.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/atm.h
index 5e1c36d..6808cf6 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/atm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/atm.h
@@ -139,6 +139,9 @@
 	int		min_pcr;	/* minimum PCR in cells per second */
 	int		max_cdv;	/* maximum CDV in microseconds */
 	int		max_sdu;	/* maximum SDU in bytes */
+	int		scr;		/* sustained rate in cells per second */
+	int		mbs;		/* maximum burst size (MBS) in cells */
+	int		cdv;		/* Cell delay varition */
         /* extra params for ABR */
         unsigned int 	icr;         	/* Initial Cell Rate (24-bit) */
         unsigned int	tbe;		/* Transient Buffer Exposure (24-bit) */ 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/audit.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/audit.h
index b66d45f..f79a1ca 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/audit.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/audit.h
@@ -26,6 +26,7 @@
 
 #include <linux/types.h>
 #include <linux/elf-em.h>
+#include <linux/ptrace.h>
 
 /* The netlink messages for the audit system is divided into blocks:
  * 1000 - 1099 are for commanding the audit system
@@ -102,6 +103,9 @@
 #define AUDIT_EOE		1320	/* End of multi-record event */
 #define AUDIT_BPRM_FCAPS	1321	/* Information about fcaps increasing perms */
 #define AUDIT_CAPSET		1322	/* Record showing argument to sys_capset */
+#define AUDIT_MMAP		1323	/* Record showing descriptor and flags in mmap */
+#define AUDIT_NETFILTER_PKT	1324	/* Packets traversing netfilter chains */
+#define AUDIT_NETFILTER_CFG	1325	/* Netfilter chain modifications */
 
 #define AUDIT_AVC		1400	/* SE Linux avc denial or grant */
 #define AUDIT_SELINUX_ERR	1401	/* Internal SE Linux Errors */
@@ -178,6 +182,40 @@
  * AUDIT_UNUSED_BITS is updated if need be. */
 #define AUDIT_UNUSED_BITS	0x07FFFC00
 
+/* AUDIT_FIELD_COMPARE rule list */
+#define AUDIT_COMPARE_UID_TO_OBJ_UID	1
+#define AUDIT_COMPARE_GID_TO_OBJ_GID	2
+#define AUDIT_COMPARE_EUID_TO_OBJ_UID	3
+#define AUDIT_COMPARE_EGID_TO_OBJ_GID	4
+#define AUDIT_COMPARE_AUID_TO_OBJ_UID	5
+#define AUDIT_COMPARE_SUID_TO_OBJ_UID	6
+#define AUDIT_COMPARE_SGID_TO_OBJ_GID	7
+#define AUDIT_COMPARE_FSUID_TO_OBJ_UID	8
+#define AUDIT_COMPARE_FSGID_TO_OBJ_GID	9
+
+#define AUDIT_COMPARE_UID_TO_AUID	10
+#define AUDIT_COMPARE_UID_TO_EUID	11
+#define AUDIT_COMPARE_UID_TO_FSUID	12
+#define AUDIT_COMPARE_UID_TO_SUID	13
+
+#define AUDIT_COMPARE_AUID_TO_FSUID	14
+#define AUDIT_COMPARE_AUID_TO_SUID	15
+#define AUDIT_COMPARE_AUID_TO_EUID	16
+
+#define AUDIT_COMPARE_EUID_TO_SUID	17
+#define AUDIT_COMPARE_EUID_TO_FSUID	18
+
+#define AUDIT_COMPARE_SUID_TO_FSUID	19
+
+#define AUDIT_COMPARE_GID_TO_EGID	20
+#define AUDIT_COMPARE_GID_TO_FSGID	21
+#define AUDIT_COMPARE_GID_TO_SGID	22
+
+#define AUDIT_COMPARE_EGID_TO_FSGID	23
+#define AUDIT_COMPARE_EGID_TO_SGID	24
+#define AUDIT_COMPARE_SGID_TO_FSGID	25
+
+#define AUDIT_MAX_FIELD_COMPARE		AUDIT_COMPARE_SGID_TO_FSGID
 
 /* Rule fields */
 				/* These are useful when checking the
@@ -219,6 +257,9 @@
 #define AUDIT_PERM	106
 #define AUDIT_DIR	107
 #define AUDIT_FILETYPE	108
+#define AUDIT_OBJ_UID	109
+#define AUDIT_OBJ_GID	110
+#define AUDIT_FIELD_COMPARE	111
 
 #define AUDIT_ARG0      200
 #define AUDIT_ARG1      (AUDIT_ARG0+1)
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/auto_fs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/auto_fs.h
index 2726346..0df86e5 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/auto_fs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/auto_fs.h
@@ -73,6 +73,7 @@
 #define AUTOFS_IOC_FAIL       _IO(0x93,0x61)
 #define AUTOFS_IOC_CATATONIC  _IO(0x93,0x62)
 #define AUTOFS_IOC_PROTOVER   _IOR(0x93,0x63,int)
+#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t)
 #define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
 #define AUTOFS_IOC_EXPIRE     _IOR(0x93,0x65,struct autofs_packet_expire)
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/auto_fs4.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/auto_fs4.h
index cf1db36..674aa75 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/auto_fs4.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/auto_fs4.h
@@ -24,7 +24,7 @@
 #define AUTOFS_MIN_PROTO_VERSION	3
 #define AUTOFS_MAX_PROTO_VERSION	5
 
-#define AUTOFS_PROTO_SUBVERSION		1
+#define AUTOFS_PROTO_SUBVERSION		2
 
 /* Mask for expire behaviour */
 #define AUTOFS_EXP_IMMEDIATE		1
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ax25.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ax25.h
index 56c11f0..74c89a4 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ax25.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ax25.h
@@ -47,7 +47,7 @@
 } ax25_address;
 
 struct sockaddr_ax25 {
-	sa_family_t	sax25_family;
+	__kernel_sa_family_t sax25_family;
 	ax25_address	sax25_call;
 	int		sax25_ndigis;
 	/* Digipeater ax25_address sets follow */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/blk_types.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/blk_types.h
new file mode 100644
index 0000000..367d1ba
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/blk_types.h
@@ -0,0 +1,195 @@
+/*
+ * Block data types and constants.  Directly include this file only to
+ * break include dependency loop.
+ */
+#ifndef __LINUX_BLK_TYPES_H
+#define __LINUX_BLK_TYPES_H
+
+#ifdef CONFIG_BLOCK
+
+#include <linux/types.h>
+
+struct bio_set;
+struct bio;
+struct bio_integrity_payload;
+struct page;
+struct block_device;
+typedef void (bio_end_io_t) (struct bio *, int);
+typedef void (bio_destructor_t) (struct bio *);
+
+/*
+ * was unsigned short, but we might as well be ready for > 64kB I/O pages
+ */
+struct bio_vec {
+	struct page	*bv_page;
+	unsigned int	bv_len;
+	unsigned int	bv_offset;
+};
+
+/*
+ * main unit of I/O for the block layer and lower layers (ie drivers and
+ * stacking drivers)
+ */
+struct bio {
+	sector_t		bi_sector;	/* device address in 512 byte
+						   sectors */
+	struct bio		*bi_next;	/* request queue link */
+	struct block_device	*bi_bdev;
+	unsigned long		bi_flags;	/* status, command, etc */
+	unsigned long		bi_rw;		/* bottom bits READ/WRITE,
+						 * top bits priority
+						 */
+
+	unsigned short		bi_vcnt;	/* how many bio_vec's */
+	unsigned short		bi_idx;		/* current index into bvl_vec */
+
+	/* Number of segments in this BIO after
+	 * physical address coalescing is performed.
+	 */
+	unsigned int		bi_phys_segments;
+
+	unsigned int		bi_size;	/* residual I/O count */
+
+	/*
+	 * To keep track of the max segment size, we account for the
+	 * sizes of the first and last mergeable segments in this bio.
+	 */
+	unsigned int		bi_seg_front_size;
+	unsigned int		bi_seg_back_size;
+
+	unsigned int		bi_max_vecs;	/* max bvl_vecs we can hold */
+
+	atomic_t		bi_cnt;		/* pin count */
+
+	struct bio_vec		*bi_io_vec;	/* the actual vec list */
+
+	bio_end_io_t		*bi_end_io;
+
+	void			*bi_private;
+#if defined(CONFIG_BLK_DEV_INTEGRITY)
+	struct bio_integrity_payload *bi_integrity;  /* data integrity */
+#endif
+
+	bio_destructor_t	*bi_destructor;	/* destructor */
+
+	/*
+	 * We can __inline__ a number of vecs at the end of the bio, to avoid
+	 * double allocations for a small number of bio_vecs. This member
+	 * MUST obviously be kept at the very end of the bio.
+	 */
+	struct bio_vec		bi_inline_vecs[0];
+};
+
+/*
+ * bio flags
+ */
+#define BIO_UPTODATE	0	/* ok after I/O completion */
+#define BIO_RW_BLOCK	1	/* RW_AHEAD set, and read/write would block */
+#define BIO_EOF		2	/* out-out-bounds error */
+#define BIO_SEG_VALID	3	/* bi_phys_segments valid */
+#define BIO_CLONED	4	/* doesn't own data */
+#define BIO_BOUNCED	5	/* bio is a bounce bio */
+#define BIO_USER_MAPPED 6	/* contains user pages */
+#define BIO_EOPNOTSUPP	7	/* not supported */
+#define BIO_NULL_MAPPED 8	/* contains invalid user pages */
+#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_flagged(bio, flag)	((bio)->bi_flags & (1 << (flag)))
+
+/*
+ * top 4 bits of bio flags indicate the pool this bio came from
+ */
+#define BIO_POOL_BITS		(4)
+#define BIO_POOL_NONE		((1UL << BIO_POOL_BITS) - 1)
+#define BIO_POOL_OFFSET		(BITS_PER_LONG - BIO_POOL_BITS)
+#define BIO_POOL_MASK		(1UL << BIO_POOL_OFFSET)
+#define BIO_POOL_IDX(bio)	((bio)->bi_flags >> BIO_POOL_OFFSET)
+
+#endif /* CONFIG_BLOCK */
+
+/*
+ * Request flags.  For use in the cmd_flags field of struct request, and in
+ * bi_rw of struct bio.  Note that some flags are only valid in either one.
+ */
+enum rq_flag_bits {
+	/* common flags */
+	__REQ_WRITE,		/* not set, read. set, write */
+	__REQ_FAILFAST_DEV,	/* no driver retries of device errors */
+	__REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */
+	__REQ_FAILFAST_DRIVER,	/* no driver retries of driver errors */
+
+	__REQ_SYNC,		/* request is sync (sync write or read) */
+	__REQ_META,		/* metadata io request */
+	__REQ_PRIO,		/* boost priority in cfq */
+	__REQ_DISCARD,		/* request to discard sectors */
+	__REQ_SECURE,		/* secure discard (used with __REQ_DISCARD) */
+
+	__REQ_NOIDLE,		/* don't anticipate more IO after this one */
+	__REQ_FUA,		/* forced unit access */
+	__REQ_FLUSH,		/* request for cache flush */
+
+	/* bio only flags */
+	__REQ_RAHEAD,		/* read ahead, can fail anytime */
+	__REQ_THROTTLED,	/* This bio has already been subjected to
+				 * throttling rules. Don't do it again. */
+
+	/* request only flags */
+	__REQ_SORTED,		/* elevator knows about this request */
+	__REQ_SOFTBARRIER,	/* may not be passed by ioscheduler */
+	__REQ_NOMERGE,		/* don't touch this for merging */
+	__REQ_STARTED,		/* drive already may have started this one */
+	__REQ_DONTPREP,		/* don't call prep for this one */
+	__REQ_QUEUED,		/* uses queueing */
+	__REQ_ELVPRIV,		/* elevator private data attached */
+	__REQ_FAILED,		/* set if the request failed */
+	__REQ_QUIET,		/* don't worry about errors */
+	__REQ_PREEMPT,		/* set for "ide_preempt" requests */
+	__REQ_ALLOCED,		/* request came from our alloc pool */
+	__REQ_COPY_USER,	/* contains copies of user pages */
+	__REQ_FLUSH_SEQ,	/* request for flush sequence */
+	__REQ_IO_STAT,		/* account I/O stat */
+	__REQ_MIXED_MERGE,	/* merge of different types, fail separately */
+	__REQ_NR_BITS,		/* stops here */
+};
+
+#define REQ_WRITE		(1 << __REQ_WRITE)
+#define REQ_FAILFAST_DEV	(1 << __REQ_FAILFAST_DEV)
+#define REQ_FAILFAST_TRANSPORT	(1 << __REQ_FAILFAST_TRANSPORT)
+#define REQ_FAILFAST_DRIVER	(1 << __REQ_FAILFAST_DRIVER)
+#define REQ_SYNC		(1 << __REQ_SYNC)
+#define REQ_META		(1 << __REQ_META)
+#define REQ_PRIO		(1 << __REQ_PRIO)
+#define REQ_DISCARD		(1 << __REQ_DISCARD)
+#define REQ_NOIDLE		(1 << __REQ_NOIDLE)
+
+#define REQ_FAILFAST_MASK \
+	(REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
+#define REQ_COMMON_MASK \
+	(REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \
+	 REQ_DISCARD | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | REQ_SECURE)
+#define REQ_CLONE_MASK		REQ_COMMON_MASK
+
+#define REQ_RAHEAD		(1 << __REQ_RAHEAD)
+#define REQ_THROTTLED		(1 << __REQ_THROTTLED)
+
+#define REQ_SORTED		(1 << __REQ_SORTED)
+#define REQ_SOFTBARRIER		(1 << __REQ_SOFTBARRIER)
+#define REQ_FUA			(1 << __REQ_FUA)
+#define REQ_NOMERGE		(1 << __REQ_NOMERGE)
+#define REQ_STARTED		(1 << __REQ_STARTED)
+#define REQ_DONTPREP		(1 << __REQ_DONTPREP)
+#define REQ_QUEUED		(1 << __REQ_QUEUED)
+#define REQ_ELVPRIV		(1 << __REQ_ELVPRIV)
+#define REQ_FAILED		(1 << __REQ_FAILED)
+#define REQ_QUIET		(1 << __REQ_QUIET)
+#define REQ_PREEMPT		(1 << __REQ_PREEMPT)
+#define REQ_ALLOCED		(1 << __REQ_ALLOCED)
+#define REQ_COPY_USER		(1 << __REQ_COPY_USER)
+#define REQ_FLUSH		(1 << __REQ_FLUSH)
+#define REQ_FLUSH_SEQ		(1 << __REQ_FLUSH_SEQ)
+#define REQ_IO_STAT		(1 << __REQ_IO_STAT)
+#define REQ_MIXED_MERGE		(1 << __REQ_MIXED_MERGE)
+#define REQ_SECURE		(1 << __REQ_SECURE)
+
+#endif /* __LINUX_BLK_TYPES_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/blktrace_api.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/blktrace_api.h
index fd3a17d..9bd20eb 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/blktrace_api.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/blktrace_api.h
@@ -9,7 +9,7 @@
 enum blktrace_cat {
 	BLK_TC_READ	= 1 << 0,	/* reads */
 	BLK_TC_WRITE	= 1 << 1,	/* writes */
-	BLK_TC_BARRIER	= 1 << 2,	/* barrier */
+	BLK_TC_FLUSH	= 1 << 2,	/* flush */
 	BLK_TC_SYNC	= 1 << 3,	/* sync IO */
 	BLK_TC_SYNCIO	= BLK_TC_SYNC,
 	BLK_TC_QUEUE	= 1 << 4,	/* queueing/merging */
@@ -23,8 +23,9 @@
 	BLK_TC_META	= 1 << 12,	/* metadata */
 	BLK_TC_DISCARD	= 1 << 13,	/* discard requests */
 	BLK_TC_DRV_DATA	= 1 << 14,	/* binary per-driver data */
+	BLK_TC_FUA	= 1 << 15,	/* fua requests */
 
-	BLK_TC_END	= 1 << 15,	/* only 16-bits, reminder */
+	BLK_TC_END	= 1 << 15,	/* we've run out of bits! */
 };
 
 #define BLK_TC_SHIFT		(16)
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/caif/caif_socket.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/caif/caif_socket.h
new file mode 100644
index 0000000..3f3bac6
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/caif/caif_socket.h
@@ -0,0 +1,194 @@
+/* linux/caif_socket.h
+ * CAIF Definitions for CAIF socket and network layer
+ * Copyright (C) ST-Ericsson AB 2010
+ * Author:	 Sjur Brendeland/ sjur.brandeland@stericsson.com
+ * License terms: GNU General Public License (GPL) version 2
+ */
+
+#ifndef _LINUX_CAIF_SOCKET_H
+#define _LINUX_CAIF_SOCKET_H
+
+#include <linux/types.h>
+#include <linux/socket.h>
+
+/**
+ * enum caif_link_selector -    Physical Link Selection.
+ * @CAIF_LINK_HIGH_BANDW:	Physical interface for high-bandwidth
+ *				traffic.
+ * @CAIF_LINK_LOW_LATENCY:	Physical interface for low-latency
+ *				traffic.
+ *
+ * CAIF Link Layers can register their link properties.
+ * This enum is used for choosing between CAIF Link Layers when
+ * setting up CAIF Channels when multiple CAIF Link Layers exists.
+ */
+enum caif_link_selector {
+	CAIF_LINK_HIGH_BANDW,
+	CAIF_LINK_LOW_LATENCY
+};
+
+/**
+ * enum caif_channel_priority - CAIF channel priorities.
+ *
+ * @CAIF_PRIO_MIN:	Min priority for a channel.
+ * @CAIF_PRIO_LOW:	Low-priority channel.
+ * @CAIF_PRIO_NORMAL:	Normal/default priority level.
+ * @CAIF_PRIO_HIGH:	High priority level
+ * @CAIF_PRIO_MAX:	Max priority for channel
+ *
+ * Priority can be set on CAIF Channels in order to
+ * prioritize between traffic on different CAIF Channels.
+ * These priority levels are recommended, but the priority value
+ * is not restricted to the values defined in this enum, any value
+ * between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used.
+ */
+enum caif_channel_priority {
+	CAIF_PRIO_MIN	 = 0x01,
+	CAIF_PRIO_LOW	 = 0x04,
+	CAIF_PRIO_NORMAL = 0x0f,
+	CAIF_PRIO_HIGH	 = 0x14,
+	CAIF_PRIO_MAX	 = 0x1F
+};
+
+/**
+ * enum caif_protocol_type  -	CAIF Channel type.
+ * @CAIFPROTO_AT:		Classic AT channel.
+ * @CAIFPROTO_DATAGRAM:	Datagram channel.
+ * @CAIFPROTO_DATAGRAM_LOOP:	Datagram loopback channel, used for testing.
+ * @CAIFPROTO_UTIL:		Utility (Psock) channel.
+ * @CAIFPROTO_RFM:		Remote File Manager
+ * @CAIFPROTO_DEBUG:		Debug link
+ *
+ * This enum defines the CAIF Channel type to be used. This defines
+ * the service to connect to on the modem.
+ */
+enum caif_protocol_type {
+	CAIFPROTO_AT,
+	CAIFPROTO_DATAGRAM,
+	CAIFPROTO_DATAGRAM_LOOP,
+	CAIFPROTO_UTIL,
+	CAIFPROTO_RFM,
+	CAIFPROTO_DEBUG,
+	_CAIFPROTO_MAX
+};
+#define	CAIFPROTO_MAX _CAIFPROTO_MAX
+
+/**
+ * enum caif_at_type - AT Service Endpoint
+ * @CAIF_ATTYPE_PLAIN:	     Connects to a plain vanilla AT channel.
+ */
+enum caif_at_type {
+	CAIF_ATTYPE_PLAIN = 2
+};
+ /**
+ * enum caif_debug_type - Content selection for debug connection
+ * @CAIF_DEBUG_TRACE_INTERACTIVE: Connection will contain
+ *				both trace and interactive debug.
+ * @CAIF_DEBUG_TRACE:		Connection contains trace only.
+ * @CAIF_DEBUG_INTERACTIVE:	Connection to interactive debug.
+ */
+enum caif_debug_type {
+	CAIF_DEBUG_TRACE_INTERACTIVE = 0,
+	CAIF_DEBUG_TRACE,
+	CAIF_DEBUG_INTERACTIVE,
+};
+
+/**
+ * enum caif_debug_service - Debug Service Endpoint
+ * @CAIF_RADIO_DEBUG_SERVICE:	Debug service on the Radio sub-system
+ * @CAIF_APP_DEBUG_SERVICE:	Debug for the applications sub-system
+ */
+enum caif_debug_service {
+	CAIF_RADIO_DEBUG_SERVICE = 1,
+	CAIF_APP_DEBUG_SERVICE
+};
+
+/**
+ * struct sockaddr_caif - the sockaddr structure for CAIF sockets.
+ * @family:		     Address family number, must be AF_CAIF.
+ * @u:			     Union of address data 'switched' by family.
+ * :
+ * @u.at:                    Applies when family = CAIFPROTO_AT.
+ *
+ * @u.at.type:               Type of AT link to set up (enum caif_at_type).
+ *
+ * @u.util:                  Applies when family = CAIFPROTO_UTIL
+ *
+ * @u.util.service:          Utility service name.
+ *
+ * @u.dgm:                   Applies when family = CAIFPROTO_DATAGRAM
+ *
+ * @u.dgm.connection_id:     Datagram connection id.
+ *
+ * @u.dgm.nsapi:             NSAPI of the PDP-Context.
+ *
+ * @u.rfm:                   Applies when family = CAIFPROTO_RFM
+ *
+ * @u.rfm.connection_id:     Connection ID for RFM.
+ *
+ * @u.rfm.volume:            Volume to mount.
+ *
+ * @u.dbg:		      Applies when family = CAIFPROTO_DEBUG.
+ *
+ * @u.dbg.type:			     Type of debug connection to set up
+ *			      (caif_debug_type).
+ *
+ * @u.dbg.service:	      Service sub-system to connect (caif_debug_service
+ * Description:
+ * This structure holds the connect parameters used for setting up a
+ * CAIF Channel. It defines the service to connect to on the modem.
+ */
+struct sockaddr_caif {
+	__kernel_sa_family_t  family;
+	union {
+		struct {
+			__u8  type;		/* type: enum caif_at_type */
+		} at;				/* CAIFPROTO_AT */
+		struct {
+			char	  service[16];
+		} util;				/* CAIFPROTO_UTIL */
+		union {
+			__u32 connection_id;
+			__u8  nsapi;
+		} dgm;				/* CAIFPROTO_DATAGRAM(_LOOP)*/
+		struct {
+			__u32 connection_id;
+			char	  volume[16];
+		} rfm;				/* CAIFPROTO_RFM */
+		struct {
+			__u8  type;		/* type:enum caif_debug_type */
+			__u8  service;		/* service:caif_debug_service */
+		} dbg;				/* CAIFPROTO_DEBUG */
+	} u;
+};
+
+/**
+ * enum caif_socket_opts - CAIF option values for getsockopt and setsockopt.
+ *
+ * @CAIFSO_LINK_SELECT:		Selector used if multiple CAIF Link layers are
+ *				available. Either a high bandwidth
+ *				link can be selected (CAIF_LINK_HIGH_BANDW) or
+ *				or a low latency link (CAIF_LINK_LOW_LATENCY).
+ *                              This option is of type __u32.
+ *				Alternatively SO_BINDTODEVICE can be used.
+ *
+ * @CAIFSO_REQ_PARAM:		Used to set the request parameters for a
+ *				utility channel. (maximum 256 bytes). This
+ *				option must be set before connecting.
+ *
+ * @CAIFSO_RSP_PARAM:		Gets the response parameters for a utility
+ *				channel. (maximum 256 bytes). This option
+ *				is valid after a successful connect.
+ *
+ *
+ * This enum defines the CAIF Socket options to be used on a socket
+ * of type PF_CAIF.
+ *
+ */
+enum caif_socket_opts {
+	CAIFSO_LINK_SELECT	= 127,
+	CAIFSO_REQ_PARAM	= 128,
+	CAIFSO_RSP_PARAM	= 129,
+};
+
+#endif /* _LINUX_CAIF_SOCKET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/caif/if_caif.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/caif/if_caif.h
new file mode 100644
index 0000000..5e7eed4
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/caif/if_caif.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) ST-Ericsson AB 2010
+ * Author:	Sjur Brendeland/ sjur.brandeland@stericsson.com
+ * License terms: GNU General Public License (GPL) version 2
+ */
+
+#ifndef IF_CAIF_H_
+#define IF_CAIF_H_
+#include <linux/sockios.h>
+#include <linux/types.h>
+#include <linux/socket.h>
+
+/**
+ * enum ifla_caif - CAIF NetlinkRT parameters.
+ * @IFLA_CAIF_IPV4_CONNID:  Connection ID for IPv4 PDP Context.
+ *			    The type of attribute is NLA_U32.
+ * @IFLA_CAIF_IPV6_CONNID:  Connection ID for IPv6 PDP Context.
+ *			    The type of attribute is NLA_U32.
+ * @IFLA_CAIF_LOOPBACK:	    If different from zero, device is doing loopback
+ *			    The type of attribute is NLA_U8.
+ *
+ * When using RT Netlink to create, destroy or configure a CAIF IP interface,
+ * enum ifla_caif is used to specify the configuration attributes.
+ */
+enum ifla_caif {
+	__IFLA_CAIF_UNSPEC,
+	IFLA_CAIF_IPV4_CONNID,
+	IFLA_CAIF_IPV6_CONNID,
+	IFLA_CAIF_LOOPBACK,
+	__IFLA_CAIF_MAX
+};
+#define	IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1)
+
+#endif /*IF_CAIF_H_*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/can.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can.h
index d183333..9a19bcb 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/can.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can.h
@@ -8,8 +8,6 @@
  * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
  * All rights reserved.
  *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
  */
 
 #ifndef CAN_H
@@ -78,7 +76,7 @@
  * @can_addr:    protocol specific address information
  */
 struct sockaddr_can {
-	sa_family_t can_family;
+	__kernel_sa_family_t can_family;
 	int         can_ifindex;
 	union {
 		/* transport protocol class address information (e.g. ISOTP) */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/bcm.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/bcm.h
index 1432b27..3ebe387 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/bcm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/bcm.h
@@ -7,14 +7,13 @@
  * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
  * All rights reserved.
  *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
  */
 
 #ifndef CAN_BCM_H
 #define CAN_BCM_H
 
 #include <linux/types.h>
+#include <linux/can.h>
 
 /**
  * struct bcm_msg_head - head of messages to/from the broadcast manager
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/error.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/error.h
index d4127fd..63e855e 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/error.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/error.h
@@ -7,8 +7,6 @@
  * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
  * All rights reserved.
  *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
  */
 
 #ifndef CAN_ERROR_H
@@ -51,7 +49,7 @@
 #define CAN_ERR_PROT_BIT1        0x10 /* unable to send recessive bit */
 #define CAN_ERR_PROT_OVERLOAD    0x20 /* bus overload */
 #define CAN_ERR_PROT_ACTIVE      0x40 /* active error announcement */
-#define CAN_ERR_PROT_TX          0x80 /* error occured on transmission */
+#define CAN_ERR_PROT_TX          0x80 /* error occurred on transmission */
 
 /* error in CAN protocol (location) / data[3] */
 #define CAN_ERR_PROT_LOC_UNSPEC  0x00 /* unspecified */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/gw.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/gw.h
new file mode 100644
index 0000000..8e1db18
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/gw.h
@@ -0,0 +1,162 @@
+/*
+ * linux/can/gw.h
+ *
+ * Definitions for CAN frame Gateway/Router/Bridge
+ *
+ * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
+ * Copyright (c) 2011 Volkswagen Group Electronic Research
+ * All rights reserved.
+ *
+ */
+
+#ifndef CAN_GW_H
+#define CAN_GW_H
+
+#include <linux/types.h>
+#include <linux/can.h>
+
+struct rtcanmsg {
+	__u8  can_family;
+	__u8  gwtype;
+	__u16 flags;
+};
+
+/* CAN gateway types */
+enum {
+	CGW_TYPE_UNSPEC,
+	CGW_TYPE_CAN_CAN,	/* CAN->CAN routing */
+	__CGW_TYPE_MAX
+};
+
+#define CGW_TYPE_MAX (__CGW_TYPE_MAX - 1)
+
+/* CAN rtnetlink attribute definitions */
+enum {
+	CGW_UNSPEC,
+	CGW_MOD_AND,	/* CAN frame modification binary AND */
+	CGW_MOD_OR,	/* CAN frame modification binary OR */
+	CGW_MOD_XOR,	/* CAN frame modification binary XOR */
+	CGW_MOD_SET,	/* CAN frame modification set alternate values */
+	CGW_CS_XOR,	/* set data[] XOR checksum into data[index] */
+	CGW_CS_CRC8,	/* set data[] CRC8 checksum into data[index] */
+	CGW_HANDLED,	/* number of handled CAN frames */
+	CGW_DROPPED,	/* number of dropped CAN frames */
+	CGW_SRC_IF,	/* ifindex of source network interface */
+	CGW_DST_IF,	/* ifindex of destination network interface */
+	CGW_FILTER,	/* specify struct can_filter on source CAN device */
+	__CGW_MAX
+};
+
+#define CGW_MAX (__CGW_MAX - 1)
+
+#define CGW_FLAGS_CAN_ECHO 0x01
+#define CGW_FLAGS_CAN_SRC_TSTAMP 0x02
+
+#define CGW_MOD_FUNCS 4 /* AND OR XOR SET */
+
+/* CAN frame elements that are affected by curr. 3 CAN frame modifications */
+#define CGW_MOD_ID	0x01
+#define CGW_MOD_DLC	0x02
+#define CGW_MOD_DATA	0x04
+
+#define CGW_FRAME_MODS 3 /* ID DLC DATA */
+
+#define MAX_MODFUNCTIONS (CGW_MOD_FUNCS * CGW_FRAME_MODS)
+
+struct cgw_frame_mod {
+	struct can_frame cf;
+	__u8 modtype;
+} __attribute__((packed));
+
+#define CGW_MODATTR_LEN sizeof(struct cgw_frame_mod)
+
+struct cgw_csum_xor {
+	__s8 from_idx;
+	__s8 to_idx;
+	__s8 result_idx;
+	__u8 init_xor_val;
+} __attribute__((packed));
+
+struct cgw_csum_crc8 {
+	__s8 from_idx;
+	__s8 to_idx;
+	__s8 result_idx;
+	__u8 init_crc_val;
+	__u8 final_xor_val;
+	__u8 crctab[256];
+	__u8 profile;
+	__u8 profile_data[20];
+} __attribute__((packed));
+
+/* length of checksum operation parameters. idx = index in CAN frame data[] */
+#define CGW_CS_XOR_LEN  sizeof(struct cgw_csum_xor)
+#define CGW_CS_CRC8_LEN  sizeof(struct cgw_csum_crc8)
+
+/* CRC8 profiles (compute CRC for additional data elements - see below) */
+enum {
+	CGW_CRC8PRF_UNSPEC,
+	CGW_CRC8PRF_1U8,	/* compute one additional u8 value */
+	CGW_CRC8PRF_16U8,	/* u8 value table indexed by data[1] & 0xF */
+	CGW_CRC8PRF_SFFID_XOR,	/* (can_id & 0xFF) ^ (can_id >> 8 & 0xFF) */
+	__CGW_CRC8PRF_MAX
+};
+
+#define CGW_CRC8PRF_MAX (__CGW_CRC8PRF_MAX - 1)
+
+/*
+ * CAN rtnetlink attribute contents in detail
+ *
+ * CGW_XXX_IF (length 4 bytes):
+ * Sets an interface index for source/destination network interfaces.
+ * For the CAN->CAN gwtype the indices of _two_ CAN interfaces are mandatory.
+ *
+ * CGW_FILTER (length 8 bytes):
+ * Sets a CAN receive filter for the gateway job specified by the
+ * struct can_filter described in include/linux/can.h
+ *
+ * CGW_MOD_XXX (length 17 bytes):
+ * Specifies a modification that's done to a received CAN frame before it is
+ * send out to the destination interface.
+ *
+ * <struct can_frame> data used as operator
+ * <u8> affected CAN frame elements
+ *
+ * CGW_CS_XOR (length 4 bytes):
+ * Set a simple XOR checksum starting with an initial value into
+ * data[result-idx] using data[start-idx] .. data[end-idx]
+ *
+ * The XOR checksum is calculated like this:
+ *
+ * xor = init_xor_val
+ *
+ * for (i = from_idx .. to_idx)
+ *      xor ^= can_frame.data[i]
+ *
+ * can_frame.data[ result_idx ] = xor
+ *
+ * CGW_CS_CRC8 (length 282 bytes):
+ * Set a CRC8 value into data[result-idx] using a given 256 byte CRC8 table,
+ * a given initial value and a defined input data[start-idx] .. data[end-idx].
+ * Finally the result value is XOR'ed with the final_xor_val.
+ *
+ * The CRC8 checksum is calculated like this:
+ *
+ * crc = init_crc_val
+ *
+ * for (i = from_idx .. to_idx)
+ *      crc = crctab[ crc ^ can_frame.data[i] ]
+ *
+ * can_frame.data[ result_idx ] = crc ^ final_xor_val
+ *
+ * The calculated CRC may contain additional source data elements that can be
+ * defined in the handling of 'checksum profiles' e.g. shown in AUTOSAR specs
+ * like http://www.autosar.org/download/R4.0/AUTOSAR_SWS_E2ELibrary.pdf
+ * E.g. the profile_data[] may contain additional u8 values (called DATA_IDs)
+ * that are used depending on counter values inside the CAN frame data[].
+ * So far only three profiles have been implemented for illustration.
+ *
+ * Remark: In general the attribute data is a linear buffer.
+ *         Beware of sending unpacked or aligned structs!
+ */
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/netlink.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/netlink.h
index 9ecbb78..14966dd 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/netlink.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/netlink.h
@@ -5,8 +5,6 @@
  *
  * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com>
  *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
  */
 
 #ifndef CAN_NETLINK_H
@@ -17,7 +15,7 @@
 /*
  * CAN bit-timing parameters
  *
- * For futher information, please read chapter "8 BIT TIMING
+ * For further information, please read chapter "8 BIT TIMING
  * REQUIREMENTS" of the "Bosch CAN Specification version 2.0"
  * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf.
  */
@@ -70,6 +68,14 @@
 };
 
 /*
+ * CAN bus error counters
+ */
+struct can_berr_counter {
+	__u16 txerr;
+	__u16 rxerr;
+};
+
+/*
  * CAN controller mode
  */
 struct can_ctrlmode {
@@ -77,9 +83,11 @@
 	__u32 flags;
 };
 
-#define CAN_CTRLMODE_LOOPBACK	0x1	/* Loopback mode */
-#define CAN_CTRLMODE_LISTENONLY	0x2 	/* Listen-only mode */
-#define CAN_CTRLMODE_3_SAMPLES	0x4	/* Triple sampling mode */
+#define CAN_CTRLMODE_LOOPBACK		0x01	/* Loopback mode */
+#define CAN_CTRLMODE_LISTENONLY		0x02 	/* Listen-only mode */
+#define CAN_CTRLMODE_3_SAMPLES		0x04	/* Triple sampling mode */
+#define CAN_CTRLMODE_ONE_SHOT		0x08	/* One-Shot mode */
+#define CAN_CTRLMODE_BERR_REPORTING	0x10	/* Bus-error reporting */
 
 /*
  * CAN device statistics
@@ -105,6 +113,7 @@
 	IFLA_CAN_CTRLMODE,
 	IFLA_CAN_RESTART_MS,
 	IFLA_CAN_RESTART,
+	IFLA_CAN_BERR_COUNTER,
 	__IFLA_CAN_MAX
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/raw.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/raw.h
index b2a0f87..781f3a3 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/raw.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/can/raw.h
@@ -8,8 +8,6 @@
  * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
  * All rights reserved.
  *
- * Send feedback to <socketcan-users@lists.berlios.de>
- *
  */
 
 #ifndef CAN_RAW_H
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/capability.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/capability.h
index 10761b4..2d2ff39 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/capability.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/capability.h
@@ -7,7 +7,7 @@
  *
  * See here for the libcap library ("POSIX draft" compliance):
  *
- * ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
+ * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
  */
 
 #ifndef _LINUX_CAPABILITY_H
@@ -49,9 +49,6 @@
 } *cap_user_data_t;
 
 
-#define XATTR_CAPS_SUFFIX "capability"
-#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
-
 #define VFS_CAP_REVISION_MASK	0xFF000000
 #define VFS_CAP_REVISION_SHIFT	24
 #define VFS_CAP_FLAGS_MASK	~VFS_CAP_REVISION_MASK
@@ -178,7 +175,7 @@
 /* Allow modification of routing tables */
 /* Allow setting arbitrary process / process group ownership on
    sockets */
-/* Allow binding to any address for transparent proxying */
+/* Allow binding to any address for transparent proxying (also via NET_RAW) */
 /* Allow setting TOS (type of service) */
 /* Allow setting promiscuous mode */
 /* Allow clearing driver statistics */
@@ -190,6 +187,7 @@
 
 /* Allow use of RAW sockets */
 /* Allow use of PACKET sockets */
+/* Allow binding to any address for transparent proxying (also via NET_ADMIN) */
 
 #define CAP_NET_RAW          13
 
@@ -226,7 +224,6 @@
 /* Allow configuration of the secure attention key */
 /* Allow administration of the random device */
 /* Allow examination and configuration of disk quotas */
-/* Allow configuring the kernel's syslog (printk behaviour) */
 /* Allow setting the domainname */
 /* Allow setting the hostname */
 /* Allow calling bdflush() */
@@ -332,7 +329,16 @@
 
 #define CAP_MAC_ADMIN        33
 
-#define CAP_LAST_CAP         CAP_MAC_ADMIN
+/* Allow configuring the kernel's syslog (printk behaviour) */
+
+#define CAP_SYSLOG           34
+
+/* Allow triggering something that will wake the system */
+
+#define CAP_WAKE_ALARM            35
+
+
+#define CAP_LAST_CAP         CAP_WAKE_ALARM
 
 #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cciss_defs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cciss_defs.h
new file mode 100644
index 0000000..316b670
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cciss_defs.h
@@ -0,0 +1,130 @@
+#ifndef CCISS_DEFS_H
+#define CCISS_DEFS_H
+
+#include <linux/types.h>
+
+/* general boundary definitions */
+#define SENSEINFOBYTES          32 /* note that this value may vary
+				      between host implementations */
+
+/* Command Status value */
+#define CMD_SUCCESS             0x0000
+#define CMD_TARGET_STATUS       0x0001
+#define CMD_DATA_UNDERRUN       0x0002
+#define CMD_DATA_OVERRUN        0x0003
+#define CMD_INVALID             0x0004
+#define CMD_PROTOCOL_ERR        0x0005
+#define CMD_HARDWARE_ERR        0x0006
+#define CMD_CONNECTION_LOST     0x0007
+#define CMD_ABORTED             0x0008
+#define CMD_ABORT_FAILED        0x0009
+#define CMD_UNSOLICITED_ABORT   0x000A
+#define CMD_TIMEOUT             0x000B
+#define CMD_UNABORTABLE		0x000C
+
+/* transfer direction */
+#define XFER_NONE               0x00
+#define XFER_WRITE              0x01
+#define XFER_READ               0x02
+#define XFER_RSVD               0x03
+
+/* task attribute */
+#define ATTR_UNTAGGED           0x00
+#define ATTR_SIMPLE             0x04
+#define ATTR_HEADOFQUEUE        0x05
+#define ATTR_ORDERED            0x06
+#define ATTR_ACA                0x07
+
+/* cdb type */
+#define TYPE_CMD				0x00
+#define TYPE_MSG				0x01
+
+/* Type defs used in the following structs */
+#define BYTE __u8
+#define WORD __u16
+#define HWORD __u16
+#define DWORD __u32
+
+#define CISS_MAX_LUN	1024
+
+#define LEVEL2LUN   1 /* index into Target(x) structure, due to byte swapping */
+#define LEVEL3LUN   0
+
+#pragma pack(1)
+
+/* Command List Structure */
+typedef union _SCSI3Addr_struct {
+   struct {
+    BYTE Dev;
+    BYTE Bus:6;
+    BYTE Mode:2;        /* b00 */
+  } PeripDev;
+   struct {
+    BYTE DevLSB;
+    BYTE DevMSB:6;
+    BYTE Mode:2;        /* b01 */
+  } LogDev;
+   struct {
+    BYTE Dev:5;
+    BYTE Bus:3;
+    BYTE Targ:6;
+    BYTE Mode:2;        /* b10 */
+  } LogUnit;
+} SCSI3Addr_struct;
+
+typedef struct _PhysDevAddr_struct {
+  DWORD             TargetId:24;
+  DWORD             Bus:6;
+  DWORD             Mode:2;
+  SCSI3Addr_struct  Target[2]; /* 2 level target device addr */
+} PhysDevAddr_struct;
+
+typedef struct _LogDevAddr_struct {
+  DWORD            VolId:30;
+  DWORD            Mode:2;
+  BYTE             reserved[4];
+} LogDevAddr_struct;
+
+typedef union _LUNAddr_struct {
+  BYTE               LunAddrBytes[8];
+  SCSI3Addr_struct   SCSI3Lun[4];
+  PhysDevAddr_struct PhysDev;
+  LogDevAddr_struct  LogDev;
+} LUNAddr_struct;
+
+typedef struct _RequestBlock_struct {
+  BYTE   CDBLen;
+  struct {
+    BYTE Type:3;
+    BYTE Attribute:3;
+    BYTE Direction:2;
+  } Type;
+  HWORD  Timeout;
+  BYTE   CDB[16];
+} RequestBlock_struct;
+
+typedef union _MoreErrInfo_struct{
+  struct {
+    BYTE  Reserved[3];
+    BYTE  Type;
+    DWORD ErrorInfo;
+  } Common_Info;
+  struct{
+    BYTE  Reserved[2];
+    BYTE  offense_size; /* size of offending entry */
+    BYTE  offense_num;  /* byte # of offense 0-base */
+    DWORD offense_value;
+  } Invalid_Cmd;
+} MoreErrInfo_struct;
+typedef struct _ErrorInfo_struct {
+  BYTE               ScsiStatus;
+  BYTE               SenseLen;
+  HWORD              CommandStatus;
+  DWORD              ResidualCnt;
+  MoreErrInfo_struct MoreErrInfo;
+  BYTE               SenseInfo[SENSEINFOBYTES];
+} ErrorInfo_struct;
+
+#pragma pack()
+
+#endif /* CCISS_DEFS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cciss_ioctl.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cciss_ioctl.h
index 7cbbecb..dc5c2b1 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cciss_ioctl.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cciss_ioctl.h
@@ -3,6 +3,7 @@
 
 #include <linux/types.h>
 #include <linux/ioctl.h>
+#include <linux/cciss_defs.h>
 
 #define CCISS_IOC_MAGIC 'B'
 
@@ -36,133 +37,6 @@
 
 #define MAX_KMALLOC_SIZE 128000
 
-#ifndef CCISS_CMD_H
-// This defines are duplicated in cciss_cmd.h in the driver directory 
-
-//general boundary defintions
-#define SENSEINFOBYTES          32//note that this value may vary between host implementations
-
-//Command Status value
-#define CMD_SUCCESS             0x0000
-#define CMD_TARGET_STATUS       0x0001
-#define CMD_DATA_UNDERRUN       0x0002
-#define CMD_DATA_OVERRUN        0x0003
-#define CMD_INVALID             0x0004
-#define CMD_PROTOCOL_ERR        0x0005
-#define CMD_HARDWARE_ERR        0x0006
-#define CMD_CONNECTION_LOST     0x0007
-#define CMD_ABORTED             0x0008
-#define CMD_ABORT_FAILED        0x0009
-#define CMD_UNSOLICITED_ABORT   0x000A
-#define CMD_TIMEOUT             0x000B
-#define CMD_UNABORTABLE		0x000C
-
-//transfer direction
-#define XFER_NONE               0x00
-#define XFER_WRITE              0x01
-#define XFER_READ               0x02
-#define XFER_RSVD               0x03
-
-//task attribute
-#define ATTR_UNTAGGED           0x00
-#define ATTR_SIMPLE             0x04
-#define ATTR_HEADOFQUEUE        0x05
-#define ATTR_ORDERED            0x06
-#define ATTR_ACA                0x07
-
-//cdb type
-#define TYPE_CMD				0x00
-#define TYPE_MSG				0x01
-
-// Type defs used in the following structs
-#define BYTE __u8
-#define WORD __u16
-#define HWORD __u16
-#define DWORD __u32
-
-#define CISS_MAX_LUN	1024
-
-#define LEVEL2LUN   1   // index into Target(x) structure, due to byte swapping
-#define LEVEL3LUN   0
-
-#pragma pack(1)
-
-//Command List Structure
-typedef union _SCSI3Addr_struct {
-   struct {
-    BYTE Dev;
-    BYTE Bus:6;
-    BYTE Mode:2;        // b00
-  } PeripDev;
-   struct {
-    BYTE DevLSB;
-    BYTE DevMSB:6;
-    BYTE Mode:2;        // b01
-  } LogDev;
-   struct {
-    BYTE Dev:5;
-    BYTE Bus:3;
-    BYTE Targ:6;
-    BYTE Mode:2;        // b10
-  } LogUnit;
-} SCSI3Addr_struct;
-
-typedef struct _PhysDevAddr_struct {
-  DWORD             TargetId:24;
-  DWORD             Bus:6;
-  DWORD             Mode:2;
-  SCSI3Addr_struct  Target[2]; //2 level target device addr
-} PhysDevAddr_struct;
-  
-typedef struct _LogDevAddr_struct {
-  DWORD            VolId:30;
-  DWORD            Mode:2;
-  BYTE             reserved[4];
-} LogDevAddr_struct;
-
-typedef union _LUNAddr_struct {
-  BYTE               LunAddrBytes[8];
-  SCSI3Addr_struct   SCSI3Lun[4];
-  PhysDevAddr_struct PhysDev;
-  LogDevAddr_struct  LogDev;
-} LUNAddr_struct;
-
-typedef struct _RequestBlock_struct {
-  BYTE   CDBLen;
-  struct {
-    BYTE Type:3;
-    BYTE Attribute:3;
-    BYTE Direction:2;
-  } Type;
-  HWORD  Timeout;
-  BYTE   CDB[16];
-} RequestBlock_struct;
-
-typedef union _MoreErrInfo_struct{
-  struct {
-    BYTE  Reserved[3];
-    BYTE  Type;
-    DWORD ErrorInfo;
-  }Common_Info;
-  struct{
-    BYTE  Reserved[2];
-    BYTE  offense_size;//size of offending entry
-    BYTE  offense_num; //byte # of offense 0-base
-    DWORD offense_value;
-  }Invalid_Cmd;
-}MoreErrInfo_struct;
-typedef struct _ErrorInfo_struct {
-  BYTE               ScsiStatus;
-  BYTE               SenseLen;
-  HWORD              CommandStatus;
-  DWORD              ResidualCnt;
-  MoreErrInfo_struct MoreErrInfo;
-  BYTE               SenseInfo[SENSEINFOBYTES];
-} ErrorInfo_struct;
-
-#pragma pack()
-#endif /* CCISS_CMD_H */ 
-
 typedef struct _IOCTL_Command_struct {
   LUNAddr_struct	   LUN_info;
   RequestBlock_struct      Request;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cdk.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cdk.h
index 0908daf..80093a8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cdk.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cdk.h
@@ -149,7 +149,7 @@
 /*
  *	Define the memory mapping structure. This structure is pointed to by
  *	the memp field in the stlcdkhdr struct. As many as these structures
- *	as required are layed out in shared memory to define how the rest of
+ *	as required are laid out in shared memory to define how the rest of
  *	shared memory is divided up. There will be one for each port.
  */
 typedef struct cdkmem {
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/chio.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/chio.h
index 6e0af99..e97cd98 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/chio.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/chio.h
@@ -21,7 +21,7 @@
  *    query vendor-specific element types
  *
  *    accessing elements works by specifing type and unit of the element.
- *    for eample, storage elements are addressed with type = CHET_ST and
+ *    for example, storage elements are addressed with type = CHET_ST and
  *    unit = 0 .. cp_nslots-1
  *
  */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cm4000_cs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cm4000_cs.h
index 2292880..4930f06 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cm4000_cs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cm4000_cs.h
@@ -20,7 +20,7 @@
 } atreq_t;
 
 
-/* what is particularly stupid in the original driver is the arch-dependant
+/* what is particularly stupid in the original driver is the arch-dependent
  * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace
  * will lay out the structure members differently than the 64bit kernel.
  *
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cn_proc.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cn_proc.h
index d51c7a6..0323cb9 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cn_proc.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cn_proc.h
@@ -52,6 +52,9 @@
 		PROC_EVENT_EXEC = 0x00000002,
 		PROC_EVENT_UID  = 0x00000004,
 		PROC_EVENT_GID  = 0x00000040,
+		PROC_EVENT_SID  = 0x00000080,
+		PROC_EVENT_PTRACE = 0x00000100,
+		PROC_EVENT_COMM = 0x00000200,
 		/* "next" should be 0x00000400 */
 		/* "last" is the last process event: exit */
 		PROC_EVENT_EXIT = 0x80000000
@@ -89,6 +92,24 @@
 			} e;
 		} id;
 
+		struct sid_proc_event {
+			__kernel_pid_t process_pid;
+			__kernel_pid_t process_tgid;
+		} sid;
+
+		struct ptrace_proc_event {
+			__kernel_pid_t process_pid;
+			__kernel_pid_t process_tgid;
+			__kernel_pid_t tracer_pid;
+			__kernel_pid_t tracer_tgid;
+		} ptrace;
+
+		struct comm_proc_event {
+			__kernel_pid_t process_pid;
+			__kernel_pid_t process_tgid;
+			char           comm[16];
+		} comm;
+
 		struct exit_proc_event {
 			__kernel_pid_t process_pid;
 			__kernel_pid_t process_tgid;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/coda_psdev.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/coda_psdev.h
index 3cccd19..92ac327 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/coda_psdev.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/coda_psdev.h
@@ -19,9 +19,9 @@
 	wait_queue_head_t   uc_sleep;   /* process' wait queue */
 };
 
-#define REQ_ASYNC  0x1
-#define REQ_READ   0x2
-#define REQ_WRITE  0x4
-#define REQ_ABORT  0x8
+#define CODA_REQ_ASYNC  0x1
+#define CODA_REQ_READ   0x2
+#define CODA_REQ_WRITE  0x4
+#define CODA_REQ_ABORT  0x8
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/connector.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/connector.h
index 9a536df..17c8e82 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/connector.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/connector.h
@@ -1,7 +1,7 @@
 /*
  * 	connector.h
  * 
- * 2004-2005 Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
+ * 2004-2005 Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
  * All rights reserved.
  * 
  * This program is free software; you can redistribute it and/or modify
@@ -24,9 +24,6 @@
 
 #include <linux/types.h>
 
-#define CN_IDX_CONNECTOR		0xffffffff
-#define CN_VAL_CONNECTOR		0xffffffff
-
 /*
  * Process Events connector unique ids -- used for message routing
  */
@@ -43,8 +40,11 @@
 #define CN_DST_VAL			0x1
 #define CN_IDX_DM			0x7	/* Device Mapper */
 #define CN_VAL_DM_USERSPACE_LOG		0x1
+#define CN_IDX_DRBD			0x8
+#define CN_VAL_DRBD			0x1
+#define CN_KVP_IDX			0x9	/* HyperV KVP */
 
-#define CN_NETLINK_USERS		8
+#define CN_NETLINK_USERS		10	/* Highest index + 1 */
 
 /*
  * Maximum connector's message size.
@@ -73,28 +73,4 @@
 	__u8 data[0];
 };
 
-/*
- * Notify structure - requests notification about
- * registering/unregistering idx/val in range [first, first+range].
- */
-struct cn_notify_req {
-	__u32 first;
-	__u32 range;
-};
-
-/*
- * Main notification control message
- * *_notify_num 	- number of appropriate cn_notify_req structures after 
- *				this struct.
- * group 		- notification receiver's idx.
- * len 			- total length of the attached data.
- */
-struct cn_ctl_msg {
-	__u32 idx_notify_num;
-	__u32 val_notify_num;
-	__u32 group;
-	__u32 len;
-	__u8 data[0];
-};
-
 #endif				/* __CONNECTOR_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cramfs_fs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cramfs_fs.h
index 6fc2bed..8acaf2d 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cramfs_fs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cramfs_fs.h
@@ -84,9 +84,5 @@
 				| CRAMFS_FLAG_WRONG_SIGNATURE \
 				| CRAMFS_FLAG_SHIFTED_ROOT_OFFSET )
 
-/* Uncompression interfaces to the underlying zlib */
-int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen);
-int cramfs_uncompress_init(void);
-void cramfs_uncompress_exit(void);
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cuda.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cuda.h
index 69c8bf0..83d9f93 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/cuda.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/cuda.h
@@ -5,6 +5,9 @@
  * Copyright (C) 1996 Paul Mackerras.
  */
 
+#ifndef _LINUX_CUDA_H
+#define _LINUX_CUDA_H
+
 /* CUDA commands (2nd byte) */
 #define CUDA_WARM_START		0
 #define CUDA_AUTOPOLL		1
@@ -26,3 +29,5 @@
 #define CUDA_GET_DEVICE_LIST	0x1a
 #define CUDA_GET_SET_IIC	0x22
 
+
+#endif /* _LINUX_CUDA_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dcbnl.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dcbnl.h
index 7d2e100..65a2562 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dcbnl.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dcbnl.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Intel Corporation.
+ * Copyright (c) 2008-2011, Intel Corporation.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -22,7 +22,151 @@
 
 #include <linux/types.h>
 
-#define DCB_PROTO_VERSION 1
+/* IEEE 802.1Qaz std supported values */
+#define IEEE_8021QAZ_MAX_TCS	8
+
+#define IEEE_8021QAZ_TSA_STRICT		0
+#define IEEE_8021QAZ_TSA_CB_SHAPER	1
+#define IEEE_8021QAZ_TSA_ETS		2
+#define IEEE_8021QAZ_TSA_VENDOR		255
+
+/* This structure contains the IEEE 802.1Qaz ETS managed object
+ *
+ * @willing: willing bit in ETS configuration TLV
+ * @ets_cap: indicates supported capacity of ets feature
+ * @cbs: credit based shaper ets algorithm supported
+ * @tc_tx_bw: tc tx bandwidth indexed by traffic class
+ * @tc_rx_bw: tc rx bandwidth indexed by traffic class
+ * @tc_tsa: TSA Assignment table, indexed by traffic class
+ * @prio_tc: priority assignment table mapping 8021Qp to traffic class
+ * @tc_reco_bw: recommended tc bandwidth indexed by traffic class for TLV
+ * @tc_reco_tsa: recommended tc bandwidth indexed by traffic class for TLV
+ * @reco_prio_tc: recommended tc tx bandwidth indexed by traffic class for TLV
+ *
+ * Recommended values are used to set fields in the ETS recommendation TLV
+ * with hardware offloaded LLDP.
+ *
+ * ----
+ *  TSA Assignment 8 bit identifiers
+ *	0	strict priority
+ *	1	credit-based shaper
+ *	2	enhanced transmission selection
+ *	3-254	reserved
+ *	255	vendor specific
+ */
+struct ieee_ets {
+	__u8	willing;
+	__u8	ets_cap;
+	__u8	cbs;
+	__u8	tc_tx_bw[IEEE_8021QAZ_MAX_TCS];
+	__u8	tc_rx_bw[IEEE_8021QAZ_MAX_TCS];
+	__u8	tc_tsa[IEEE_8021QAZ_MAX_TCS];
+	__u8	prio_tc[IEEE_8021QAZ_MAX_TCS];
+	__u8	tc_reco_bw[IEEE_8021QAZ_MAX_TCS];
+	__u8	tc_reco_tsa[IEEE_8021QAZ_MAX_TCS];
+	__u8	reco_prio_tc[IEEE_8021QAZ_MAX_TCS];
+};
+
+/* This structure contains the IEEE 802.1Qaz PFC managed object
+ *
+ * @pfc_cap: Indicates the number of traffic classes on the local device
+ *	     that may simultaneously have PFC enabled.
+ * @pfc_en: bitmap indicating pfc enabled traffic classes
+ * @mbc: enable macsec bypass capability
+ * @delay: the allowance made for a round-trip propagation delay of the
+ *	   link in bits.
+ * @requests: count of the sent pfc frames
+ * @indications: count of the received pfc frames
+ */
+struct ieee_pfc {
+	__u8	pfc_cap;
+	__u8	pfc_en;
+	__u8	mbc;
+	__u16	delay;
+	__u64	requests[IEEE_8021QAZ_MAX_TCS];
+	__u64	indications[IEEE_8021QAZ_MAX_TCS];
+};
+
+/* CEE DCBX std supported values */
+#define CEE_DCBX_MAX_PGS	8
+#define CEE_DCBX_MAX_PRIO	8
+
+/**
+ * struct cee_pg - CEE Priority-Group managed object
+ *
+ * @willing: willing bit in the PG tlv
+ * @error: error bit in the PG tlv
+ * @pg_en: enable bit of the PG feature
+ * @tcs_supported: number of traffic classes supported
+ * @pg_bw: bandwidth percentage for each priority group
+ * @prio_pg: priority to PG mapping indexed by priority
+ */
+struct cee_pg {
+	__u8    willing;
+	__u8    error;
+	__u8    pg_en;
+	__u8    tcs_supported;
+	__u8    pg_bw[CEE_DCBX_MAX_PGS];
+	__u8    prio_pg[CEE_DCBX_MAX_PGS];
+};
+
+/**
+ * struct cee_pfc - CEE PFC managed object
+ *
+ * @willing: willing bit in the PFC tlv
+ * @error: error bit in the PFC tlv
+ * @pfc_en: bitmap indicating pfc enabled traffic classes
+ * @tcs_supported: number of traffic classes supported
+ */
+struct cee_pfc {
+	__u8    willing;
+	__u8    error;
+	__u8    pfc_en;
+	__u8    tcs_supported;
+};
+
+/* IEEE 802.1Qaz std supported values */
+#define IEEE_8021QAZ_APP_SEL_ETHERTYPE	1
+#define IEEE_8021QAZ_APP_SEL_STREAM	2
+#define IEEE_8021QAZ_APP_SEL_DGRAM	3
+#define IEEE_8021QAZ_APP_SEL_ANY	4
+
+/* This structure contains the IEEE 802.1Qaz APP managed object. This
+ * object is also used for the CEE std as well. There is no difference
+ * between the objects.
+ *
+ * @selector: protocol identifier type
+ * @protocol: protocol of type indicated
+ * @priority: 3-bit unsigned integer indicating priority
+ *
+ * ----
+ *  Selector field values
+ *	0	Reserved
+ *	1	Ethertype
+ *	2	Well known port number over TCP or SCTP
+ *	3	Well known port number over UDP or DCCP
+ *	4	Well known port number over TCP, SCTP, UDP, or DCCP
+ *	5-7	Reserved
+ */
+struct dcb_app {
+	__u8	selector;
+	__u8	priority;
+	__u16	protocol;
+};
+
+/**
+ * struct dcb_peer_app_info - APP feature information sent by the peer
+ *
+ * @willing: willing bit in the peer APP tlv
+ * @error: error bit in the peer APP tlv
+ *
+ * In addition to this information the full peer APP tlv also contains
+ * a table of 'app_count' APP objects defined above.
+ */
+struct dcb_peer_app_info {
+	__u8	willing;
+	__u8	error;
+};
 
 struct dcbmsg {
 	__u8               dcb_family;
@@ -50,6 +194,16 @@
  * @DCB_CMD_SNUMTCS: set the number of traffic classes
  * @DCB_CMD_GBCN: set backward congestion notification configuration
  * @DCB_CMD_SBCN: get backward congestion notification configration.
+ * @DCB_CMD_GAPP: get application protocol configuration
+ * @DCB_CMD_SAPP: set application protocol configuration
+ * @DCB_CMD_IEEE_SET: set IEEE 802.1Qaz configuration
+ * @DCB_CMD_IEEE_GET: get IEEE 802.1Qaz configuration
+ * @DCB_CMD_GDCBX: get DCBX engine configuration
+ * @DCB_CMD_SDCBX: set DCBX engine configuration
+ * @DCB_CMD_GFEATCFG: get DCBX features flags
+ * @DCB_CMD_SFEATCFG: set DCBX features negotiation flags
+ * @DCB_CMD_CEE_GET: get CEE aggregated configuration
+ * @DCB_CMD_IEEE_DEL: delete IEEE 802.1Qaz configuration
  */
 enum dcbnl_commands {
 	DCB_CMD_UNDEFINED,
@@ -80,6 +234,21 @@
 	DCB_CMD_BCN_GCFG,
 	DCB_CMD_BCN_SCFG,
 
+	DCB_CMD_GAPP,
+	DCB_CMD_SAPP,
+
+	DCB_CMD_IEEE_SET,
+	DCB_CMD_IEEE_GET,
+
+	DCB_CMD_GDCBX,
+	DCB_CMD_SDCBX,
+
+	DCB_CMD_GFEATCFG,
+	DCB_CMD_SFEATCFG,
+
+	DCB_CMD_CEE_GET,
+	DCB_CMD_IEEE_DEL,
+
 	__DCB_CMD_ENUM_MAX,
 	DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
 };
@@ -99,6 +268,10 @@
  * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED)
  * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED)
  * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED)
+ * @DCB_ATTR_IEEE: IEEE 802.1Qaz supported attributes (NLA_NESTED)
+ * @DCB_ATTR_DCBX: DCBX engine configuration in the device (NLA_U8)
+ * @DCB_ATTR_FEATCFG: DCBX features flags (NLA_NESTED)
+ * @DCB_ATTR_CEE: CEE std supported attributes (NLA_NESTED)
  */
 enum dcbnl_attrs {
 	DCB_ATTR_UNDEFINED,
@@ -114,12 +287,96 @@
 	DCB_ATTR_CAP,
 	DCB_ATTR_NUMTCS,
 	DCB_ATTR_BCN,
+	DCB_ATTR_APP,
+
+	/* IEEE std attributes */
+	DCB_ATTR_IEEE,
+
+	DCB_ATTR_DCBX,
+	DCB_ATTR_FEATCFG,
+
+	/* CEE nested attributes */
+	DCB_ATTR_CEE,
 
 	__DCB_ATTR_ENUM_MAX,
 	DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
 };
 
 /**
+ * enum ieee_attrs - IEEE 802.1Qaz get/set attributes
+ *
+ * @DCB_ATTR_IEEE_UNSPEC: unspecified
+ * @DCB_ATTR_IEEE_ETS: negotiated ETS configuration
+ * @DCB_ATTR_IEEE_PFC: negotiated PFC configuration
+ * @DCB_ATTR_IEEE_APP_TABLE: negotiated APP configuration
+ * @DCB_ATTR_IEEE_PEER_ETS: peer ETS configuration - get only
+ * @DCB_ATTR_IEEE_PEER_PFC: peer PFC configuration - get only
+ * @DCB_ATTR_IEEE_PEER_APP: peer APP tlv - get only
+ */
+enum ieee_attrs {
+	DCB_ATTR_IEEE_UNSPEC,
+	DCB_ATTR_IEEE_ETS,
+	DCB_ATTR_IEEE_PFC,
+	DCB_ATTR_IEEE_APP_TABLE,
+	DCB_ATTR_IEEE_PEER_ETS,
+	DCB_ATTR_IEEE_PEER_PFC,
+	DCB_ATTR_IEEE_PEER_APP,
+	__DCB_ATTR_IEEE_MAX
+};
+#define DCB_ATTR_IEEE_MAX (__DCB_ATTR_IEEE_MAX - 1)
+
+enum ieee_attrs_app {
+	DCB_ATTR_IEEE_APP_UNSPEC,
+	DCB_ATTR_IEEE_APP,
+	__DCB_ATTR_IEEE_APP_MAX
+};
+#define DCB_ATTR_IEEE_APP_MAX (__DCB_ATTR_IEEE_APP_MAX - 1)
+
+/**
+ * enum cee_attrs - CEE DCBX get attributes.
+ *
+ * @DCB_ATTR_CEE_UNSPEC: unspecified
+ * @DCB_ATTR_CEE_PEER_PG: peer PG configuration - get only
+ * @DCB_ATTR_CEE_PEER_PFC: peer PFC configuration - get only
+ * @DCB_ATTR_CEE_PEER_APP_TABLE: peer APP tlv - get only
+ * @DCB_ATTR_CEE_TX_PG: TX PG configuration (DCB_CMD_PGTX_GCFG)
+ * @DCB_ATTR_CEE_RX_PG: RX PG configuration (DCB_CMD_PGRX_GCFG)
+ * @DCB_ATTR_CEE_PFC: PFC configuration (DCB_CMD_PFC_GCFG)
+ * @DCB_ATTR_CEE_APP_TABLE: APP configuration (multi DCB_CMD_GAPP)
+ * @DCB_ATTR_CEE_FEAT: DCBX features flags (DCB_CMD_GFEATCFG)
+ *
+ * An aggregated collection of the cee std negotiated parameters.
+ */
+enum cee_attrs {
+	DCB_ATTR_CEE_UNSPEC,
+	DCB_ATTR_CEE_PEER_PG,
+	DCB_ATTR_CEE_PEER_PFC,
+	DCB_ATTR_CEE_PEER_APP_TABLE,
+	DCB_ATTR_CEE_TX_PG,
+	DCB_ATTR_CEE_RX_PG,
+	DCB_ATTR_CEE_PFC,
+	DCB_ATTR_CEE_APP_TABLE,
+	DCB_ATTR_CEE_FEAT,
+	__DCB_ATTR_CEE_MAX
+};
+#define DCB_ATTR_CEE_MAX (__DCB_ATTR_CEE_MAX - 1)
+
+enum peer_app_attr {
+	DCB_ATTR_CEE_PEER_APP_UNSPEC,
+	DCB_ATTR_CEE_PEER_APP_INFO,
+	DCB_ATTR_CEE_PEER_APP,
+	__DCB_ATTR_CEE_PEER_APP_MAX
+};
+#define DCB_ATTR_CEE_PEER_APP_MAX (__DCB_ATTR_CEE_PEER_APP_MAX - 1)
+
+enum cee_attrs_app {
+	DCB_ATTR_CEE_APP_UNSPEC,
+	DCB_ATTR_CEE_APP,
+	__DCB_ATTR_CEE_APP_MAX
+};
+#define DCB_ATTR_CEE_APP_MAX (__DCB_ATTR_CEE_APP_MAX - 1)
+
+/**
  * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
  *
  * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
@@ -258,6 +515,8 @@
  * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority
  * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion
  *                             Notification
+ * @DCB_CAP_ATTR_DCBX: (NLA_U8) device supports DCBX engine
+ *
  */
 enum dcbnl_cap_attrs {
 	DCB_CAP_ATTR_UNDEFINED,
@@ -269,12 +528,45 @@
 	DCB_CAP_ATTR_PFC_TCS,
 	DCB_CAP_ATTR_GSP,
 	DCB_CAP_ATTR_BCN,
+	DCB_CAP_ATTR_DCBX,
 
 	__DCB_CAP_ATTR_ENUM_MAX,
 	DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1,
 };
 
 /**
+ * DCBX capability flags
+ *
+ * @DCB_CAP_DCBX_HOST: DCBX negotiation is performed by the host LLDP agent.
+ *                     'set' routines are used to configure the device with
+ *                     the negotiated parameters
+ *
+ * @DCB_CAP_DCBX_LLD_MANAGED: DCBX negotiation is not performed in the host but
+ *                            by another entity
+ *                            'get' routines are used to retrieve the
+ *                            negotiated parameters
+ *                            'set' routines can be used to set the initial
+ *                            negotiation configuration
+ *
+ * @DCB_CAP_DCBX_VER_CEE: for a non-host DCBX engine, indicates the engine
+ *                        supports the CEE protocol flavor
+ *
+ * @DCB_CAP_DCBX_VER_IEEE: for a non-host DCBX engine, indicates the engine
+ *                         supports the IEEE protocol flavor
+ *
+ * @DCB_CAP_DCBX_STATIC: for a non-host DCBX engine, indicates the engine
+ *                       supports static configuration (i.e no actual
+ *                       negotiation is performed negotiated parameters equal
+ *                       the initial configuration)
+ *
+ */
+#define DCB_CAP_DCBX_HOST		0x01
+#define DCB_CAP_DCBX_LLD_MANAGED	0x02
+#define DCB_CAP_DCBX_VER_CEE		0x04
+#define DCB_CAP_DCBX_VER_IEEE		0x08
+#define DCB_CAP_DCBX_STATIC		0x10
+
+/**
  * enum dcbnl_numtcs_attrs - number of traffic classes
  *
  * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors
@@ -338,5 +630,43 @@
 	DCB_ATTR_VALUE_UNDEFINED = 0xff
 };
 
+#define DCB_APP_IDTYPE_ETHTYPE	0x00
+#define DCB_APP_IDTYPE_PORTNUM	0x01
+enum dcbnl_app_attrs {
+	DCB_APP_ATTR_UNDEFINED,
+
+	DCB_APP_ATTR_IDTYPE,
+	DCB_APP_ATTR_ID,
+	DCB_APP_ATTR_PRIORITY,
+
+	__DCB_APP_ATTR_ENUM_MAX,
+	DCB_APP_ATTR_MAX = __DCB_APP_ATTR_ENUM_MAX - 1,
+};
+
+/**
+ * enum dcbnl_featcfg_attrs - features conifiguration flags
+ *
+ * @DCB_FEATCFG_ATTR_UNDEFINED: unspecified attribute to catch errors
+ * @DCB_FEATCFG_ATTR_ALL: (NLA_FLAG) all features configuration attributes
+ * @DCB_FEATCFG_ATTR_PG: (NLA_U8) configuration flags for priority groups
+ * @DCB_FEATCFG_ATTR_PFC: (NLA_U8) configuration flags for priority
+ *                                 flow control
+ * @DCB_FEATCFG_ATTR_APP: (NLA_U8) configuration flags for application TLV
+ *
+ */
+#define DCB_FEATCFG_ERROR	0x01	/* error in feature resolution */
+#define DCB_FEATCFG_ENABLE	0x02	/* enable feature */
+#define DCB_FEATCFG_WILLING	0x04	/* feature is willing */
+#define DCB_FEATCFG_ADVERTISE	0x08	/* advertise feature */
+enum dcbnl_featcfg_attrs {
+	DCB_FEATCFG_ATTR_UNDEFINED,
+	DCB_FEATCFG_ATTR_ALL,
+	DCB_FEATCFG_ATTR_PG,
+	DCB_FEATCFG_ATTR_PFC,
+	DCB_FEATCFG_ATTR_APP,
+
+	__DCB_FEATCFG_ATTR_ENUM_MAX,
+	DCB_FEATCFG_ATTR_MAX = __DCB_FEATCFG_ATTR_ENUM_MAX - 1,
+};
 
 #endif /* __LINUX_DCBNL_H__ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dccp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dccp.h
index bdd6d4a..d0e2226 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dccp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dccp.h
@@ -165,8 +165,10 @@
 	DCCPO_TIMESTAMP_ECHO = 42,
 	DCCPO_ELAPSED_TIME = 43,
 	DCCPO_MAX = 45,
-	DCCPO_MIN_CCID_SPECIFIC = 128,
-	DCCPO_MAX_CCID_SPECIFIC = 255,
+	DCCPO_MIN_RX_CCID_SPECIFIC = 128,	/* from sender to receiver */
+	DCCPO_MAX_RX_CCID_SPECIFIC = 191,
+	DCCPO_MIN_TX_CCID_SPECIFIC = 192,	/* from receiver to sender */
+	DCCPO_MAX_TX_CCID_SPECIFIC = 255,
 };
 /* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */
 #define DCCP_SINGLE_OPT_MAXLEN	253
@@ -195,6 +197,21 @@
 	DCCPF_MAX_CCID_SPECIFIC = 255,
 };
 
+/* DCCP socket control message types for cmsg */
+enum dccp_cmsg_type {
+	DCCP_SCM_PRIORITY = 1,
+	DCCP_SCM_QPOLICY_MAX = 0xFFFF,
+	/* ^-- Up to here reserved exclusively for qpolicy parameters */
+	DCCP_SCM_MAX
+};
+
+/* DCCP priorities for outgoing/queued packets */
+enum dccp_packet_dequeueing_policy {
+	DCCPQ_POLICY_SIMPLE,
+	DCCPQ_POLICY_PRIO,
+	DCCPQ_POLICY_MAX
+};
+
 /* DCCP socket options */
 #define DCCP_SOCKOPT_PACKET_SIZE	1 /* XXX deprecated, without effect */
 #define DCCP_SOCKOPT_SERVICE		2
@@ -208,6 +225,8 @@
 #define DCCP_SOCKOPT_CCID		13
 #define DCCP_SOCKOPT_TX_CCID		14
 #define DCCP_SOCKOPT_RX_CCID		15
+#define DCCP_SOCKOPT_QPOLICY_ID		16
+#define DCCP_SOCKOPT_QPOLICY_TXQLEN	17
 #define DCCP_SOCKOPT_CCID_RX_INFO	128
 #define DCCP_SOCKOPT_CCID_TX_INFO	192
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dlm.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dlm.h
index 2293367..9d5c08f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dlm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dlm.h
@@ -2,7 +2,7 @@
 *******************************************************************************
 **
 **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
-**  Copyright (C) 2004-2008 Red Hat, Inc.  All rights reserved.
+**  Copyright (C) 2004-2011 Red Hat, Inc.  All rights reserved.
 **
 **  This copyrighted material is made available to anyone wishing to use,
 **  modify, copy, or redistribute it subject to the terms and conditions
@@ -48,10 +48,10 @@
  *
  * 0 if lock request was successful
  * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE
- * -ENOMEM if there is no memory to process request
- * -EINVAL if there are invalid parameters
  * -DLM_EUNLOCK if unlock request was successful
  * -DLM_ECANCEL if a cancel completed successfully
+ * -EDEADLK if a deadlock was detected
+ * -ETIMEDOUT if the lock request was canceled due to a timeout
  */
 
 #define DLM_SBF_DEMOTED		0x01
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dlm_plock.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dlm_plock.h
index 9ea891a..135b453 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dlm_plock.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dlm_plock.h
@@ -14,7 +14,7 @@
 #define DLM_PLOCK_MISC_NAME		"dlm_plock"
 
 #define DLM_PLOCK_VERSION_MAJOR	1
-#define DLM_PLOCK_VERSION_MINOR	1
+#define DLM_PLOCK_VERSION_MINOR	2
 #define DLM_PLOCK_VERSION_PATCH	0
 
 enum {
@@ -23,12 +23,14 @@
 	DLM_PLOCK_OP_GET,
 };
 
+#define DLM_PLOCK_FL_CLOSE 1
+
 struct dlm_plock_info {
 	__u32 version[3];
 	__u8 optype;
 	__u8 ex;
 	__u8 wait;
-	__u8 pad;
+	__u8 flags;
 	__u32 pid;
 	__s32 nodeid;
 	__s32 rv;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dm-ioctl.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dm-ioctl.h
index 2ab84c8..75fd557 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dm-ioctl.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dm-ioctl.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001 - 2003 Sistina Software (UK) Limited.
- * Copyright (C) 2004 - 2005 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004 - 2009 Red Hat, Inc. All rights reserved.
  *
  * This file is released under the LGPL.
  */
@@ -11,6 +11,7 @@
 #include <linux/types.h>
 
 #define DM_DIR "mapper"		/* Slashes not supported */
+#define DM_CONTROL_NODE "control"
 #define DM_MAX_TYPE_NAME 16
 #define DM_NAME_LEN 128
 #define DM_UUID_LEN 129
@@ -43,7 +44,7 @@
  * Remove a device, destroy any tables.
  *
  * DM_DEV_RENAME:
- * Rename a device.
+ * Rename a device or set its uuid if none was previously supplied.
  *
  * DM_SUSPEND:
  * This performs both suspend and resume, depending which flag is
@@ -266,9 +267,9 @@
 #define DM_DEV_SET_GEOMETRY	_IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
 
 #define DM_VERSION_MAJOR	4
-#define DM_VERSION_MINOR	15
+#define DM_VERSION_MINOR	22
 #define DM_VERSION_PATCHLEVEL	0
-#define DM_VERSION_EXTRA	"-ioctl (2009-04-01)"
+#define DM_VERSION_EXTRA	"-ioctl (2011-10-19)"
 
 /* Status bits */
 #define DM_READONLY_FLAG	(1 << 0) /* In/Out */
@@ -309,4 +310,28 @@
  */
 #define DM_NOFLUSH_FLAG		(1 << 11) /* In */
 
+/*
+ * If set, any table information returned will relate to the inactive
+ * table instead of the live one.  Always check DM_INACTIVE_PRESENT_FLAG
+ * is set before using the data returned.
+ */
+#define DM_QUERY_INACTIVE_TABLE_FLAG	(1 << 12) /* In */
+
+/*
+ * If set, a uevent was generated for which the caller may need to wait.
+ */
+#define DM_UEVENT_GENERATED_FLAG	(1 << 13) /* Out */
+
+/*
+ * If set, rename changes the uuid not the name.  Only permitted
+ * if no uuid was previously supplied: an existing uuid cannot be changed.
+ */
+#define DM_UUID_FLAG			(1 << 14) /* In */
+
+/*
+ * If set, all buffers are wiped after use. Use when sending
+ * or requesting sensitive data such as an encryption key.
+ */
+#define DM_SECURE_DATA_FLAG		(1 << 15) /* In */
+
 #endif				/* _LINUX_DM_IOCTL_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dm-log-userspace.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dm-log-userspace.h
index 8a1f972..0678c2a 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dm-log-userspace.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dm-log-userspace.h
@@ -52,15 +52,20 @@
  * Payload-to-userspace:
  *	A single string containing all the argv arguments separated by ' 's
  * Payload-to-kernel:
- *	None.  ('data_size' in the dm_ulog_request struct should be 0.)
+ *	A NUL-terminated string that is the name of the device that is used
+ *	as the backing store for the log data.  'dm_get_device' will be called
+ *	on this device.  ('dm_put_device' will be called on this device
+ *	automatically after calling DM_ULOG_DTR.)  If there is no device needed
+ *	for log data, 'data_size' in the dm_ulog_request struct should be 0.
  *
  * The UUID contained in the dm_ulog_request structure is the reference that
  * will be used by all request types to a specific log.  The constructor must
- * record this assotiation with instance created.
+ * record this association with the instance created.
  *
  * When the request has been processed, user-space must return the
- * dm_ulog_request to the kernel - setting the 'error' field and
- * 'data_size' appropriately.
+ * dm_ulog_request to the kernel - setting the 'error' field, filling the
+ * data field with the log device if necessary, and setting 'data_size'
+ * appropriately.
  */
 #define DM_ULOG_CTR                    1
 
@@ -363,13 +368,26 @@
  * various request types above.  The remaining 24-bits are currently
  * set to zero and are reserved for future use and compatibility concerns.
  *
- * User-space should always use DM_ULOG_REQUEST_TYPE to aquire the
+ * User-space should always use DM_ULOG_REQUEST_TYPE to acquire the
  * request type from the 'request_type' field to maintain forward compatibility.
  */
 #define DM_ULOG_REQUEST_MASK 0xFF
 #define DM_ULOG_REQUEST_TYPE(request_type) \
 	(DM_ULOG_REQUEST_MASK & (request_type))
 
+/*
+ * DM_ULOG_REQUEST_VERSION is incremented when there is a
+ * change to the way information is passed between kernel
+ * and userspace.  This could be a structure change of
+ * dm_ulog_request or a change in the way requests are
+ * issued/handled.  Changes are outlined here:
+ *	version 1:  Initial implementation
+ *	version 2:  DM_ULOG_CTR allowed to return a string containing a
+ *	            device name that is to be registered with DM via
+ *	            'dm_get_device'.
+ */
+#define DM_ULOG_REQUEST_VERSION 2
+
 struct dm_ulog_request {
 	/*
 	 * The local unique identifier (luid) and the universally unique
@@ -383,8 +401,9 @@
 	 */
 	uint64_t luid;
 	char uuid[DM_UUID_LEN];
-	char padding[7];        /* Padding because DM_UUID_LEN = 129 */
+	char padding[3];        /* Padding because DM_UUID_LEN = 129 */
 
+	uint32_t version;       /* See DM_ULOG_REQUEST_VERSION */
 	int32_t error;          /* Used to report back processing errors */
 
 	uint32_t seq;           /* Sequence number for request */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dn.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dn.h
index fe99908..9c50445 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dn.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dn.h
@@ -71,14 +71,12 @@
 /* Structures */
 
 
-struct dn_naddr 
-{
+struct dn_naddr {
 	__le16		a_len;
 	__u8 a_addr[DN_MAXADDL]; /* Two bytes little endian */
 };
 
-struct sockaddr_dn
-{
+struct sockaddr_dn {
 	__u16		sdn_family;
 	__u8		sdn_flags;
 	__u8		sdn_objnum;
@@ -101,8 +99,7 @@
         __u8   opt_data[16];   /* User data              */
 };
 
-struct accessdata_dn
-{
+struct accessdata_dn {
 	__u8		acc_accl;
 	__u8		acc_acc[DN_MAXACCL];
 	__u8 		acc_passl;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dqblk_xfs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dqblk_xfs.h
index 527504c..8655280 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dqblk_xfs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dqblk_xfs.h
@@ -49,7 +49,7 @@
 #define FS_DQUOT_VERSION	1	/* fs_disk_quota.d_version */
 typedef struct fs_disk_quota {
 	__s8		d_version;	/* version of this structure */
-	__s8		d_flags;	/* XFS_{USER,PROJ,GROUP}_QUOTA */
+	__s8		d_flags;	/* FS_{USER,PROJ,GROUP}_QUOTA */
 	__u16		d_fieldmask;	/* field specifier */
 	__u32		d_id;		/* user, project, or group ID */
 	__u64		d_blk_hardlimit;/* absolute limit on disk blks */
@@ -110,18 +110,27 @@
 #define FS_DQ_WARNS_MASK	(FS_DQ_BWARNS | FS_DQ_IWARNS | FS_DQ_RTBWARNS)
 
 /*
- * Various flags related to quotactl(2).  Only relevant to XFS filesystems.
+ * Accounting values.  These can only be set for filesystem with
+ * non-transactional quotas that require quotacheck(8) in userspace.
  */
-#define XFS_QUOTA_UDQ_ACCT	(1<<0)  /* user quota accounting */
-#define XFS_QUOTA_UDQ_ENFD	(1<<1)  /* user quota limits enforcement */
-#define XFS_QUOTA_GDQ_ACCT	(1<<2)  /* group quota accounting */
-#define XFS_QUOTA_GDQ_ENFD	(1<<3)  /* group quota limits enforcement */
-#define XFS_QUOTA_PDQ_ACCT	(1<<4)  /* project quota accounting */
-#define XFS_QUOTA_PDQ_ENFD	(1<<5)  /* project quota limits enforcement */
+#define FS_DQ_BCOUNT		(1<<12)
+#define FS_DQ_ICOUNT		(1<<13)
+#define FS_DQ_RTBCOUNT		(1<<14)
+#define FS_DQ_ACCT_MASK		(FS_DQ_BCOUNT | FS_DQ_ICOUNT | FS_DQ_RTBCOUNT)
 
-#define XFS_USER_QUOTA		(1<<0)	/* user quota type */
-#define XFS_PROJ_QUOTA		(1<<1)	/* project quota type */
-#define XFS_GROUP_QUOTA		(1<<2)	/* group quota type */
+/*
+ * Various flags related to quotactl(2).
+ */
+#define FS_QUOTA_UDQ_ACCT	(1<<0)  /* user quota accounting */
+#define FS_QUOTA_UDQ_ENFD	(1<<1)  /* user quota limits enforcement */
+#define FS_QUOTA_GDQ_ACCT	(1<<2)  /* group quota accounting */
+#define FS_QUOTA_GDQ_ENFD	(1<<3)  /* group quota limits enforcement */
+#define FS_QUOTA_PDQ_ACCT	(1<<4)  /* project quota accounting */
+#define FS_QUOTA_PDQ_ENFD	(1<<5)  /* project quota limits enforcement */
+
+#define FS_USER_QUOTA		(1<<0)	/* user quota type */
+#define FS_PROJ_QUOTA		(1<<1)	/* project quota type */
+#define FS_GROUP_QUOTA		(1<<2)	/* group quota type */
 
 /*
  * fs_quota_stat is the struct returned in Q_XGETQSTAT for a given file system.
@@ -142,7 +151,7 @@
 
 typedef struct fs_quota_stat {
 	__s8		qs_version;	/* version number for future changes */
-	__u16		qs_flags;	/* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */
+	__u16		qs_flags;	/* FS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */
 	__s8		qs_pad;		/* unused */
 	fs_qfilestat_t	qs_uquota;	/* user quota storage information */
 	fs_qfilestat_t	qs_gquota;	/* group quota storage information */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/audio.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/audio.h
index fec66bd..d47bccd 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/audio.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/audio.h
@@ -67,7 +67,7 @@
 
 
 typedef
-struct audio_karaoke{  /* if Vocal1 or Vocal2 are non-zero, they get mixed  */
+struct audio_karaoke {  /* if Vocal1 or Vocal2 are non-zero, they get mixed  */
 	int vocal1;    /* into left and right t at 70% each */
 	int vocal2;    /* if both, Vocal1 and Vocal2 are non-zero, Vocal1 gets*/
 	int melody;    /* mixed into the left channel and */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/dmx.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/dmx.h
index a0e0d3f..681e8ad 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/dmx.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/dmx.h
@@ -147,5 +147,7 @@
 #define DMX_GET_CAPS             _IOR('o', 48, dmx_caps_t)
 #define DMX_SET_SOURCE           _IOW('o', 49, dmx_source_t)
 #define DMX_GET_STC              _IOWR('o', 50, struct dmx_stc)
+#define DMX_ADD_PID              _IOW('o', 51, __u16)
+#define DMX_REMOVE_PID           _IOW('o', 52, __u16)
 
 #endif /*_DVBDMX_H_*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/frontend.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/frontend.h
index 51c8d2d..6b4b7cb 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/frontend.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/frontend.h
@@ -62,6 +62,7 @@
 	FE_CAN_8VSB			= 0x200000,
 	FE_CAN_16VSB			= 0x400000,
 	FE_HAS_EXTENDED_CAPS		= 0x800000,   /* We need more bitspace for newer APIs, indicate this. */
+	FE_CAN_TURBO_FEC		= 0x8000000,  /* frontend supports "turbo fec modulation" */
 	FE_CAN_2G_MODULATION		= 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */
 	FE_NEEDS_BENDING		= 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */
 	FE_CAN_RECOVER			= 0x40000000, /* frontend can recover from a cable unplug automatically */
@@ -71,7 +72,7 @@
 
 struct dvb_frontend_info {
 	char       name[128];
-	fe_type_t  type;
+	fe_type_t  type;			/* DEPRECATED. Use DTV_ENUM_DELSYS instead */
 	__u32      frequency_min;
 	__u32      frequency_max;
 	__u32      frequency_stepsize;
@@ -173,23 +174,32 @@
 typedef enum fe_transmit_mode {
 	TRANSMISSION_MODE_2K,
 	TRANSMISSION_MODE_8K,
-	TRANSMISSION_MODE_AUTO
+	TRANSMISSION_MODE_AUTO,
+	TRANSMISSION_MODE_4K,
+	TRANSMISSION_MODE_1K,
+	TRANSMISSION_MODE_16K,
+	TRANSMISSION_MODE_32K,
 } fe_transmit_mode_t;
 
 typedef enum fe_bandwidth {
 	BANDWIDTH_8_MHZ,
 	BANDWIDTH_7_MHZ,
 	BANDWIDTH_6_MHZ,
-	BANDWIDTH_AUTO
+	BANDWIDTH_AUTO,
+	BANDWIDTH_5_MHZ,
+	BANDWIDTH_10_MHZ,
+	BANDWIDTH_1_712_MHZ,
 } fe_bandwidth_t;
 
-
 typedef enum fe_guard_interval {
 	GUARD_INTERVAL_1_32,
 	GUARD_INTERVAL_1_16,
 	GUARD_INTERVAL_1_8,
 	GUARD_INTERVAL_1_4,
-	GUARD_INTERVAL_AUTO
+	GUARD_INTERVAL_AUTO,
+	GUARD_INTERVAL_1_128,
+	GUARD_INTERVAL_19_128,
+	GUARD_INTERVAL_19_256,
 } fe_guard_interval_t;
 
 
@@ -240,7 +250,6 @@
 	} u;
 };
 
-
 struct dvb_frontend_event {
 	fe_status_t status;
 	struct dvb_frontend_parameters parameters;
@@ -268,15 +277,46 @@
 #define DTV_FE_CAPABILITY	16
 #define DTV_DELIVERY_SYSTEM	17
 
-#define DTV_API_VERSION				35
-#define DTV_API_VERSION				35
-#define DTV_CODE_RATE_HP			36
-#define DTV_CODE_RATE_LP			37
-#define DTV_GUARD_INTERVAL			38
-#define DTV_TRANSMISSION_MODE			39
-#define DTV_HIERARCHY				40
+/* ISDB-T and ISDB-Tsb */
+#define DTV_ISDBT_PARTIAL_RECEPTION	18
+#define DTV_ISDBT_SOUND_BROADCASTING	19
 
-#define DTV_MAX_COMMAND				DTV_HIERARCHY
+#define DTV_ISDBT_SB_SUBCHANNEL_ID	20
+#define DTV_ISDBT_SB_SEGMENT_IDX	21
+#define DTV_ISDBT_SB_SEGMENT_COUNT	22
+
+#define DTV_ISDBT_LAYERA_FEC			23
+#define DTV_ISDBT_LAYERA_MODULATION		24
+#define DTV_ISDBT_LAYERA_SEGMENT_COUNT		25
+#define DTV_ISDBT_LAYERA_TIME_INTERLEAVING	26
+
+#define DTV_ISDBT_LAYERB_FEC			27
+#define DTV_ISDBT_LAYERB_MODULATION		28
+#define DTV_ISDBT_LAYERB_SEGMENT_COUNT		29
+#define DTV_ISDBT_LAYERB_TIME_INTERLEAVING	30
+
+#define DTV_ISDBT_LAYERC_FEC			31
+#define DTV_ISDBT_LAYERC_MODULATION		32
+#define DTV_ISDBT_LAYERC_SEGMENT_COUNT		33
+#define DTV_ISDBT_LAYERC_TIME_INTERLEAVING	34
+
+#define DTV_API_VERSION		35
+
+#define DTV_CODE_RATE_HP	36
+#define DTV_CODE_RATE_LP	37
+#define DTV_GUARD_INTERVAL	38
+#define DTV_TRANSMISSION_MODE	39
+#define DTV_HIERARCHY		40
+
+#define DTV_ISDBT_LAYER_ENABLED	41
+
+#define DTV_ISDBS_TS_ID		42
+
+#define DTV_DVBT2_PLP_ID	43
+
+#define DTV_ENUM_DELSYS		44
+
+#define DTV_MAX_COMMAND				DTV_ENUM_DELSYS
 
 typedef enum fe_pilot {
 	PILOT_ON,
@@ -293,7 +333,7 @@
 
 typedef enum fe_delivery_system {
 	SYS_UNDEFINED,
-	SYS_DVBC_ANNEX_AC,
+	SYS_DVBC_ANNEX_A,
 	SYS_DVBC_ANNEX_B,
 	SYS_DVBT,
 	SYS_DSS,
@@ -308,8 +348,15 @@
 	SYS_DMBTH,
 	SYS_CMMB,
 	SYS_DAB,
+	SYS_DVBT2,
+	SYS_TURBO,
+	SYS_DVBC_ANNEX_C,
 } fe_delivery_system_t;
 
+
+#define SYS_DVBC_ANNEX_AC	SYS_DVBC_ANNEX_A
+
+
 struct dtv_cmds_h {
 	char	*name;		/* A display name for debugging purposes */
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/version.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/version.h
index 25b823b..0559e2b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/version.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/dvb/version.h
@@ -24,6 +24,6 @@
 #define _DVBVERSION_H_
 
 #define DVB_API_VERSION 5
-#define DVB_API_VERSION_MINOR 0
+#define DVB_API_VERSION_MINOR 5
 
 #endif /*_DVBVERSION_H_*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/elf-em.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/elf-em.h
index 18bea78..8e2b7ba 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/elf-em.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/elf-em.h
@@ -33,6 +33,7 @@
 #define EM_H8_300	46	/* Renesas H8/300,300H,H8S */
 #define EM_MN10300	89	/* Panasonic/MEI MN10300, AM33 */
 #define EM_BLACKFIN     106     /* ADI Blackfin Processor */
+#define EM_TI_C6000	140	/* TI C6X DSPs */
 #define EM_FRV		0x5441	/* Fujitsu FR-V */
 #define EM_AVR32	0x18ad	/* Atmel AVR32 */
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/elf.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/elf.h
index ac06599..d739b23 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/elf.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/elf.h
@@ -4,15 +4,6 @@
 #include <linux/types.h>
 #include <linux/elf-em.h>
 
-struct file;
-
-#ifndef elf_read_implies_exec
-  /* Executables for which elf_read_implies_exec() returns TRUE will
-     have the READ_IMPLIES_EXEC personality flag set automatically.
-     Override in asm/elf.h as needed.  */
-# define elf_read_implies_exec(ex, have_pt_gnu_stack)	0
-#endif
-
 /* 32-bit ELF base types. */
 typedef __u32	Elf32_Addr;
 typedef __u16	Elf32_Half;
@@ -47,6 +38,28 @@
 
 #define PT_GNU_STACK	(PT_LOOS + 0x474e551)
 
+/*
+ * Extended Numbering
+ *
+ * If the real number of program header table entries is larger than
+ * or equal to PN_XNUM(0xffff), it is set to sh_info field of the
+ * section header at index 0, and PN_XNUM is set to e_phnum
+ * field. Otherwise, the section header at index 0 is zero
+ * initialized, if it exists.
+ *
+ * Specifications are available in:
+ *
+ * - Sun microsystems: Linker and Libraries.
+ *   Part No: 817-1984-17, September 2008.
+ *   URL: http://docs.sun.com/app/docs/doc/817-1984
+ *
+ * - System V ABI AMD64 Architecture Processor Supplement
+ *   Draft Version 0.99.,
+ *   May 11, 2009.
+ *   URL: http://www.x86-64.org/
+ */
+#define PN_XNUM 0xffff
+
 /* These constants define the different elf file types */
 #define ET_NONE   0
 #define ET_REL    1
@@ -283,7 +296,7 @@
 #define SHN_COMMON	0xfff2
 #define SHN_HIRESERVE	0xffff
  
-typedef struct {
+typedef struct elf32_shdr {
   Elf32_Word	sh_name;
   Elf32_Word	sh_type;
   Elf32_Word	sh_flags;
@@ -346,7 +359,11 @@
 #define ELF_OSABI ELFOSABI_NONE
 #endif
 
-/* Notes used in ET_CORE */
+/*
+ * Notes used in ET_CORE. Architectures export some of the arch register sets
+ * using the corresponding note types via the PTRACE_GETREGSET and
+ * PTRACE_SETREGSET requests.
+ */
 #define NT_PRSTATUS	1
 #define NT_PRFPREG	2
 #define NT_PRPSINFO	3
@@ -358,6 +375,16 @@
 #define NT_PPC_VSX	0x102		/* PowerPC VSX registers */
 #define NT_386_TLS	0x200		/* i386 TLS slots (struct user_desc) */
 #define NT_386_IOPERM	0x201		/* x86 io permission bitmap (1=deny) */
+#define NT_X86_XSTATE	0x202		/* x86 extended state using xsave */
+#define NT_S390_HIGH_GPRS	0x300	/* s390 upper register halves */
+#define NT_S390_TIMER	0x301		/* s390 timer register */
+#define NT_S390_TODCMP	0x302		/* s390 TOD clock comparator register */
+#define NT_S390_TODPREG	0x303		/* s390 TOD programmable register */
+#define NT_S390_CTRS	0x304		/* s390 control registers */
+#define NT_S390_PREFIX	0x305		/* s390 prefix register */
+#define NT_S390_LAST_BREAK	0x306	/* s390 breaking event address */
+#define NT_S390_SYSTEM_CALL	0x307	/* s390 system call restart data */
+#define NT_ARM_VFP	0x400		/* ARM VFP/NEON registers */
 
 
 /* Note header in a PT_NOTE section */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/elfcore.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/elfcore.h
index 7e58df1..9dd784c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/elfcore.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/elfcore.h
@@ -5,6 +5,8 @@
 #include <linux/signal.h>
 #include <linux/time.h>
 #include <linux/ptrace.h>
+#include <linux/elf.h>
+#include <linux/fs.h>
 
 struct elf_siginfo
 {
@@ -91,5 +93,4 @@
 #define PRARGSZ ELF_PRARGSZ 
 
 
-
 #endif /* _LINUX_ELFCORE_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/errqueue.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/errqueue.h
index 35de665..bccd3a1 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/errqueue.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/errqueue.h
@@ -3,8 +3,7 @@
 
 #include <linux/types.h>
 
-struct sock_extended_err
-{
+struct sock_extended_err {
 	__u32	ee_errno;	
 	__u8	ee_origin;
 	__u8	ee_type;
@@ -18,7 +17,8 @@
 #define SO_EE_ORIGIN_LOCAL	1
 #define SO_EE_ORIGIN_ICMP	2
 #define SO_EE_ORIGIN_ICMP6	3
-#define SO_EE_ORIGIN_TIMESTAMPING 4
+#define SO_EE_ORIGIN_TXSTATUS	4
+#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
 
 #define SO_EE_OFFENDER(ee)	((struct sockaddr*)((ee)+1))
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ethtool.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ethtool.h
index c2cd082..d904c1a 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ethtool.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ethtool.h
@@ -14,13 +14,17 @@
 #define _LINUX_ETHTOOL_H
 
 #include <linux/types.h>
+#include <linux/if_ether.h>
 
 /* This should work for both 32 and 64 bit userland. */
 struct ethtool_cmd {
 	__u32	cmd;
 	__u32	supported;	/* Features this interface supports */
 	__u32	advertising;	/* Features this interface advertises */
-	__u16	speed;		/* The forced speed, 10Mb, 100Mb, gigabit */
+	__u16	speed;	        /* The forced speed (lower bits) in
+				 * Mbps. Please use
+				 * ethtool_cmd_speed()/_set() to
+				 * access it */
 	__u8	duplex;		/* Duplex, half or full */
 	__u8	port;		/* Which connector port */
 	__u8	phy_address;
@@ -29,7 +33,10 @@
 	__u8	mdio_support;
 	__u32	maxtxpkt;	/* Tx pkts before generating tx int */
 	__u32	maxrxpkt;	/* Rx pkts before generating rx int */
-	__u16	speed_hi;
+	__u16	speed_hi;       /* The forced speed (upper
+				 * bits) in Mbps. Please use
+				 * ethtool_cmd_speed()/_set() to
+				 * access it */
 	__u8	eth_tp_mdix;
 	__u8	reserved2;
 	__u32	lp_advertising;	/* Features the link partner advertises */
@@ -37,29 +44,37 @@
 };
 
 static __inline__ void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
-						__u32 speed)
+					 __u32 speed)
 {
 
 	ep->speed = (__u16)speed;
 	ep->speed_hi = (__u16)(speed >> 16);
 }
 
-static __inline__ __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
+static __inline__ __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
 {
 	return (ep->speed_hi << 16) | ep->speed;
 }
 
+#define ETHTOOL_FWVERS_LEN	32
 #define ETHTOOL_BUSINFO_LEN	32
 /* these strings are set to whatever the driver author decides... */
 struct ethtool_drvinfo {
 	__u32	cmd;
 	char	driver[32];	/* driver short name, "tulip", "eepro100" */
 	char	version[32];	/* driver version string */
-	char	fw_version[32];	/* firmware version string, if applicable */
+	char	fw_version[ETHTOOL_FWVERS_LEN];	/* firmware version string */
 	char	bus_info[ETHTOOL_BUSINFO_LEN];	/* Bus info for this IF. */
 				/* For PCI devices, use pci_name(pci_dev). */
 	char	reserved1[32];
 	char	reserved2[12];
+				/*
+				 * Some struct members below are filled in
+				 * using ops->get_sset_count().  Obtaining
+				 * this info from ethtool_drvinfo is now
+				 * deprecated; Use ETHTOOL_GSSET_INFO
+				 * instead.
+				 */
 	__u32	n_priv_flags;	/* number of flags valid in ETHTOOL_GPFLAGS */
 	__u32	n_stats;	/* number of u64's from ETHTOOL_GSTATS */
 	__u32	testinfo_len;
@@ -99,99 +114,101 @@
 	__u8	data[0];
 };
 
-/* for configuring coalescing parameters of chip */
+/**
+ * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
+ * @cmd: ETHTOOL_{G,S}COALESCE
+ * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
+ *	a packet arrives.
+ * @rx_max_coalesced_frames: Maximum number of packets to receive
+ *	before an RX interrupt.
+ * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that
+ *	this value applies while an IRQ is being serviced by the host.
+ * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames,
+ *	except that this value applies while an IRQ is being serviced
+ *	by the host.
+ * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after
+ *	a packet is sent.
+ * @tx_max_coalesced_frames: Maximum number of packets to be sent
+ *	before a TX interrupt.
+ * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that
+ *	this value applies while an IRQ is being serviced by the host.
+ * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames,
+ *	except that this value applies while an IRQ is being serviced
+ *	by the host.
+ * @stats_block_coalesce_usecs: How many usecs to delay in-memory
+ *	statistics block updates.  Some drivers do not have an
+ *	in-memory statistic block, and in such cases this value is
+ *	ignored.  This value must not be zero.
+ * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing.
+ * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing.
+ * @pkt_rate_low: Threshold for low packet rate (packets per second).
+ * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after
+ *	a packet arrives, when the packet rate is below @pkt_rate_low.
+ * @rx_max_coalesced_frames_low: Maximum number of packets to be received
+ *	before an RX interrupt, when the packet rate is below @pkt_rate_low.
+ * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after
+ *	a packet is sent, when the packet rate is below @pkt_rate_low.
+ * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before
+ *	a TX interrupt, when the packet rate is below @pkt_rate_low.
+ * @pkt_rate_high: Threshold for high packet rate (packets per second).
+ * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after
+ *	a packet arrives, when the packet rate is above @pkt_rate_high.
+ * @rx_max_coalesced_frames_high: Maximum number of packets to be received
+ *	before an RX interrupt, when the packet rate is above @pkt_rate_high.
+ * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after
+ *	a packet is sent, when the packet rate is above @pkt_rate_high.
+ * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before
+ *	a TX interrupt, when the packet rate is above @pkt_rate_high.
+ * @rate_sample_interval: How often to do adaptive coalescing packet rate
+ *	sampling, measured in seconds.  Must not be zero.
+ *
+ * Each pair of (usecs, max_frames) fields specifies this exit
+ * condition for interrupt coalescing:
+ *	(usecs > 0 && time_since_first_completion >= usecs) ||
+ *	(max_frames > 0 && completed_frames >= max_frames)
+ * It is illegal to set both usecs and max_frames to zero as this
+ * would cause interrupts to never be generated.  To disable
+ * coalescing, set usecs = 0 and max_frames = 1.
+ *
+ * Some implementations ignore the value of max_frames and use the
+ * condition:
+ *	time_since_first_completion >= usecs
+ * This is deprecated.  Drivers for hardware that does not support
+ * counting completions should validate that max_frames == !rx_usecs.
+ *
+ * Adaptive RX/TX coalescing is an algorithm implemented by some
+ * drivers to improve latency under low packet rates and improve
+ * throughput under high packet rates.  Some drivers only implement
+ * one of RX or TX adaptive coalescing.  Anything not implemented by
+ * the driver causes these values to be silently ignored.
+ *
+ * When the packet rate is below @pkt_rate_high but above
+ * @pkt_rate_low (both measured in packets per second) the
+ * normal {rx,tx}_* coalescing parameters are used.
+ */
 struct ethtool_coalesce {
-	__u32	cmd;	/* ETHTOOL_{G,S}COALESCE */
-
-	/* How many usecs to delay an RX interrupt after
-	 * a packet arrives.  If 0, only rx_max_coalesced_frames
-	 * is used.
-	 */
+	__u32	cmd;
 	__u32	rx_coalesce_usecs;
-
-	/* How many packets to delay an RX interrupt after
-	 * a packet arrives.  If 0, only rx_coalesce_usecs is
-	 * used.  It is illegal to set both usecs and max frames
-	 * to zero as this would cause RX interrupts to never be
-	 * generated.
-	 */
 	__u32	rx_max_coalesced_frames;
-
-	/* Same as above two parameters, except that these values
-	 * apply while an IRQ is being serviced by the host.  Not
-	 * all cards support this feature and the values are ignored
-	 * in that case.
-	 */
 	__u32	rx_coalesce_usecs_irq;
 	__u32	rx_max_coalesced_frames_irq;
-
-	/* How many usecs to delay a TX interrupt after
-	 * a packet is sent.  If 0, only tx_max_coalesced_frames
-	 * is used.
-	 */
 	__u32	tx_coalesce_usecs;
-
-	/* How many packets to delay a TX interrupt after
-	 * a packet is sent.  If 0, only tx_coalesce_usecs is
-	 * used.  It is illegal to set both usecs and max frames
-	 * to zero as this would cause TX interrupts to never be
-	 * generated.
-	 */
 	__u32	tx_max_coalesced_frames;
-
-	/* Same as above two parameters, except that these values
-	 * apply while an IRQ is being serviced by the host.  Not
-	 * all cards support this feature and the values are ignored
-	 * in that case.
-	 */
 	__u32	tx_coalesce_usecs_irq;
 	__u32	tx_max_coalesced_frames_irq;
-
-	/* How many usecs to delay in-memory statistics
-	 * block updates.  Some drivers do not have an in-memory
-	 * statistic block, and in such cases this value is ignored.
-	 * This value must not be zero.
-	 */
 	__u32	stats_block_coalesce_usecs;
-
-	/* Adaptive RX/TX coalescing is an algorithm implemented by
-	 * some drivers to improve latency under low packet rates and
-	 * improve throughput under high packet rates.  Some drivers
-	 * only implement one of RX or TX adaptive coalescing.  Anything
-	 * not implemented by the driver causes these values to be
-	 * silently ignored.
-	 */
 	__u32	use_adaptive_rx_coalesce;
 	__u32	use_adaptive_tx_coalesce;
-
-	/* When the packet rate (measured in packets per second)
-	 * is below pkt_rate_low, the {rx,tx}_*_low parameters are
-	 * used.
-	 */
 	__u32	pkt_rate_low;
 	__u32	rx_coalesce_usecs_low;
 	__u32	rx_max_coalesced_frames_low;
 	__u32	tx_coalesce_usecs_low;
 	__u32	tx_max_coalesced_frames_low;
-
-	/* When the packet rate is below pkt_rate_high but above
-	 * pkt_rate_low (both measured in packets per second) the
-	 * normal {rx,tx}_* coalescing parameters are used.
-	 */
-
-	/* When the packet rate is (measured in packets per second)
-	 * is above pkt_rate_high, the {rx,tx}_*_high parameters are
-	 * used.
-	 */
 	__u32	pkt_rate_high;
 	__u32	rx_coalesce_usecs_high;
 	__u32	rx_max_coalesced_frames_high;
 	__u32	tx_coalesce_usecs_high;
 	__u32	tx_max_coalesced_frames_high;
-
-	/* How often to do adaptive coalescing packet rate sampling,
-	 * measured in seconds.  Must not be zero.
-	 */
 	__u32	rate_sample_interval;
 };
 
@@ -217,12 +234,40 @@
 	__u32	tx_pending;
 };
 
+/**
+ * struct ethtool_channels - configuring number of network channel
+ * @cmd: ETHTOOL_{G,S}CHANNELS
+ * @max_rx: Read only. Maximum number of receive channel the driver support.
+ * @max_tx: Read only. Maximum number of transmit channel the driver support.
+ * @max_other: Read only. Maximum number of other channel the driver support.
+ * @max_combined: Read only. Maximum number of combined channel the driver
+ *	support. Set of queues RX, TX or other.
+ * @rx_count: Valid values are in the range 1 to the max_rx.
+ * @tx_count: Valid values are in the range 1 to the max_tx.
+ * @other_count: Valid values are in the range 1 to the max_other.
+ * @combined_count: Valid values are in the range 1 to the max_combined.
+ *
+ * This can be used to configure RX, TX and other channels.
+ */
+
+struct ethtool_channels {
+	__u32	cmd;
+	__u32	max_rx;
+	__u32	max_tx;
+	__u32	max_other;
+	__u32	max_combined;
+	__u32	rx_count;
+	__u32	tx_count;
+	__u32	other_count;
+	__u32	combined_count;
+};
+
 /* for configuring link flow control parameters */
 struct ethtool_pauseparam {
 	__u32	cmd;	/* ETHTOOL_{G,S}PAUSEPARAM */
 
 	/* If the link is being auto-negotiated (via ethtool_cmd.autoneg
-	 * being true) the user may set 'autonet' here non-zero to have the
+	 * being true) the user may set 'autoneg' here non-zero to have the
 	 * pause parameters be auto-negotiated too.  In such a case, the
 	 * {rx,tx}_pause values below determine what capabilities are
 	 * advertised.
@@ -241,6 +286,8 @@
 	ETH_SS_TEST		= 0,
 	ETH_SS_STATS,
 	ETH_SS_PRIV_FLAGS,
+	ETH_SS_NTUPLE_FILTERS,	/* Do not use, GRXNTUPLE is now deprecated */
+	ETH_SS_FEATURES,
 };
 
 /* for passing string sets for data tagging */
@@ -251,9 +298,32 @@
 	__u8	data[0];
 };
 
+struct ethtool_sset_info {
+	__u32	cmd;		/* ETHTOOL_GSSET_INFO */
+	__u32	reserved;
+	__u64	sset_mask;	/* input: each bit selects an sset to query */
+				/* output: each bit a returned sset */
+	__u32	data[0];	/* ETH_SS_xxx count, in order, based on bits
+				   in sset_mask.  One bit implies one
+				   __u32, two bits implies two
+				   __u32's, etc. */
+};
+
+/**
+ * enum ethtool_test_flags - flags definition of ethtool_test
+ * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
+ *	only online tests.
+ * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
+ * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
+ *	test.
+ * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
+ */
+
 enum ethtool_test_flags {
-	ETH_TEST_FL_OFFLINE	= (1 << 0),	/* online / offline */
-	ETH_TEST_FL_FAILED	= (1 << 1),	/* test passed / failed */
+	ETH_TEST_FL_OFFLINE	= (1 << 0),
+	ETH_TEST_FL_FAILED	= (1 << 1),
+	ETH_TEST_FL_EXTERNAL_LB	= (1 << 2),
+	ETH_TEST_FL_EXTERNAL_LB_DONE	= (1 << 3),
 };
 
 /* for requesting NIC test and getting results*/
@@ -288,13 +358,28 @@
  * flag differs from the read-only value.
  */
 enum ethtool_flags {
+	ETH_FLAG_TXVLAN		= (1 << 7),	/* TX VLAN offload enabled */
+	ETH_FLAG_RXVLAN		= (1 << 8),	/* RX VLAN offload enabled */
 	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */
+	ETH_FLAG_NTUPLE		= (1 << 27),	/* N-tuple filters enabled */
+	ETH_FLAG_RXHASH		= (1 << 28),
 };
 
 /* The following structures are for supporting RX network flow
- * classification configuration. Note, all multibyte fields, e.g.,
- * ip4src, ip4dst, psrc, pdst, spi, etc. are expected to be in network
- * byte order.
+ * classification and RX n-tuple configuration. Note, all multibyte
+ * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
+ * be in network byte order.
+ */
+
+/**
+ * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
+ * @ip4src: Source host
+ * @ip4dst: Destination host
+ * @psrc: Source port
+ * @pdst: Destination port
+ * @tos: Type-of-service
+ *
+ * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
  */
 struct ethtool_tcpip4_spec {
 	__be32	ip4src;
@@ -304,6 +389,15 @@
 	__u8    tos;
 };
 
+/**
+ * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
+ * @ip4src: Source host
+ * @ip4dst: Destination host
+ * @spi: Security parameters index
+ * @tos: Type-of-service
+ *
+ * This can be used to specify an IPsec transport or tunnel over IPv4.
+ */
 struct ethtool_ah_espip4_spec {
 	__be32	ip4src;
 	__be32	ip4dst;
@@ -311,21 +405,17 @@
 	__u8    tos;
 };
 
-struct ethtool_rawip4_spec {
-	__be32	ip4src;
-	__be32	ip4dst;
-	__u8	hdata[64];
-};
-
-struct ethtool_ether_spec {
-	__be16	ether_type;
-	__u8	frame_size;
-	__u8	eframe[16];
-};
-
 #define	ETH_RX_NFC_IP4	1
-#define	ETH_RX_NFC_IP6	2
 
+/**
+ * struct ethtool_usrip4_spec - general flow specification for IPv4
+ * @ip4src: Source host
+ * @ip4dst: Destination host
+ * @l4_4_bytes: First 4 bytes of transport (layer 4) header
+ * @tos: Type-of-service
+ * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
+ * @proto: Transport protocol number; mask must be 0
+ */
 struct ethtool_usrip4_spec {
 	__be32	ip4src;
 	__be32	ip4dst;
@@ -335,33 +425,296 @@
 	__u8    proto;
 };
 
+union ethtool_flow_union {
+	struct ethtool_tcpip4_spec		tcp_ip4_spec;
+	struct ethtool_tcpip4_spec		udp_ip4_spec;
+	struct ethtool_tcpip4_spec		sctp_ip4_spec;
+	struct ethtool_ah_espip4_spec		ah_ip4_spec;
+	struct ethtool_ah_espip4_spec		esp_ip4_spec;
+	struct ethtool_usrip4_spec		usr_ip4_spec;
+	struct ethhdr				ether_spec;
+	__u8					hdata[60];
+};
+
+struct ethtool_flow_ext {
+	__be16	vlan_etype;
+	__be16	vlan_tci;
+	__be32	data[2];
+};
+
+/**
+ * struct ethtool_rx_flow_spec - classification rule for RX flows
+ * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
+ * @h_u: Flow fields to match (dependent on @flow_type)
+ * @h_ext: Additional fields to match
+ * @m_u: Masks for flow field bits to be matched
+ * @m_ext: Masks for additional field bits to be matched
+ *	Note, all additional fields must be ignored unless @flow_type
+ *	includes the %FLOW_EXT flag.
+ * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
+ *	if packets should be discarded
+ * @location: Location of rule in the table.  Locations must be
+ *	numbered such that a flow matching multiple rules will be
+ *	classified according to the first (lowest numbered) rule.
+ */
 struct ethtool_rx_flow_spec {
 	__u32		flow_type;
+	union ethtool_flow_union h_u;
+	struct ethtool_flow_ext h_ext;
+	union ethtool_flow_union m_u;
+	struct ethtool_flow_ext m_ext;
+	__u64		ring_cookie;
+	__u32		location;
+};
+
+/**
+ * struct ethtool_rxnfc - command to get or set RX flow classification rules
+ * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
+ *	%ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
+ *	%ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
+ * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
+ * @data: Command-dependent value
+ * @fs: Flow classification rule
+ * @rule_cnt: Number of rules to be affected
+ * @rule_locs: Array of used rule locations
+ *
+ * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
+ * the fields included in the flow hash, e.g. %RXH_IP_SRC.  The following
+ * structure fields must not be used.
+ *
+ * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
+ * on return.
+ *
+ * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
+ * rules on return.  If @data is non-zero on return then it is the
+ * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
+ * driver supports any special location values.  If that flag is not
+ * set in @data then special location values should not be used.
+ *
+ * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
+ * existing rule on entry and @fs contains the rule on return.
+ *
+ * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
+ * user buffer for @rule_locs on entry.  On return, @data is the size
+ * of the rule table, @rule_cnt is the number of defined rules, and
+ * @rule_locs contains the locations of the defined rules.  Drivers
+ * must use the second parameter to get_rxnfc() instead of @rule_locs.
+ *
+ * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
+ * @fs.@location either specifies the location to use or is a special
+ * location value with %RX_CLS_LOC_SPECIAL flag set.  On return,
+ * @fs.@location is the actual rule location.
+ *
+ * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
+ * existing rule on entry.
+ *
+ * A driver supporting the special location values for
+ * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
+ * location, and may remove a rule at a later location (lower
+ * priority) that matches exactly the same set of flows.  The special
+ * values are: %RX_CLS_LOC_ANY, selecting any location;
+ * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
+ * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
+ * location (minimum priority).  Additional special values may be
+ * defined in future and drivers must return -%EINVAL for any
+ * unrecognised value.
+ */
+struct ethtool_rxnfc {
+	__u32				cmd;
+	__u32				flow_type;
+	__u64				data;
+	struct ethtool_rx_flow_spec	fs;
+	__u32				rule_cnt;
+	__u32				rule_locs[0];
+};
+
+
+/**
+ * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
+ * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
+ * @size: On entry, the array size of the user buffer, which may be zero.
+ *	On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
+ *	indirection table.
+ * @ring_index: RX ring/queue index for each hash value
+ *
+ * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
+ * should be returned.  For %ETHTOOL_SRXFHINDIR, a @size of zero means
+ * the table should be reset to default values.  This last feature
+ * is not supported by the original implementations.
+ */
+struct ethtool_rxfh_indir {
+	__u32	cmd;
+	__u32	size;
+	__u32	ring_index[0];
+};
+
+/**
+ * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
+ * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
+ * @h_u: Flow field values to match (dependent on @flow_type)
+ * @m_u: Masks for flow field value bits to be ignored
+ * @vlan_tag: VLAN tag to match
+ * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
+ * @data: Driver-dependent data to match
+ * @data_mask: Mask for driver-dependent data bits to be ignored
+ * @action: RX ring/queue index to deliver to (non-negative) or other action
+ *	(negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
+ *
+ * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
+ * a field value and mask are both zero this is treated as if all mask
+ * bits are set i.e. the field is ignored.
+ */
+struct ethtool_rx_ntuple_flow_spec {
+	__u32		 flow_type;
 	union {
 		struct ethtool_tcpip4_spec		tcp_ip4_spec;
 		struct ethtool_tcpip4_spec		udp_ip4_spec;
 		struct ethtool_tcpip4_spec		sctp_ip4_spec;
 		struct ethtool_ah_espip4_spec		ah_ip4_spec;
 		struct ethtool_ah_espip4_spec		esp_ip4_spec;
-		struct ethtool_rawip4_spec		raw_ip4_spec;
-		struct ethtool_ether_spec		ether_spec;
 		struct ethtool_usrip4_spec		usr_ip4_spec;
-		__u8					hdata[64];
-	} h_u, m_u; /* entry, mask */
-	__u64		ring_cookie;
-	__u32		location;
+		struct ethhdr				ether_spec;
+		__u8					hdata[72];
+	} h_u, m_u;
+
+	__u16	        vlan_tag;
+	__u16	        vlan_tag_mask;
+	__u64		data;
+	__u64		data_mask;
+
+	__s32		action;
+#define ETHTOOL_RXNTUPLE_ACTION_DROP	(-1)	/* drop packet */
+#define ETHTOOL_RXNTUPLE_ACTION_CLEAR	(-2)	/* clear filter */
 };
 
-struct ethtool_rxnfc {
-	__u32				cmd;
-	__u32				flow_type;
-	/* The rx flow hash value or the rule DB size */
-	__u64				data;
-	struct ethtool_rx_flow_spec	fs;
-	__u32				rule_cnt;
-	__u32				rule_locs[0];
+/**
+ * struct ethtool_rx_ntuple - command to set or clear RX flow filter
+ * @cmd: Command number - %ETHTOOL_SRXNTUPLE
+ * @fs: Flow filter specification
+ */
+struct ethtool_rx_ntuple {
+	__u32					cmd;
+	struct ethtool_rx_ntuple_flow_spec	fs;
 };
 
+#define ETHTOOL_FLASH_MAX_FILENAME	128
+enum ethtool_flash_op_type {
+	ETHTOOL_FLASH_ALL_REGIONS	= 0,
+};
+
+/* for passing firmware flashing related parameters */
+struct ethtool_flash {
+	__u32	cmd;
+	__u32	region;
+	char	data[ETHTOOL_FLASH_MAX_FILENAME];
+};
+
+/**
+ * struct ethtool_dump - used for retrieving, setting device dump
+ * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
+ * 	%ETHTOOL_SET_DUMP
+ * @version: FW version of the dump, filled in by driver
+ * @flag: driver dependent flag for dump setting, filled in by driver during
+ * 	  get and filled in by ethtool for set operation
+ * @len: length of dump data, used as the length of the user buffer on entry to
+ * 	 %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
+ * 	 for %ETHTOOL_GET_DUMP_FLAG command
+ * @data: data collected for get dump data operation
+ */
+struct ethtool_dump {
+	__u32	cmd;
+	__u32	version;
+	__u32	flag;
+	__u32	len;
+	__u8	data[0];
+};
+
+/* for returning and changing feature sets */
+
+/**
+ * struct ethtool_get_features_block - block with state of 32 features
+ * @available: mask of changeable features
+ * @requested: mask of features requested to be enabled if possible
+ * @active: mask of currently enabled features
+ * @never_changed: mask of features not changeable for any device
+ */
+struct ethtool_get_features_block {
+	__u32	available;
+	__u32	requested;
+	__u32	active;
+	__u32	never_changed;
+};
+
+/**
+ * struct ethtool_gfeatures - command to get state of device's features
+ * @cmd: command number = %ETHTOOL_GFEATURES
+ * @size: in: number of elements in the features[] array;
+ *       out: number of elements in features[] needed to hold all features
+ * @features: state of features
+ */
+struct ethtool_gfeatures {
+	__u32	cmd;
+	__u32	size;
+	struct ethtool_get_features_block features[0];
+};
+
+/**
+ * struct ethtool_set_features_block - block with request for 32 features
+ * @valid: mask of features to be changed
+ * @requested: values of features to be changed
+ */
+struct ethtool_set_features_block {
+	__u32	valid;
+	__u32	requested;
+};
+
+/**
+ * struct ethtool_sfeatures - command to request change in device's features
+ * @cmd: command number = %ETHTOOL_SFEATURES
+ * @size: array size of the features[] array
+ * @features: feature change masks
+ */
+struct ethtool_sfeatures {
+	__u32	cmd;
+	__u32	size;
+	struct ethtool_set_features_block features[0];
+};
+
+/*
+ * %ETHTOOL_SFEATURES changes features present in features[].valid to the
+ * values of corresponding bits in features[].requested. Bits in .requested
+ * not set in .valid or not changeable are ignored.
+ *
+ * Returns %EINVAL when .valid contains undefined or never-changeable bits
+ * or size is not equal to required number of features words (32-bit blocks).
+ * Returns >= 0 if request was completed; bits set in the value mean:
+ *   %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
+ *	changeable (not present in %ETHTOOL_GFEATURES' features[].available)
+ *	those bits were ignored.
+ *   %ETHTOOL_F_WISH - some or all changes requested were recorded but the
+ *      resulting state of bits masked by .valid is not equal to .requested.
+ *      Probably there are other device-specific constraints on some features
+ *      in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
+ *      here as though ignored bits were cleared.
+ *   %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
+ *      compatibility functions. Requested offload state cannot be properly
+ *      managed by kernel.
+ *
+ * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
+ * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
+ * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
+ * significant bit in features[0] fields. Empty strings mark undefined features.
+ */
+enum ethtool_sfeatures_retval_bits {
+	ETHTOOL_F_UNSUPPORTED__BIT,
+	ETHTOOL_F_WISH__BIT,
+	ETHTOOL_F_COMPAT__BIT,
+};
+
+#define ETHTOOL_F_UNSUPPORTED   (1 << ETHTOOL_F_UNSUPPORTED__BIT)
+#define ETHTOOL_F_WISH          (1 << ETHTOOL_F_WISH__BIT)
+#define ETHTOOL_F_COMPAT        (1 << ETHTOOL_F_COMPAT__BIT)
+
 
 /* CMDs currently supported */
 #define ETHTOOL_GSET		0x00000001 /* Get settings. */
@@ -373,7 +726,9 @@
 #define ETHTOOL_GMSGLVL		0x00000007 /* Get driver message level */
 #define ETHTOOL_SMSGLVL		0x00000008 /* Set driver msg level. */
 #define ETHTOOL_NWAY_RST	0x00000009 /* Restart autonegotiation. */
-#define ETHTOOL_GLINK		0x0000000a /* Get link status (ethtool_value) */
+/* Get link status for host, i.e. whether the interface *and* the
+ * physical port (if there is one) are up (ethtool_value). */
+#define ETHTOOL_GLINK		0x0000000a
 #define ETHTOOL_GEEPROM		0x0000000b /* Get EEPROM data */
 #define ETHTOOL_SEEPROM		0x0000000c /* Set EEPROM data. */
 #define ETHTOOL_GCOALESCE	0x0000000e /* Get coalesce config */
@@ -406,16 +761,31 @@
 #define ETHTOOL_GPFLAGS		0x00000027 /* Get driver-private flags bitmap */
 #define ETHTOOL_SPFLAGS		0x00000028 /* Set driver-private flags bitmap */
 
-#define	ETHTOOL_GRXFH		0x00000029 /* Get RX flow hash configuration */
-#define	ETHTOOL_SRXFH		0x0000002a /* Set RX flow hash configuration */
+#define ETHTOOL_GRXFH		0x00000029 /* Get RX flow hash configuration */
+#define ETHTOOL_SRXFH		0x0000002a /* Set RX flow hash configuration */
 #define ETHTOOL_GGRO		0x0000002b /* Get GRO enable (ethtool_value) */
 #define ETHTOOL_SGRO		0x0000002c /* Set GRO enable (ethtool_value) */
-#define	ETHTOOL_GRXRINGS	0x0000002d /* Get RX rings available for LB */
-#define	ETHTOOL_GRXCLSRLCNT	0x0000002e /* Get RX class rule count */
-#define	ETHTOOL_GRXCLSRULE	0x0000002f /* Get RX classification rule */
-#define	ETHTOOL_GRXCLSRLALL	0x00000030 /* Get all RX classification rule */
-#define	ETHTOOL_SRXCLSRLDEL	0x00000031 /* Delete RX classification rule */
-#define	ETHTOOL_SRXCLSRLINS	0x00000032 /* Insert RX classification rule */
+#define ETHTOOL_GRXRINGS	0x0000002d /* Get RX rings available for LB */
+#define ETHTOOL_GRXCLSRLCNT	0x0000002e /* Get RX class rule count */
+#define ETHTOOL_GRXCLSRULE	0x0000002f /* Get RX classification rule */
+#define ETHTOOL_GRXCLSRLALL	0x00000030 /* Get all RX classification rule */
+#define ETHTOOL_SRXCLSRLDEL	0x00000031 /* Delete RX classification rule */
+#define ETHTOOL_SRXCLSRLINS	0x00000032 /* Insert RX classification rule */
+#define ETHTOOL_FLASHDEV	0x00000033 /* Flash firmware to device */
+#define ETHTOOL_RESET		0x00000034 /* Reset hardware */
+#define ETHTOOL_SRXNTUPLE	0x00000035 /* Add an n-tuple filter to device */
+#define ETHTOOL_GRXNTUPLE	0x00000036 /* deprecated */
+#define ETHTOOL_GSSET_INFO	0x00000037 /* Get string set info */
+#define ETHTOOL_GRXFHINDIR	0x00000038 /* Get RX flow hash indir'n table */
+#define ETHTOOL_SRXFHINDIR	0x00000039 /* Set RX flow hash indir'n table */
+
+#define ETHTOOL_GFEATURES	0x0000003a /* Get device offload settings */
+#define ETHTOOL_SFEATURES	0x0000003b /* Change device offload settings */
+#define ETHTOOL_GCHANNELS	0x0000003c /* Get no of channels */
+#define ETHTOOL_SCHANNELS	0x0000003d /* Set no of channels */
+#define ETHTOOL_SET_DUMP	0x0000003e /* Set dump settings */
+#define ETHTOOL_GET_DUMP_FLAG	0x0000003f /* Get dump settings */
+#define ETHTOOL_GET_DUMP_DATA	0x00000040 /* Get dump data */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET		ETHTOOL_GSET
@@ -443,6 +813,8 @@
 #define SUPPORTED_10000baseKX4_Full	(1 << 18)
 #define SUPPORTED_10000baseKR_Full	(1 << 19)
 #define SUPPORTED_10000baseR_FEC	(1 << 20)
+#define SUPPORTED_20000baseMLD2_Full	(1 << 21)
+#define SUPPORTED_20000baseKR2_Full	(1 << 22)
 
 /* Indicates what features are advertised by the interface. */
 #define ADVERTISED_10baseT_Half		(1 << 0)
@@ -466,11 +838,13 @@
 #define ADVERTISED_10000baseKX4_Full	(1 << 18)
 #define ADVERTISED_10000baseKR_Full	(1 << 19)
 #define ADVERTISED_10000baseR_FEC	(1 << 20)
+#define ADVERTISED_20000baseMLD2_Full	(1 << 21)
+#define ADVERTISED_20000baseKR2_Full	(1 << 22)
 
 /* The following are all involved in forcing a particular link
  * mode for the device for setting things.  When getting the
  * devices settings, these indicate the current mode and whether
- * it was foced up into this mode or autonegotiated.
+ * it was forced up into this mode or autonegotiated.
  */
 
 /* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */
@@ -479,10 +853,12 @@
 #define SPEED_1000		1000
 #define SPEED_2500		2500
 #define SPEED_10000		10000
+#define SPEED_UNKNOWN		-1
 
 /* Duplex, half or full. */
 #define DUPLEX_HALF		0x00
 #define DUPLEX_FULL		0x01
+#define DUPLEX_UNKNOWN		0xff
 
 /* Which connector port. */
 #define PORT_TP			0x00
@@ -490,6 +866,8 @@
 #define PORT_MII		0x02
 #define PORT_FIBRE		0x03
 #define PORT_BNC		0x04
+#define PORT_DA			0x05
+#define PORT_NONE		0xef
 #define PORT_OTHER		0xff
 
 /* Which transceiver to use. */
@@ -519,20 +897,25 @@
 #define WAKE_MAGIC		(1 << 5)
 #define WAKE_MAGICSECURE	(1 << 6) /* only meaningful if WAKE_MAGIC */
 
-/* L3-L4 network traffic flow types */
-#define	TCP_V4_FLOW	0x01
-#define	UDP_V4_FLOW	0x02
-#define	SCTP_V4_FLOW	0x03
-#define	AH_ESP_V4_FLOW	0x04
-#define	TCP_V6_FLOW	0x05
-#define	UDP_V6_FLOW	0x06
-#define	SCTP_V6_FLOW	0x07
-#define	AH_ESP_V6_FLOW	0x08
-#define	AH_V4_FLOW	0x09
-#define	ESP_V4_FLOW	0x0a
-#define	AH_V6_FLOW	0x0b
-#define	ESP_V6_FLOW	0x0c
-#define	IP_USER_FLOW	0x0d
+/* L2-L4 network traffic flow types */
+#define	TCP_V4_FLOW	0x01	/* hash or spec (tcp_ip4_spec) */
+#define	UDP_V4_FLOW	0x02	/* hash or spec (udp_ip4_spec) */
+#define	SCTP_V4_FLOW	0x03	/* hash or spec (sctp_ip4_spec) */
+#define	AH_ESP_V4_FLOW	0x04	/* hash only */
+#define	TCP_V6_FLOW	0x05	/* hash only */
+#define	UDP_V6_FLOW	0x06	/* hash only */
+#define	SCTP_V6_FLOW	0x07	/* hash only */
+#define	AH_ESP_V6_FLOW	0x08	/* hash only */
+#define	AH_V4_FLOW	0x09	/* hash or spec (ah_ip4_spec) */
+#define	ESP_V4_FLOW	0x0a	/* hash or spec (esp_ip4_spec) */
+#define	AH_V6_FLOW	0x0b	/* hash only */
+#define	ESP_V6_FLOW	0x0c	/* hash only */
+#define	IP_USER_FLOW	0x0d	/* spec only (usr_ip4_spec) */
+#define	IPV4_FLOW	0x10	/* hash only */
+#define	IPV6_FLOW	0x11	/* hash only */
+#define	ETHER_FLOW	0x12	/* spec only (ether_spec) */
+/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
+#define	FLOW_EXT	0x80000000
 
 /* L3-L4 network traffic flow hash options */
 #define	RXH_L2DA	(1 << 1)
@@ -546,4 +929,40 @@
 
 #define	RX_CLS_FLOW_DISC	0xffffffffffffffffULL
 
+/* Special RX classification rule insert location values */
+#define RX_CLS_LOC_SPECIAL	0x80000000	/* flag */
+#define RX_CLS_LOC_ANY		0xffffffff
+#define RX_CLS_LOC_FIRST	0xfffffffe
+#define RX_CLS_LOC_LAST		0xfffffffd
+
+/* Reset flags */
+/* The reset() operation must clear the flags for the components which
+ * were actually reset.  On successful return, the flags indicate the
+ * components which were not reset, either because they do not exist
+ * in the hardware or because they cannot be reset independently.  The
+ * driver must never reset any components that were not requested.
+ */
+enum ethtool_reset_flags {
+	/* These flags represent components dedicated to the interface
+	 * the command is addressed to.  Shift any flag left by
+	 * ETH_RESET_SHARED_SHIFT to reset a shared component of the
+	 * same type.
+	 */
+	ETH_RESET_MGMT		= 1 << 0,	/* Management processor */
+	ETH_RESET_IRQ		= 1 << 1,	/* Interrupt requester */
+	ETH_RESET_DMA		= 1 << 2,	/* DMA engine */
+	ETH_RESET_FILTER	= 1 << 3,	/* Filtering/flow direction */
+	ETH_RESET_OFFLOAD	= 1 << 4,	/* Protocol offload */
+	ETH_RESET_MAC		= 1 << 5,	/* Media access controller */
+	ETH_RESET_PHY		= 1 << 6,	/* Transceiver/PHY */
+	ETH_RESET_RAM		= 1 << 7,	/* RAM shared between
+						 * multiple components */
+
+	ETH_RESET_DEDICATED	= 0x0000ffff,	/* All components dedicated to
+						 * this interface */
+	ETH_RESET_ALL		= 0xffffffff,	/* All components used by this
+						 * interface, even if shared */
+};
+#define ETH_RESET_SHARED_SHIFT	16
+
 #endif /* _LINUX_ETHTOOL_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/eventpoll.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/eventpoll.h
index d9d19ae..c38a02f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/eventpoll.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/eventpoll.h
@@ -1,5 +1,5 @@
 /*
- *  include/linux/eventpoll.h ( Efficent event polling implementation )
+ *  include/linux/eventpoll.h ( Efficient event polling implementation )
  *  Copyright (C) 2001,...,2006	 Davide Libenzi
  *
  *  This program is free software; you can redistribute it and/or modify
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ext2_fs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ext2_fs.h
index afb7507..b5f2882 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ext2_fs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ext2_fs.h
@@ -18,6 +18,7 @@
 
 #include <linux/types.h>
 #include <linux/magic.h>
+#include <linux/fs.h>
 
 /*
  * The second extended filesystem constants/structures
@@ -162,8 +163,8 @@
 
 /* Flags that should be inherited by new inodes from their parent. */
 #define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\
-			   EXT2_SYNC_FL | EXT2_IMMUTABLE_FL | EXT2_APPEND_FL |\
-			   EXT2_NODUMP_FL | EXT2_NOATIME_FL | EXT2_COMPRBLK_FL|\
+			   EXT2_SYNC_FL | EXT2_NODUMP_FL |\
+			   EXT2_NOATIME_FL | EXT2_COMPRBLK_FL |\
 			   EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\
 			   EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL)
 
@@ -531,14 +532,14 @@
  * other bits are reserved for now.
  */
 enum {
-	EXT2_FT_UNKNOWN,
-	EXT2_FT_REG_FILE,
-	EXT2_FT_DIR,
-	EXT2_FT_CHRDEV,
-	EXT2_FT_BLKDEV,
-	EXT2_FT_FIFO,
-	EXT2_FT_SOCK,
-	EXT2_FT_SYMLINK,
+	EXT2_FT_UNKNOWN		= 0,
+	EXT2_FT_REG_FILE	= 1,
+	EXT2_FT_DIR		= 2,
+	EXT2_FT_CHRDEV		= 3,
+	EXT2_FT_BLKDEV		= 4,
+	EXT2_FT_FIFO		= 5,
+	EXT2_FT_SOCK		= 6,
+	EXT2_FT_SYMLINK		= 7,
 	EXT2_FT_MAX
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/falloc.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/falloc.h
index 60cef56..e9bb4b7 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/falloc.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/falloc.h
@@ -2,6 +2,7 @@
 #define _FALLOC_H_
 
 #define FALLOC_FL_KEEP_SIZE	0x01 /* default is extend size */
+#define FALLOC_FL_PUNCH_HOLE	0x02 /* de-allocates range */
 
 
 #endif /* _FALLOC_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fanotify.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fanotify.h
new file mode 100644
index 0000000..f780e5a
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fanotify.h
@@ -0,0 +1,116 @@
+#ifndef _LINUX_FANOTIFY_H
+#define _LINUX_FANOTIFY_H
+
+#include <linux/types.h>
+
+/* the following events that user-space can register for */
+#define FAN_ACCESS		0x00000001	/* File was accessed */
+#define FAN_MODIFY		0x00000002	/* File was modified */
+#define FAN_CLOSE_WRITE		0x00000008	/* Writtable file closed */
+#define FAN_CLOSE_NOWRITE	0x00000010	/* Unwrittable file closed */
+#define FAN_OPEN		0x00000020	/* File was opened */
+
+#define FAN_Q_OVERFLOW		0x00004000	/* Event queued overflowed */
+
+#define FAN_OPEN_PERM		0x00010000	/* File open in perm check */
+#define FAN_ACCESS_PERM		0x00020000	/* File accessed in perm check */
+
+#define FAN_ONDIR		0x40000000	/* event occurred against dir */
+
+#define FAN_EVENT_ON_CHILD	0x08000000	/* interested in child events */
+
+/* helper events */
+#define FAN_CLOSE		(FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */
+
+/* flags used for fanotify_init() */
+#define FAN_CLOEXEC		0x00000001
+#define FAN_NONBLOCK		0x00000002
+
+/* These are NOT bitwise flags.  Both bits are used togther.  */
+#define FAN_CLASS_NOTIF		0x00000000
+#define FAN_CLASS_CONTENT	0x00000004
+#define FAN_CLASS_PRE_CONTENT	0x00000008
+#define FAN_ALL_CLASS_BITS	(FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \
+				 FAN_CLASS_PRE_CONTENT)
+
+#define FAN_UNLIMITED_QUEUE	0x00000010
+#define FAN_UNLIMITED_MARKS	0x00000020
+
+#define FAN_ALL_INIT_FLAGS	(FAN_CLOEXEC | FAN_NONBLOCK | \
+				 FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\
+				 FAN_UNLIMITED_MARKS)
+
+/* flags used for fanotify_modify_mark() */
+#define FAN_MARK_ADD		0x00000001
+#define FAN_MARK_REMOVE		0x00000002
+#define FAN_MARK_DONT_FOLLOW	0x00000004
+#define FAN_MARK_ONLYDIR	0x00000008
+#define FAN_MARK_MOUNT		0x00000010
+#define FAN_MARK_IGNORED_MASK	0x00000020
+#define FAN_MARK_IGNORED_SURV_MODIFY	0x00000040
+#define FAN_MARK_FLUSH		0x00000080
+
+#define FAN_ALL_MARK_FLAGS	(FAN_MARK_ADD |\
+				 FAN_MARK_REMOVE |\
+				 FAN_MARK_DONT_FOLLOW |\
+				 FAN_MARK_ONLYDIR |\
+				 FAN_MARK_MOUNT |\
+				 FAN_MARK_IGNORED_MASK |\
+				 FAN_MARK_IGNORED_SURV_MODIFY |\
+				 FAN_MARK_FLUSH)
+
+/*
+ * All of the events - we build the list by hand so that we can add flags in
+ * the future and not break backward compatibility.  Apps will get only the
+ * events that they originally wanted.  Be sure to add new events here!
+ */
+#define FAN_ALL_EVENTS (FAN_ACCESS |\
+			FAN_MODIFY |\
+			FAN_CLOSE |\
+			FAN_OPEN)
+
+/*
+ * All events which require a permission response from userspace
+ */
+#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM |\
+			     FAN_ACCESS_PERM)
+
+#define FAN_ALL_OUTGOING_EVENTS	(FAN_ALL_EVENTS |\
+				 FAN_ALL_PERM_EVENTS |\
+				 FAN_Q_OVERFLOW)
+
+#define FANOTIFY_METADATA_VERSION	3
+
+struct fanotify_event_metadata {
+	__u32 event_len;
+	__u8 vers;
+	__u8 reserved;
+	__u16 metadata_len;
+	__aligned_u64 mask;
+	__s32 fd;
+	__s32 pid;
+};
+
+struct fanotify_response {
+	__s32 fd;
+	__u32 response;
+};
+
+/* Legit userspace responses to a _PERM event */
+#define FAN_ALLOW	0x01
+#define FAN_DENY	0x02
+/* No fd set in event */
+#define FAN_NOFD	-1
+
+/* Helper functions to deal with fanotify_event_metadata buffers */
+#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
+
+#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, \
+				   (struct fanotify_event_metadata*)(((char *)(meta)) + \
+				   (meta)->event_len))
+
+#define FAN_EVENT_OK(meta, len)	((long)(len) >= (long)FAN_EVENT_METADATA_LEN && \
+				(long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \
+				(long)(meta)->event_len <= (long)(len))
+
+#endif /* _LINUX_FANOTIFY_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fb.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fb.h
index ab4b3dc..cea4280 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fb.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fb.h
@@ -4,8 +4,6 @@
 #include <linux/types.h>
 #include <linux/i2c.h>
 
-struct dentry;
-
 /* Definitions of frame buffers						*/
 
 #define FB_MAX			32	/* sufficient for now */
@@ -33,13 +31,14 @@
 #define FBIOGET_HWCINFO         0x4616
 #define FBIOPUT_MODEINFO        0x4617
 #define FBIOGET_DISPINFO        0x4618
-
+#define FBIO_WAITFORVSYNC	_IOW('F', 0x20, __u32)
 
 #define FB_TYPE_PACKED_PIXELS		0	/* Packed Pixels	*/
 #define FB_TYPE_PLANES			1	/* Non interleaved planes */
 #define FB_TYPE_INTERLEAVED_PLANES	2	/* Interleaved planes	*/
 #define FB_TYPE_TEXT			3	/* Text/attributes	*/
 #define FB_TYPE_VGA_PLANES		4	/* EGA/VGA planes	*/
+#define FB_TYPE_FOURCC			5	/* Type identified by a V4L2 FOURCC */
 
 #define FB_AUX_TEXT_MDA		0	/* Monochrome text */
 #define FB_AUX_TEXT_CGA		1	/* CGA/EGA/VGA Color text */
@@ -64,6 +63,7 @@
 #define FB_VISUAL_PSEUDOCOLOR		3	/* Pseudo color (like atari) */
 #define FB_VISUAL_DIRECTCOLOR		4	/* Direct color */
 #define FB_VISUAL_STATIC_PSEUDOCOLOR	5	/* Pseudo color readonly */
+#define FB_VISUAL_FOURCC		6	/* Visual identified by a V4L2 FOURCC */
 
 #define FB_ACCEL_NONE		0	/* no hardware accelerator	*/
 #define FB_ACCEL_ATARIBLITT	1	/* Atari Blitter		*/
@@ -120,6 +120,7 @@
 #define FB_ACCEL_TRIDENT_BLADE3D 52	/* Trident Blade3D		*/
 #define FB_ACCEL_TRIDENT_BLADEXP 53	/* Trident BladeXP		*/
 #define FB_ACCEL_CIRRUS_ALPINE   53	/* Cirrus Logic 543x/544x/5480	*/
+#define FB_ACCEL_GLAMO		50	/* SMedia Glamo                 */
 #define FB_ACCEL_NEOMAGIC_NM2070 90	/* NeoMagic NM2070              */
 #define FB_ACCEL_NEOMAGIC_NM2090 91	/* NeoMagic NM2090              */
 #define FB_ACCEL_NEOMAGIC_NM2093 92	/* NeoMagic NM2093              */
@@ -129,6 +130,7 @@
 #define FB_ACCEL_NEOMAGIC_NM2230 96	/* NeoMagic NM2230              */
 #define FB_ACCEL_NEOMAGIC_NM2360 97	/* NeoMagic NM2360              */
 #define FB_ACCEL_NEOMAGIC_NM2380 98	/* NeoMagic NM2380              */
+#define FB_ACCEL_PXA3XX		 99	/* PXA3xx			*/
 
 #define FB_ACCEL_SAVAGE4        0x80	/* S3 Savage4                   */
 #define FB_ACCEL_SAVAGE3D       0x81	/* S3 Savage3D                  */
@@ -146,6 +148,10 @@
 #define FB_ACCEL_PROSAVAGE_DDR  0x8d	/* S3 ProSavage DDR             */
 #define FB_ACCEL_PROSAVAGE_DDRK 0x8e	/* S3 ProSavage DDR-K           */
 
+#define FB_ACCEL_PUV3_UNIGFX	0xa0	/* PKUnity-v3 Unigfx		*/
+
+#define FB_CAP_FOURCC		1	/* Device supports FOURCC-based formats */
+
 struct fb_fix_screeninfo {
 	char id[16];			/* identification string eg "TT Builtin" */
 	unsigned long smem_start;	/* Start of frame buffer mem */
@@ -163,7 +169,8 @@
 	__u32 mmio_len;			/* Length of Memory Mapped I/O  */
 	__u32 accel;			/* Indicate to driver which	*/
 					/*  specific chip/card we have	*/
-	__u16 reserved[3];		/* Reserved for future compatibility */
+	__u16 capabilities;		/* see FB_CAP_*			*/
+	__u16 reserved[2];		/* Reserved for future compatibility */
 };
 
 /* Interpretation of offset for color fields: All offsets are from the right,
@@ -238,8 +245,8 @@
 	__u32 yoffset;			/* resolution			*/
 
 	__u32 bits_per_pixel;		/* guess what			*/
-	__u32 grayscale;		/* != 0 Graylevels instead of colors */
-
+	__u32 grayscale;		/* 0 = color, 1 = grayscale,	*/
+					/* >1 = FOURCC			*/
 	struct fb_bitfield red;		/* bitfield in fb mem if true color, */
 	struct fb_bitfield green;	/* else only length is significant */
 	struct fb_bitfield blue;
@@ -265,7 +272,8 @@
 	__u32 sync;			/* see FB_SYNC_*		*/
 	__u32 vmode;			/* see FB_VMODE_*		*/
 	__u32 rotate;			/* angle we rotate counter clockwise */
-	__u32 reserved[5];		/* Reserved for future compatibility */
+	__u32 colorspace;		/* colorspace for FOURCC-based modes */
+	__u32 reserved[4];		/* Reserved for future compatibility */
 };
 
 struct fb_cmap {
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fcntl.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fcntl.h
index a4cd365..df54484 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fcntl.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fcntl.h
@@ -22,6 +22,12 @@
 #define F_NOTIFY	(F_LINUX_SPECIFIC_BASE+2)
 
 /*
+ * Set and get of pipe page size array
+ */
+#define F_SETPIPE_SZ	(F_LINUX_SPECIFIC_BASE + 7)
+#define F_GETPIPE_SZ	(F_LINUX_SPECIFIC_BASE + 8)
+
+/*
  * Types of directory notifications that may be requested.
  */
 #define DN_ACCESS	0x00000001	/* File accessed */
@@ -39,6 +45,8 @@
 #define AT_REMOVEDIR		0x200   /* Remove directory instead of
                                            unlinking file.  */
 #define AT_SYMLINK_FOLLOW	0x400   /* Follow symbolic links.  */
+#define AT_NO_AUTOMOUNT		0x800	/* Suppress terminal automount traversal */
+#define AT_EMPTY_PATH		0x1000	/* Allow empty relative pathname */
 
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fd.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fd.h
index d64375a..60a1a59 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fd.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fd.h
@@ -377,4 +377,6 @@
 #define FDEJECT _IO(2, 0x5a)
 /* eject the disk */
 
+
+
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fdreg.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fdreg.h
index c2eeb63..61ce641 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fdreg.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fdreg.h
@@ -89,7 +89,7 @@
 /* the following commands are new in the 82078. They are not used in the
  * floppy driver, except the first three. These commands may be useful for apps
  * which use the FDRAWCMD interface. For doc, get the 82078 spec sheets at
- * http://www-techdoc.intel.com/docs/periph/fd_contr/datasheets/ */
+ * http://www.intel.com/design/archives/periphrl/docs/29046803.htm */
 
 #define FD_PARTID		0x18	/* part id ("extended" version cmd) */
 #define FD_SAVE			0x2e	/* save fdc regs for later restore */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fib_rules.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fib_rules.h
index 87b606b..51da65b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fib_rules.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fib_rules.h
@@ -8,13 +8,14 @@
 #define FIB_RULE_PERMANENT	0x00000001
 #define FIB_RULE_INVERT		0x00000002
 #define FIB_RULE_UNRESOLVED	0x00000004
-#define FIB_RULE_DEV_DETACHED	0x00000008
+#define FIB_RULE_IIF_DETACHED	0x00000008
+#define FIB_RULE_DEV_DETACHED	FIB_RULE_IIF_DETACHED
+#define FIB_RULE_OIF_DETACHED	0x00000010
 
 /* try to find source address in routing lookups */
 #define FIB_RULE_FIND_SADDR	0x00010000
 
-struct fib_rule_hdr
-{
+struct fib_rule_hdr {
 	__u8		family;
 	__u8		dst_len;
 	__u8		src_len;
@@ -28,12 +29,12 @@
 	__u32		flags;
 };
 
-enum
-{
+enum {
 	FRA_UNSPEC,
 	FRA_DST,	/* destination address */
 	FRA_SRC,	/* source address */
-	FRA_IFNAME,	/* interface name */
+	FRA_IIFNAME,	/* interface name */
+#define FRA_IFNAME	FRA_IIFNAME
 	FRA_GOTO,	/* target to jump to (FR_ACT_GOTO) */
 	FRA_UNUSED2,
 	FRA_PRIORITY,	/* priority/preference */
@@ -47,13 +48,13 @@
 	FRA_UNUSED8,
 	FRA_TABLE,	/* Extended table id */
 	FRA_FWMASK,	/* mask for netfilter mark */
+	FRA_OIFNAME,
 	__FRA_MAX
 };
 
 #define FRA_MAX (__FRA_MAX - 1)
 
-enum
-{
+enum {
 	FR_ACT_UNSPEC,
 	FR_ACT_TO_TBL,		/* Pass to fixed table */
 	FR_ACT_GOTO,		/* Jump to another rule */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fiemap.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fiemap.h
index 934e22d..d830747 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fiemap.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fiemap.h
@@ -62,5 +62,7 @@
 #define FIEMAP_EXTENT_MERGED		0x00001000 /* File does not natively
 						    * support extents. Result
 						    * merged for efficiency. */
+#define FIEMAP_EXTENT_SHARED		0x00002000 /* Space shared with other
+						    * files. */
 
 #endif /* _LINUX_FIEMAP_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/filter.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/filter.h
index 0e4dbed..839e026 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/filter.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/filter.h
@@ -20,16 +20,14 @@
  *	the BPF code definitions which need to match so you can share filters
  */
  
-struct sock_filter	/* Filter block */
-{
+struct sock_filter {	/* Filter block */
 	__u16	code;   /* Actual filter code */
 	__u8	jt;	/* Jump true */
 	__u8	jf;	/* Jump false */
 	__u32	k;      /* Generic multiuse field */
 };
 
-struct sock_fprog	/* Required for SO_ATTACH_FILTER. */
-{
+struct sock_fprog {	/* Required for SO_ATTACH_FILTER. */
 	unsigned short		len;	/* Number of filter blocks */
 	struct sock_filter *filter;
 };
@@ -120,7 +118,12 @@
 #define SKF_AD_IFINDEX 	8
 #define SKF_AD_NLATTR	12
 #define SKF_AD_NLATTR_NEST	16
-#define SKF_AD_MAX	20
+#define SKF_AD_MARK 	20
+#define SKF_AD_QUEUE	24
+#define SKF_AD_HATYPE	28
+#define SKF_AD_RXHASH	32
+#define SKF_AD_CPU	36
+#define SKF_AD_MAX	40
 #define SKF_NET_OFF   (-0x100000)
 #define SKF_LL_OFF    (-0x200000)
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/firewire-cdev.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/firewire-cdev.h
index c6b3ca3..357dbfc 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/firewire-cdev.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/firewire-cdev.h
@@ -1,21 +1,26 @@
 /*
  * Char device interface.
  *
- * Copyright (C) 2005-2006  Kristian Hoegsberg <krh@bitplanet.net>
+ * Copyright (C) 2005-2007  Kristian Hoegsberg <krh@bitplanet.net>
  *
- * 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.
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
  *
- * 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.
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
  *
- * 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.
+ * 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 _LINUX_FIREWIRE_CDEV_H
@@ -25,12 +30,21 @@
 #include <linux/types.h>
 #include <linux/firewire-constants.h>
 
-#define FW_CDEV_EVENT_BUS_RESET			0x00
-#define FW_CDEV_EVENT_RESPONSE			0x01
-#define FW_CDEV_EVENT_REQUEST			0x02
-#define FW_CDEV_EVENT_ISO_INTERRUPT		0x03
-#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED	0x04
-#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED	0x05
+/* available since kernel version 2.6.22 */
+#define FW_CDEV_EVENT_BUS_RESET				0x00
+#define FW_CDEV_EVENT_RESPONSE				0x01
+#define FW_CDEV_EVENT_REQUEST				0x02
+#define FW_CDEV_EVENT_ISO_INTERRUPT			0x03
+
+/* available since kernel version 2.6.30 */
+#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED		0x04
+#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED		0x05
+
+/* available since kernel version 2.6.36 */
+#define FW_CDEV_EVENT_REQUEST2				0x06
+#define FW_CDEV_EVENT_PHY_PACKET_SENT			0x07
+#define FW_CDEV_EVENT_PHY_PACKET_RECEIVED		0x08
+#define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL	0x09
 
 /**
  * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types
@@ -63,6 +77,10 @@
  * This event is sent when the bus the device belongs to goes through a bus
  * reset.  It provides information about the new bus configuration, such as
  * new node ID for this device, new root ID, and others.
+ *
+ * If @bm_node_id is 0xffff right after bus reset it can be reread by an
+ * %FW_CDEV_IOC_GET_INFO ioctl after bus manager selection was finished.
+ * Kernels with ABI version < 4 do not set @bm_node_id.
  */
 struct fw_cdev_event_bus_reset {
 	__u64 closure;
@@ -77,8 +95,9 @@
 
 /**
  * struct fw_cdev_event_response - Sent when a response packet was received
- * @closure:	See &fw_cdev_event_common;
- *		set by %FW_CDEV_IOC_SEND_REQUEST ioctl
+ * @closure:	See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST
+ *		or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST
+ *		or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl
  * @type:	See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE
  * @rcode:	Response code returned by the remote node
  * @length:	Data length, i.e. the response's payload size in bytes
@@ -88,6 +107,11 @@
  * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl.  The payload data for responses
  * carrying data (read and lock responses) follows immediately and can be
  * accessed through the @data field.
+ *
+ * The event is also generated after conclusions of transactions that do not
+ * involve response packets.  This includes unified write transactions,
+ * broadcast write transactions, and transmission of asynchronous stream
+ * packets.  @rcode indicates success or failure of such transmissions.
  */
 struct fw_cdev_event_response {
 	__u64 closure;
@@ -98,11 +122,33 @@
 };
 
 /**
- * struct fw_cdev_event_request - Sent on incoming request to an address region
- * @closure:	See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
+ * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2
  * @type:	See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST
+ *
+ * This event is sent instead of &fw_cdev_event_request2 if the kernel or
+ * the client implements ABI version <= 3.  &fw_cdev_event_request lacks
+ * essential information; use &fw_cdev_event_request2 instead.
+ */
+struct fw_cdev_event_request {
+	__u64 closure;
+	__u32 type;
+	__u32 tcode;
+	__u64 offset;
+	__u32 handle;
+	__u32 length;
+	__u32 data[0];
+};
+
+/**
+ * struct fw_cdev_event_request2 - Sent on incoming request to an address region
+ * @closure:	See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
+ * @type:	See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2
  * @tcode:	Transaction code of the incoming request
  * @offset:	The offset into the 48-bit per-node address space
+ * @source_node_id: Sender node ID
+ * @destination_node_id: Destination node ID
+ * @card:	The index of the card from which the request came
+ * @generation:	Bus generation in which the request is valid
  * @handle:	Reference to the kernel-side pending request
  * @length:	Data length, i.e. the request's payload size in bytes
  * @data:	Incoming data, if any
@@ -115,12 +161,42 @@
  *
  * The payload data for requests carrying data (write and lock requests)
  * follows immediately and can be accessed through the @data field.
+ *
+ * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the
+ * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT,
+ * i.e. encodes the extended transaction code.
+ *
+ * @card may differ from &fw_cdev_get_info.card because requests are received
+ * from all cards of the Linux host.  @source_node_id, @destination_node_id, and
+ * @generation pertain to that card.  Destination node ID and bus generation may
+ * therefore differ from the corresponding fields of the last
+ * &fw_cdev_event_bus_reset.
+ *
+ * @destination_node_id may also differ from the current node ID because of a
+ * non-local bus ID part or in case of a broadcast write request.  Note, a
+ * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a
+ * broadcast write request; the kernel will then release the kernel-side pending
+ * request but will not actually send a response packet.
+ *
+ * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already
+ * sent a write response immediately after the request was received; in this
+ * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to
+ * release the kernel-side pending request, though another response won't be
+ * sent.
+ *
+ * If the client subsequently needs to initiate requests to the sender node of
+ * an &fw_cdev_event_request2, it needs to use a device file with matching
+ * card index, node ID, and generation for outbound requests.
  */
-struct fw_cdev_event_request {
+struct fw_cdev_event_request2 {
 	__u64 closure;
 	__u32 type;
 	__u32 tcode;
 	__u64 offset;
+	__u32 source_node_id;
+	__u32 destination_node_id;
+	__u32 card;
+	__u32 generation;
 	__u32 handle;
 	__u32 length;
 	__u32 data[0];
@@ -136,26 +212,43 @@
  * @header:	Stripped headers, if any
  *
  * This event is sent when the controller has completed an &fw_cdev_iso_packet
- * with the %FW_CDEV_ISO_INTERRUPT bit set.  In the receive case, the headers
- * stripped of all packets up until and including the interrupt packet are
- * returned in the @header field.  The amount of header data per packet is as
- * specified at iso context creation by &fw_cdev_create_iso_context.header_size.
+ * with the %FW_CDEV_ISO_INTERRUPT bit set.
  *
- * In version 1 of this ABI, header data consisted of the 1394 isochronous
- * packet header, followed by quadlets from the packet payload if
- * &fw_cdev_create_iso_context.header_size > 4.
+ * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT):
  *
- * In version 2 of this ABI, header data consist of the 1394 isochronous
- * packet header, followed by a timestamp quadlet if
- * &fw_cdev_create_iso_context.header_size > 4, followed by quadlets from the
- * packet payload if &fw_cdev_create_iso_context.header_size > 8.
+ * In version 3 and some implementations of version 2 of the ABI, &header_length
+ * is a multiple of 4 and &header contains timestamps of all packets up until
+ * the interrupt packet.  The format of the timestamps is as described below for
+ * isochronous reception.  In version 1 of the ABI, &header_length was 0.
  *
+ * Isochronous receive events (context type %FW_CDEV_ISO_CONTEXT_RECEIVE):
+ *
+ * The headers stripped of all packets up until and including the interrupt
+ * packet are returned in the @header field.  The amount of header data per
+ * packet is as specified at iso context creation by
+ * &fw_cdev_create_iso_context.header_size.
+ *
+ * Hence, _interrupt.header_length / _context.header_size is the number of
+ * packets received in this interrupt event.  The client can now iterate
+ * through the mmap()'ed DMA buffer according to this number of packets and
+ * to the buffer sizes as the client specified in &fw_cdev_queue_iso.
+ *
+ * Since version 2 of this ABI, the portion for each packet in _interrupt.header
+ * consists of the 1394 isochronous packet header, followed by a timestamp
+ * quadlet if &fw_cdev_create_iso_context.header_size > 4, followed by quadlets
+ * from the packet payload if &fw_cdev_create_iso_context.header_size > 8.
+ *
+ * Format of 1394 iso packet header:  16 bits data_length, 2 bits tag, 6 bits
+ * channel, 4 bits tcode, 4 bits sy, in big endian byte order.
+ * data_length is the actual received size of the packet without the four
+ * 1394 iso packet header bytes.
+ *
+ * Format of timestamp:  16 bits invalid, 3 bits cycleSeconds, 13 bits
+ * cycleCount, in big endian byte order.
+ *
+ * In version 1 of the ABI, no timestamp quadlet was inserted; instead, payload
+ * data followed directly after the 1394 is header if header_size > 4.
  * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2.
- *
- * Format of 1394 iso packet header: 16 bits len, 2 bits tag, 6 bits channel,
- * 4 bits tcode, 4 bits sy, in big endian byte order.  Format of timestamp:
- * 16 bits invalid, 3 bits cycleSeconds, 13 bits cycleCount, in big endian byte
- * order.
  */
 struct fw_cdev_event_iso_interrupt {
 	__u64 closure;
@@ -166,6 +259,43 @@
 };
 
 /**
+ * struct fw_cdev_event_iso_interrupt_mc - An iso buffer chunk was completed
+ * @closure:	See &fw_cdev_event_common;
+ *		set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
+ * @type:	%FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
+ * @completed:	Offset into the receive buffer; data before this offset is valid
+ *
+ * This event is sent in multichannel contexts (context type
+ * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer
+ * chunks that have the %FW_CDEV_ISO_INTERRUPT bit set.  Whether this happens
+ * when a packet is completed and/or when a buffer chunk is completed depends
+ * on the hardware implementation.
+ *
+ * The buffer is continuously filled with the following data, per packet:
+ *  - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt,
+ *    but in little endian byte order,
+ *  - packet payload (as many bytes as specified in the data_length field of
+ *    the 1394 iso packet header) in big endian byte order,
+ *  - 0...3 padding bytes as needed to align the following trailer quadlet,
+ *  - trailer quadlet, containing the reception timestamp as described at
+ *    &fw_cdev_event_iso_interrupt, but in little endian byte order.
+ *
+ * Hence the per-packet size is data_length (rounded up to a multiple of 4) + 8.
+ * When processing the data, stop before a packet that would cross the
+ * @completed offset.
+ *
+ * A packet near the end of a buffer chunk will typically spill over into the
+ * next queued buffer chunk.  It is the responsibility of the client to check
+ * for this condition, assemble a broken-up packet from its parts, and not to
+ * re-queue any buffer chunks in which as yet unread packet parts reside.
+ */
+struct fw_cdev_event_iso_interrupt_mc {
+	__u64 closure;
+	__u32 type;
+	__u32 completed;
+};
+
+/**
  * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed
  * @closure:	See &fw_cdev_event_common;
  *		set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl
@@ -195,15 +325,45 @@
 };
 
 /**
+ * struct fw_cdev_event_phy_packet - A PHY packet was transmitted or received
+ * @closure:	See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET
+ *		or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl
+ * @type:	%FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED
+ * @rcode:	%RCODE_..., indicates success or failure of transmission
+ * @length:	Data length in bytes
+ * @data:	Incoming data
+ *
+ * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty,
+ * except in case of a ping packet:  Then, @length is 4, and @data[0] is the
+ * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE.
+ *
+ * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data
+ * consists of the two PHY packet quadlets, in host byte order.
+ */
+struct fw_cdev_event_phy_packet {
+	__u64 closure;
+	__u32 type;
+	__u32 rcode;
+	__u32 length;
+	__u32 data[0];
+};
+
+/**
  * union fw_cdev_event - Convenience union of fw_cdev_event_ types
- * @common:        Valid for all types
- * @bus_reset:     Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
- * @response:      Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
- * @request:       Valid if @common.type == %FW_CDEV_EVENT_REQUEST
- * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
- * @iso_resource:  Valid if @common.type ==
+ * @common:		Valid for all types
+ * @bus_reset:		Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
+ * @response:		Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
+ * @request:		Valid if @common.type == %FW_CDEV_EVENT_REQUEST
+ * @request2:		Valid if @common.type == %FW_CDEV_EVENT_REQUEST2
+ * @iso_interrupt:	Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
+ * @iso_interrupt_mc:	Valid if @common.type ==
+ *				%FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
+ * @iso_resource:	Valid if @common.type ==
  *				%FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
  *				%FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
+ * @phy_packet:		Valid if @common.type ==
+ *				%FW_CDEV_EVENT_PHY_PACKET_SENT or
+ *				%FW_CDEV_EVENT_PHY_PACKET_RECEIVED
  *
  * Convenience union for userspace use.  Events could be read(2) into an
  * appropriately aligned char buffer and then cast to this union for further
@@ -218,8 +378,11 @@
 	struct fw_cdev_event_bus_reset		bus_reset;
 	struct fw_cdev_event_response		response;
 	struct fw_cdev_event_request		request;
+	struct fw_cdev_event_request2		request2;		/* added in 2.6.36 */
 	struct fw_cdev_event_iso_interrupt	iso_interrupt;
-	struct fw_cdev_event_iso_resource	iso_resource;
+	struct fw_cdev_event_iso_interrupt_mc	iso_interrupt_mc;	/* added in 2.6.36 */
+	struct fw_cdev_event_iso_resource	iso_resource;		/* added in 2.6.30 */
+	struct fw_cdev_event_phy_packet		phy_packet;		/* added in 2.6.36 */
 };
 
 /* available since kernel version 2.6.22 */
@@ -248,30 +411,62 @@
 #define FW_CDEV_IOC_SEND_BROADCAST_REQUEST       _IOW('#', 0x12, struct fw_cdev_send_request)
 #define FW_CDEV_IOC_SEND_STREAM_PACKET           _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
 
+/* available since kernel version 2.6.34 */
+#define FW_CDEV_IOC_GET_CYCLE_TIMER2   _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
+
+/* available since kernel version 2.6.36 */
+#define FW_CDEV_IOC_SEND_PHY_PACKET    _IOWR('#', 0x15, struct fw_cdev_send_phy_packet)
+#define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets)
+#define FW_CDEV_IOC_SET_ISO_CHANNELS    _IOW('#', 0x17, struct fw_cdev_set_iso_channels)
+
 /*
- * FW_CDEV_VERSION History
+ * ABI version history
  *  1  (2.6.22)  - initial version
+ *     (2.6.24)  - added %FW_CDEV_IOC_GET_CYCLE_TIMER
  *  2  (2.6.30)  - changed &fw_cdev_event_iso_interrupt.header if
  *                 &fw_cdev_create_iso_context.header_size is 8 or more
+ *               - added %FW_CDEV_IOC_*_ISO_RESOURCE*,
+ *                 %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST,
+ *                 %FW_CDEV_IOC_SEND_STREAM_PACKET
+ *     (2.6.32)  - added time stamp to xmit &fw_cdev_event_iso_interrupt
+ *     (2.6.33)  - IR has always packet-per-buffer semantics now, not one of
+ *                 dual-buffer or packet-per-buffer depending on hardware
+ *               - shared use and auto-response for FCP registers
+ *  3  (2.6.34)  - made &fw_cdev_get_cycle_timer reliable
+ *               - added %FW_CDEV_IOC_GET_CYCLE_TIMER2
+ *  4  (2.6.36)  - added %FW_CDEV_EVENT_REQUEST2, %FW_CDEV_EVENT_PHY_PACKET_*,
+ *                 and &fw_cdev_allocate.region_end
+ *               - implemented &fw_cdev_event_bus_reset.bm_node_id
+ *               - added %FW_CDEV_IOC_SEND_PHY_PACKET, _RECEIVE_PHY_PACKETS
+ *               - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL,
+ *                 %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and
+ *                 %FW_CDEV_IOC_SET_ISO_CHANNELS
  */
-#define FW_CDEV_VERSION 2
 
 /**
  * struct fw_cdev_get_info - General purpose information ioctl
- * @version:	The version field is just a running serial number.
- *		We never break backwards compatibility, but may add more
- *		structs and ioctls in later revisions.
- * @rom_length:	If @rom is non-zero, at most rom_length bytes of configuration
+ * @version:	The version field is just a running serial number.  Both an
+ *		input parameter (ABI version implemented by the client) and
+ *		output parameter (ABI version implemented by the kernel).
+ *		A client shall fill in the ABI @version for which the client
+ *		was implemented.  This is necessary for forward compatibility.
+ * @rom_length:	If @rom is non-zero, up to @rom_length bytes of Configuration
  *		ROM will be copied into that user space address.  In either
  *		case, @rom_length is updated with the actual length of the
- *		configuration ROM.
+ *		Configuration ROM.
  * @rom:	If non-zero, address of a buffer to be filled by a copy of the
- *		device's configuration ROM
+ *		device's Configuration ROM
  * @bus_reset:	If non-zero, address of a buffer to be filled by a
  *		&struct fw_cdev_event_bus_reset with the current state
  *		of the bus.  This does not cause a bus reset to happen.
  * @bus_reset_closure: Value of &closure in this and subsequent bus reset events
  * @card:	The index of the card this device belongs to
+ *
+ * The %FW_CDEV_IOC_GET_INFO ioctl is usually the very first one which a client
+ * performs right after it opened a /dev/fw* file.
+ *
+ * As a side effect, reception of %FW_CDEV_EVENT_BUS_RESET events to be read(2)
+ * is started by this ioctl.
  */
 struct fw_cdev_get_info {
 	__u32 version;
@@ -327,25 +522,48 @@
 };
 
 /**
- * struct fw_cdev_allocate - Allocate a CSR address range
+ * struct fw_cdev_allocate - Allocate a CSR in an address range
  * @offset:	Start offset of the address range
  * @closure:	To be passed back to userspace in request events
- * @length:	Length of the address range, in bytes
+ * @length:	Length of the CSR, in bytes
  * @handle:	Handle to the allocation, written by the kernel
+ * @region_end:	First address above the address range (added in ABI v4, 2.6.36)
  *
  * Allocate an address range in the 48-bit address space on the local node
  * (the controller).  This allows userspace to listen for requests with an
- * offset within that address range.  When the kernel receives a request
- * within the range, an &fw_cdev_event_request event will be written back.
- * The @closure field is passed back to userspace in the response event.
+ * offset within that address range.  Every time when the kernel receives a
+ * request within the range, an &fw_cdev_event_request2 event will be emitted.
+ * (If the kernel or the client implements ABI version <= 3, an
+ * &fw_cdev_event_request will be generated instead.)
+ *
+ * The @closure field is passed back to userspace in these request events.
  * The @handle field is an out parameter, returning a handle to the allocated
  * range to be used for later deallocation of the range.
+ *
+ * The address range is allocated on all local nodes.  The address allocation
+ * is exclusive except for the FCP command and response registers.  If an
+ * exclusive address region is already in use, the ioctl fails with errno set
+ * to %EBUSY.
+ *
+ * If kernel and client implement ABI version >= 4, the kernel looks up a free
+ * spot of size @length inside [@offset..@region_end) and, if found, writes
+ * the start address of the new CSR back in @offset.  I.e. @offset is an
+ * in and out parameter.  If this automatic placement of a CSR in a bigger
+ * address range is not desired, the client simply needs to set @region_end
+ * = @offset + @length.
+ *
+ * If the kernel or the client implements ABI version <= 3, @region_end is
+ * ignored and effectively assumed to be @offset + @length.
+ *
+ * @region_end is only present in a kernel header >= 2.6.36.  If necessary,
+ * this can for example be tested by #ifdef FW_CDEV_EVENT_REQUEST2.
  */
 struct fw_cdev_allocate {
 	__u64 offset;
 	__u64 closure;
 	__u32 length;
 	__u32 handle;
+	__u64 region_end;	/* available since kernel version 2.6.36 */
 };
 
 /**
@@ -367,9 +585,14 @@
  * Initiate a bus reset for the bus this device is on.  The bus reset can be
  * either the original (long) bus reset or the arbitrated (short) bus reset
  * introduced in 1394a-2000.
+ *
+ * The ioctl returns immediately.  A subsequent &fw_cdev_event_bus_reset
+ * indicates when the reset actually happened.  Since ABI v4, this may be
+ * considerably later than the ioctl because the kernel ensures a grace period
+ * between subsequent bus resets as per IEEE 1394 bus management specification.
  */
 struct fw_cdev_initiate_bus_reset {
-	__u32 type;	/* FW_CDEV_SHORT_RESET or FW_CDEV_LONG_RESET */
+	__u32 type;
 };
 
 /**
@@ -377,11 +600,11 @@
  * @immediate:	If non-zero, immediate key to insert before pointer
  * @key:	Upper 8 bits of root directory pointer
  * @data:	Userspace pointer to contents of descriptor block
- * @length:	Length of descriptor block data, in bytes
+ * @length:	Length of descriptor block data, in quadlets
  * @handle:	Handle to the descriptor, written by the kernel
  *
  * Add a descriptor block and optionally a preceding immediate key to the local
- * node's configuration ROM.
+ * node's Configuration ROM.
  *
  * The @key field specifies the upper 8 bits of the descriptor root directory
  * pointer and the @data and @length fields specify the contents. The @key
@@ -391,11 +614,14 @@
  * If not 0, the @immediate field specifies an immediate key which will be
  * inserted before the root directory pointer.
  *
- * If successful, the kernel adds the descriptor and writes back a handle to the
- * kernel-side object to be used for later removal of the descriptor block and
- * immediate key.
+ * @immediate, @key, and @data array elements are CPU-endian quadlets.
  *
- * This ioctl affects the configuration ROMs of all local nodes.
+ * If successful, the kernel adds the descriptor and writes back a @handle to
+ * the kernel-side object to be used for later removal of the descriptor block
+ * and immediate key.  The kernel will also generate a bus reset to signal the
+ * change of the Configuration ROM to other nodes.
+ *
+ * This ioctl affects the Configuration ROMs of all local nodes.
  * The ioctl only succeeds on device files which represent a local node.
  */
 struct fw_cdev_add_descriptor {
@@ -407,40 +633,55 @@
 };
 
 /**
- * struct fw_cdev_remove_descriptor - Remove contents from the configuration ROM
+ * struct fw_cdev_remove_descriptor - Remove contents from the Configuration ROM
  * @handle:	Handle to the descriptor, as returned by the kernel when the
  *		descriptor was added
  *
  * Remove a descriptor block and accompanying immediate key from the local
- * nodes' configuration ROMs.
+ * nodes' Configuration ROMs.  The kernel will also generate a bus reset to
+ * signal the change of the Configuration ROM to other nodes.
  */
 struct fw_cdev_remove_descriptor {
 	__u32 handle;
 };
 
-#define FW_CDEV_ISO_CONTEXT_TRANSMIT	0
-#define FW_CDEV_ISO_CONTEXT_RECEIVE	1
+#define FW_CDEV_ISO_CONTEXT_TRANSMIT			0
+#define FW_CDEV_ISO_CONTEXT_RECEIVE			1
+#define FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL	2 /* added in 2.6.36 */
 
 /**
- * struct fw_cdev_create_iso_context - Create a context for isochronous IO
- * @type:	%FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE
- * @header_size: Header size to strip for receive contexts
- * @channel:	Channel to bind to
- * @speed:	Speed to transmit at
- * @closure:	To be returned in &fw_cdev_event_iso_interrupt
+ * struct fw_cdev_create_iso_context - Create a context for isochronous I/O
+ * @type:	%FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE or
+ *		%FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL
+ * @header_size: Header size to strip in single-channel reception
+ * @channel:	Channel to bind to in single-channel reception or transmission
+ * @speed:	Transmission speed
+ * @closure:	To be returned in &fw_cdev_event_iso_interrupt or
+ *		&fw_cdev_event_iso_interrupt_multichannel
  * @handle:	Handle to context, written back by kernel
  *
  * Prior to sending or receiving isochronous I/O, a context must be created.
  * The context records information about the transmit or receive configuration
  * and typically maps to an underlying hardware resource.  A context is set up
  * for either sending or receiving.  It is bound to a specific isochronous
- * channel.
+ * @channel.
+ *
+ * In case of multichannel reception, @header_size and @channel are ignored
+ * and the channels are selected by %FW_CDEV_IOC_SET_ISO_CHANNELS.
+ *
+ * For %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, @header_size must be at least 4
+ * and must be a multiple of 4.  It is ignored in other context types.
+ *
+ * @speed is ignored in receive context types.
  *
  * If a context was successfully created, the kernel writes back a handle to the
  * context, which must be passed in for subsequent operations on that context.
  *
- * Note that the effect of a @header_size > 4 depends on
- * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt.
+ * Limitations:
+ * No more than one iso context can be created per fd.
+ * The total number of contexts that all userspace and kernelspace drivers can
+ * create on a card at a time is a hardware limit, typically 4 or 8 contexts per
+ * direction, and of them at most one multichannel receive context.
  */
 struct fw_cdev_create_iso_context {
 	__u32 type;
@@ -451,6 +692,22 @@
 	__u32 handle;
 };
 
+/**
+ * struct fw_cdev_set_iso_channels - Select channels in multichannel reception
+ * @channels:	Bitmask of channels to listen to
+ * @handle:	Handle of the mutichannel receive context
+ *
+ * @channels is the bitwise or of 1ULL << n for each channel n to listen to.
+ *
+ * The ioctl fails with errno %EBUSY if there is already another receive context
+ * on a channel in @channels.  In that case, the bitmask of all unoccupied
+ * channels is returned in @channels.
+ */
+struct fw_cdev_set_iso_channels {
+	__u64 channels;
+	__u32 handle;
+};
+
 #define FW_CDEV_ISO_PAYLOAD_LENGTH(v)	(v)
 #define FW_CDEV_ISO_INTERRUPT		(1 << 16)
 #define FW_CDEV_ISO_SKIP		(1 << 17)
@@ -461,18 +718,72 @@
 
 /**
  * struct fw_cdev_iso_packet - Isochronous packet
- * @control:	Contains the header length (8 uppermost bits), the sy field
- *		(4 bits), the tag field (2 bits), a sync flag (1 bit),
- *		a skip flag (1 bit), an interrupt flag (1 bit), and the
+ * @control:	Contains the header length (8 uppermost bits),
+ *		the sy field (4 bits), the tag field (2 bits), a sync flag
+ *		or a skip flag (1 bit), an interrupt flag (1 bit), and the
  *		payload length (16 lowermost bits)
- * @header:	Header and payload
+ * @header:	Header and payload in case of a transmit context.
  *
  * &struct fw_cdev_iso_packet is used to describe isochronous packet queues.
+ * Use the FW_CDEV_ISO_ macros to fill in @control.
+ * The @header array is empty in case of receive contexts.
  *
- * Use the FW_CDEV_ISO_ macros to fill in @control.  The sy and tag fields are
- * specified by IEEE 1394a and IEC 61883.
+ * Context type %FW_CDEV_ISO_CONTEXT_TRANSMIT:
  *
- * FIXME - finish this documentation
+ * @control.HEADER_LENGTH must be a multiple of 4.  It specifies the numbers of
+ * bytes in @header that will be prepended to the packet's payload.  These bytes
+ * are copied into the kernel and will not be accessed after the ioctl has
+ * returned.
+ *
+ * The @control.SY and TAG fields are copied to the iso packet header.  These
+ * fields are specified by IEEE 1394a and IEC 61883-1.
+ *
+ * The @control.SKIP flag specifies that no packet is to be sent in a frame.
+ * When using this, all other fields except @control.INTERRUPT must be zero.
+ *
+ * When a packet with the @control.INTERRUPT flag set has been completed, an
+ * &fw_cdev_event_iso_interrupt event will be sent.
+ *
+ * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE:
+ *
+ * @control.HEADER_LENGTH must be a multiple of the context's header_size.
+ * If the HEADER_LENGTH is larger than the context's header_size, multiple
+ * packets are queued for this entry.
+ *
+ * The @control.SY and TAG fields are ignored.
+ *
+ * If the @control.SYNC flag is set, the context drops all packets until a
+ * packet with a sy field is received which matches &fw_cdev_start_iso.sync.
+ *
+ * @control.PAYLOAD_LENGTH defines how many payload bytes can be received for
+ * one packet (in addition to payload quadlets that have been defined as headers
+ * and are stripped and returned in the &fw_cdev_event_iso_interrupt structure).
+ * If more bytes are received, the additional bytes are dropped.  If less bytes
+ * are received, the remaining bytes in this part of the payload buffer will not
+ * be written to, not even by the next packet.  I.e., packets received in
+ * consecutive frames will not necessarily be consecutive in memory.  If an
+ * entry has queued multiple packets, the PAYLOAD_LENGTH is divided equally
+ * among them.
+ *
+ * When a packet with the @control.INTERRUPT flag set has been completed, an
+ * &fw_cdev_event_iso_interrupt event will be sent.  An entry that has queued
+ * multiple receive packets is completed when its last packet is completed.
+ *
+ * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
+ *
+ * Here, &fw_cdev_iso_packet would be more aptly named _iso_buffer_chunk since
+ * it specifies a chunk of the mmap()'ed buffer, while the number and alignment
+ * of packets to be placed into the buffer chunk is not known beforehand.
+ *
+ * @control.PAYLOAD_LENGTH is the size of the buffer chunk and specifies room
+ * for header, payload, padding, and trailer bytes of one or more packets.
+ * It must be a multiple of 4.
+ *
+ * @control.HEADER_LENGTH, TAG and SY are ignored.  SYNC is treated as described
+ * for single-channel reception.
+ *
+ * When a buffer chunk with the @control.INTERRUPT flag set has been filled
+ * entirely, an &fw_cdev_event_iso_interrupt_mc event will be sent.
  */
 struct fw_cdev_iso_packet {
 	__u32 control;
@@ -481,21 +792,24 @@
 
 /**
  * struct fw_cdev_queue_iso - Queue isochronous packets for I/O
- * @packets:	Userspace pointer to packet data
+ * @packets:	Userspace pointer to an array of &fw_cdev_iso_packet
  * @data:	Pointer into mmap()'ed payload buffer
- * @size:	Size of packet data in bytes
+ * @size:	Size of the @packets array, in bytes
  * @handle:	Isochronous context handle
  *
  * Queue a number of isochronous packets for reception or transmission.
  * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs,
  * which describe how to transmit from or receive into a contiguous region
- * of a mmap()'ed payload buffer.  As part of the packet descriptors,
+ * of a mmap()'ed payload buffer.  As part of transmit packet descriptors,
  * a series of headers can be supplied, which will be prepended to the
  * payload during DMA.
  *
  * The kernel may or may not queue all packets, but will write back updated
  * values of the @packets, @data and @size fields, so the ioctl can be
  * resubmitted easily.
+ *
+ * In case of a multichannel receive context, @data must be quadlet-aligned
+ * relative to the buffer start.
  */
 struct fw_cdev_queue_iso {
 	__u64 packets;
@@ -539,14 +853,13 @@
 /**
  * struct fw_cdev_get_cycle_timer - read cycle timer register
  * @local_time:   system time, in microseconds since the Epoch
- * @cycle_timer:  isochronous cycle timer, as per OHCI 1.1 clause 5.13
+ * @cycle_timer:  Cycle Time register contents
  *
- * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer
- * and also the system clock.  This allows to express the receive time of an
- * isochronous packet as a system time with microsecond accuracy.
+ * Same as %FW_CDEV_IOC_GET_CYCLE_TIMER2, but fixed to use %CLOCK_REALTIME
+ * and only with microseconds resolution.
  *
- * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
- * 12 bits cycleOffset, in host byte order.
+ * In version 1 and 2 of the ABI, this ioctl returned unreliable (non-
+ * monotonic) @cycle_timer values on certain controllers.
  */
 struct fw_cdev_get_cycle_timer {
 	__u64 local_time;
@@ -554,8 +867,34 @@
 };
 
 /**
+ * struct fw_cdev_get_cycle_timer2 - read cycle timer register
+ * @tv_sec:       system time, seconds
+ * @tv_nsec:      system time, sub-seconds part in nanoseconds
+ * @clk_id:       input parameter, clock from which to get the system time
+ * @cycle_timer:  Cycle Time register contents
+ *
+ * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 ioctl reads the isochronous cycle timer
+ * and also the system clock.  This allows to correlate reception time of
+ * isochronous packets with system time.
+ *
+ * @clk_id lets you choose a clock like with POSIX' clock_gettime function.
+ * Supported @clk_id values are POSIX' %CLOCK_REALTIME and %CLOCK_MONOTONIC
+ * and Linux' %CLOCK_MONOTONIC_RAW.
+ *
+ * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
+ * 12 bits cycleOffset, in host byte order.  Cf. the Cycle Time register
+ * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
+ */
+struct fw_cdev_get_cycle_timer2 {
+	__s64 tv_sec;
+	__s32 tv_nsec;
+	__s32 clk_id;
+	__u32 cycle_timer;
+};
+
+/**
  * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
- * @closure:	Passed back to userspace in correponding iso resource events
+ * @closure:	Passed back to userspace in corresponding iso resource events
  * @channels:	Isochronous channels of which one is to be (de)allocated
  * @bandwidth:	Isochronous bandwidth units to be (de)allocated
  * @handle:	Handle to the allocation, written by the kernel (only valid in
@@ -585,8 +924,8 @@
  * instead of allocated.
  * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
  *
- * To summarize, %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE allocates iso resources
- * for the lifetime of the fd or handle.
+ * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources
+ * for the lifetime of the fd or @handle.
  * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources
  * for the duration of a bus generation.
  *
@@ -631,4 +970,41 @@
 	__u32 speed;
 };
 
+/**
+ * struct fw_cdev_send_phy_packet - send a PHY packet
+ * @closure:	Passed back to userspace in the PHY-packet-sent event
+ * @data:	First and second quadlet of the PHY packet
+ * @generation:	The bus generation where packet is valid
+ *
+ * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes
+ * on the same card as this device.  After transmission, an
+ * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated.
+ *
+ * The payload @data[] shall be specified in host byte order.  Usually,
+ * @data[1] needs to be the bitwise inverse of @data[0].  VersaPHY packets
+ * are an exception to this rule.
+ *
+ * The ioctl is only permitted on device files which represent a local node.
+ */
+struct fw_cdev_send_phy_packet {
+	__u64 closure;
+	__u32 data[2];
+	__u32 generation;
+};
+
+/**
+ * struct fw_cdev_receive_phy_packets - start reception of PHY packets
+ * @closure: Passed back to userspace in phy packet events
+ *
+ * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to
+ * incoming PHY packets from any node on the same bus as the device.
+ *
+ * The ioctl is only permitted on device files which represent a local node.
+ */
+struct fw_cdev_receive_phy_packets {
+	__u64 closure;
+};
+
+#define FW_CDEV_VERSION 3 /* Meaningless legacy macro; don't use it. */
+
 #endif /* _LINUX_FIREWIRE_CDEV_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/firewire-constants.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/firewire-constants.h
index b316770..9b4bb5f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/firewire-constants.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/firewire-constants.h
@@ -1,3 +1,28 @@
+/*
+ * IEEE 1394 constants.
+ *
+ * Copyright (C) 2005-2007  Kristian Hoegsberg <krh@bitplanet.net>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * 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 _LINUX_FIREWIRE_CONSTANTS_H
 #define _LINUX_FIREWIRE_CONSTANTS_H
 
@@ -21,7 +46,7 @@
 #define EXTCODE_WRAP_ADD		0x6
 #define EXTCODE_VENDOR_DEPENDENT	0x7
 
-/* Juju specific tcodes */
+/* Linux firewire-core (Juju) specific tcodes */
 #define TCODE_LOCK_MASK_SWAP		(0x10 | EXTCODE_MASK_SWAP)
 #define TCODE_LOCK_COMPARE_SWAP		(0x10 | EXTCODE_COMPARE_SWAP)
 #define TCODE_LOCK_FETCH_ADD		(0x10 | EXTCODE_FETCH_ADD)
@@ -36,7 +61,7 @@
 #define RCODE_TYPE_ERROR		0x6
 #define RCODE_ADDRESS_ERROR		0x7
 
-/* Juju specific rcodes */
+/* Linux firewire-core (Juju) specific rcodes */
 #define RCODE_SEND_ERROR		0x10
 #define RCODE_CANCELLED			0x11
 #define RCODE_BUSY			0x12
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fs.h
index 6461a29..ab8b0ea 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fs.h
@@ -8,6 +8,8 @@
 
 #include <linux/limits.h>
 #include <linux/ioctl.h>
+#include <linux/blk_types.h>
+#include <linux/types.h>
 
 /*
  * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -21,7 +23,8 @@
 
 /* Fixed constants first: */
 #undef NR_OPEN
-#define INR_OPEN 1024		/* Initial setting for nfile rlimits */
+#define INR_OPEN_CUR 1024	/* Initial setting for nfile rlimits */
+#define INR_OPEN_MAX 4096	/* Hard limit for nfile rlimits */
 
 #define BLOCK_SIZE_BITS 10
 #define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
@@ -29,13 +32,21 @@
 #define SEEK_SET	0	/* seek relative to beginning of file */
 #define SEEK_CUR	1	/* seek relative to current file position */
 #define SEEK_END	2	/* seek relative to end of file */
-#define SEEK_MAX	SEEK_END
+#define SEEK_DATA	3	/* seek to the next data */
+#define SEEK_HOLE	4	/* seek to the next hole */
+#define SEEK_MAX	SEEK_HOLE
+
+struct fstrim_range {
+	__u64 start;
+	__u64 len;
+	__u64 minlen;
+};
 
 /* And dynamically-tunable limits and defaults: */
 struct files_stat_struct {
-	int nr_files;		/* read only */
-	int nr_free_files;	/* read only */
-	int max_files;		/* tunable */
+	unsigned long nr_files;		/* read only */
+	unsigned long nr_free_files;	/* read only */
+	unsigned long max_files;		/* tunable */
 };
 
 struct inodes_stat_t {
@@ -47,12 +58,15 @@
 
 #define NR_FILE  8192	/* this can well be larger on a larger system */
 
-#define MAY_EXEC 1
-#define MAY_WRITE 2
-#define MAY_READ 4
-#define MAY_APPEND 8
-#define MAY_ACCESS 16
-#define MAY_OPEN 32
+#define MAY_EXEC		0x00000001
+#define MAY_WRITE		0x00000002
+#define MAY_READ		0x00000004
+#define MAY_APPEND		0x00000008
+#define MAY_ACCESS		0x00000010
+#define MAY_OPEN		0x00000020
+#define MAY_CHDIR		0x00000040
+/* called from RCU mode, don't block */
+#define MAY_NOT_BLOCK		0x00000080
 
 /*
  * flags in file.f_mode.  Note that FMODE_READ and FMODE_WRITE must correspond
@@ -60,24 +74,24 @@
  */
 
 /* file is open for reading */
-#define FMODE_READ		((fmode_t)1)
+#define FMODE_READ		((fmode_t)0x1)
 /* file is open for writing */
-#define FMODE_WRITE		((fmode_t)2)
+#define FMODE_WRITE		((fmode_t)0x2)
 /* file is seekable */
-#define FMODE_LSEEK		((fmode_t)4)
+#define FMODE_LSEEK		((fmode_t)0x4)
 /* file can be accessed using pread */
-#define FMODE_PREAD		((fmode_t)8)
+#define FMODE_PREAD		((fmode_t)0x8)
 /* file can be accessed using pwrite */
-#define FMODE_PWRITE		((fmode_t)16)
+#define FMODE_PWRITE		((fmode_t)0x10)
 /* File is opened for execution with sys_execve / sys_uselib */
-#define FMODE_EXEC		((fmode_t)32)
+#define FMODE_EXEC		((fmode_t)0x20)
 /* File is opened with O_NDELAY (only set for block devices) */
-#define FMODE_NDELAY		((fmode_t)64)
+#define FMODE_NDELAY		((fmode_t)0x40)
 /* File is opened with O_EXCL (only set for block devices) */
-#define FMODE_EXCL		((fmode_t)128)
+#define FMODE_EXCL		((fmode_t)0x80)
 /* File is opened using open(.., 3, ..) and is writeable only for ioctls
    (specialy hack for floppy.c) */
-#define FMODE_WRITE_IOCTL	((fmode_t)256)
+#define FMODE_WRITE_IOCTL	((fmode_t)0x100)
 
 /*
  * Don't update ctime and mtime.
@@ -85,7 +99,19 @@
  * Currently a special hack for the XFS open_by_handle ioctl, but we'll
  * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon.
  */
-#define FMODE_NOCMTIME		((fmode_t)2048)
+#define FMODE_NOCMTIME		((fmode_t)0x800)
+
+/* Expect random access pattern */
+#define FMODE_RANDOM		((fmode_t)0x1000)
+
+/* File is huge (eg. /dev/kmem): treat loff_t as unsigned */
+#define FMODE_UNSIGNED_OFFSET	((fmode_t)0x2000)
+
+/* File is opened with O_PATH; almost nothing can be done with it */
+#define FMODE_PATH		((fmode_t)0x4000)
+
+/* File was opened by fanotify and shouldn't generate fanotify events */
+#define FMODE_NONOTIFY		((fmode_t)0x1000000)
 
 /*
  * The below are the various read and write types that we support. Some of
@@ -114,55 +140,34 @@
  *			immediately wait on this read without caring about
  *			unplugging.
  * READA		Used for read-ahead operations. Lower priority, and the
- *			 block layer could (in theory) choose to ignore this
+ *			block layer could (in theory) choose to ignore this
  *			request if it runs into resource problems.
  * WRITE		A normal async write. Device will be plugged.
- * SWRITE		Like WRITE, but a special case for ll_rw_block() that
- *			tells it to lock the buffer first. Normally a buffer
- *			must be locked before doing IO.
- * WRITE_SYNC_PLUG	Synchronous write. Identical to WRITE, but passes down
+ * WRITE_SYNC		Synchronous write. Identical to WRITE, but passes down
  *			the hint that someone will be waiting on this IO
- *			shortly. The device must still be unplugged explicitly,
- *			WRITE_SYNC_PLUG does not do this as we could be
- *			submitting more writes before we actually wait on any
- *			of them.
- * WRITE_SYNC		Like WRITE_SYNC_PLUG, but also unplugs the device
- *			immediately after submission. The write equivalent
- *			of READ_SYNC.
+ *			shortly. The write equivalent of READ_SYNC.
  * WRITE_ODIRECT	Special case write for O_DIRECT only.
- * SWRITE_SYNC
- * SWRITE_SYNC_PLUG	Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer.
- *			See SWRITE.
- * WRITE_BARRIER	Like WRITE, but tells the block layer that all
- *			previously submitted writes must be safely on storage
- *			before this one is started. Also guarantees that when
- *			this write is complete, it itself is also safely on
- *			storage. Prevents reordering of writes on both sides
- *			of this IO.
+ * WRITE_FLUSH		Like WRITE_SYNC but with preceding cache flush.
+ * WRITE_FUA		Like WRITE_SYNC but data is guaranteed to be on
+ *			non-volatile media on completion.
+ * WRITE_FLUSH_FUA	Combination of WRITE_FLUSH and FUA. The IO is preceded
+ *			by a cache flush and data is guaranteed to be on
+ *			non-volatile media on completion.
  *
  */
-#define RW_MASK		1
-#define RWA_MASK	2
-#define READ 0
-#define WRITE 1
-#define READA 2		/* read-ahead  - don't block if no resources */
-#define SWRITE 3	/* for ll_rw_block() - wait for buffer lock */
-#define READ_SYNC	(READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
-#define READ_META	(READ | (1 << BIO_RW_META))
-#define WRITE_SYNC_PLUG	(WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
-#define WRITE_SYNC	(WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
-#define WRITE_ODIRECT	(WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
-#define SWRITE_SYNC_PLUG	\
-			(SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
-#define SWRITE_SYNC	(SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
-#define WRITE_BARRIER	(WRITE | (1 << BIO_RW_BARRIER))
+#define RW_MASK			REQ_WRITE
+#define RWA_MASK		REQ_RAHEAD
 
-/*
- * These aren't really reads or writes, they pass down information about
- * parts of device that are now unused by the file system.
- */
-#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
-#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
+#define READ			0
+#define WRITE			RW_MASK
+#define READA			RWA_MASK
+
+#define READ_SYNC		(READ | REQ_SYNC)
+#define WRITE_SYNC		(WRITE | REQ_SYNC | REQ_NOIDLE)
+#define WRITE_ODIRECT		(WRITE | REQ_SYNC)
+#define WRITE_FLUSH		(WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH)
+#define WRITE_FUA		(WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)
+#define WRITE_FLUSH_FUA		(WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
 
 #define SEL_IN		1
 #define SEL_OUT		2
@@ -205,6 +210,8 @@
 #define MS_KERNMOUNT	(1<<22) /* this is a kern_mount call */
 #define MS_I_VERSION	(1<<23) /* Update inode I_version field */
 #define MS_STRICTATIME	(1<<24) /* Always perform atime updates */
+#define MS_NOSEC	(1<<28)
+#define MS_BORN		(1<<29)
 #define MS_ACTIVE	(1<<30)
 #define MS_NOUSER	(1<<31)
 
@@ -231,6 +238,9 @@
 #define S_NOCMTIME	128	/* Do not update file c/mtime */
 #define S_SWAPFILE	256	/* Do not truncate: swapon got its bmaps */
 #define S_PRIVATE	512	/* Inode is fs-internal */
+#define S_IMA		1024	/* Inode has an associated IMA struct */
+#define S_AUTOMOUNT	2048	/* Automount/referral quasi-directory */
+#define S_NOSEC		4096	/* no suid or xattr security attributes */
 
 /*
  * Note that nosuid etc flags are inode-specific: setting some file-system
@@ -265,6 +275,9 @@
 #define IS_NOCMTIME(inode)	((inode)->i_flags & S_NOCMTIME)
 #define IS_SWAPFILE(inode)	((inode)->i_flags & S_SWAPFILE)
 #define IS_PRIVATE(inode)	((inode)->i_flags & S_PRIVATE)
+#define IS_IMA(inode)		((inode)->i_flags & S_IMA)
+#define IS_AUTOMOUNT(inode)	((inode)->i_flags & S_AUTOMOUNT)
+#define IS_NOSEC(inode)		((inode)->i_flags & S_NOSEC)
 
 /* the read-only stuff doesn't really belong here, but any other place is
    probably as bad and I don't want to create yet another include file. */
@@ -300,12 +313,20 @@
 #define BLKTRACESTOP _IO(0x12,117)
 #define BLKTRACETEARDOWN _IO(0x12,118)
 #define BLKDISCARD _IO(0x12,119)
+#define BLKIOMIN _IO(0x12,120)
+#define BLKIOOPT _IO(0x12,121)
+#define BLKALIGNOFF _IO(0x12,122)
+#define BLKPBSZGET _IO(0x12,123)
+#define BLKDISCARDZEROES _IO(0x12,124)
+#define BLKSECDISCARD _IO(0x12,125)
+#define BLKROTATIONAL _IO(0x12,126)
 
 #define BMAP_IOCTL 1		/* obsolete - kept for compatibility */
 #define FIBMAP	   _IO(0x00,1)	/* bmap access */
 #define FIGETBSZ   _IO(0x00,2)	/* get the block size used for bmap */
 #define FIFREEZE	_IOWR('X', 119, int)	/* Freeze */
 #define FITHAW		_IOWR('X', 120, int)	/* Thaw */
+#define FITRIM		_IOWR('X', 121, struct fstrim_range)	/* Trim */
 
 #define	FS_IOC_GETFLAGS			_IOR('f', 1, long)
 #define	FS_IOC_SETFLAGS			_IOW('f', 2, long)
@@ -343,6 +364,7 @@
 #define FS_TOPDIR_FL			0x00020000 /* Top of directory hierarchies*/
 #define FS_EXTENT_FL			0x00080000 /* Extents */
 #define FS_DIRECTIO_FL			0x00100000 /* Use direct i/o */
+#define FS_NOCOW_FL			0x00800000 /* Do not cow file */
 #define FS_RESERVED_FL			0x80000000 /* reserved for ext2 lib */
 
 #define FS_FL_USER_VISIBLE		0x0003DFFF /* User visible flags */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fsl_hypervisor.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fsl_hypervisor.h
new file mode 100644
index 0000000..0c82155
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fsl_hypervisor.h
@@ -0,0 +1,220 @@
+/*
+ * Freescale hypervisor ioctl and kernel interface
+ *
+ * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
+ * Author: Timur Tabi <timur@freescale.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Freescale Semiconductor nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * This software is provided by Freescale Semiconductor "as is" and any
+ * express or implied warranties, including, but not limited to, the implied
+ * warranties of merchantability and fitness for a particular purpose are
+ * disclaimed. In no event shall Freescale Semiconductor be liable for any
+ * direct, indirect, incidental, special, exemplary, or consequential damages
+ * (including, but not limited to, procurement of substitute goods or services;
+ * loss of use, data, or profits; or business interruption) however caused and
+ * on any theory of liability, whether in contract, strict liability, or tort
+ * (including negligence or otherwise) arising in any way out of the use of this
+ * software, even if advised of the possibility of such damage.
+ *
+ * This file is used by the Freescale hypervisor management driver.  It can
+ * also be included by applications that need to communicate with the driver
+ * via the ioctl interface.
+ */
+
+#ifndef FSL_HYPERVISOR_H
+#define FSL_HYPERVISOR_H
+
+#include <linux/types.h>
+
+/**
+ * struct fsl_hv_ioctl_restart - restart a partition
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to restart, or -1 for the
+ *             calling partition
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_RESTART
+ */
+struct fsl_hv_ioctl_restart {
+	__u32 ret;
+	__u32 partition;
+};
+
+/**
+ * struct fsl_hv_ioctl_status - get a partition's status
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to query, or -1 for the
+ *             calling partition
+ * @status: The returned status of the partition
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS
+ *
+ * Values of 'status':
+ *    0 = Stopped
+ *    1 = Running
+ *    2 = Starting
+ *    3 = Stopping
+ */
+struct fsl_hv_ioctl_status {
+	__u32 ret;
+	__u32 partition;
+	__u32 status;
+};
+
+/**
+ * struct fsl_hv_ioctl_start - start a partition
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to control
+ * @entry_point: The offset within the guest IMA to start execution
+ * @load: If non-zero, reload the partition's images before starting
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_START
+ */
+struct fsl_hv_ioctl_start {
+	__u32 ret;
+	__u32 partition;
+	__u32 entry_point;
+	__u32 load;
+};
+
+/**
+ * struct fsl_hv_ioctl_stop - stop a partition
+ * @ret: return error code from the hypervisor
+ * @partition: the ID of the partition to stop, or -1 for the calling
+ *             partition
+ *
+ * Used by FSL_HV_IOCTL_PARTITION_STOP
+ */
+struct fsl_hv_ioctl_stop {
+	__u32 ret;
+	__u32 partition;
+};
+
+/**
+ * struct fsl_hv_ioctl_memcpy - copy memory between partitions
+ * @ret: return error code from the hypervisor
+ * @source: the partition ID of the source partition, or -1 for this
+ *          partition
+ * @target: the partition ID of the target partition, or -1 for this
+ *          partition
+ * @reserved: reserved, must be set to 0
+ * @local_addr: user-space virtual address of a buffer in the local
+ *              partition
+ * @remote_addr: guest physical address of a buffer in the
+ *           remote partition
+ * @count: the number of bytes to copy.  Both the local and remote
+ *         buffers must be at least 'count' bytes long
+ *
+ * Used by FSL_HV_IOCTL_MEMCPY
+ *
+ * The 'local' partition is the partition that calls this ioctl.  The
+ * 'remote' partition is a different partition.  The data is copied from
+ * the 'source' paritition' to the 'target' partition.
+ *
+ * The buffer in the remote partition must be guest physically
+ * contiguous.
+ *
+ * This ioctl does not support copying memory between two remote
+ * partitions or within the same partition, so either 'source' or
+ * 'target' (but not both) must be -1.  In other words, either
+ *
+ *      source == local and target == remote
+ * or
+ *      source == remote and target == local
+ */
+struct fsl_hv_ioctl_memcpy {
+	__u32 ret;
+	__u32 source;
+	__u32 target;
+	__u32 reserved;	/* padding to ensure local_vaddr is aligned */
+	__u64 local_vaddr;
+	__u64 remote_paddr;
+	__u64 count;
+};
+
+/**
+ * struct fsl_hv_ioctl_doorbell - ring a doorbell
+ * @ret: return error code from the hypervisor
+ * @doorbell: the handle of the doorbell to ring doorbell
+ *
+ * Used by FSL_HV_IOCTL_DOORBELL
+ */
+struct fsl_hv_ioctl_doorbell {
+	__u32 ret;
+	__u32 doorbell;
+};
+
+/**
+ * struct fsl_hv_ioctl_prop - get/set a device tree property
+ * @ret: return error code from the hypervisor
+ * @handle: handle of partition whose tree to access
+ * @path: virtual address of path name of node to access
+ * @propname: virtual address of name of property to access
+ * @propval: virtual address of property data buffer
+ * @proplen: Size of property data buffer
+ * @reserved: reserved, must be set to 0
+ *
+ * Used by FSL_HV_IOCTL_DOORBELL
+ */
+struct fsl_hv_ioctl_prop {
+	__u32 ret;
+	__u32 handle;
+	__u64 path;
+	__u64 propname;
+	__u64 propval;
+	__u32 proplen;
+	__u32 reserved;	/* padding to ensure structure is aligned */
+};
+
+/* The ioctl type, documented in ioctl-number.txt */
+#define FSL_HV_IOCTL_TYPE	0xAF
+
+/* Restart another partition */
+#define FSL_HV_IOCTL_PARTITION_RESTART \
+	_IOWR(FSL_HV_IOCTL_TYPE, 1, struct fsl_hv_ioctl_restart)
+
+/* Get a partition's status */
+#define FSL_HV_IOCTL_PARTITION_GET_STATUS \
+	_IOWR(FSL_HV_IOCTL_TYPE, 2, struct fsl_hv_ioctl_status)
+
+/* Boot another partition */
+#define FSL_HV_IOCTL_PARTITION_START \
+	_IOWR(FSL_HV_IOCTL_TYPE, 3, struct fsl_hv_ioctl_start)
+
+/* Stop this or another partition */
+#define FSL_HV_IOCTL_PARTITION_STOP \
+	_IOWR(FSL_HV_IOCTL_TYPE, 4, struct fsl_hv_ioctl_stop)
+
+/* Copy data from one partition to another */
+#define FSL_HV_IOCTL_MEMCPY \
+	_IOWR(FSL_HV_IOCTL_TYPE, 5, struct fsl_hv_ioctl_memcpy)
+
+/* Ring a doorbell */
+#define FSL_HV_IOCTL_DOORBELL \
+	_IOWR(FSL_HV_IOCTL_TYPE, 6, struct fsl_hv_ioctl_doorbell)
+
+/* Get a property from another guest's device tree */
+#define FSL_HV_IOCTL_GETPROP \
+	_IOWR(FSL_HV_IOCTL_TYPE, 7, struct fsl_hv_ioctl_prop)
+
+/* Set a property in another guest's device tree */
+#define FSL_HV_IOCTL_SETPROP \
+	_IOWR(FSL_HV_IOCTL_TYPE, 8, struct fsl_hv_ioctl_prop)
+
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fuse.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fuse.h
index cf593bf..8ba2c94 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/fuse.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/fuse.h
@@ -30,6 +30,30 @@
  *  - add umask flag to input argument of open, mknod and mkdir
  *  - add notification messages for invalidation of inodes and
  *    directory entries
+ *
+ * 7.13
+ *  - make max number of background requests and congestion threshold
+ *    tunables
+ *
+ * 7.14
+ *  - add splice support to fuse device
+ *
+ * 7.15
+ *  - add store notify
+ *  - add retrieve notify
+ *
+ * 7.16
+ *  - add BATCH_FORGET request
+ *  - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
+ *    fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
+ *  - add FUSE_IOCTL_32BIT flag
+ *
+ * 7.17
+ *  - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
+ *
+ * 7.18
+ *  - add FUSE_IOCTL_DIR flag
+ *  - add FUSE_NOTIFY_DELETE
  */
 
 #ifndef _LINUX_FUSE_H
@@ -37,11 +61,31 @@
 
 #include <linux/types.h>
 
+/*
+ * Version negotiation:
+ *
+ * Both the kernel and userspace send the version they support in the
+ * INIT request and reply respectively.
+ *
+ * If the major versions match then both shall use the smallest
+ * of the two minor versions for communication.
+ *
+ * If the kernel supports a larger major version, then userspace shall
+ * reply with the major version it supports, ignore the rest of the
+ * INIT message and expect a new INIT message from the kernel with a
+ * matching major version.
+ *
+ * If the library supports a larger major version, then it shall fall
+ * back to the major protocol version sent by the kernel for
+ * communication and reply with that major version (and an arbitrary
+ * supported minor version).
+ */
+
 /** Version number of this interface */
 #define FUSE_KERNEL_VERSION 7
 
 /** Minor version number of this interface */
-#define FUSE_KERNEL_MINOR_VERSION 12
+#define FUSE_KERNEL_MINOR_VERSION 18
 
 /** The node ID of the root inode */
 #define FUSE_ROOT_ID 1
@@ -116,8 +160,10 @@
 /**
  * INIT request/reply flags
  *
+ * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
  * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
  * FUSE_DONT_MASK: don't apply umask to file mode on create operations
+ * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
  */
 #define FUSE_ASYNC_READ		(1 << 0)
 #define FUSE_POSIX_LOCKS	(1 << 1)
@@ -126,6 +172,7 @@
 #define FUSE_EXPORT_SUPPORT	(1 << 4)
 #define FUSE_BIG_WRITES		(1 << 5)
 #define FUSE_DONT_MASK		(1 << 6)
+#define FUSE_FLOCK_LOCKS	(1 << 10)
 
 /**
  * CUSE INIT request/reply flags
@@ -138,6 +185,7 @@
  * Release flags
  */
 #define FUSE_RELEASE_FLUSH	(1 << 0)
+#define FUSE_RELEASE_FLOCK_UNLOCK	(1 << 1)
 
 /**
  * Getattr flags
@@ -169,12 +217,16 @@
  * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
  * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
  * FUSE_IOCTL_RETRY: retry with new iovecs
+ * FUSE_IOCTL_32BIT: 32bit ioctl
+ * FUSE_IOCTL_DIR: is a directory
  *
  * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
  */
 #define FUSE_IOCTL_COMPAT	(1 << 0)
 #define FUSE_IOCTL_UNRESTRICTED	(1 << 1)
 #define FUSE_IOCTL_RETRY	(1 << 2)
+#define FUSE_IOCTL_32BIT	(1 << 3)
+#define FUSE_IOCTL_DIR		(1 << 4)
 
 #define FUSE_IOCTL_MAX_IOV	256
 
@@ -224,6 +276,8 @@
 	FUSE_DESTROY       = 38,
 	FUSE_IOCTL         = 39,
 	FUSE_POLL          = 40,
+	FUSE_NOTIFY_REPLY  = 41,
+	FUSE_BATCH_FORGET  = 42,
 
 	/* CUSE specific operations */
 	CUSE_INIT          = 4096,
@@ -233,6 +287,9 @@
 	FUSE_NOTIFY_POLL   = 1,
 	FUSE_NOTIFY_INVAL_INODE = 2,
 	FUSE_NOTIFY_INVAL_ENTRY = 3,
+	FUSE_NOTIFY_STORE = 4,
+	FUSE_NOTIFY_RETRIEVE = 5,
+	FUSE_NOTIFY_DELETE = 6,
 	FUSE_NOTIFY_CODE_MAX,
 };
 
@@ -256,6 +313,16 @@
 	__u64	nlookup;
 };
 
+struct fuse_forget_one {
+	__u64	nodeid;
+	__u64	nlookup;
+};
+
+struct fuse_batch_forget_in {
+	__u32	count;
+	__u32	dummy;
+};
+
 struct fuse_getattr_in {
 	__u32	getattr_flags;
 	__u32	dummy;
@@ -427,7 +494,8 @@
 	__u32	minor;
 	__u32	max_readahead;
 	__u32	flags;
-	__u32	unused;
+	__u16   max_background;
+	__u16   congestion_threshold;
 	__u32	max_write;
 };
 
@@ -475,6 +543,11 @@
 	__u32	out_size;
 };
 
+struct fuse_ioctl_iovec {
+	__u64	base;
+	__u64	len;
+};
+
 struct fuse_ioctl_out {
 	__s32	result;
 	__u32	flags;
@@ -540,4 +613,36 @@
 	__u32	padding;
 };
 
+struct fuse_notify_delete_out {
+	__u64	parent;
+	__u64	child;
+	__u32	namelen;
+	__u32	padding;
+};
+
+struct fuse_notify_store_out {
+	__u64	nodeid;
+	__u64	offset;
+	__u32	size;
+	__u32	padding;
+};
+
+struct fuse_notify_retrieve_out {
+	__u64	notify_unique;
+	__u64	nodeid;
+	__u64	offset;
+	__u32	size;
+	__u32	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;
+};
+
 #endif /* _LINUX_FUSE_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/futex.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/futex.h
index 1e1f7fa..c311e9d 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/futex.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/futex.h
@@ -4,11 +4,6 @@
 
 #include <linux/types.h>
 
-struct inode;
-struct mm_struct;
-struct task_struct;
-union ktime;
-
 /* Second argument to futex syscall */
 
 
@@ -38,8 +33,8 @@
 #define FUTEX_LOCK_PI_PRIVATE	(FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG)
 #define FUTEX_UNLOCK_PI_PRIVATE	(FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG)
 #define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
-#define FUTEX_WAIT_BITSET_PRIVATE	(FUTEX_WAIT_BITS | FUTEX_PRIVATE_FLAG)
-#define FUTEX_WAKE_BITSET_PRIVATE	(FUTEX_WAKE_BITS | FUTEX_PRIVATE_FLAG)
+#define FUTEX_WAIT_BITSET_PRIVATE	(FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG)
+#define FUTEX_WAKE_BITSET_PRIVATE	(FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG)
 #define FUTEX_WAIT_REQUEUE_PI_PRIVATE	(FUTEX_WAIT_REQUEUE_PI | \
 					 FUTEX_PRIVATE_FLAG)
 #define FUTEX_CMP_REQUEUE_PI_PRIVATE	(FUTEX_CMP_REQUEUE_PI | \
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/gen_stats.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/gen_stats.h
index 710e901..552c8a0 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/gen_stats.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/gen_stats.h
@@ -18,13 +18,11 @@
  * @bytes: number of seen bytes
  * @packets: number of seen packets
  */
-struct gnet_stats_basic
-{
+struct gnet_stats_basic {
 	__u64	bytes;
 	__u32	packets;
 };
-struct gnet_stats_basic_packed
-{
+struct gnet_stats_basic_packed {
 	__u64	bytes;
 	__u32	packets;
 } __attribute__ ((packed));
@@ -34,8 +32,7 @@
  * @bps: current byte rate
  * @pps: current packet rate
  */
-struct gnet_stats_rate_est
-{
+struct gnet_stats_rate_est {
 	__u32	bps;
 	__u32	pps;
 };
@@ -48,8 +45,7 @@
  * @requeues: number of requeues
  * @overlimits: number of enqueues over the limit
  */
-struct gnet_stats_queue
-{
+struct gnet_stats_queue {
 	__u32	qlen;
 	__u32	backlog;
 	__u32	drops;
@@ -62,8 +58,7 @@
  * @interval: sampling period
  * @ewma_log: the log of measurement window weight
  */
-struct gnet_estimator
-{
+struct gnet_estimator {
 	signed char	interval;
 	unsigned char	ewma_log;
 };
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/genetlink.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/genetlink.h
index b834ef6..55ce7bb 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/genetlink.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/genetlink.h
@@ -80,4 +80,5 @@
 
 #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
 
+
 #endif	/* __LINUX_GENERIC_NETLINK_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/gfs2_ondisk.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/gfs2_ondisk.h
index c56b4bc..507cf6d 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/gfs2_ondisk.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/gfs2_ondisk.h
@@ -22,6 +22,8 @@
 #define GFS2_LIVE_LOCK		1
 #define GFS2_TRANS_LOCK		2
 #define GFS2_RENAME_LOCK	3
+#define GFS2_CONTROL_LOCK	4
+#define GFS2_MOUNTED_LOCK	5
 
 /* Format numbers for various metadata types */
 
@@ -81,7 +83,11 @@
 	__be32 mh_type;
 	__be64 __pad0;		/* Was generation number in gfs1 */
 	__be32 mh_format;
-	__be32 __pad1;		/* Was incarnation number in gfs1 */
+	/* This union is to keep userspace happy */
+	union {
+		__be32 mh_jid;		/* Was incarnation number in gfs1 */
+		__be32 __pad1;
+	};
 };
 
 /*
@@ -176,33 +182,6 @@
 };
 
 /*
- * quota linked list: user quotas and group quotas form two separate 
- * singly linked lists. ll_next stores uids or gids of next quotas in the 
- * linked list.
-
-Given the uid/gid, how to calculate the quota file offsets for the corresponding
-gfs2_quota structures on disk:
-
-for user quotas, given uid,
-offset = uid * sizeof(struct gfs2_quota);
-
-for group quotas, given gid,
-offset = (gid * sizeof(struct gfs2_quota)) + sizeof(struct gfs2_quota);
-
-
-  uid:0   gid:0       uid:12   gid:12      uid:17   gid:17     uid:5142 gid:5142
-+-------+-------+    +-------+-------+    +-------+- - - -+    +- - - -+-------+
-| valid | valid | :: | valid | valid | :: | valid | inval | :: | inval | valid |
-+-------+-------+    +-------+-------+    +-------+- - - -+    +- - - -+-------+
-next:12   next:12    next:17 next:5142    next:NULL                    next:NULL
-    |       |            |       |            |<-- user quota list         |
-     \______|___________/ \______|___________/         group quota list -->|
-            |                    |                                         |
-             \__________________/ \_______________________________________/
-
-*/
-
-/*
  * quota structure
  */
 
@@ -210,8 +189,7 @@
 	__be64 qu_limit;
 	__be64 qu_warn;
 	__be64 qu_value;
-	__be32 qu_ll_next; /* location of next quota in list */
-	__u8 qu_reserved[60];
+	__u8 qu_reserved[64];
 };
 
 /*
@@ -333,6 +311,28 @@
 
 /*
  * Extended attribute header format
+ *
+ * This works in a similar way to dirents. There is a fixed size header
+ * followed by a variable length section made up of the name and the
+ * associated data. In the case of a "stuffed" entry, the value is
+ * __inline__ directly after the name, the ea_num_ptrs entry will be
+ * zero in that case. For non-"stuffed" entries, there will be
+ * a set of pointers (aligned to 8 byte boundary) to the block(s)
+ * containing the value.
+ *
+ * The blocks containing the values and the blocks containing the
+ * extended attribute headers themselves all start with the common
+ * metadata header. Each inode, if it has extended attributes, will
+ * have either a single block containing the extended attribute headers
+ * or a single indirect block pointing to blocks containing the
+ * extended attribure headers.
+ *
+ * The maximim size of the data part of an extended attribute is 64k
+ * so the number of blocks required depends upon block size. Since the
+ * block size also determines the number of pointers in an indirect
+ * block, its a fairly complicated calculation to work out the maximum
+ * number of blocks that an inode may have relating to extended attributes.
+ *
  */
 
 #define GFS2_EA_MAX_NAME_LEN	255
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/gigaset_dev.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/gigaset_dev.h
index 5dc4a31..258ba82 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/gigaset_dev.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/gigaset_dev.h
@@ -16,15 +16,23 @@
 
 #include <linux/ioctl.h>
 
+/* The magic IOCTL value for this interface. */
 #define GIGASET_IOCTL 0x47
 
-#define GIGVER_DRIVER 0
-#define GIGVER_COMPAT 1
-#define GIGVER_FWBASE 2
+/* enable/disable device control via character device (lock out ISDN subsys) */
+#define GIGASET_REDIR    _IOWR(GIGASET_IOCTL, 0, int)
 
-#define GIGASET_REDIR    _IOWR (GIGASET_IOCTL, 0, int)
-#define GIGASET_CONFIG   _IOWR (GIGASET_IOCTL, 1, int)
-#define GIGASET_BRKCHARS _IOW  (GIGASET_IOCTL, 2, unsigned char[6]) //FIXME [6] okay?
-#define GIGASET_VERSION  _IOWR (GIGASET_IOCTL, 3, unsigned[4])
+/* enable adapter configuration mode (M10x only) */
+#define GIGASET_CONFIG   _IOWR(GIGASET_IOCTL, 1, int)
+
+/* set break characters (M105 only) */
+#define GIGASET_BRKCHARS _IOW(GIGASET_IOCTL, 2, unsigned char[6])
+
+/* get version information selected by arg[0] */
+#define GIGASET_VERSION  _IOWR(GIGASET_IOCTL, 3, unsigned[4])
+/* values for GIGASET_VERSION arg[0] */
+#define GIGVER_DRIVER 0		/* get driver version */
+#define GIGVER_COMPAT 1		/* get interface compatibility version */
+#define GIGVER_FWBASE 2		/* get base station firmware version */
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/glamo-engine.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/glamo-engine.h
new file mode 100644
index 0000000..516d45f
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/glamo-engine.h
@@ -0,0 +1,27 @@
+#ifndef __GLAMO_ENGINE_H
+#define __GLAMO_ENGINE_H
+
+enum glamo_engine {
+	GLAMO_ENGINE_CAPTURE = 0,
+	GLAMO_ENGINE_ISP = 1,
+	GLAMO_ENGINE_JPEG = 2,
+	GLAMO_ENGINE_MPEG_ENC = 3,
+	GLAMO_ENGINE_MPEG_DEC = 4,
+	GLAMO_ENGINE_LCD = 5,
+	GLAMO_ENGINE_CMDQ = 6,
+	GLAMO_ENGINE_2D = 7,
+	GLAMO_ENGINE_3D = 8,
+	GLAMO_ENGINE_MMC = 9,
+	GLAMO_ENGINE_MICROP0 = 10,
+	GLAMO_ENGINE_RISC = 11,
+	GLAMO_ENGINE_MICROP1_MPEG_ENC = 12,
+	GLAMO_ENGINE_MICROP1_MPEG_DEC = 13,
+#if 0
+	GLAMO_ENGINE_H264_DEC = 14,
+	GLAMO_ENGINE_RISC1 = 15,
+	GLAMO_ENGINE_SPI = 16,
+#endif
+	__NUM_GLAMO_ENGINES
+};
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/glamofb.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/glamofb.h
new file mode 100644
index 0000000..47c0d1b
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/glamofb.h
@@ -0,0 +1,11 @@
+#ifndef _LINUX_GLAMOFB_H
+#define _LINUX_GLAMOFB_H
+
+#include <linux/fb.h>
+
+
+#define GLAMOFB_ENGINE_ENABLE _IOW('F', 0x1, __u32)
+#define GLAMOFB_ENGINE_DISABLE _IOW('F', 0x2, __u32)
+#define GLAMOFB_ENGINE_RESET _IOW('F', 0x3, __u32)
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/hayesesp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/hayesesp.h
deleted file mode 100644
index 59d744d..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/hayesesp.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef HAYESESP_H
-#define HAYESESP_H
-
-struct hayes_esp_config {
-	short flow_on;
-	short flow_off;
-	short rx_trigger;
-	short tx_trigger;
-	short pio_threshold;
-	unsigned char rx_timeout;
-	char dma_channel;
-};
-
-
-
-#endif /* ESP_H */
-
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/hidraw.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/hidraw.h
index 9e19979..b216b12 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/hidraw.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/hidraw.h
@@ -35,6 +35,9 @@
 #define HIDIOCGRAWINFO		_IOR('H', 0x03, struct hidraw_devinfo)
 #define HIDIOCGRAWNAME(len)     _IOC(_IOC_READ, 'H', 0x04, len)
 #define HIDIOCGRAWPHYS(len)     _IOC(_IOC_READ, 'H', 0x05, len)
+/* The first byte of SFEATURE and GFEATURE is the report number */
+#define HIDIOCSFEATURE(len)    _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
+#define HIDIOCGFEATURE(len)    _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len)
 
 #define HIDRAW_FIRST_MINOR 0
 #define HIDRAW_MAX_DEVICES 64
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/hpet.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/hpet.h
index 263f7fe..8c2b8fd 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/hpet.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/hpet.h
@@ -20,4 +20,6 @@
 #define	HPET_DPI	_IO('h', 0x05)	/* disable periodic */
 #define	HPET_IRQFREQ	_IOW('h', 0x6, unsigned long)	/* IRQFREQ usec */
 
+#define MAX_HPET_TBS	8		/* maximum hpet timer blocks */
+
 #endif				/* !__HPET__ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/i2c.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/i2c.h
index 6d77f1f..3c204e0 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/i2c.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/i2c.h
@@ -145,5 +145,4 @@
 #define I2C_SMBUS_BLOCK_PROC_CALL   7		/* SMBus 2.0 */
 #define I2C_SMBUS_I2C_BLOCK_DATA    8
 
-
 #endif /* _LINUX_I2C_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if.h
index 010a0d2..c4b7169 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if.h
@@ -70,6 +70,17 @@
 #define IFF_XMIT_DST_RELEASE 0x400	/* dev_hard_start_xmit() is allowed to
 					 * release skb->dst
 					 */
+#define IFF_DONT_BRIDGE 0x800		/* disallow bridging this ether dev */
+#define IFF_DISABLE_NETPOLL	0x1000	/* disable netpoll at run-time */
+#define IFF_MACVLAN_PORT	0x2000	/* device used as macvlan port */
+#define IFF_BRIDGE_PORT	0x4000		/* device used as bridge port */
+#define IFF_OVS_DATAPATH	0x8000	/* device used as Open vSwitch
+					 * datapath port */
+#define IFF_TX_SKB_SHARING	0x10000	/* The interface supports sharing
+					 * skbs on transmit */
+#define IFF_UNICAST_FLT	0x20000		/* Supports unicast filtering	*/
+#define IFF_TEAM_PORT	0x40000		/* device used as team port */
+#define IFF_NO_IP_ALIGN	0x80000		/* do not ip-align allocated rx pkts */
 
 #define IF_GET_IFACE	0x0001		/* for querying only */
 #define IF_GET_PROTO	0x0002
@@ -125,8 +136,7 @@
  *	being very small might be worth keeping for clean configuration.
  */
 
-struct ifmap 
-{
+struct ifmap {
 	unsigned long mem_start;
 	unsigned long mem_end;
 	unsigned short base_addr; 
@@ -136,8 +146,7 @@
 	/* 3 bytes spare */
 };
 
-struct if_settings
-{
+struct if_settings {
 	unsigned int type;	/* Type of physical device or protocol */
 	unsigned int size;	/* Size of the data allocated by the caller */
 	union {
@@ -161,8 +170,7 @@
  * remainder may be interface specific.
  */
 
-struct ifreq 
-{
+struct ifreq {
 #define IFHWADDRLEN	6
 	union
 	{
@@ -211,11 +219,9 @@
  * must know all networks accessible).
  */
 
-struct ifconf 
-{
+struct ifconf  {
 	int	ifc_len;			/* size of buffer	*/
-	union 
-	{
+	union {
 		char *ifcu_buf;
 		struct ifreq *ifcu_req;
 	} ifc_ifcu;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_addr.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_addr.h
index 08ea980..58b39f4 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_addr.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_addr.h
@@ -4,8 +4,7 @@
 #include <linux/types.h>
 #include <linux/netlink.h>
 
-struct ifaddrmsg
-{
+struct ifaddrmsg {
 	__u8		ifa_family;
 	__u8		ifa_prefixlen;	/* The prefix length		*/
 	__u8		ifa_flags;	/* Flags			*/
@@ -20,8 +19,7 @@
  * but for point-to-point IFA_ADDRESS is DESTINATION address,
  * local address is supplied in IFA_LOCAL attribute.
  */
-enum
-{
+enum {
 	IFA_UNSPEC,
 	IFA_ADDRESS,
 	IFA_LOCAL,
@@ -41,13 +39,13 @@
 
 #define	IFA_F_NODAD		0x02
 #define IFA_F_OPTIMISTIC	0x04
+#define IFA_F_DADFAILED		0x08
 #define	IFA_F_HOMEADDRESS	0x10
 #define IFA_F_DEPRECATED	0x20
 #define IFA_F_TENTATIVE		0x40
 #define IFA_F_PERMANENT		0x80
 
-struct ifa_cacheinfo
-{
+struct ifa_cacheinfo {
 	__u32	ifa_prefered;
 	__u32	ifa_valid;
 	__u32	cstamp; /* created timestamp, hundredths of seconds */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_addrlabel.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_addrlabel.h
index 89571f6..54580c2 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_addrlabel.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_addrlabel.h
@@ -12,8 +12,7 @@
 
 #include <linux/types.h>
 
-struct ifaddrlblmsg
-{
+struct ifaddrlblmsg {
 	__u8		ifal_family;		/* Address family */
 	__u8		__ifal_reserved;	/* Reserved */
 	__u8		ifal_prefixlen;		/* Prefix length */
@@ -22,8 +21,7 @@
 	__u32		ifal_seq;		/* sequence number */
 };
 
-enum
-{
+enum {
 	IFAL_ADDRESS = 1,
 	IFAL_LABEL = 2,
 	__IFAL_MAX
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_alg.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_alg.h
new file mode 100644
index 0000000..0f9acce
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_alg.h
@@ -0,0 +1,40 @@
+/*
+ * if_alg: User-space algorithm interface
+ *
+ * Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au>
+ *
+ * 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 _LINUX_IF_ALG_H
+#define _LINUX_IF_ALG_H
+
+#include <linux/types.h>
+
+struct sockaddr_alg {
+	__u16	salg_family;
+	__u8	salg_type[14];
+	__u32	salg_feat;
+	__u32	salg_mask;
+	__u8	salg_name[64];
+};
+
+struct af_alg_iv {
+	__u32	ivlen;
+	__u8	iv[0];
+};
+
+/* Socket options */
+#define ALG_SET_KEY			1
+#define ALG_SET_IV			2
+#define ALG_SET_OP			3
+
+/* Operations */
+#define ALG_OP_DECRYPT			0
+#define ALG_OP_ENCRYPT			1
+
+#endif	/* _LINUX_IF_ALG_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_arcnet.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_arcnet.h
index 0835deb..46e34bd 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_arcnet.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_arcnet.h
@@ -56,8 +56,7 @@
 /*
  * The RFC1201-specific components of an arcnet packet header.
  */
-struct arc_rfc1201
-{
+struct arc_rfc1201 {
     __u8  proto;		/* protocol ID field - varies		*/
     __u8  split_flag;	/* for use with split packets		*/
     __be16   sequence;		/* sequence number			*/
@@ -69,8 +68,7 @@
 /*
  * The RFC1051-specific components.
  */
-struct arc_rfc1051
-{
+struct arc_rfc1051 {
     __u8 proto;		/* ARC_P_RFC1051_ARP/RFC1051_IP	*/
     __u8 payload[0];		/* 507 bytes			*/
 };
@@ -81,8 +79,7 @@
  * The ethernet-encap-specific components.  We have a real ethernet header
  * and some data.
  */
-struct arc_eth_encap
-{
+struct arc_eth_encap {
     __u8 proto;		/* Always ARC_P_ETHER			*/
     struct ethhdr eth;		/* standard ethernet header (yuck!)	*/
     __u8 payload[0];		/* 493 bytes				*/
@@ -90,8 +87,7 @@
 #define ETH_ENCAP_HDR_SIZE 14
 
 
-struct arc_cap
-{
+struct arc_cap {
 	__u8 proto;
 	__u8 cookie[sizeof(int)];   /* Actually NOT sent over the network */
 	union {
@@ -108,8 +104,7 @@
  * the _end_ of the 512-byte buffer.  We hide this complexity inside the
  * driver.
  */
-struct arc_hardware
-{
+struct arc_hardware {
     __u8  source,		/* source ARCnet - filled in automagically */
              dest,		/* destination ARCnet - 0 for broadcast    */
     	     offset[2];		/* offset bytes (some weird semantics)     */
@@ -120,8 +115,7 @@
  * This is an ARCnet frame header, as seen by the kernel (and userspace,
  * when you do a raw packet capture).
  */
-struct archdr
-{
+struct archdr {
     /* hardware requirements */
     struct arc_hardware hard;
      
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_arp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_arp.h
index f186943..1f9fc5d 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_arp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_arp.h
@@ -87,10 +87,10 @@
 #define ARPHRD_IEEE80211_PRISM 802	/* IEEE 802.11 + Prism2 header  */
 #define ARPHRD_IEEE80211_RADIOTAP 803	/* IEEE 802.11 + radiotap header */
 #define ARPHRD_IEEE802154	  804
-#define ARPHRD_IEEE802154_PHY	  805
 
 #define ARPHRD_PHONET	820		/* PhoNet media type		*/
 #define ARPHRD_PHONET_PIPE 821		/* PhoNet pipe header		*/
+#define ARPHRD_CAIF	822		/* CAIF media type		*/
 
 #define ARPHRD_VOID	  0xFFFF	/* Void type, nothing is known */
 #define ARPHRD_NONE	  0xFFFE	/* zero header length */
@@ -134,8 +134,7 @@
  *	This structure defines an ethernet arp header.
  */
 
-struct arphdr
-{
+struct arphdr {
 	__be16		ar_hrd;		/* format of hardware address	*/
 	__be16		ar_pro;		/* format of protocol address	*/
 	unsigned char	ar_hln;		/* length of hardware address	*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_bonding.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_bonding.h
index 65c2d24..a17edda 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_bonding.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_bonding.h
@@ -83,6 +83,10 @@
 
 #define BOND_DEFAULT_MAX_BONDS  1   /* Default maximum number of devices to support */
 
+#define BOND_DEFAULT_TX_QUEUES 16   /* Default number of tx queues per device */
+
+#define BOND_DEFAULT_RESEND_IGMP	1 /* Default number of IGMP membership reports */
+
 /* hashing types */
 #define BOND_XMIT_POLICY_LAYER2		0 /* layer 2 (MAC only), default */
 #define BOND_XMIT_POLICY_LAYER34	1 /* layer 3+4 (IP ^ (TCP || UDP)) */
@@ -94,8 +98,7 @@
 	__s32 miimon;
 } ifbond;
 
-typedef struct ifslave
-{
+typedef struct ifslave {
 	__s32 slave_id; /* Used as an IN param to the BOND_SLAVE_INFO_QUERY ioctl */
 	char slave_name[IFNAMSIZ];
 	__s8 link;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_bridge.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_bridge.h
index 8458963..91911b7 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_bridge.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_bridge.h
@@ -49,8 +49,7 @@
 #define BR_STATE_FORWARDING 3
 #define BR_STATE_BLOCKING 4
 
-struct __bridge_info
-{
+struct __bridge_info {
 	__u64 designated_root;
 	__u64 bridge_id;
 	__u32 root_path_cost;
@@ -72,8 +71,7 @@
 	__u32 gc_timer_value;
 };
 
-struct __port_info
-{
+struct __port_info {
 	__u64 designated_root;
 	__u64 designated_bridge;
 	__u16 port_id;
@@ -89,8 +87,7 @@
 	__u32 hold_timer_value;
 };
 
-struct __fdb_entry
-{
+struct __fdb_entry {
 	__u8 mac_addr[6];
 	__u8 port_no;
 	__u8 is_local;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ec.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ec.h
index a8b81f8..b07ede1 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ec.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ec.h
@@ -5,14 +5,12 @@
 
 /* User visible stuff. Glibc provides its own but libc5 folk will use these */
 
-struct ec_addr
-{
+struct ec_addr {
   unsigned char station;		/* Station number.  */
   unsigned char net;			/* Network number.  */
 };
 
-struct sockaddr_ec
-{
+struct sockaddr_ec {
   unsigned short sec_family;
   unsigned char port;			/* Port number.  */
   unsigned char cb;			/* Control/flag byte.  */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ether.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ether.h
index 893f72e..8b35afe 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ether.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ether.h
@@ -72,16 +72,25 @@
 #define ETH_P_MPLS_UC	0x8847		/* MPLS Unicast traffic		*/
 #define ETH_P_MPLS_MC	0x8848		/* MPLS Multicast traffic	*/
 #define ETH_P_ATMMPOA	0x884c		/* MultiProtocol Over ATM	*/
+#define ETH_P_LINK_CTL	0x886c		/* HPNA, wlan link local tunnel */
 #define ETH_P_ATMFATE	0x8884		/* Frame-based ATM Transport
 					 * over Ethernet
 					 */
 #define ETH_P_PAE	0x888E		/* Port Access Entity (IEEE 802.1X) */
 #define ETH_P_AOE	0x88A2		/* ATA over Ethernet		*/
+#define ETH_P_8021AD	0x88A8          /* 802.1ad Service VLAN		*/
+#define ETH_P_802_EX1	0x88B5		/* 802.1 Local Experimental 1.  */
 #define ETH_P_TIPC	0x88CA		/* TIPC 			*/
+#define ETH_P_8021AH	0x88E7          /* 802.1ah Backbone Service Tag */
 #define ETH_P_1588	0x88F7		/* IEEE 1588 Timesync */
 #define ETH_P_FCOE	0x8906		/* Fibre Channel over Ethernet  */
+#define ETH_P_TDLS	0x890D          /* TDLS */
 #define ETH_P_FIP	0x8914		/* FCoE Initialization Protocol */
+#define ETH_P_QINQ1	0x9100		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
+#define ETH_P_QINQ2	0x9200		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
+#define ETH_P_QINQ3	0x9300		/* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
 #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 ] */
 
 /*
  *	Non DIX types. Won't clash for 1500 types.
@@ -109,6 +118,7 @@
 #define ETH_P_TRAILER	0x001C		/* Trailer switch tagging	*/
 #define ETH_P_PHONET	0x00F5		/* Nokia Phonet frames          */
 #define ETH_P_IEEE802154 0x00F6		/* IEEE802.15.4 frame		*/
+#define ETH_P_CAIF	0x00F7		/* ST-Ericsson CAIF protocol	*/
 
 /*
  *	This is an Ethernet frame header.
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_fddi.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_fddi.h
index be70f75..3c28442 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_fddi.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_fddi.h
@@ -63,36 +63,32 @@
 #define FDDI_UI_CMD			0x03
 
 /* Define 802.2 Type 1 header */
-struct fddi_8022_1_hdr
-	{
+struct fddi_8022_1_hdr {
 	__u8	dsap;					/* destination service access point */
 	__u8	ssap;					/* source service access point */
 	__u8	ctrl;					/* control byte #1 */
-	} __attribute__ ((packed));
+} __attribute__((packed));
 
 /* Define 802.2 Type 2 header */
-struct fddi_8022_2_hdr
-	{
+struct fddi_8022_2_hdr {
 	__u8	dsap;					/* destination service access point */
 	__u8	ssap;					/* source service access point */
 	__u8	ctrl_1;					/* control byte #1 */
 	__u8	ctrl_2;					/* control byte #2 */
-	} __attribute__ ((packed));
+} __attribute__((packed));
 
 /* Define 802.2 SNAP header */
 #define FDDI_K_OUI_LEN	3
-struct fddi_snap_hdr
-	{
+struct fddi_snap_hdr {
 	__u8	dsap;					/* always 0xAA */
 	__u8	ssap;					/* always 0xAA */
 	__u8	ctrl;					/* always 0x03 */
 	__u8	oui[FDDI_K_OUI_LEN];	/* organizational universal id */
 	__be16	ethertype;				/* packet type ID field */
-	} __attribute__ ((packed));
+} __attribute__((packed));
 
 /* Define FDDI LLC frame header */
-struct fddihdr
-	{
+struct fddihdr {
 	__u8	fc;						/* frame control */
 	__u8	daddr[FDDI_K_ALEN];		/* destination address */
 	__u8	saddr[FDDI_K_ALEN];		/* source address */
@@ -102,7 +98,7 @@
 		struct fddi_8022_2_hdr		llc_8022_2;
 		struct fddi_snap_hdr		llc_snap;
 		} hdr;
-	} __attribute__ ((packed));
+} __attribute__((packed));
 
 
 #endif	/* _LINUX_IF_FDDI_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_frad.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_frad.h
index 0a4484b..23099dc 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_frad.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_frad.h
@@ -69,11 +69,6 @@
 
 #define DLCI_VALID_FLAGS	0x000B
 
-/* FRAD driver uses these to indicate what it did with packet */
-#define DLCI_RET_OK		0x00
-#define DLCI_RET_ERR		0x01
-#define DLCI_RET_DROP		0x02
-
 /* defines for the actual Frame Relay hardware */
 #define FRAD_GET_CONF	(SIOCDEVPRIVATE)
 #define FRAD_SET_CONF	(SIOCDEVPRIVATE + 1)
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_hippi.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_hippi.h
index 4a7c994..cdc049f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_hippi.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_hippi.h
@@ -51,8 +51,7 @@
  *	HIPPI statistics collection data. 
  */
  
-struct hipnet_statistics
-{
+struct hipnet_statistics {
 	int	rx_packets;		/* total packets received	*/
 	int	tx_packets;		/* total packets transmitted	*/
 	int	rx_errors;		/* bad packets received		*/
@@ -77,8 +76,7 @@
 };
 
 
-struct hippi_fp_hdr
-{
+struct hippi_fp_hdr {
 #if 0
 	__u8		ulp;				/* must contain 4 */
 #if defined (__BIG_ENDIAN_BITFIELD)
@@ -106,10 +104,9 @@
 	__be32		fixed;
 #endif
 	__be32		d2_size;
-} __attribute__ ((packed));
+} __attribute__((packed));
 
-struct hippi_le_hdr
-{
+struct hippi_le_hdr {
 #if defined (__BIG_ENDIAN_BITFIELD)
 	__u8		fc:3;
 	__u8		double_wide:1;
@@ -132,27 +129,25 @@
 	__u8		daddr[HIPPI_ALEN];
 	__u16		locally_administered;
 	__u8		saddr[HIPPI_ALEN];
-} __attribute__ ((packed));
+} __attribute__((packed));
 
 #define HIPPI_OUI_LEN	3
 /*
  * Looks like the dsap and ssap fields have been swapped by mistake in
  * RFC 2067 "IP over HIPPI".
  */
-struct hippi_snap_hdr
-{
+struct hippi_snap_hdr {
 	__u8	dsap;			/* always 0xAA */
 	__u8	ssap;			/* always 0xAA */
 	__u8	ctrl;			/* always 0x03 */
 	__u8	oui[HIPPI_OUI_LEN];	/* organizational universal id (zero)*/
 	__be16	ethertype;		/* packet type ID field */
-} __attribute__ ((packed));
+} __attribute__((packed));
 
-struct hippi_hdr
-{
+struct hippi_hdr {
 	struct hippi_fp_hdr	fp;
 	struct hippi_le_hdr	le;
 	struct hippi_snap_hdr	snap;
-} __attribute__ ((packed));
+} __attribute__((packed));
 
 #endif	/* _LINUX_IF_HIPPI_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_hybrid.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_hybrid.h
deleted file mode 100644
index f0c1dde..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_hybrid.h
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
- *  Copyright (c) 2013 Qualcomm Atheros, Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  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
- */
-
-/*
- * Hybrid bridge definitions and data types
- *
- * netlink message format:
- *  ------------------------------------------
- * | NLMSG_HEADER | HYMSG_HEADER | HYMSG_DATA |
- *  ------------------------------------------
- * HYMSG_DATA format for the different message types:
- *
- * HYCTL_GET_HA_TABLE:          multiple of struct __hatbl_entry
- * HYCTL_GET_HD_TABLE:          multiple of struct __hdtbl_entry
- * HYCTL_UPDATE_HATBL_ENTRIES:  multiple of struct __hatbl_entry
- * HYCTL_UPDATE_HDTBL_ENTRIES:  multiple of struct __hdtbl_entry
- * HYCTL_ADD_HDTBL_ENTRIES:     multiple of struct __hdtbl_entry
- * HYCTL_DEL_HDTBL_ENTRIES:     multiple of struct __hdtbl_entry
- * HYCTL_FLUSH_HDTBL:
- * HYCTL_SET_HATBL_AGING_PARAM: struct __aging_param
- * HYCTL_ADD_BRIDGE:
- * HYCTL_DEL_BRIDGE:
- * HYCTL_ADD_IF:                ifindex (u32)
- * HYCTL_DEL_IF:                ifindex (u32)
- * HYCTL_GET_BRIDGES:           multiple of struct __hybr_info
- * HYCTL_GET_PORT_LIST:         multiple of struct __brport_group
- * HYCTL_SET_EVENT_INFO:        struct __event_info
- * HYCTL_SET_BRIDGE_MODE:       bridge mode (HR or HC) (u32)
- * HYCTL_SET_BRPORT_GROUP:      group num and type (u32)
- * HYCTL_FLUSH_HATBL:
- * HYCTL_ADD_HATBL_ENTRIES:     multiple of struct __hatbl_entry
- * HYCTL_DEL_HDTBL_ENTRIES_BYID: multiple of struct __hdtbl_entry
- * HYCTL_SET_BRPORT_BCAST:      struct __brport_group
- * HYCTL_SET_TCP_SP:            __u32
- * HYCTL_SET_BRPORT_TYPE:       struct __brport_group
- *
- *
- * netlink event format:
- *  ------------------------------------------
- * | NLMSG_HEADER | EVENT_DATA |
- *  ------------------------------------------
- * HY_EVENT_ADD_HA_ENTRY:       struct __hatbl_entry
- * HY_EVENT_DEL_HA_ENTRY:       struct __hatbl_entry
- * HY_EVENT_AGEOUT_HA_ENTRIES:
- * HY_EVENT_LINK_UP:              ifindex (u32)
- * HY_EVENT_LINK_DOWN:            ifindex (u32)
- */
-
-#ifndef _IF_HYBRID_BRIDGE_H
-#define _IF_HYBRID_BRIDGE_H
-
-#include <linux/types.h>
-
-/* netlink define */
-/* netlink port */
-#define NETLINK_ATHEROS_HY 25
-#define NETLINK_ATHEROS_HY_EVENT 26
-#define HY_IFNAME_SZ       16
-
-/* netlink message type */
-enum
-{
-    HYCTL_HYFI_FIRST = 0, /* Hy-Fi bridge range 0 - 0x100 */
-    HYCTL_GET_HA_TABLE = HYCTL_HYFI_FIRST,
-    HYCTL_GET_HD_TABLE,
-    HYCTL_GET_FDB,
-    HYCTL_UPDATE_HATBL_ENTRIES,
-    HYCTL_UPDATE_HDTBL_ENTRIES,
-    HYCTL_ADD_HDTBL_ENTRIES,
-    HYCTL_DEL_HDTBL_ENTRIES,
-    HYCTL_FLUSH_HDTBL,
-    HYCTL_SET_HATBL_AGING_PARAM,
-    HYCTL_ADD_BRIDGE,
-    HYCTL_DEL_BRIDGE,
-    HYCTL_ADD_IF,
-    HYCTL_DEL_IF,
-    HYCTL_GET_BRIDGES,
-    HYCTL_GET_PORT_LIST,
-    HYCTL_SET_EVENT_INFO,
-    HYCTL_SET_BRIDGE_MODE,
-    HYCTL_SET_BRPORT_GROUP,
-    HYCTL_FLUSH_HATBL,
-    HYCTL_ADD_HATBL_ENTRIES,
-    HYCTL_DEL_HDTBL_ENTRIES_BYID,
-    HYCTL_SET_BRPORT_BCAST,
-    HYCTL_SET_TCP_SP,
-    HYCTL_SET_PATHSWITCH_PARAM,
-    HYCTL_SET_BRPORT_TYPE,
-    HYCTL_UPDATE_HATBL_ENTRY,
-    HYCTL_DEL_FDB_ENTRY,
-    HYCTL_HYFI_LAST,
-
-    HYCTL_MC_FIRST = 0x100, /* Multicast range 0x100 - 0x200 */
-    HYCTL_SET_MC_ENABLE = HYCTL_MC_FIRST,
-    HYCTL_SET_MC_DEBUG,
-    HYCTL_SET_MC_POLICY,
-    HYCTL_SET_MC_MEMBERSHIP_INTERVAL,
-    HYCTL_SET_MC_RETAG,
-    HYCTL_SET_MC_ROUTER_PORT,
-    HYCTL_SET_MC_ADD_ACL_RULE,
-    HYCTL_SET_MC_FLUSH_ACL_RULE,
-    HYCTL_SET_MC_CONVERT_ALL,
-    HYCTL_SET_MC_TIMEOUT,
-    HYCTL_SET_MC_M2I3_FILTER,
-    HYCTL_SET_MC_TBIT,
-    HYCTL_SET_MC_LOCAL_QUERY_INTERVAL,
-    HYCTL_SET_MC_PSW_ENCAP,
-    HYCTL_SET_MC_PSW_FLOOD,
-    HYCTL_GET_MC_ACL,
-    HYCTL_GET_MC_MDB,
-    HYCTL_SET_MC_EXTRA_QUERY_RESPONSE_TIME,
-    HYCTL_SET_MC_LOCAL_INSPECT,
-    HYCTL_SET_MC_QRV_THRESHOLD,
-    HYCTL_MC_LAST,
-
-    HYCTL_PSW_FIRST = 0x200, /* Advanced path switching range 0x200 - 0x300 */
-    HYCTL_SET_PSW_DEBUG = HYCTL_PSW_FIRST,
-    HYCTL_SET_PSW_MSE_TIMEOUT,
-    HYCTL_SET_PSW_DROP_MARKERS,
-    HYCTL_SET_PSW_OLD_IF_QUIET_TIME,
-    HYCTL_SET_PSW_DUP_PKT_FLUSH_QUOTA,
-    HYCTL_PSW_LAST
-};
-
-/* Bridge mode:
- * The Hybrid bridge can be programmed in two modes:
- * 1. Relay override mode: Allow packet relaying from every port in every group to any other port in any other port.
- * 2. Group type relay mode: Packet relay decision is done according to the group type.
- */
-#define HY_BRIDGE_MODE_RELAY_OVERRIDE        1
-
-/* Group type:
- * A port can belong to either 2 groups:
- * 1. Relay group: Where packets are relayed from each port to every other port
- * 2. Non-relay group: Where packets are not relayed between group ports.
- *
- * Note that this has no effect in relay override bridge mode.
- */
-#define HY_PORTGRP_TYPE_RELAY     1
-
-/* The hyInterfaceType enum is deprecated and should not be used anymore.
- * It is kept here temporarily until it will be cleaned completely.
- * The following macro will break the compilation of any user space
- * application which is trying to use this enum.
- */
-#define __HY_MISUSE_PROTECT( x )    __##x
-
-enum __HY_MISUSE_PROTECT( hyInterfaceType )
-{
-    __HY_MISUSE_PROTECT( hyInterface_WIFI_2G ) = 0, /* Always leave W2G as '0': used as index by pcw service */
-    __HY_MISUSE_PROTECT( hyInterface_WIFI_5G ),
-    __HY_MISUSE_PROTECT( hyInterface_HPAV ),
-    __HY_MISUSE_PROTECT( hyInterface_ETH ),
-
-    __HY_MISUSE_PROTECT( hyInterface_NumberOfChildInterfaces ), /* Use this constant for arrays containing only child interfaces */
-
-    __HY_MISUSE_PROTECT( hyInterface_HY_BRIDGE ) = __HY_MISUSE_PROTECT( hyInterface_NumberOfChildInterfaces ),
-
-    __HY_MISUSE_PROTECT( hyInterface_NumberOfInterfaces )
-};
-
-
-struct __hyctl_msg_header
-{
-    char  if_name[HY_IFNAME_SZ];  /* hybrid bridge name: hy0 */
-    __u32 buf_len;                /* not include this header */
-    __u32 tbl_offsite;            /* how many entries to skip */
-    __u32 status;
-    __u32 bytes_written;
-    __u32 bytes_needed;
-    /* __u8  data[1]; */
-} __attribute__ ((packed));
-
-#define HYMSG_HDRLEN       sizeof (struct __hyctl_msg_header)
-#define HYMSG_DATA(p)      ((void*)(((char*)p) + NLMSG_LENGTH(0) + HYMSG_HDRLEN))
-/* define for the status field */
-enum
-{
-     HYCTL_STATUS_SUCCESS           = 0,
-     HYCTL_STATUS_NOT_SUPPORTED     = 1,
-     HYCTL_STATUS_RESOURCES         = 2,
-     HYCTL_STATUS_INVALID_PARAMETER = 3,
-     HYCTL_STATUS_BUFFER_OVERFLOW   = 4,
-     HYCTL_STATUS_FAILURE           = 5,
-     HYCTL_STATUS_NOT_FOUND         = 6,
-};
-
-#define HY_TRAFFIC_CLASS_OTHER 0
-#define HY_TRAFFIC_CLASS_UDP   1
-
-struct __aging_param
-{
-    __u32 aging_time;
-};
-
-struct __event_info
-{
-    __u32 event_pid;
-};
-
-struct __hybr_info
-{
-    __u32 ifindex;
-    __u32 br_opmode;
-    __u32 tcpsp_enable;
-};
-
-struct __brport_group
-{
-    __u32 ifindex;
-    __u32 group_num;
-    __u32 group_type;
-    __u32 bcast_enable;
-    __u32 port_type;
-};
-
-/* netlink event type */
-enum
-{
-     HY_EVENT_ADD_HA_ENTRY         = 1,
-     HY_EVENT_DEL_HA_ENTRY         = 2,
-     HY_EVENT_AGEOUT_HA_ENTRIES    = 3,
-     HY_EVENT_LINK_UP              = 4,
-     HY_EVENT_LINK_DOWN            = 5,
-     HY_EVENT_FDB_UPDATED          = 6,
-     HY_EVENT_MDB_UPDATED          = 7,
-};
-
-struct __hfdb_entry
-{
-    __u8 mac_addr[6];
-    __u8 port_no;
-    __u8 is_local;
-    __u32 ageing_timer_value;
-    __u8 port_hi;
-    __u8 pad0;
-    __u16 unused;
-} __attribute__ ((packed));
-
-struct __hdtbl_entry
-{
-	__u8 mac_addr[6];
-	__u8 id[6];
-	__u32 udp_port;         /* udp port ifindex */
-	__u32 other_port;       /* other port ifindex */
-	__u32 static_entry;
-} __attribute__ ((packed));
-
-struct __hatbl_entry
-{
- 	__u16 hash;
-    __u8  sa[6];
-    __u8  da[6];
-	__u8  id[6];
-	__u16 sub_class;
-	__u32 port;             /* port ifindex */
-	__u32 age;              /* since last access */
-	__u32 create_time;      /* ha entry create time */
-	__u32 num_packets;
-	__u32 num_bytes;
-	__u32 action:3;         /* drop, throttle */
-	__u32 local:1;          /* not created from HD */
-	__u32 psw_enable:1;     /*Enable per stream path switch */
-	__u32 static_entry:1;
-        __u32 psw_use:1; /* Forward tracked packet to new interface */
-	__u32 priority;
-
-	__u32 reserved;         /* Reserved */
-} __attribute__ ((packed));
-
-#define HATBL_PRIORITY_DSCP_VALID (1 << 31)
-#define HATBL_PRIORITY_8021_VALID (1 << 30)
-#define HATBL_PRIORITY_8021_MASK  0x00000007
-#define HATBL_PRIORITY_8021_SHIFT 0
-#define HATBL_PRIORITY_DSCP_MASK  0x000001F8
-#define HATBL_PRIORITY_DSCP_SHIFT 3
-
-struct __path_switch_param
-{
-    __u32 enable_path_switch;
-    __u32 wifi_2_q_max_len;
-    __u32 wifi_2_tracking_time;
-    __u32 wifi_5_q_max_len;
-    __u32 wifi_5_tracking_time;
-    __u32 plc_q_max_len;
-    __u32 plc_tracking_time;
-    __u32 eth_q_max_len;
-    __u32 eth_tracking_time;
-    __u32 enable_switch_markers;
-};
-
-struct __mc_param_value
-{
-    __u32 val;
-};
-
-enum
-{
-    MC_POLICY_DROP = 0,
-    MC_POLICY_FLOOD
-};
-
-struct __mc_param_retag
-{
-    __u32 enable;
-    __u32 dscp;
-};
-
-enum
-{
-    MC_RTPORT_FLOOD = 0,
-    MC_RTPORT_DROP,
-    MC_RTPORT_SPECIFY,
-    MC_RTPORT_DEFAULT,
-    MC_RTPORT_MAX
-};
-struct __mc_param_router_port
-{
-    __u32 type;
-    __u32 ifindex;
-};
-
-enum
-{
-    MC_ACL_RULE_DISABLE = 0,
-    MC_ACL_RULE_MULTICAST,
-    MC_ACL_RULE_SWM,     /* system wide management */
-    MC_ACL_RULE_MANAGEMENT,
-    MC_ACL_RULE_NON_SNOOPING,
-    MC_ACL_RULE_INTERNAL,
-    MC_ACL_RULE_MAX
-};
-enum
-{
-    MC_ACL_PATTERN_IGMP = 0,
-    MC_ACL_PATTERN_MLD,
-    MC_ACL_PATTERN_MAX
-};
-#define MC_ACL_RULE_MAX_COUNT 8 /* 8 for IGMP, 8 for MLD */
-struct __mc_param_pattern
-{
-    __u32 rule;
-    __u8  mac[6];
-    __u8  mac_mask[6];
-    __u8  ip[16];
-    __u8  ip_mask[16];
-} __attribute__ ((packed));
-struct __mc_param_acl_rule
-{
-    __u32 pattern_type; /* IGMP or MLD */
-    struct __mc_param_pattern pattern;
-} __attribute__ ((packed));
-
-enum
-{
-    MC_TIMEOUT_FROM_GROUP_SPECIFIC_QUERIES = 0,
-    MC_TIMEOUT_FROM_ALL_SYSTEM_QUERIES,
-    MC_TIMEOUT_FROM_GROUP_MEMBERSHIP_INTERVAL
-};
-
-struct __mc_param_timeout
-{
-    __u32 from;
-    __u32 enable;
-};
-
-#define HY_MC_SRCS_MAX      4
-#define HY_MC_RT_SRCS_MAX   8
-#define HY_MC_DEV_MAX       64
-#define HY_MC_IF_MAX        16
-#define HY_MC_IF_NODE_MAX   8
-#define HY_MC_GROUP_MAX     16
-#define HY_MC_IP6_SIZE      16
-//Do not change the below two macro values vice versa 
-#define HY_MC_EXCLUDE       1
-#define HY_MC_INCLUDE       2
-/* 
-The above two macros HY_MC_EXCLUDE and HY_MC_INCLUDE has been modified 
-to align those values with what being used in IGMP INC/EXC right now. 
-
-Please refer below the macro values and with ieee80211_ique.h. 
-#define IGMP_SNOOP_CMD_ADD_EXC_LIST  1
-#define IGMP_SNOOP_CMD_ADD_INC_LIST  2
-*/ 
-
-#define HY_MC_EX_SRCS_INVAL 0xff
-
-struct __mc_group
-{
-    __u32 pro;
-    union {
-        __u32 ip4;
-        __u8  ip6[HY_MC_IP6_SIZE];
-    } u;
-};
-
-struct __mc_mdb_entry
-{
-    struct __mc_group       group;
-    __u32                   ifindex;
-    __u32                   nsrcs;
-    __u8                    srcs[HY_MC_SRCS_MAX * HY_MC_IP6_SIZE];
-    __u32                   aging;
-    __u8                    filter_mode;
-    __u8                    fdb_age_out;
-    __u8                    mac[6];
-} __attribute__ ((packed));
-
-struct __mc_encaptbl_dev
-{
-    __u8                    mac[6];
-    __u16                   pad;
-    __u32                   in_nsrcs;
-    __u8                    in_srcs[HY_MC_RT_SRCS_MAX * HY_MC_IP6_SIZE]; /* include sources list */
-    __u32                   ex_nsrcs;
-    __u8                    ex_srcs[HY_MC_RT_SRCS_MAX * HY_MC_IP6_SIZE]; /* exclude sources list */
-};
-
-struct __mc_encaptbl_entry
-{
-    struct __mc_group        group;
-    __u32                    dev_cnt;
-    struct __mc_encaptbl_dev dev[HY_MC_DEV_MAX];
-} __attribute__ ((packed));
-
-struct __mc_floodtbl_entry
-{
-    struct __mc_group       group;
-    __u32                   ifcnt;
-    __u32                   ifindex[HY_MC_IF_MAX];
-} __attribute__ ((packed));
-
-struct __mc_iftbl_node
-{
-    __u8                     mac[6];
-    __u8                     filter_mode;
-    __u8                     nsrcs;
-    __u8                     srcs[HY_MC_SRCS_MAX * HY_MC_IP6_SIZE];
-};
-struct __mc_iftbl_entry
-{
-    struct __mc_group        group;
-    __u32                    node_cnt;
-    struct __mc_iftbl_node   nodes[HY_MC_IF_NODE_MAX];
-};
-
-
-#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_infiniband.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_infiniband.h
index 3e659ec..7d95847 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_infiniband.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_infiniband.h
@@ -5,7 +5,7 @@
  * <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD
  * license, available in the LICENSE.TXT file accompanying this
  * software.  These details are also available at
- * <http://openib.org/license.html>.
+ * <http://www.openfabrics.org/software_license.htm>.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_link.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_link.h
index b0b9e8a..06a3a47 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_link.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_link.h
@@ -4,9 +4,8 @@
 #include <linux/types.h>
 #include <linux/netlink.h>
 
-/* The struct should be in sync with struct net_device_stats */
-struct rtnl_link_stats
-{
+/* This struct should be in sync with struct rtnl_link_stats64 */
+struct rtnl_link_stats {
 	__u32	rx_packets;		/* total packets received	*/
 	__u32	tx_packets;		/* total packets transmitted	*/
 	__u32	rx_bytes;		/* total bytes received 	*/
@@ -38,9 +37,41 @@
 	__u32	tx_compressed;
 };
 
+/* The main device statistics structure */
+struct rtnl_link_stats64 {
+	__u64	rx_packets;		/* total packets received	*/
+	__u64	tx_packets;		/* total packets transmitted	*/
+	__u64	rx_bytes;		/* total bytes received 	*/
+	__u64	tx_bytes;		/* total bytes transmitted	*/
+	__u64	rx_errors;		/* bad packets received		*/
+	__u64	tx_errors;		/* packet transmit problems	*/
+	__u64	rx_dropped;		/* no space in linux buffers	*/
+	__u64	tx_dropped;		/* no space available in linux	*/
+	__u64	multicast;		/* multicast packets received	*/
+	__u64	collisions;
+
+	/* detailed rx_errors: */
+	__u64	rx_length_errors;
+	__u64	rx_over_errors;		/* receiver ring buff overflow	*/
+	__u64	rx_crc_errors;		/* recved pkt with crc error	*/
+	__u64	rx_frame_errors;	/* recv'd frame alignment error */
+	__u64	rx_fifo_errors;		/* recv'r fifo overrun		*/
+	__u64	rx_missed_errors;	/* receiver missed packet	*/
+
+	/* detailed tx_errors */
+	__u64	tx_aborted_errors;
+	__u64	tx_carrier_errors;
+	__u64	tx_fifo_errors;
+	__u64	tx_heartbeat_errors;
+	__u64	tx_window_errors;
+
+	/* for cslip etc */
+	__u64	rx_compressed;
+	__u64	tx_compressed;
+};
+
 /* The struct should be in sync with struct ifmap */
-struct rtnl_link_ifmap
-{
+struct rtnl_link_ifmap {
 	__u64	mem_start;
 	__u64	mem_end;
 	__u64	base_addr;
@@ -49,8 +80,25 @@
 	__u8	port;
 };
 
-enum
-{
+/*
+ * IFLA_AF_SPEC
+ *   Contains nested attributes for address family specific attributes.
+ *   Each address family may create a attribute with the address family
+ *   number as type and create its own attribute structure in it.
+ *
+ *   Example:
+ *   [IFLA_AF_SPEC] = {
+ *       [AF_INET] = {
+ *           [IFLA_INET_CONF] = ...,
+ *       },
+ *       [AF_INET6] = {
+ *           [IFLA_INET6_FLAGS] = ...,
+ *           [IFLA_INET6_CONF] = ...,
+ *       }
+ *   }
+ */
+
+enum {
 	IFLA_UNSPEC,
 	IFLA_ADDRESS,
 	IFLA_BROADCAST,
@@ -81,6 +129,15 @@
 #define IFLA_LINKINFO IFLA_LINKINFO
 	IFLA_NET_NS_PID,
 	IFLA_IFALIAS,
+	IFLA_NUM_VF,		/* Number of VFs if device is SR-IOV PF */
+	IFLA_VFINFO_LIST,
+	IFLA_STATS64,
+	IFLA_VF_PORTS,
+	IFLA_PORT_SELF,
+	IFLA_AF_SPEC,
+	IFLA_GROUP,		/* Group the device belongs to */
+	IFLA_NET_NS_FD,
+	IFLA_EXT_MASK,		/* Extended info mask, VFs, etc */
 	__IFLA_MAX
 };
 
@@ -91,6 +148,14 @@
 #define IFLA_RTA(r)  ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
 #define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
 
+enum {
+	IFLA_INET_UNSPEC,
+	IFLA_INET_CONF,
+	__IFLA_INET_MAX,
+};
+
+#define IFLA_INET_MAX (__IFLA_INET_MAX - 1)
+
 /* ifi_flags.
 
    IFF_* flags.
@@ -121,8 +186,7 @@
  */
 
 /* Subtype attributes for IFLA_PROTINFO */
-enum
-{
+enum {
 	IFLA_INET6_UNSPEC,
 	IFLA_INET6_FLAGS,	/* link flags			*/
 	IFLA_INET6_CONF,	/* sysctl parameters		*/
@@ -135,16 +199,14 @@
 
 #define IFLA_INET6_MAX	(__IFLA_INET6_MAX - 1)
 
-struct ifla_cacheinfo
-{
+struct ifla_cacheinfo {
 	__u32	max_reasm_len;
 	__u32	tstamp;		/* ipv6InterfaceTable updated timestamp */
 	__u32	reachable_time;
 	__u32	retrans_time;
 };
 
-enum
-{
+enum {
 	IFLA_INFO_UNSPEC,
 	IFLA_INFO_KIND,
 	IFLA_INFO_DATA,
@@ -156,8 +218,7 @@
 
 /* VLAN section */
 
-enum
-{
+enum {
 	IFLA_VLAN_UNSPEC,
 	IFLA_VLAN_ID,
 	IFLA_VLAN_FLAGS,
@@ -173,8 +234,7 @@
 	__u32	mask;
 };
 
-enum
-{
+enum {
 	IFLA_VLAN_QOS_UNSPEC,
 	IFLA_VLAN_QOS_MAPPING,
 	__IFLA_VLAN_QOS_MAX
@@ -182,10 +242,139 @@
 
 #define IFLA_VLAN_QOS_MAX	(__IFLA_VLAN_QOS_MAX - 1)
 
-struct ifla_vlan_qos_mapping
-{
+struct ifla_vlan_qos_mapping {
 	__u32 from;
 	__u32 to;
 };
 
+/* MACVLAN section */
+enum {
+	IFLA_MACVLAN_UNSPEC,
+	IFLA_MACVLAN_MODE,
+	__IFLA_MACVLAN_MAX,
+};
+
+#define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1)
+
+enum macvlan_mode {
+	MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */
+	MACVLAN_MODE_VEPA    = 2, /* talk to other ports through ext bridge */
+	MACVLAN_MODE_BRIDGE  = 4, /* talk to bridge ports directly */
+	MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */
+};
+
+/* SR-IOV virtual function management section */
+
+enum {
+	IFLA_VF_INFO_UNSPEC,
+	IFLA_VF_INFO,
+	__IFLA_VF_INFO_MAX,
+};
+
+#define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1)
+
+enum {
+	IFLA_VF_UNSPEC,
+	IFLA_VF_MAC,		/* Hardware queue specific attributes */
+	IFLA_VF_VLAN,
+	IFLA_VF_TX_RATE,	/* TX Bandwidth Allocation */
+	IFLA_VF_SPOOFCHK,	/* Spoof Checking on/off switch */
+	__IFLA_VF_MAX,
+};
+
+#define IFLA_VF_MAX (__IFLA_VF_MAX - 1)
+
+struct ifla_vf_mac {
+	__u32 vf;
+	__u8 mac[32]; /* MAX_ADDR_LEN */
+};
+
+struct ifla_vf_vlan {
+	__u32 vf;
+	__u32 vlan; /* 0 - 4095, 0 disables VLAN filter */
+	__u32 qos;
+};
+
+struct ifla_vf_tx_rate {
+	__u32 vf;
+	__u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */
+};
+
+struct ifla_vf_spoofchk {
+	__u32 vf;
+	__u32 setting;
+};
+
+/* VF ports management section
+ *
+ *	Nested layout of set/get msg is:
+ *
+ *		[IFLA_NUM_VF]
+ *		[IFLA_VF_PORTS]
+ *			[IFLA_VF_PORT]
+ *				[IFLA_PORT_*], ...
+ *			[IFLA_VF_PORT]
+ *				[IFLA_PORT_*], ...
+ *			...
+ *		[IFLA_PORT_SELF]
+ *			[IFLA_PORT_*], ...
+ */
+
+enum {
+	IFLA_VF_PORT_UNSPEC,
+	IFLA_VF_PORT,			/* nest */
+	__IFLA_VF_PORT_MAX,
+};
+
+#define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1)
+
+enum {
+	IFLA_PORT_UNSPEC,
+	IFLA_PORT_VF,			/* __u32 */
+	IFLA_PORT_PROFILE,		/* string */
+	IFLA_PORT_VSI_TYPE,		/* 802.1Qbg (pre-)standard VDP */
+	IFLA_PORT_INSTANCE_UUID,	/* binary UUID */
+	IFLA_PORT_HOST_UUID,		/* binary UUID */
+	IFLA_PORT_REQUEST,		/* __u8 */
+	IFLA_PORT_RESPONSE,		/* __u16, output only */
+	__IFLA_PORT_MAX,
+};
+
+#define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1)
+
+#define PORT_PROFILE_MAX	40
+#define PORT_UUID_MAX		16
+#define PORT_SELF_VF		-1
+
+enum {
+	PORT_REQUEST_PREASSOCIATE = 0,
+	PORT_REQUEST_PREASSOCIATE_RR,
+	PORT_REQUEST_ASSOCIATE,
+	PORT_REQUEST_DISASSOCIATE,
+};
+
+enum {
+	PORT_VDP_RESPONSE_SUCCESS = 0,
+	PORT_VDP_RESPONSE_INVALID_FORMAT,
+	PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES,
+	PORT_VDP_RESPONSE_UNUSED_VTID,
+	PORT_VDP_RESPONSE_VTID_VIOLATION,
+	PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION,
+	PORT_VDP_RESPONSE_OUT_OF_SYNC,
+	/* 0x08-0xFF reserved for future VDP use */
+	PORT_PROFILE_RESPONSE_SUCCESS = 0x100,
+	PORT_PROFILE_RESPONSE_INPROGRESS,
+	PORT_PROFILE_RESPONSE_INVALID,
+	PORT_PROFILE_RESPONSE_BADSTATE,
+	PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES,
+	PORT_PROFILE_RESPONSE_ERROR,
+};
+
+struct ifla_port_vsi {
+	__u8 vsi_mgr_id;
+	__u8 vsi_type_id[3];
+	__u8 vsi_type_version;
+	__u8 pad[3];
+};
+
 #endif /* _LINUX_IF_LINK_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_packet.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_packet.h
index dea7d6b..e06b393 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_packet.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_packet.h
@@ -3,15 +3,13 @@
 
 #include <linux/types.h>
 
-struct sockaddr_pkt
-{
+struct sockaddr_pkt {
 	unsigned short spkt_family;
 	unsigned char spkt_device[14];
 	__be16 spkt_protocol;
 };
 
-struct sockaddr_ll
-{
+struct sockaddr_ll {
 	unsigned short	sll_family;
 	__be16		sll_protocol;
 	int		sll_ifindex;
@@ -31,6 +29,8 @@
 /* These ones are invisible by user level */
 #define PACKET_LOOPBACK		5		/* MC/BRD frame looped back */
 #define PACKET_FASTROUTE	6		/* Fastrouted frame	*/
+#define PACKET_MASK_ANY		0xffffffff	/* mask for packet type bits */
+
 
 /* Packet socket options */
 
@@ -48,21 +48,41 @@
 #define PACKET_RESERVE			12
 #define PACKET_TX_RING			13
 #define PACKET_LOSS			14
+#define PACKET_VNET_HDR			15
+#define PACKET_TX_TIMESTAMP		16
+#define PACKET_TIMESTAMP		17
+#define PACKET_FANOUT			18
+#define PACKET_RECV_TYPE		19
 
-struct tpacket_stats
-{
+#define PACKET_FANOUT_HASH		0
+#define PACKET_FANOUT_LB		1
+#define PACKET_FANOUT_CPU		2
+#define PACKET_FANOUT_FLAG_DEFRAG	0x8000
+
+struct tpacket_stats {
 	unsigned int	tp_packets;
 	unsigned int	tp_drops;
 };
 
-struct tpacket_auxdata
-{
+struct tpacket_stats_v3 {
+	unsigned int	tp_packets;
+	unsigned int	tp_drops;
+	unsigned int	tp_freeze_q_cnt;
+};
+
+union tpacket_stats_u {
+	struct tpacket_stats stats1;
+	struct tpacket_stats_v3 stats3;
+};
+
+struct tpacket_auxdata {
 	__u32		tp_status;
 	__u32		tp_len;
 	__u32		tp_snaplen;
 	__u16		tp_mac;
 	__u16		tp_net;
 	__u16		tp_vlan_tci;
+	__u16		tp_padding;
 };
 
 /* Rx ring - header status */
@@ -71,6 +91,8 @@
 #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
 
 /* Tx ring - header status */
 #define TP_STATUS_AVAILABLE	0x0
@@ -78,8 +100,10 @@
 #define TP_STATUS_SENDING	0x2
 #define TP_STATUS_WRONG_FORMAT	0x4
 
-struct tpacket_hdr
-{
+/* Rx ring - feature request bits */
+#define TP_FT_REQ_FILL_RXHASH	0x1
+
+struct tpacket_hdr {
 	unsigned long	tp_status;
 	unsigned int	tp_len;
 	unsigned int	tp_snaplen;
@@ -93,8 +117,7 @@
 #define TPACKET_ALIGN(x)	(((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1))
 #define TPACKET_HDRLEN		(TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll))
 
-struct tpacket2_hdr
-{
+struct tpacket2_hdr {
 	__u32		tp_status;
 	__u32		tp_len;
 	__u32		tp_snaplen;
@@ -103,14 +126,103 @@
 	__u32		tp_sec;
 	__u32		tp_nsec;
 	__u16		tp_vlan_tci;
+	__u16		tp_padding;
+};
+
+struct tpacket_hdr_variant1 {
+	__u32	tp_rxhash;
+	__u32	tp_vlan_tci;
+};
+
+struct tpacket3_hdr {
+	__u32		tp_next_offset;
+	__u32		tp_sec;
+	__u32		tp_nsec;
+	__u32		tp_snaplen;
+	__u32		tp_len;
+	__u32		tp_status;
+	__u16		tp_mac;
+	__u16		tp_net;
+	/* pkt_hdr variants */
+	union {
+		struct tpacket_hdr_variant1 hv1;
+	};
+};
+
+struct tpacket_bd_ts {
+	unsigned int ts_sec;
+	union {
+		unsigned int ts_usec;
+		unsigned int ts_nsec;
+	};
+};
+
+struct tpacket_hdr_v1 {
+	__u32	block_status;
+	__u32	num_pkts;
+	__u32	offset_to_first_pkt;
+
+	/* Number of valid bytes (including padding)
+	 * blk_len <= tp_block_size
+	 */
+	__u32	blk_len;
+
+	/*
+	 * Quite a few uses of sequence number:
+	 * 1. Make sure cache flush etc worked.
+	 *    Well, one can argue - why not use the increasing ts below?
+	 *    But look at 2. below first.
+	 * 2. When you pass around blocks to other user space decoders,
+	 *    you can see which blk[s] is[are] outstanding etc.
+	 * 3. Validate kernel code.
+	 */
+	__aligned_u64	seq_num;
+
+	/*
+	 * ts_last_pkt:
+	 *
+	 * Case 1.	Block has 'N'(N >=1) packets and TMO'd(timed out)
+	 *		ts_last_pkt == 'time-stamp of last packet' and NOT the
+	 *		time when the timer fired and the block was closed.
+	 *		By providing the ts of the last packet we can absolutely
+	 *		guarantee that time-stamp wise, the first packet in the
+	 *		next block will never precede the last packet of the
+	 *		previous block.
+	 * Case 2.	Block has zero packets and TMO'd
+	 *		ts_last_pkt = time when the timer fired and the block
+	 *		was closed.
+	 * Case 3.	Block has 'N' packets and NO TMO.
+	 *		ts_last_pkt = time-stamp of the last pkt in the block.
+	 *
+	 * ts_first_pkt:
+	 *		Is always the time-stamp when the block was opened.
+	 *		Case a)	ZERO packets
+	 *			No packets to deal with but atleast you know the
+	 *			time-interval of this block.
+	 *		Case b) Non-zero packets
+	 *			Use the ts of the first packet in the block.
+	 *
+	 */
+	struct tpacket_bd_ts	ts_first_pkt, ts_last_pkt;
+};
+
+union tpacket_bd_header_u {
+	struct tpacket_hdr_v1 bh1;
+};
+
+struct tpacket_block_desc {
+	__u32 version;
+	__u32 offset_to_priv;
+	union tpacket_bd_header_u hdr;
 };
 
 #define TPACKET2_HDRLEN		(TPACKET_ALIGN(sizeof(struct tpacket2_hdr)) + sizeof(struct sockaddr_ll))
+#define TPACKET3_HDRLEN		(TPACKET_ALIGN(sizeof(struct tpacket3_hdr)) + sizeof(struct sockaddr_ll))
 
-enum tpacket_versions
-{
+enum tpacket_versions {
 	TPACKET_V1,
 	TPACKET_V2,
+	TPACKET_V3
 };
 
 /*
@@ -126,16 +238,29 @@
    - Pad to align to TPACKET_ALIGNMENT=16
  */
 
-struct tpacket_req
-{
+struct tpacket_req {
 	unsigned int	tp_block_size;	/* Minimal size of contiguous block */
 	unsigned int	tp_block_nr;	/* Number of blocks */
 	unsigned int	tp_frame_size;	/* Size of frame */
 	unsigned int	tp_frame_nr;	/* Total number of frames */
 };
 
-struct packet_mreq
-{
+struct tpacket_req3 {
+	unsigned int	tp_block_size;	/* Minimal size of contiguous block */
+	unsigned int	tp_block_nr;	/* Number of blocks */
+	unsigned int	tp_frame_size;	/* Size of frame */
+	unsigned int	tp_frame_nr;	/* Total number of frames */
+	unsigned int	tp_retire_blk_tov; /* timeout in msecs */
+	unsigned int	tp_sizeof_priv; /* offset to private data area */
+	unsigned int	tp_feature_req_word;
+};
+
+union tpacket_req_u {
+	struct tpacket_req	req;
+	struct tpacket_req3	req3;
+};
+
+struct packet_mreq {
 	int		mr_ifindex;
 	unsigned short	mr_type;
 	unsigned short	mr_alen;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_plip.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_plip.h
index 153a649..6298c7e 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_plip.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_plip.h
@@ -15,8 +15,7 @@
 
 #define	SIOCDEVPLIP	SIOCDEVPRIVATE
 
-struct plipconf
-{
+struct plipconf {
 	unsigned short pcmd;
 	unsigned long  nibble;
 	unsigned long  trigger;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ppp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ppp.h
index c57bd71..0b88f26 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ppp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_ppp.h
@@ -114,14 +114,14 @@
 	__u16		tunnel_id;	/* redundant */
 	__u16		session_id;	/* if zero, get tunnel stats */
 	__u32		using_ipsec:1;	/* valid only for session_id == 0 */
-	aligned_u64	tx_packets;
-	aligned_u64	tx_bytes;
-	aligned_u64	tx_errors;
-	aligned_u64	rx_packets;
-	aligned_u64	rx_bytes;
-	aligned_u64	rx_seq_discards;
-	aligned_u64	rx_oos_packets;
-	aligned_u64	rx_errors;
+	__aligned_u64	tx_packets;
+	__aligned_u64	tx_bytes;
+	__aligned_u64	tx_errors;
+	__aligned_u64	rx_packets;
+	__aligned_u64	rx_bytes;
+	__aligned_u64	rx_seq_discards;
+	__aligned_u64	rx_oos_packets;
+	__aligned_u64	rx_errors;
 };
 
 #define ifr__name       b.ifr_ifrn.ifrn_name
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_pppol2tp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_pppol2tp.h
index cb939b2..45fb9f3 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_pppol2tp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_pppol2tp.h
@@ -2,7 +2,7 @@
  * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661)
  *
  * This file supplies definitions required by the PPP over L2TP driver
- * (pppol2tp.c).  All version information wrt this file is located in pppol2tp.c
+ * (l2tp_ppp.c).  All version information wrt this file is located in l2tp_ppp.c
  *
  * License:
  *		This program is free software; you can redistribute it and/or
@@ -21,8 +21,7 @@
 /* Structure used to connect() the socket to a particular tunnel UDP
  * socket.
  */
-struct pppol2tp_addr
-{
+struct pppol2tp_addr {
 	__kernel_pid_t	pid;		/* pid that owns the fd.
 					 * 0 => current */
 	int	fd;			/* FD of UDP socket to use */
@@ -33,6 +32,20 @@
 	__u16 d_tunnel, d_session;	/* For sending outgoing packets */
 };
 
+/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
+ * bits. So we need a different sockaddr structure.
+ */
+struct pppol2tpv3_addr {
+	__kernel_pid_t	pid;		/* pid that owns the fd.
+					 * 0 => current */
+	int	fd;			/* FD of UDP or IP socket to use */
+
+	struct sockaddr_in addr;	/* IP address and port to send to */
+
+	__u32 s_tunnel, s_session;	/* For matching incoming packets */
+	__u32 d_tunnel, d_session;	/* For sending outgoing packets */
+};
+
 /* Socket options:
  * DEBUG	- bitmask of debug message categories
  * SENDSEQ	- 0 => don't send packets with sequence numbers
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_pppox.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_pppox.h
index d8e1511..b0cc29b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_pppox.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_pppox.h
@@ -20,6 +20,8 @@
 #include <linux/types.h>
 #include <asm/byteorder.h>
 
+#include <linux/socket.h>
+#include <linux/if_ether.h>
 #include <linux/if_pppol2tp.h>
 
 /* For user-space programs to pick up these definitions
@@ -34,26 +36,36 @@
  * PPPoE addressing definition 
  */ 
 typedef __be16 sid_t;
-struct pppoe_addr{ 
-       sid_t           sid;                    /* Session identifier */ 
-       unsigned char   remote[ETH_ALEN];       /* Remote address */ 
-       char            dev[IFNAMSIZ];          /* Local device to use */ 
+struct pppoe_addr {
+	sid_t         sid;                    /* Session identifier */
+	unsigned char remote[ETH_ALEN];       /* Remote address */
+	char          dev[IFNAMSIZ];          /* Local device to use */
 }; 
  
 /************************************************************************ 
- * Protocols supported by AF_PPPOX 
- */ 
+ * PPTP addressing definition
+ */
+struct pptp_addr {
+	__be16		call_id;
+	struct in_addr	sin_addr;
+};
+
+/************************************************************************
+ * Protocols supported by AF_PPPOX
+ */
 #define PX_PROTO_OE    0 /* Currently just PPPoE */
 #define PX_PROTO_OL2TP 1 /* Now L2TP also */
-#define PX_MAX_PROTO   2
+#define PX_PROTO_PPTP  2
+#define PX_MAX_PROTO   3
 
-struct sockaddr_pppox { 
-       sa_family_t     sa_family;            /* address family, AF_PPPOX */ 
-       unsigned int    sa_protocol;          /* protocol identifier */ 
-       union{ 
-               struct pppoe_addr       pppoe; 
-       }sa_addr; 
-}__attribute__ ((packed)); 
+struct sockaddr_pppox {
+	__kernel_sa_family_t sa_family;       /* address family, AF_PPPOX */
+	unsigned int    sa_protocol;          /* protocol identifier */
+	union {
+		struct pppoe_addr  pppoe;
+		struct pptp_addr   pptp;
+	} sa_addr;
+} __attribute__((packed));
 
 /* The use of the above union isn't viable because the size of this
  * struct must stay fixed over time -- applications use sizeof(struct
@@ -61,10 +73,19 @@
  * type instead.
  */
 struct sockaddr_pppol2tp {
-	sa_family_t     sa_family;      /* address family, AF_PPPOX */
+	__kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
 	unsigned int    sa_protocol;    /* protocol identifier */
 	struct pppol2tp_addr pppol2tp;
-}__attribute__ ((packed));
+} __attribute__((packed));
+
+/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
+ * bits. So we need a different sockaddr structure.
+ */
+struct sockaddr_pppol2tpv3 {
+	__kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
+	unsigned int    sa_protocol;    /* protocol identifier */
+	struct pppol2tpv3_addr pppol2tp;
+} __attribute__((packed));
 
 /*********************************************************************
  *
@@ -86,7 +107,7 @@
 	__be16 tag_type;
 	__be16 tag_len;
 	char tag_data[0];
-} __attribute ((packed));
+} __attribute__ ((packed));
 
 /* Tag identifiers */
 #define PTT_EOL		__cpu_to_be16(0x0000)
@@ -114,7 +135,7 @@
 	__be16 sid;
 	__be16 length;
 	struct pppoe_tag tag[0];
-} __attribute__ ((packed));
+} __attribute__((packed));
 
 /* Length of entire PPPoE + PPP header */
 #define PPPOE_SES_HLEN	8
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_team.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_team.h
new file mode 100644
index 0000000..c1f4d9b
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_team.h
@@ -0,0 +1,105 @@
+/*
+ * include/linux/if_team.h - Network team device driver header
+ * Copyright (c) 2011 Jiri Pirko <jpirko@redhat.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.
+ */
+
+#ifndef _LINUX_IF_TEAM_H_
+#define _LINUX_IF_TEAM_H_
+
+
+#define TEAM_STRING_MAX_LEN 32
+
+/**********************************
+ * NETLINK_GENERIC netlink family.
+ **********************************/
+
+enum {
+	TEAM_CMD_NOOP,
+	TEAM_CMD_OPTIONS_SET,
+	TEAM_CMD_OPTIONS_GET,
+	TEAM_CMD_PORT_LIST_GET,
+
+	__TEAM_CMD_MAX,
+	TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1),
+};
+
+enum {
+	TEAM_ATTR_UNSPEC,
+	TEAM_ATTR_TEAM_IFINDEX,		/* u32 */
+	TEAM_ATTR_LIST_OPTION,		/* nest */
+	TEAM_ATTR_LIST_PORT,		/* nest */
+
+	__TEAM_ATTR_MAX,
+	TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1,
+};
+
+/* Nested layout of get/set msg:
+ *
+ *	[TEAM_ATTR_LIST_OPTION]
+ *		[TEAM_ATTR_ITEM_OPTION]
+ *			[TEAM_ATTR_OPTION_*], ...
+ *		[TEAM_ATTR_ITEM_OPTION]
+ *			[TEAM_ATTR_OPTION_*], ...
+ *		...
+ *	[TEAM_ATTR_LIST_PORT]
+ *		[TEAM_ATTR_ITEM_PORT]
+ *			[TEAM_ATTR_PORT_*], ...
+ *		[TEAM_ATTR_ITEM_PORT]
+ *			[TEAM_ATTR_PORT_*], ...
+ *		...
+ */
+
+enum {
+	TEAM_ATTR_ITEM_OPTION_UNSPEC,
+	TEAM_ATTR_ITEM_OPTION,		/* nest */
+
+	__TEAM_ATTR_ITEM_OPTION_MAX,
+	TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1,
+};
+
+enum {
+	TEAM_ATTR_OPTION_UNSPEC,
+	TEAM_ATTR_OPTION_NAME,		/* string */
+	TEAM_ATTR_OPTION_CHANGED,	/* flag */
+	TEAM_ATTR_OPTION_TYPE,		/* u8 */
+	TEAM_ATTR_OPTION_DATA,		/* dynamic */
+	TEAM_ATTR_OPTION_REMOVED,	/* flag */
+
+	__TEAM_ATTR_OPTION_MAX,
+	TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
+};
+
+enum {
+	TEAM_ATTR_ITEM_PORT_UNSPEC,
+	TEAM_ATTR_ITEM_PORT,		/* nest */
+
+	__TEAM_ATTR_ITEM_PORT_MAX,
+	TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1,
+};
+
+enum {
+	TEAM_ATTR_PORT_UNSPEC,
+	TEAM_ATTR_PORT_IFINDEX,		/* u32 */
+	TEAM_ATTR_PORT_CHANGED,		/* flag */
+	TEAM_ATTR_PORT_LINKUP,		/* flag */
+	TEAM_ATTR_PORT_SPEED,		/* u32 */
+	TEAM_ATTR_PORT_DUPLEX,		/* u8 */
+	TEAM_ATTR_PORT_REMOVED,		/* flag */
+
+	__TEAM_ATTR_PORT_MAX,
+	TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1,
+};
+
+/*
+ * NETLINK_GENERIC related info
+ */
+#define TEAM_GENL_NAME "team"
+#define TEAM_GENL_VERSION 0x1
+#define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event"
+
+#endif /* _LINUX_IF_TEAM_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_tun.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_tun.h
index 915ba57..4054c1a 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_tun.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_tun.h
@@ -18,6 +18,7 @@
 
 #include <linux/types.h>
 #include <linux/if_ether.h>
+#include <linux/filter.h>
 
 /* Read queue size */
 #define TUN_READQ_SIZE	500
@@ -48,6 +49,10 @@
 #define TUNGETIFF      _IOR('T', 210, unsigned int)
 #define TUNGETSNDBUF   _IOR('T', 211, int)
 #define TUNSETSNDBUF   _IOW('T', 212, int)
+#define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog)
+#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog)
+#define TUNGETVNETHDRSZ _IOR('T', 215, int)
+#define TUNSETVNETHDRSZ _IOW('T', 216, int)
 
 /* TUNSETIFF ifr flags */
 #define IFF_TUN		0x0001
@@ -62,6 +67,7 @@
 #define TUN_F_TSO4	0x02	/* I can handle TSO for IPv4 packets */
 #define TUN_F_TSO6	0x04	/* I can handle TSO for IPv6 packets */
 #define TUN_F_TSO_ECN	0x08	/* I can handle TSO with ECN bits. */
+#define TUN_F_UFO	0x10	/* I can handle UFO packets */
 
 /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */
 #define TUN_PKT_STRIP	0x0001
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_tunnel.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_tunnel.h
index 9229075..8c819b8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_tunnel.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_tunnel.h
@@ -2,6 +2,7 @@
 #define _IF_TUNNEL_H_
 
 #include <linux/types.h>
+#include <asm/byteorder.h>
 
 
 #define SIOCGETTUNNEL   (SIOCDEVPRIVATE + 0)
@@ -12,6 +13,10 @@
 #define SIOCADDPRL      (SIOCDEVPRIVATE + 5)
 #define SIOCDELPRL      (SIOCDEVPRIVATE + 6)
 #define SIOCCHGPRL      (SIOCDEVPRIVATE + 7)
+#define SIOCGET6RD      (SIOCDEVPRIVATE + 8)
+#define SIOCADD6RD      (SIOCDEVPRIVATE + 9)
+#define SIOCDEL6RD      (SIOCDEVPRIVATE + 10)
+#define SIOCCHG6RD      (SIOCDEVPRIVATE + 11)
 
 #define GRE_CSUM	__cpu_to_be16(0x8000)
 #define GRE_ROUTING	__cpu_to_be16(0x4000)
@@ -22,8 +27,7 @@
 #define GRE_FLAGS	__cpu_to_be16(0x00F8)
 #define GRE_VERSION	__cpu_to_be16(0x0007)
 
-struct ip_tunnel_parm
-{
+struct ip_tunnel_parm {
 	char			name[IFNAMSIZ];
 	int			link;
 	__be16			i_flags;
@@ -41,15 +45,21 @@
 	__u16			flags;
 	__u16			__reserved;
 	__u32			datalen;
-	__u32			rs_delay;
+	__u32			__reserved2;
 	/* data follows */
 };
 
 /* PRL flags */
 #define	PRL_DEFAULT		0x0001
 
-enum
-{
+struct ip_tunnel_6rd {
+	struct in6_addr		prefix;
+	__be32			relay_prefix;
+	__u16			prefixlen;
+	__u16			relay_prefixlen;
+};
+
+enum {
 	IFLA_GRE_UNSPEC,
 	IFLA_GRE_LINK,
 	IFLA_GRE_IFLAGS,
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_vlan.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_vlan.h
index 2dc4a57..5b808eb 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_vlan.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_vlan.h
@@ -33,6 +33,7 @@
 enum vlan_flags {
 	VLAN_FLAG_REORDER_HDR	= 0x1,
 	VLAN_FLAG_GVRP		= 0x2,
+	VLAN_FLAG_LOOSE_BINDING	= 0x4,
 };
 
 enum vlan_name_types {
@@ -53,7 +54,7 @@
 		unsigned int skb_priority;
 		unsigned int name_type;
 		unsigned int bind_type;
-		unsigned int flag; /* Matches vlan_dev_info flags */
+		unsigned int flag; /* Matches vlan_dev_priv flags */
         } u;
 
 	short vlan_qos;   
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_x25.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_x25.h
new file mode 100644
index 0000000..897765f
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/if_x25.h
@@ -0,0 +1,26 @@
+/*
+ *  Linux X.25 packet to device interface
+ *
+ *  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.
+ */
+
+#ifndef _IF_X25_H
+#define _IF_X25_H
+
+#include <linux/types.h>
+
+/* Documentation/networking/x25-iface.txt */
+#define X25_IFACE_DATA		0x00
+#define X25_IFACE_CONNECT	0x01
+#define X25_IFACE_DISCONNECT	0x02
+#define X25_IFACE_PARAMS	0x03
+
+#endif /* _IF_X25_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/igmp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/igmp.h
index 6c4c5a7..392ba86 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/igmp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/igmp.h
@@ -27,8 +27,7 @@
  *	Header in on cable format
  */
 
-struct igmphdr
-{
+struct igmphdr {
 	__u8 type;
 	__u8 code;		/* For newer IGMP */
 	__sum16 csum;
@@ -86,9 +85,9 @@
 #define IGMP_DVMRP			0x13	/* DVMRP routing */
 #define IGMP_PIM			0x14	/* PIM routing */
 #define IGMP_TRACE			0x15
-#define IGMPV2_HOST_MEMBERSHIP_REPORT	0x16	/* V2 version of 0x11 */
+#define IGMPV2_HOST_MEMBERSHIP_REPORT	0x16	/* V2 version of 0x12 */
 #define IGMP_HOST_LEAVE_MESSAGE 	0x17
-#define IGMPV3_HOST_MEMBERSHIP_REPORT	0x22	/* V3 version of 0x11 */
+#define IGMPV3_HOST_MEMBERSHIP_REPORT	0x22	/* V3 version of 0x12 */
 
 #define IGMP_MTRACE_RESP		0x1e
 #define IGMP_MTRACE			0x1f
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/in.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/in.h
index f397261..71aefd1 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/in.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/in.h
@@ -84,6 +84,9 @@
 #define IP_ORIGDSTADDR       20
 #define IP_RECVORIGDSTADDR   IP_ORIGDSTADDR
 
+#define IP_MINTTL       21
+#define IP_NODEFRAG     22
+
 /* IP_MTU_DISCOVER values */
 #define IP_PMTUDISC_DONT		0	/* Never send DF frames */
 #define IP_PMTUDISC_WANT		1	/* Use per route hints	*/
@@ -118,14 +121,12 @@
 
 /* Request struct for multicast socket ops */
 
-struct ip_mreq 
-{
+struct ip_mreq  {
 	struct in_addr imr_multiaddr;	/* IP multicast address of group */
 	struct in_addr imr_interface;	/* local IP address of interface */
 };
 
-struct ip_mreqn
-{
+struct ip_mreqn {
 	struct in_addr	imr_multiaddr;		/* IP multicast address of group */
 	struct in_addr	imr_address;		/* local IP address of interface */
 	int		imr_ifindex;		/* Interface index */
@@ -149,21 +150,18 @@
 	(sizeof(struct ip_msfilter) - sizeof(__u32) \
 	+ (numsrc) * sizeof(__u32))
 
-struct group_req
-{
+struct group_req {
 	__u32				 gr_interface;	/* interface index */
 	struct __kernel_sockaddr_storage gr_group;	/* group address */
 };
 
-struct group_source_req
-{
+struct group_source_req {
 	__u32				 gsr_interface;	/* interface index */
 	struct __kernel_sockaddr_storage gsr_group;	/* group address */
 	struct __kernel_sockaddr_storage gsr_source;	/* source address */
 };
 
-struct group_filter
-{
+struct group_filter {
 	__u32				 gf_interface;	/* interface index */
 	struct __kernel_sockaddr_storage gf_group;	/* multicast address */
 	__u32				 gf_fmode;	/* filter mode */
@@ -175,8 +173,7 @@
 	(sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \
 	+ (numsrc) * sizeof(struct __kernel_sockaddr_storage))
 
-struct in_pktinfo
-{
+struct in_pktinfo {
 	int		ipi_ifindex;
 	struct in_addr	ipi_spec_dst;
 	struct in_addr	ipi_addr;
@@ -185,7 +182,7 @@
 /* Structure describing an Internet (IP) socket address. */
 #define __SOCK_SIZE__	16		/* sizeof(struct sockaddr)	*/
 struct sockaddr_in {
-  sa_family_t		sin_family;	/* Address family		*/
+  __kernel_sa_family_t	sin_family;	/* Address family		*/
   __be16		sin_port;	/* Port number			*/
   struct in_addr	sin_addr;	/* Internet address		*/
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/in6.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/in6.h
index 9536569..59b222d 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/in6.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/in6.h
@@ -27,10 +27,8 @@
  *	IPv6 address structure
  */
 
-struct in6_addr
-{
-	union 
-	{
+struct in6_addr {
+	union {
 		__u8		u6_addr8[16];
 		__be16		u6_addr16[8];
 		__be32		u6_addr32[4];
@@ -63,8 +61,7 @@
 
 #define ipv6mr_acaddr	ipv6mr_multiaddr
 
-struct in6_flowlabel_req
-{
+struct in6_flowlabel_req {
 	struct in6_addr	flr_dst;
 	__be32	flr_label;
 	__u8	flr_action;
@@ -101,7 +98,7 @@
 #define IPV6_FLOWINFO_FLOWLABEL		0x000fffff
 #define IPV6_FLOWINFO_PRIORITY		0x0ff00000
 
-/* These defintions are obsolete */
+/* These definitions are obsolete */
 #define IPV6_PRIORITY_UNCHARACTERIZED	0x0000
 #define IPV6_PRIORITY_FILLER		0x0100
 #define IPV6_PRIORITY_UNATTENDED	0x0200
@@ -212,10 +209,10 @@
 #define IPV6_RTHDR		57
 #define IPV6_RECVDSTOPTS	58
 #define IPV6_DSTOPTS		59
-#if 0	/* not yet */
 #define IPV6_RECVPATHMTU	60
 #define IPV6_PATHMTU		61
 #define IPV6_DONTFRAG		62
+#if 0	/* not yet */
 #define IPV6_USE_MIN_MTU	63
 #endif
 
@@ -256,6 +253,13 @@
 #define IPV6_PREFER_SRC_CGA		0x0008
 #define IPV6_PREFER_SRC_NONCGA		0x0800
 
+/* RFC5082: Generalized Ttl Security Mechanism */
+#define IPV6_MINHOPCOUNT		73
+
+#define IPV6_ORIGDSTADDR        74
+#define IPV6_RECVORIGDSTADDR    IPV6_ORIGDSTADDR
+#define IPV6_TRANSPARENT        75
+
 /*
  * Multicast Routing:
  * see include/linux/mroute6.h.
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/inet_diag.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/inet_diag.h
index 1107ed2..7e31238 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/inet_diag.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/inet_diag.h
@@ -34,6 +34,15 @@
 	__u32	idiag_dbs;		/* Tables to dump (NI) */
 };
 
+struct inet_diag_req_v2 {
+	__u8	sdiag_family;
+	__u8	sdiag_protocol;
+	__u8	idiag_ext;
+	__u8	pad;
+	__u32	idiag_states;
+	struct inet_diag_sockid id;
+};
+
 enum {
 	INET_DIAG_REQ_NONE,
 	INET_DIAG_REQ_BYTECODE,
@@ -97,9 +106,12 @@
 	INET_DIAG_INFO,
 	INET_DIAG_VEGASINFO,
 	INET_DIAG_CONG,
+	INET_DIAG_TOS,
+	INET_DIAG_TCLASS,
+	INET_DIAG_SKMEMINFO,
 };
 
-#define INET_DIAG_MAX INET_DIAG_CONG
+#define INET_DIAG_MAX INET_DIAG_SKMEMINFO
 
 
 /* INET_DIAG_MEM */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/inotify.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/inotify.h
index 8be5ac5..a03bfa2 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/inotify.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/inotify.h
@@ -51,6 +51,7 @@
 /* special flags */
 #define IN_ONLYDIR		0x01000000	/* only watch the path if it is a directory */
 #define IN_DONT_FOLLOW		0x02000000	/* don't follow a sym link */
+#define IN_EXCL_UNLINK		0x04000000	/* exclude events on unlinked objects */
 #define IN_MASK_ADD		0x20000000	/* add to the mask of an already existing watch */
 #define IN_ISDIR		0x40000000	/* event occurred against dir */
 #define IN_ONESHOT		0x80000000	/* only send event once */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/input.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/input.h
index 4a53193..d723b63 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/input.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/input.h
@@ -29,7 +29,7 @@
  * Protocol version.
  */
 
-#define EV_VERSION		0x010000
+#define EV_VERSION		0x010001
 
 /*
  * IOCTLs (0x00 - 0x7f)
@@ -42,6 +42,25 @@
 	__u16 version;
 };
 
+/**
+ * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
+ * @value: latest reported value for the axis.
+ * @minimum: specifies minimum value for the axis.
+ * @maximum: specifies maximum value for the axis.
+ * @fuzz: specifies fuzz value that is used to filter noise from
+ *	the event stream.
+ * @flat: values that are within this value will be discarded by
+ *	joydev interface and reported as 0 instead.
+ * @resolution: specifies resolution for the values reported for
+ *	the axis.
+ *
+ * Note that input core does not clamp reported values to the
+ * [minimum, maximum] limits, such task is left to userspace.
+ *
+ * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in
+ * units per millimeter (units/mm), resolution for rotational axes
+ * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
+ */
 struct input_absinfo {
 	__s32 value;
 	__s32 minimum;
@@ -51,25 +70,53 @@
 	__s32 resolution;
 };
 
+/**
+ * struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls
+ * @scancode: scancode represented in machine-endian form.
+ * @len: length of the scancode that resides in @scancode buffer.
+ * @index: index in the keymap, may be used instead of scancode
+ * @flags: allows to specify how kernel should handle the request. For
+ *	example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel
+ *	should perform lookup in keymap by @index instead of @scancode
+ * @keycode: key code assigned to this scancode
+ *
+ * The structure is used to retrieve and modify keymap data. Users have
+ * option of performing lookup either by @scancode itself or by @index
+ * in keymap entry. EVIOCGKEYCODE will also return scancode or index
+ * (depending on which element was used to perform lookup).
+ */
+struct input_keymap_entry {
+#define INPUT_KEYMAP_BY_INDEX	(1 << 0)
+	__u8  flags;
+	__u8  len;
+	__u16 index;
+	__u32 keycode;
+	__u8  scancode[32];
+};
+
 #define EVIOCGVERSION		_IOR('E', 0x01, int)			/* get driver version */
 #define EVIOCGID		_IOR('E', 0x02, struct input_id)	/* get device ID */
-#define EVIOCGREP		_IOR('E', 0x03, int[2])			/* get repeat settings */
-#define EVIOCSREP		_IOW('E', 0x03, int[2])			/* set repeat settings */
-#define EVIOCGKEYCODE		_IOR('E', 0x04, int[2])			/* get keycode */
-#define EVIOCSKEYCODE		_IOW('E', 0x04, int[2])			/* set keycode */
+#define EVIOCGREP		_IOR('E', 0x03, unsigned int[2])	/* get repeat settings */
+#define EVIOCSREP		_IOW('E', 0x03, unsigned int[2])	/* set repeat settings */
+
+#define EVIOCGKEYCODE		_IOR('E', 0x04, unsigned int[2])        /* get keycode */
+#define EVIOCGKEYCODE_V2	_IOR('E', 0x04, struct input_keymap_entry)
+#define EVIOCSKEYCODE		_IOW('E', 0x04, unsigned int[2])        /* set keycode */
+#define EVIOCSKEYCODE_V2	_IOW('E', 0x04, struct input_keymap_entry)
 
 #define EVIOCGNAME(len)		_IOC(_IOC_READ, 'E', 0x06, len)		/* get device name */
 #define EVIOCGPHYS(len)		_IOC(_IOC_READ, 'E', 0x07, len)		/* get physical location */
 #define EVIOCGUNIQ(len)		_IOC(_IOC_READ, 'E', 0x08, len)		/* get unique identifier */
+#define EVIOCGPROP(len)		_IOC(_IOC_READ, 'E', 0x09, len)		/* get device properties */
 
-#define EVIOCGKEY(len)		_IOC(_IOC_READ, 'E', 0x18, len)		/* get global keystate */
+#define EVIOCGKEY(len)		_IOC(_IOC_READ, 'E', 0x18, len)		/* get global key state */
 #define EVIOCGLED(len)		_IOC(_IOC_READ, 'E', 0x19, len)		/* get all LEDs */
 #define EVIOCGSND(len)		_IOC(_IOC_READ, 'E', 0x1a, len)		/* get all sounds status */
 #define EVIOCGSW(len)		_IOC(_IOC_READ, 'E', 0x1b, len)		/* get all switch states */
 
-#define EVIOCGBIT(ev,len)	_IOC(_IOC_READ, 'E', 0x20 + ev, len)	/* get event bits */
-#define EVIOCGABS(abs)		_IOR('E', 0x40 + abs, struct input_absinfo)		/* get abs value/limits */
-#define EVIOCSABS(abs)		_IOW('E', 0xc0 + abs, struct input_absinfo)		/* set abs value/limits */
+#define EVIOCGBIT(ev,len)	_IOC(_IOC_READ, 'E', 0x20 + (ev), len)	/* get event bits */
+#define EVIOCGABS(abs)		_IOR('E', 0x40 + (abs), struct input_absinfo)	/* get abs value/limits */
+#define EVIOCSABS(abs)		_IOW('E', 0xc0 + (abs), struct input_absinfo)	/* set abs value/limits */
 
 #define EVIOCSFF		_IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect))	/* send a force effect to a force feedback device */
 #define EVIOCRMFF		_IOW('E', 0x81, int)			/* Erase a force effect */
@@ -78,6 +125,18 @@
 #define EVIOCGRAB		_IOW('E', 0x90, int)			/* Grab/Release device */
 
 /*
+ * Device properties and quirks
+ */
+
+#define INPUT_PROP_POINTER		0x00	/* needs a pointer */
+#define INPUT_PROP_DIRECT		0x01	/* direct input devices */
+#define INPUT_PROP_BUTTONPAD		0x02	/* has button(s) under pad */
+#define INPUT_PROP_SEMI_MT		0x03	/* touch rectangle only */
+
+#define INPUT_PROP_MAX			0x1f
+#define INPUT_PROP_CNT			(INPUT_PROP_MAX + 1)
+
+/*
  * Event types
  */
 
@@ -103,6 +162,7 @@
 #define SYN_REPORT		0
 #define SYN_CONFIG		1
 #define SYN_MT_REPORT		2
+#define SYN_DROPPED		3
 
 /*
  * Keys and buttons
@@ -371,8 +431,11 @@
 #define KEY_DISPLAY_OFF		245	/* display device to off state */
 
 #define KEY_WIMAX		246
+#define KEY_RFKILL		247	/* Key that controls all radios */
 
-/* Range 248 - 255 is reserved for special needs of AT keyboard driver */
+#define KEY_MICMUTE		248	/* Mute / unmute the microphone */
+
+/* Code 255 is reserved for special needs of AT keyboard driver */
 
 #define BTN_MISC		0x100
 #define BTN_0			0x100
@@ -437,6 +500,7 @@
 #define BTN_TOOL_FINGER		0x145
 #define BTN_TOOL_MOUSE		0x146
 #define BTN_TOOL_LENS		0x147
+#define BTN_TOOL_QUINTTAP	0x148	/* Five fingers on trackpad */
 #define BTN_TOUCH		0x14a
 #define BTN_STYLUS		0x14b
 #define BTN_STYLUS2		0x14c
@@ -488,8 +552,8 @@
 #define KEY_DVD			0x185	/* Media Select DVD */
 #define KEY_AUX			0x186
 #define KEY_MP3			0x187
-#define KEY_AUDIO		0x188
-#define KEY_VIDEO		0x189
+#define KEY_AUDIO		0x188	/* AL Audio Browser */
+#define KEY_VIDEO		0x189	/* AL Movie Browser */
 #define KEY_DIRECTORY		0x18a
 #define KEY_LIST		0x18b
 #define KEY_MEMO		0x18c	/* Media Select Messages */
@@ -538,6 +602,9 @@
 #define KEY_FRAMEFORWARD	0x1b5
 #define KEY_CONTEXT_MENU	0x1b6	/* GenDesc - system context menu */
 #define KEY_MEDIA_REPEAT	0x1b7	/* Consumer - transport control */
+#define KEY_10CHANNELSUP	0x1b8	/* 10 channels up (10+) */
+#define KEY_10CHANNELSDOWN	0x1b9	/* 10 channels down (10-) */
+#define KEY_IMAGES		0x1ba	/* AL Image Browser */
 
 #define KEY_DEL_EOL		0x1c0
 #define KEY_DEL_EOS		0x1c1
@@ -590,6 +657,62 @@
 #define KEY_NUMERIC_STAR	0x20a
 #define KEY_NUMERIC_POUND	0x20b
 
+#define KEY_CAMERA_FOCUS	0x210
+#define KEY_WPS_BUTTON		0x211	/* WiFi Protected Setup key */
+
+#define KEY_TOUCHPAD_TOGGLE	0x212	/* Request switch touchpad on or off */
+#define KEY_TOUCHPAD_ON		0x213
+#define KEY_TOUCHPAD_OFF	0x214
+
+#define KEY_CAMERA_ZOOMIN	0x215
+#define KEY_CAMERA_ZOOMOUT	0x216
+#define KEY_CAMERA_UP		0x217
+#define KEY_CAMERA_DOWN		0x218
+#define KEY_CAMERA_LEFT		0x219
+#define KEY_CAMERA_RIGHT	0x21a
+
+#define BTN_TRIGGER_HAPPY		0x2c0
+#define BTN_TRIGGER_HAPPY1		0x2c0
+#define BTN_TRIGGER_HAPPY2		0x2c1
+#define BTN_TRIGGER_HAPPY3		0x2c2
+#define BTN_TRIGGER_HAPPY4		0x2c3
+#define BTN_TRIGGER_HAPPY5		0x2c4
+#define BTN_TRIGGER_HAPPY6		0x2c5
+#define BTN_TRIGGER_HAPPY7		0x2c6
+#define BTN_TRIGGER_HAPPY8		0x2c7
+#define BTN_TRIGGER_HAPPY9		0x2c8
+#define BTN_TRIGGER_HAPPY10		0x2c9
+#define BTN_TRIGGER_HAPPY11		0x2ca
+#define BTN_TRIGGER_HAPPY12		0x2cb
+#define BTN_TRIGGER_HAPPY13		0x2cc
+#define BTN_TRIGGER_HAPPY14		0x2cd
+#define BTN_TRIGGER_HAPPY15		0x2ce
+#define BTN_TRIGGER_HAPPY16		0x2cf
+#define BTN_TRIGGER_HAPPY17		0x2d0
+#define BTN_TRIGGER_HAPPY18		0x2d1
+#define BTN_TRIGGER_HAPPY19		0x2d2
+#define BTN_TRIGGER_HAPPY20		0x2d3
+#define BTN_TRIGGER_HAPPY21		0x2d4
+#define BTN_TRIGGER_HAPPY22		0x2d5
+#define BTN_TRIGGER_HAPPY23		0x2d6
+#define BTN_TRIGGER_HAPPY24		0x2d7
+#define BTN_TRIGGER_HAPPY25		0x2d8
+#define BTN_TRIGGER_HAPPY26		0x2d9
+#define BTN_TRIGGER_HAPPY27		0x2da
+#define BTN_TRIGGER_HAPPY28		0x2db
+#define BTN_TRIGGER_HAPPY29		0x2dc
+#define BTN_TRIGGER_HAPPY30		0x2dd
+#define BTN_TRIGGER_HAPPY31		0x2de
+#define BTN_TRIGGER_HAPPY32		0x2df
+#define BTN_TRIGGER_HAPPY33		0x2e0
+#define BTN_TRIGGER_HAPPY34		0x2e1
+#define BTN_TRIGGER_HAPPY35		0x2e2
+#define BTN_TRIGGER_HAPPY36		0x2e3
+#define BTN_TRIGGER_HAPPY37		0x2e4
+#define BTN_TRIGGER_HAPPY38		0x2e5
+#define BTN_TRIGGER_HAPPY39		0x2e6
+#define BTN_TRIGGER_HAPPY40		0x2e7
+
 /* We avoid low common keys in module aliases so they don't get huge. */
 #define KEY_MIN_INTERESTING	KEY_MUTE
 #define KEY_MAX			0x2ff
@@ -640,9 +763,12 @@
 #define ABS_TILT_X		0x1a
 #define ABS_TILT_Y		0x1b
 #define ABS_TOOL_WIDTH		0x1c
+
 #define ABS_VOLUME		0x20
+
 #define ABS_MISC		0x28
 
+#define ABS_MT_SLOT		0x2f	/* MT slot being modified */
 #define ABS_MT_TOUCH_MAJOR	0x30	/* Major axis of touching ellipse */
 #define ABS_MT_TOUCH_MINOR	0x31	/* Minor axis (omit if circular) */
 #define ABS_MT_WIDTH_MAJOR	0x32	/* Major axis of approaching ellipse */
@@ -653,6 +779,9 @@
 #define ABS_MT_TOOL_TYPE	0x37	/* Type of touching device */
 #define ABS_MT_BLOB_ID		0x38	/* Group a set of packets as a blob */
 #define ABS_MT_TRACKING_ID	0x39	/* Unique ID of initiated contact */
+#define ABS_MT_PRESSURE		0x3a	/* Pressure on contact area */
+#define ABS_MT_DISTANCE		0x3b	/* Contact hover distance */
+
 
 #define ABS_MAX			0x3f
 #define ABS_CNT			(ABS_MAX+1)
@@ -672,6 +801,11 @@
 #define SW_LINEOUT_INSERT	0x06  /* set = inserted */
 #define SW_JACK_PHYSICAL_INSERT 0x07  /* set = mechanical switch set */
 #define SW_VIDEOOUT_INSERT	0x08  /* set = inserted */
+#define SW_CAMERA_LENS_COVER	0x09  /* set = lens covered */
+#define SW_KEYPAD_SLIDE		0x0a  /* set = keypad slide out */
+#define SW_FRONT_PROXIMITY	0x0b  /* set = front proximity sensor active */
+#define SW_ROTATE_LOCK		0x0c  /* set = rotate locked/disabled */
+#define SW_LINEIN_INSERT	0x0d  /* set = inserted */
 #define SW_MAX			0x0f
 #define SW_CNT			(SW_MAX+1)
 
@@ -712,6 +846,7 @@
 #define REP_DELAY		0x00
 #define REP_PERIOD		0x01
 #define REP_MAX			0x01
+#define REP_CNT			(REP_MAX+1)
 
 /*
  * Sounds
@@ -751,12 +886,14 @@
 #define BUS_HOST		0x19
 #define BUS_GSC			0x1A
 #define BUS_ATARI		0x1B
+#define BUS_SPI			0x1C
 
 /*
  * MT_TOOL types
  */
 #define MT_TOOL_FINGER		0
 #define MT_TOOL_PEN		1
+#define MT_TOOL_MAX		1
 
 /*
  * Values describing the status of a force-feedback effect
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip.h
index 56f472a..519cb52 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip.h
@@ -102,7 +102,7 @@
 	__be32	saddr;
 	__be32	daddr;
 	/*The options start here. */
-};
+} __attribute__((packed));
 
 
 struct ip_auth_hdr {
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip6_tunnel.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip6_tunnel.h
index acb9ad6..bf22b03 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip6_tunnel.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip6_tunnel.h
@@ -16,6 +16,8 @@
 #define IP6_TNL_F_MIP6_DEV 0x8
 /* copy DSCP from the outer packet */
 #define IP6_TNL_F_RCV_DSCP_COPY 0x10
+/* copy fwmark from inner packet */
+#define IP6_TNL_F_USE_ORIG_FWMARK 0x20
 
 struct ip6_tnl_parm {
 	char name[IFNAMSIZ];	/* name of tunnel device */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip_vs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip_vs.h
index 148265e..4deb383 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip_vs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ip_vs.h
@@ -19,6 +19,7 @@
  */
 #define IP_VS_SVC_F_PERSISTENT	0x0001		/* persistent port */
 #define IP_VS_SVC_F_HASHED	0x0002		/* hashed entry */
+#define IP_VS_SVC_F_ONEPACKET	0x0004		/* one-packet scheduling */
 
 /*
  *      Destination Server Flags
@@ -69,6 +70,7 @@
 
 /*
  *      IPVS Connection Flags
+ *      Only flags 0..15 are sent to backup server
  */
 #define IP_VS_CONN_F_FWD_MASK	0x0007		/* mask for the fwd methods */
 #define IP_VS_CONN_F_MASQ	0x0000		/* masquerading/NAT */
@@ -85,10 +87,30 @@
 #define IP_VS_CONN_F_SEQ_MASK	0x0600		/* in/out sequence mask */
 #define IP_VS_CONN_F_NO_CPORT	0x0800		/* no client port set yet */
 #define IP_VS_CONN_F_TEMPLATE	0x1000		/* template, not connection */
+#define IP_VS_CONN_F_ONE_PACKET	0x2000		/* forward only one packet */
+
+#define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | \
+				  IP_VS_CONN_F_NOOUTPUT | \
+				  IP_VS_CONN_F_INACTIVE | \
+				  IP_VS_CONN_F_SEQ_MASK | \
+				  IP_VS_CONN_F_NO_CPORT | \
+				  IP_VS_CONN_F_TEMPLATE \
+				 )
+
+/* Flags that are not sent to backup server start from bit 16 */
+#define IP_VS_CONN_F_NFCT	(1 << 16)	/* use netfilter conntrack */
+
+/* Connection flags from destination that can be changed by user space */
+#define IP_VS_CONN_F_DEST_MASK (IP_VS_CONN_F_FWD_MASK | \
+				IP_VS_CONN_F_ONE_PACKET | \
+				IP_VS_CONN_F_NFCT | \
+				0)
 
 #define IP_VS_SCHEDNAME_MAXLEN	16
+#define IP_VS_PENAME_MAXLEN	16
 #define IP_VS_IFNAME_MAXLEN	16
 
+#define IP_VS_PEDATA_MAXLEN     255
 
 /*
  *	The struct ip_vs_service_user and struct ip_vs_dest_user are
@@ -127,8 +149,7 @@
 /*
  *	IPVS statistics object (for user space)
  */
-struct ip_vs_stats_user
-{
+struct ip_vs_stats_user {
 	__u32                   conns;          /* connections scheduled */
 	__u32                   inpkts;         /* incoming packets */
 	__u32                   outpkts;        /* outgoing packets */
@@ -323,6 +344,9 @@
 	IPVS_SVC_ATTR_NETMASK,		/* persistent netmask */
 
 	IPVS_SVC_ATTR_STATS,		/* nested attribute for service stats */
+
+	IPVS_SVC_ATTR_PE_NAME,		/* name of ct retriever */
+
 	__IPVS_SVC_ATTR_MAX,
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipmi.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipmi.h
index b9ff672..15fe5e5 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipmi.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipmi.h
@@ -111,7 +111,7 @@
  * A LAN Address.  This is an address to/from a LAN interface bridged
  * by the BMC, not an address actually out on the LAN.
  *
- * A concious decision was made here to deviate slightly from the IPMI
+ * A conscious decision was made here to deviate slightly from the IPMI
  * spec.  We do not use rqSWID and rsSWID like it shows in the
  * message.  Instead, we use remote_SWID and local_SWID.  This means
  * that any message (a request or response) from another device will
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipv6.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipv6.h
index 12dfb33..1072647 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipv6.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipv6.h
@@ -21,6 +21,10 @@
 	int		ipi6_ifindex;
 };
 
+struct ip6_mtuinfo {
+	struct sockaddr_in6	ip6m_addr;
+	__u32			ip6m_mtu;
+};
 
 struct in6_ifreq {
 	struct in6_addr	ifr6_addr;
@@ -54,7 +58,7 @@
 	/* 
 	 * TLV encoded option data follows.
 	 */
-} __attribute__ ((packed));	/* required for some archs */
+} __attribute__((packed));	/* required for some archs */
 
 #define ipv6_destopt_hdr ipv6_opt_hdr
 #define ipv6_hopopt_hdr  ipv6_opt_hdr
@@ -92,7 +96,7 @@
 	__u8			type;
 	__u8			length;
 	struct in6_addr		addr;
-} __attribute__ ((__packed__));
+} __attribute__((packed));
 
 /*
  *	IPv6 fixed header
@@ -119,7 +123,7 @@
 
 	struct	in6_addr	saddr;
 	struct	in6_addr	daddr;
-};
+} __attribute__((packed));
 
 
 /* index values for the variables in ipv6_devconf */
@@ -152,6 +156,7 @@
 	DEVCONF_MC_FORWARDING,
 	DEVCONF_DISABLE_IPV6,
 	DEVCONF_ACCEPT_DAD,
+	DEVCONF_FORCE_TLLAO,
 	DEVCONF_MAX
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipx.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipx.h
index aabb1d2..3d48014 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipx.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ipx.h
@@ -7,7 +7,7 @@
 #define IPX_MTU		576
 
 struct sockaddr_ipx {
-	sa_family_t	sipx_family;
+	__kernel_sa_family_t sipx_family;
 	__be16		sipx_port;
 	__be32		sipx_network;
 	unsigned char 	sipx_node[IPX_NODE_LEN];
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/irda.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/irda.h
index 00bdad0..a014c32 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/irda.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/irda.h
@@ -26,12 +26,9 @@
 #define KERNEL_IRDA_H
 
 #include <linux/types.h>
+#include <linux/socket.h>
 
-/* Please do *not* add any #include in this file, this file is
- * included as-is in user space.
- * Please fix the calling file to properly included needed files before
- * this one, or preferably to include <net/irda/irda.h> instead.
- * Jean II */
+/* Note that this file is shared with user space. */
 
 /* Hint bit positions for first hint byte */
 #define HINT_PNP         0x01
@@ -125,7 +122,7 @@
 #define LSAP_ANY              0xff
 
 struct sockaddr_irda {
-	sa_family_t sir_family;   /* AF_IRDA */
+	__kernel_sa_family_t sir_family; /* AF_IRDA */
 	__u8        sir_lsap_sel; /* LSAP selector */
 	__u32       sir_addr;     /* Device address */
 	char        sir_name[25]; /* Usually <service>:IrDA:TinyTP */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/isdn.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/isdn.h
index 596bbec..3d72b0c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/isdn.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/isdn.h
@@ -68,7 +68,7 @@
 #define ISDN_NET_ENCAP_SYNCPPP    4
 #define ISDN_NET_ENCAP_UIHDLC     5
 #define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive    */
-#define ISDN_NET_ENCAP_X25IFACE   7 /* Documentation/networking/x25-iface.txt*/
+#define ISDN_NET_ENCAP_X25IFACE   7 /* Documentation/networking/x25-iface.txt */
 #define ISDN_NET_ENCAP_MAX_ENCAP  ISDN_NET_ENCAP_X25IFACE
 
 /* Facility which currently uses an ISDN-channel */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/isdn_divertif.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/isdn_divertif.h
index 10ff7e7..67575ba 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/isdn_divertif.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/isdn_divertif.h
@@ -10,6 +10,8 @@
  *
  */
 
+#ifndef _LINUX_ISDN_DIVERTIF_H
+#define _LINUX_ISDN_DIVERTIF_H
 
 /***********************************************************/
 /* magic value is also used to control version information */
@@ -24,3 +26,5 @@
 #define DIVERT_REL_ERR  0x04  /* module not registered */
 #define DIVERT_REG_NAME isdn_register_divert
 
+
+#endif /* _LINUX_ISDN_DIVERTIF_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ivtvfb.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ivtvfb.h
index d9be3ff..97eaf4e 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ivtvfb.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ivtvfb.h
@@ -33,6 +33,5 @@
 };
 
 #define IVTVFB_IOC_DMA_FRAME 	_IOW('V', BASE_VIDIOC_PRIVATE+0, struct ivtvfb_dma_frame)
-#define FBIO_WAITFORVSYNC	_IOW('F', 0x20, __u32)
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ixjuser.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ixjuser.h
index 7d8525e..0b829f9 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ixjuser.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ixjuser.h
@@ -50,7 +50,7 @@
 * IOCTL's used for the Quicknet Telephony Cards
 *
 * If you use the IXJCTL_TESTRAM command, the card must be power cycled to
-* reset the SRAM values before futher use.
+* reset the SRAM values before further use.
 *
 ******************************************************************************/
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/jffs2.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/jffs2.h
index 5ee7a54..f3431a5 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/jffs2.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/jffs2.h
@@ -1,7 +1,8 @@
 /*
  * JFFS2 -- Journalling Flash File System, Version 2.
  *
- * Copyright (C) 2001-2003 Red Hat, Inc.
+ * Copyright © 2001-2007 Red Hat, Inc.
+ * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
  *
  * Created by David Woodhouse <dwmw2@infradead.org>
  *
@@ -186,7 +187,7 @@
 	jint32_t hdr_crc;
 	jint32_t ino;		/* inode number */
 	jint32_t xid;		/* XATTR identifier number */
-	jint32_t xseqno;	/* xref sequencial number */
+	jint32_t xseqno;	/* xref sequential number */
 	jint32_t node_crc;
 } __attribute__((packed));
 
@@ -216,8 +217,8 @@
 
 /* Data payload for device nodes. */
 union jffs2_device_node {
-	jint16_t old;
-	jint32_t new;
+	jint16_t old_id;
+	jint32_t new_id;
 };
 
 #endif /* __LINUX_JFFS2_H__ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/joystick.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/joystick.h
index 0cb947f..353661d 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/joystick.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/joystick.h
@@ -64,8 +64,8 @@
 #define JSIOCSCORR		_IOW('j', 0x21, struct js_corr)			/* set correction values */
 #define JSIOCGCORR		_IOR('j', 0x22, struct js_corr)			/* get correction values */
 
-#define JSIOCSAXMAP		_IOW('j', 0x31, __u8[ABS_MAX + 1])		/* set axis mapping */
-#define JSIOCGAXMAP		_IOR('j', 0x32, __u8[ABS_MAX + 1])		/* get axis mapping */
+#define JSIOCSAXMAP		_IOW('j', 0x31, __u8[ABS_CNT])			/* set axis mapping */
+#define JSIOCGAXMAP		_IOR('j', 0x32, __u8[ABS_CNT])			/* get axis mapping */
 #define JSIOCSBTNMAP		_IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1])	/* set button mapping */
 #define JSIOCGBTNMAP		_IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1])	/* get button mapping */
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/kd.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/kd.h
index 15c8122..3286a3f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/kd.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/kd.h
@@ -81,6 +81,7 @@
 #define		K_XLATE		0x01
 #define		K_MEDIUMRAW	0x02
 #define		K_UNICODE	0x03
+#define		K_OFF		0x04
 #define KDGKBMODE	0x4B44	/* gets current keyboard mode */
 #define KDSKBMODE	0x4B45	/* sets current keyboard mode */
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/kernel.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/kernel.h
index 299702e..d4c59f6 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/kernel.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/kernel.h
@@ -4,6 +4,8 @@
 /*
  * 'kernel.h' contains some often-used function prototypes etc
  */
+#define __ALIGN_KERNEL(x, a)		__ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
+#define __ALIGN_KERNEL_MASK(x, mask)	(((x) + (mask)) & ~(mask))
 
 
 #define SI_LOAD_SHIFT	16
@@ -24,28 +26,4 @@
 	char _f[20-2*sizeof(long)-sizeof(int)];	/* Padding: libc5 uses this.. */
 };
 
-/* Force a compilation error if condition is true */
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-
-/* Force a compilation error if condition is true, but also produce a
-   result (of value 0 and type size_t), so the expression can be used
-   e.g. in a structure initializer (or where-ever else comma expressions
-   aren't permitted). */
-#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1)
-
-/* Trap pasters of __FUNCTION__ at compile-time */
-#define __FUNCTION__ (__func__)
-
-/* This helps us to avoid #ifdef CONFIG_NUMA */
-#ifdef CONFIG_NUMA
-#define NUMA_BUILD 1
-#else
-#define NUMA_BUILD 0
-#endif
-
-/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
-#ifdef CONFIG_FTRACE_MCOUNT_RECORD
-# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
-#endif
-
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/keyctl.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/keyctl.h
index c0688eb..9b0b865 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/keyctl.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/keyctl.h
@@ -52,5 +52,8 @@
 #define KEYCTL_SET_TIMEOUT		15	/* set key timeout */
 #define KEYCTL_ASSUME_AUTHORITY		16	/* assume request_key() authorisation */
 #define KEYCTL_GET_SECURITY		17	/* get key security label */
+#define KEYCTL_SESSION_TO_PARENT	18	/* apply session keyring to parent process */
+#define KEYCTL_REJECT			19	/* reject a partially constructed key */
+#define KEYCTL_INSTANTIATE_IOV		20	/* instantiate a partially constructed key */
 
 #endif /*  _LINUX_KEYCTL_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/l2tp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/l2tp.h
new file mode 100644
index 0000000..5ca74dd
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/l2tp.h
@@ -0,0 +1,160 @@
+/*
+ * L2TP-over-IP socket for L2TPv3.
+ *
+ * Author: James Chapman <jchapman@katalix.com>
+ */
+
+#ifndef _LINUX_L2TP_H_
+#define _LINUX_L2TP_H_
+
+#include <linux/types.h>
+#include <linux/socket.h>
+#include <netinet/in.h>
+
+#define IPPROTO_L2TP		115
+
+/**
+ * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets
+ * @l2tp_family:  address family number AF_L2TPIP.
+ * @l2tp_addr:    protocol specific address information
+ * @l2tp_conn_id: connection id of tunnel
+ */
+#define __SOCK_SIZE__	16		/* sizeof(struct sockaddr)	*/
+struct sockaddr_l2tpip {
+	/* The first fields must match struct sockaddr_in */
+	__kernel_sa_family_t l2tp_family; /* AF_INET */
+	__be16		l2tp_unused;	/* INET port number (unused) */
+	struct in_addr	l2tp_addr;	/* Internet address */
+
+	__u32		l2tp_conn_id;	/* Connection ID of tunnel */
+
+	/* Pad to size of `struct sockaddr'. */
+	unsigned char	__pad[sizeof(struct sockaddr) -
+			      sizeof(__kernel_sa_family_t) -
+			      sizeof(__be16) - sizeof(struct in_addr) -
+			      sizeof(__u32)];
+};
+
+/*****************************************************************************
+ *  NETLINK_GENERIC netlink family.
+ *****************************************************************************/
+
+/*
+ * Commands.
+ * Valid TLVs of each command are:-
+ * TUNNEL_CREATE	- CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid
+ * TUNNEL_DELETE	- CONN_ID
+ * TUNNEL_MODIFY	- CONN_ID, udpcsum
+ * TUNNEL_GETSTATS	- CONN_ID, (stats)
+ * TUNNEL_GET		- CONN_ID, (...)
+ * SESSION_CREATE	- SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec
+ * SESSION_DELETE	- SESSION_ID
+ * SESSION_MODIFY	- SESSION_ID, data_seq
+ * SESSION_GET		- SESSION_ID, (...)
+ * SESSION_GETSTATS	- SESSION_ID, (stats)
+ *
+ */
+enum {
+	L2TP_CMD_NOOP,
+	L2TP_CMD_TUNNEL_CREATE,
+	L2TP_CMD_TUNNEL_DELETE,
+	L2TP_CMD_TUNNEL_MODIFY,
+	L2TP_CMD_TUNNEL_GET,
+	L2TP_CMD_SESSION_CREATE,
+	L2TP_CMD_SESSION_DELETE,
+	L2TP_CMD_SESSION_MODIFY,
+	L2TP_CMD_SESSION_GET,
+	__L2TP_CMD_MAX,
+};
+
+#define L2TP_CMD_MAX			(__L2TP_CMD_MAX - 1)
+
+/*
+ * ATTR types defined for L2TP
+ */
+enum {
+	L2TP_ATTR_NONE,			/* no data */
+	L2TP_ATTR_PW_TYPE,		/* u16, enum l2tp_pwtype */
+	L2TP_ATTR_ENCAP_TYPE,		/* u16, enum l2tp_encap_type */
+	L2TP_ATTR_OFFSET,		/* u16 */
+	L2TP_ATTR_DATA_SEQ,		/* u16 */
+	L2TP_ATTR_L2SPEC_TYPE,		/* u8, enum l2tp_l2spec_type */
+	L2TP_ATTR_L2SPEC_LEN,		/* u8, enum l2tp_l2spec_type */
+	L2TP_ATTR_PROTO_VERSION,	/* u8 */
+	L2TP_ATTR_IFNAME,		/* string */
+	L2TP_ATTR_CONN_ID,		/* u32 */
+	L2TP_ATTR_PEER_CONN_ID,		/* u32 */
+	L2TP_ATTR_SESSION_ID,		/* u32 */
+	L2TP_ATTR_PEER_SESSION_ID,	/* u32 */
+	L2TP_ATTR_UDP_CSUM,		/* u8 */
+	L2TP_ATTR_VLAN_ID,		/* u16 */
+	L2TP_ATTR_COOKIE,		/* 0, 4 or 8 bytes */
+	L2TP_ATTR_PEER_COOKIE,		/* 0, 4 or 8 bytes */
+	L2TP_ATTR_DEBUG,		/* u32 */
+	L2TP_ATTR_RECV_SEQ,		/* u8 */
+	L2TP_ATTR_SEND_SEQ,		/* u8 */
+	L2TP_ATTR_LNS_MODE,		/* u8 */
+	L2TP_ATTR_USING_IPSEC,		/* u8 */
+	L2TP_ATTR_RECV_TIMEOUT,		/* msec */
+	L2TP_ATTR_FD,			/* int */
+	L2TP_ATTR_IP_SADDR,		/* u32 */
+	L2TP_ATTR_IP_DADDR,		/* u32 */
+	L2TP_ATTR_UDP_SPORT,		/* u16 */
+	L2TP_ATTR_UDP_DPORT,		/* u16 */
+	L2TP_ATTR_MTU,			/* u16 */
+	L2TP_ATTR_MRU,			/* u16 */
+	L2TP_ATTR_STATS,		/* nested */
+	__L2TP_ATTR_MAX,
+};
+
+#define L2TP_ATTR_MAX			(__L2TP_ATTR_MAX - 1)
+
+/* Nested in L2TP_ATTR_STATS */
+enum {
+	L2TP_ATTR_STATS_NONE,		/* no data */
+	L2TP_ATTR_TX_PACKETS,		/* u64 */
+	L2TP_ATTR_TX_BYTES,		/* u64 */
+	L2TP_ATTR_TX_ERRORS,		/* u64 */
+	L2TP_ATTR_RX_PACKETS,		/* u64 */
+	L2TP_ATTR_RX_BYTES,		/* u64 */
+	L2TP_ATTR_RX_SEQ_DISCARDS,	/* u64 */
+	L2TP_ATTR_RX_OOS_PACKETS,	/* u64 */
+	L2TP_ATTR_RX_ERRORS,		/* u64 */
+	__L2TP_ATTR_STATS_MAX,
+};
+
+#define L2TP_ATTR_STATS_MAX		(__L2TP_ATTR_STATS_MAX - 1)
+
+enum l2tp_pwtype {
+	L2TP_PWTYPE_NONE = 0x0000,
+	L2TP_PWTYPE_ETH_VLAN = 0x0004,
+	L2TP_PWTYPE_ETH = 0x0005,
+	L2TP_PWTYPE_PPP = 0x0007,
+	L2TP_PWTYPE_PPP_AC = 0x0008,
+	L2TP_PWTYPE_IP = 0x000b,
+	__L2TP_PWTYPE_MAX
+};
+
+enum l2tp_l2spec_type {
+	L2TP_L2SPECTYPE_NONE,
+	L2TP_L2SPECTYPE_DEFAULT,
+};
+
+enum l2tp_encap_type {
+	L2TP_ENCAPTYPE_UDP,
+	L2TP_ENCAPTYPE_IP,
+};
+
+enum l2tp_seqmode {
+	L2TP_SEQ_NONE = 0,
+	L2TP_SEQ_IP = 1,
+	L2TP_SEQ_ALL = 2,
+};
+
+/*
+ * NETLINK_GENERIC related info
+ */
+#define L2TP_GENL_NAME		"l2tp"
+#define L2TP_GENL_VERSION	0x1
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/llc.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/llc.h
index 6bb32fe..e9a63fe 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/llc.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/llc.h
@@ -12,16 +12,20 @@
  *
  * See the GNU General Public License for more details.
  */
+
+#include <linux/socket.h>
+
 #define __LLC_SOCK_SIZE__ 16	/* sizeof(sockaddr_llc), word align. */
 struct sockaddr_llc {
-	sa_family_t     sllc_family;	/* AF_LLC */
-	sa_family_t	sllc_arphrd;	/* ARPHRD_ETHER */
+	__kernel_sa_family_t sllc_family; /* AF_LLC */
+	__kernel_sa_family_t sllc_arphrd; /* ARPHRD_ETHER */
 	unsigned char   sllc_test;
 	unsigned char   sllc_xid;
 	unsigned char	sllc_ua;	/* UA data, only for SOCK_STREAM. */
 	unsigned char   sllc_sap;
 	unsigned char   sllc_mac[IFHWADDRLEN];
-	unsigned char   __pad[__LLC_SOCK_SIZE__ - sizeof(sa_family_t) * 2 -
+	unsigned char   __pad[__LLC_SOCK_SIZE__ -
+			      sizeof(__kernel_sa_family_t) * 2 -
 			      sizeof(unsigned char) * 4 - IFHWADDRLEN];
 };
 
@@ -36,6 +40,7 @@
 	LLC_OPT_BUSY_TMR_EXP,	/* busy state expire time (secs). */
 	LLC_OPT_TX_WIN,		/* tx window size. */
 	LLC_OPT_RX_WIN,		/* rx window size. */
+	LLC_OPT_PKTINFO,	/* ancillary packet information. */
 	LLC_OPT_MAX
 };
 
@@ -70,4 +75,10 @@
 #define LLC_SAP_RM	0xD4		/* Resource Management 		*/
 #define LLC_SAP_GLOBAL	0xFF		/* Global SAP. 			*/
 
+struct llc_pktinfo {
+	int lpi_ifindex;
+	unsigned char lpi_sap;
+	unsigned char lpi_mac[IFHWADDRLEN];
+};
+
 #endif /* __LINUX_LLC_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/loop.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/loop.h
index 988cfed..0c87e91 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/loop.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/loop.h
@@ -19,8 +19,8 @@
  */
 enum {
 	LO_FLAGS_READ_ONLY	= 1,
-	LO_FLAGS_USE_AOPS	= 2,
 	LO_FLAGS_AUTOCLEAR	= 4,
+	LO_FLAGS_PARTSCAN	= 8,
 };
 
 #include <asm/posix_types.h>	/* for __kernel_old_dev_t */
@@ -87,4 +87,8 @@
 #define LOOP_CHANGE_FD		0x4C06
 #define LOOP_SET_CAPACITY	0x4C07
 
+/* /dev/loop-control interface */
+#define LOOP_CTL_ADD		0x4C80
+#define LOOP_CTL_REMOVE		0x4C81
+#define LOOP_CTL_GET_FREE	0x4C82
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/magic.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/magic.h
index 1923327..2d4beab 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/magic.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/magic.h
@@ -12,24 +12,29 @@
 #define SYSFS_MAGIC		0x62656572
 #define SECURITYFS_MAGIC	0x73636673
 #define SELINUX_MAGIC		0xf97cff8c
+#define RAMFS_MAGIC		0x858458f6	/* some random number */
 #define TMPFS_MAGIC		0x01021994
+#define HUGETLBFS_MAGIC 	0x958458f6	/* some random number */
 #define SQUASHFS_MAGIC		0x73717368
+#define ECRYPTFS_SUPER_MAGIC	0xf15f
 #define EFS_SUPER_MAGIC		0x414A53
 #define EXT2_SUPER_MAGIC	0xEF53
 #define EXT3_SUPER_MAGIC	0xEF53
 #define XENFS_SUPER_MAGIC	0xabba1974
 #define EXT4_SUPER_MAGIC	0xEF53
 #define BTRFS_SUPER_MAGIC	0x9123683E
+#define NILFS_SUPER_MAGIC	0x3434
 #define HPFS_SUPER_MAGIC	0xf995e849
 #define ISOFS_SUPER_MAGIC	0x9660
 #define JFFS2_SUPER_MAGIC	0x72b6
 #define ANON_INODE_FS_MAGIC	0x09041934
+#define PSTOREFS_MAGIC		0x6165676C
 
-#define MINIX_SUPER_MAGIC	0x137F		/* original minix fs */
-#define MINIX_SUPER_MAGIC2	0x138F		/* minix fs, 30 char names */
-#define MINIX2_SUPER_MAGIC	0x2468		/* minix V2 fs */
-#define MINIX2_SUPER_MAGIC2	0x2478		/* minix V2 fs, 30 char names */
-#define MINIX3_SUPER_MAGIC	0x4d5a		/* minix V3 fs */
+#define MINIX_SUPER_MAGIC	0x137F		/* minix v1 fs, 14 char names */
+#define MINIX_SUPER_MAGIC2	0x138F		/* minix v1 fs, 30 char names */
+#define MINIX2_SUPER_MAGIC	0x2468		/* minix v2 fs, 14 char names */
+#define MINIX2_SUPER_MAGIC2	0x2478		/* minix v2 fs, 30 char names */
+#define MINIX3_SUPER_MAGIC	0x4d5a		/* minix v3 fs, 60 char names */
 
 #define MSDOS_SUPER_MAGIC	0x4d44		/* MD */
 #define NCP_SUPER_MAGIC		0x564c		/* Guess, what 0x564c is :-) */
@@ -50,7 +55,11 @@
 #define CGROUP_SUPER_MAGIC	0x27e0eb
 
 #define FUTEXFS_SUPER_MAGIC	0xBAD1DEA
-#define INOTIFYFS_SUPER_MAGIC	0x2BAD1DEA
 
 #define STACK_END_MAGIC		0x57AC6E9D
+
+#define DEVPTS_SUPER_MAGIC	0x1cd1
+#define SOCKFS_MAGIC		0x534F434B
+#define V9FS_MAGIC		0x01021997
+
 #endif /* __LINUX_MAGIC_H__ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/matroxfb.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/matroxfb.h
index 2203121..8c22a89 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/matroxfb.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/matroxfb.h
@@ -4,6 +4,7 @@
 #include <asm/ioctl.h>
 #include <linux/types.h>
 #include <linux/videodev2.h>
+#include <linux/fb.h>
 
 struct matroxioc_output_mode {
 	__u32	output;		/* which output */
@@ -37,7 +38,5 @@
   MATROXFB_CID_LAST
 };
 
-#define FBIO_WAITFORVSYNC	_IOW('F', 0x20, __u32)
-
 #endif
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/media.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/media.h
new file mode 100644
index 0000000..410e7cc
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/media.h
@@ -0,0 +1,132 @@
+/*
+ * Multimedia device API
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ *	     Sakari Ailus <sakari.ailus@iki.fi>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __LINUX_MEDIA_H
+#define __LINUX_MEDIA_H
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+#include <linux/version.h>
+
+#define MEDIA_API_VERSION	KERNEL_VERSION(0, 1, 0)
+
+struct media_device_info {
+	char driver[16];
+	char model[32];
+	char serial[40];
+	char bus_info[32];
+	__u32 media_version;
+	__u32 hw_revision;
+	__u32 driver_version;
+	__u32 reserved[31];
+};
+
+#define MEDIA_ENT_ID_FLAG_NEXT		(1 << 31)
+
+#define MEDIA_ENT_TYPE_SHIFT		16
+#define MEDIA_ENT_TYPE_MASK		0x00ff0000
+#define MEDIA_ENT_SUBTYPE_MASK		0x0000ffff
+
+#define MEDIA_ENT_T_DEVNODE		(1 << MEDIA_ENT_TYPE_SHIFT)
+#define MEDIA_ENT_T_DEVNODE_V4L		(MEDIA_ENT_T_DEVNODE + 1)
+#define MEDIA_ENT_T_DEVNODE_FB		(MEDIA_ENT_T_DEVNODE + 2)
+#define MEDIA_ENT_T_DEVNODE_ALSA	(MEDIA_ENT_T_DEVNODE + 3)
+#define MEDIA_ENT_T_DEVNODE_DVB		(MEDIA_ENT_T_DEVNODE + 4)
+
+#define MEDIA_ENT_T_V4L2_SUBDEV		(2 << MEDIA_ENT_TYPE_SHIFT)
+#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)
+
+#define MEDIA_ENT_FL_DEFAULT		(1 << 0)
+
+struct media_entity_desc {
+	__u32 id;
+	char name[32];
+	__u32 type;
+	__u32 revision;
+	__u32 flags;
+	__u32 group_id;
+	__u16 pads;
+	__u16 links;
+
+	__u32 reserved[4];
+
+	union {
+		/* Node specifications */
+		struct {
+			__u32 major;
+			__u32 minor;
+		} v4l;
+		struct {
+			__u32 major;
+			__u32 minor;
+		} fb;
+		struct {
+			__u32 card;
+			__u32 device;
+			__u32 subdevice;
+		} alsa;
+		int dvb;
+
+		/* Sub-device specifications */
+		/* Nothing needed yet */
+		__u8 raw[184];
+	};
+};
+
+#define MEDIA_PAD_FL_SINK		(1 << 0)
+#define MEDIA_PAD_FL_SOURCE		(1 << 1)
+
+struct media_pad_desc {
+	__u32 entity;		/* entity ID */
+	__u16 index;		/* pad index */
+	__u32 flags;		/* pad flags */
+	__u32 reserved[2];
+};
+
+#define MEDIA_LNK_FL_ENABLED		(1 << 0)
+#define MEDIA_LNK_FL_IMMUTABLE		(1 << 1)
+#define MEDIA_LNK_FL_DYNAMIC		(1 << 2)
+
+struct media_link_desc {
+	struct media_pad_desc source;
+	struct media_pad_desc sink;
+	__u32 flags;
+	__u32 reserved[2];
+};
+
+struct media_links_enum {
+	__u32 entity;
+	/* Should have enough room for pads elements */
+	struct media_pad_desc *pads;
+	/* Should have enough room for links elements */
+	struct media_link_desc *links;
+	__u32 reserved[4];
+};
+
+#define MEDIA_IOC_DEVICE_INFO		_IOWR('|', 0x00, struct media_device_info)
+#define MEDIA_IOC_ENUM_ENTITIES		_IOWR('|', 0x01, struct media_entity_desc)
+#define MEDIA_IOC_ENUM_LINKS		_IOWR('|', 0x02, struct media_links_enum)
+#define MEDIA_IOC_SETUP_LINK		_IOWR('|', 0x03, struct media_link_desc)
+
+#endif /* __LINUX_MEDIA_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/mempolicy.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mempolicy.h
index 40b072d..1c3757a 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/mempolicy.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mempolicy.h
@@ -23,6 +23,13 @@
 	MPOL_MAX,	/* always last member of enum */
 };
 
+enum mpol_rebind_step {
+	MPOL_REBIND_ONCE,	/* do rebind work at once(not by two step) */
+	MPOL_REBIND_STEP1,	/* first step(set all the newly nodes) */
+	MPOL_REBIND_STEP2,	/* second step(clean all the disallowed nodes)*/
+	MPOL_REBIND_NSTEP,
+};
+
 /* Flags for set_mempolicy */
 #define MPOL_F_STATIC_NODES	(1 << 15)
 #define MPOL_F_RELATIVE_NODES	(1 << 14)
@@ -51,6 +58,7 @@
  */
 #define MPOL_F_SHARED  (1 << 0)	/* identify shared policies */
 #define MPOL_F_LOCAL   (1 << 1)	/* preferred local allocation */
+#define MPOL_F_REBINDING (1 << 2)	/* identify policies in rebinding */
 
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/meye.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/meye.h
index 12010ac..0dd4995 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/meye.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/meye.h
@@ -44,17 +44,17 @@
 };
 
 /* query the extended parameters */
-#define MEYEIOC_G_PARAMS	_IOR ('v', BASE_VIDIOCPRIVATE+0, struct meye_params)
+#define MEYEIOC_G_PARAMS	_IOR ('v', BASE_VIDIOC_PRIVATE+0, struct meye_params)
 /* set the extended parameters */
-#define MEYEIOC_S_PARAMS	_IOW ('v', BASE_VIDIOCPRIVATE+1, struct meye_params)
+#define MEYEIOC_S_PARAMS	_IOW ('v', BASE_VIDIOC_PRIVATE+1, struct meye_params)
 /* queue a buffer for mjpeg capture */
-#define MEYEIOC_QBUF_CAPT	_IOW ('v', BASE_VIDIOCPRIVATE+2, int)
+#define MEYEIOC_QBUF_CAPT	_IOW ('v', BASE_VIDIOC_PRIVATE+2, int)
 /* sync a previously queued mjpeg buffer */
-#define MEYEIOC_SYNC		_IOWR('v', BASE_VIDIOCPRIVATE+3, int)
+#define MEYEIOC_SYNC		_IOWR('v', BASE_VIDIOC_PRIVATE+3, int)
 /* get a still uncompressed snapshot */
-#define MEYEIOC_STILLCAPT	_IO  ('v', BASE_VIDIOCPRIVATE+4)
+#define MEYEIOC_STILLCAPT	_IO  ('v', BASE_VIDIOC_PRIVATE+4)
 /* get a jpeg compressed snapshot */
-#define MEYEIOC_STILLJCAPT	_IOR ('v', BASE_VIDIOCPRIVATE+5, int)
+#define MEYEIOC_STILLJCAPT	_IOR ('v', BASE_VIDIOC_PRIVATE+5, int)
 
 /* V4L2 private controls */
 #define V4L2_CID_AGC		V4L2_CID_PRIVATE_BASE
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/mii.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mii.h
index de1d74e..dc3d17f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/mii.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mii.h
@@ -9,131 +9,133 @@
 #define __LINUX_MII_H__
 
 #include <linux/types.h>
+#include <linux/ethtool.h>
 
 /* Generic MII registers. */
-
-#define MII_BMCR            0x00        /* Basic mode control register */
-#define MII_BMSR            0x01        /* Basic mode status register  */
-#define MII_PHYSID1         0x02        /* PHYS ID 1                   */
-#define MII_PHYSID2         0x03        /* PHYS ID 2                   */
-#define MII_ADVERTISE       0x04        /* Advertisement control reg   */
-#define MII_LPA             0x05        /* Link partner ability reg    */
-#define MII_EXPANSION       0x06        /* Expansion register          */
-#define MII_CTRL1000        0x09        /* 1000BASE-T control          */
-#define MII_STAT1000        0x0a        /* 1000BASE-T status           */
-#define MII_ESTATUS	    0x0f	/* Extended Status */
-#define MII_DCOUNTER        0x12        /* Disconnect counter          */
-#define MII_FCSCOUNTER      0x13        /* False carrier counter       */
-#define MII_NWAYTEST        0x14        /* N-way auto-neg test reg     */
-#define MII_RERRCOUNTER     0x15        /* Receive error counter       */
-#define MII_SREVISION       0x16        /* Silicon revision            */
-#define MII_RESV1           0x17        /* Reserved...                 */
-#define MII_LBRERROR        0x18        /* Lpback, rx, bypass error    */
-#define MII_PHYADDR         0x19        /* PHY address                 */
-#define MII_RESV2           0x1a        /* Reserved...                 */
-#define MII_TPISTATUS       0x1b        /* TPI status for 10mbps       */
-#define MII_NCONFIG         0x1c        /* Network interface config    */
+#define MII_BMCR		0x00	/* Basic mode control register */
+#define MII_BMSR		0x01	/* Basic mode status register  */
+#define MII_PHYSID1		0x02	/* PHYS ID 1                   */
+#define MII_PHYSID2		0x03	/* PHYS ID 2                   */
+#define MII_ADVERTISE		0x04	/* Advertisement control reg   */
+#define MII_LPA			0x05	/* Link partner ability reg    */
+#define MII_EXPANSION		0x06	/* Expansion register          */
+#define MII_CTRL1000		0x09	/* 1000BASE-T control          */
+#define MII_STAT1000		0x0a	/* 1000BASE-T status           */
+#define MII_ESTATUS		0x0f	/* Extended Status             */
+#define MII_DCOUNTER		0x12	/* Disconnect counter          */
+#define MII_FCSCOUNTER		0x13	/* False carrier counter       */
+#define MII_NWAYTEST		0x14	/* N-way auto-neg test reg     */
+#define MII_RERRCOUNTER		0x15	/* Receive error counter       */
+#define MII_SREVISION		0x16	/* Silicon revision            */
+#define MII_RESV1		0x17	/* Reserved...                 */
+#define MII_LBRERROR		0x18	/* Lpback, rx, bypass error    */
+#define MII_PHYADDR		0x19	/* PHY address                 */
+#define MII_RESV2		0x1a	/* Reserved...                 */
+#define MII_TPISTATUS		0x1b	/* TPI status for 10mbps       */
+#define MII_NCONFIG		0x1c	/* Network interface config    */
 
 /* Basic mode control register. */
-#define BMCR_RESV               0x003f  /* Unused...                   */
-#define BMCR_SPEED1000		0x0040  /* MSB of Speed (1000)         */
-#define BMCR_CTST               0x0080  /* Collision test              */
-#define BMCR_FULLDPLX           0x0100  /* Full duplex                 */
-#define BMCR_ANRESTART          0x0200  /* Auto negotiation restart    */
-#define BMCR_ISOLATE            0x0400  /* Disconnect DP83840 from MII */
-#define BMCR_PDOWN              0x0800  /* Powerdown the DP83840       */
-#define BMCR_ANENABLE           0x1000  /* Enable auto negotiation     */
-#define BMCR_SPEED100           0x2000  /* Select 100Mbps              */
-#define BMCR_LOOPBACK           0x4000  /* TXD loopback bits           */
-#define BMCR_RESET              0x8000  /* Reset the DP83840           */
+#define BMCR_RESV		0x003f	/* Unused...                   */
+#define BMCR_SPEED1000		0x0040	/* MSB of Speed (1000)         */
+#define BMCR_CTST		0x0080	/* Collision test              */
+#define BMCR_FULLDPLX		0x0100	/* Full duplex                 */
+#define BMCR_ANRESTART		0x0200	/* Auto negotiation restart    */
+#define BMCR_ISOLATE		0x0400	/* Isolate data paths from MII */
+#define BMCR_PDOWN		0x0800	/* Enable low power state      */
+#define BMCR_ANENABLE		0x1000	/* Enable auto negotiation     */
+#define BMCR_SPEED100		0x2000	/* Select 100Mbps              */
+#define BMCR_LOOPBACK		0x4000	/* TXD loopback bits           */
+#define BMCR_RESET		0x8000	/* Reset to default state      */
 
 /* Basic mode status register. */
-#define BMSR_ERCAP              0x0001  /* Ext-reg capability          */
-#define BMSR_JCD                0x0002  /* Jabber detected             */
-#define BMSR_LSTATUS            0x0004  /* Link status                 */
-#define BMSR_ANEGCAPABLE        0x0008  /* Able to do auto-negotiation */
-#define BMSR_RFAULT             0x0010  /* Remote fault detected       */
-#define BMSR_ANEGCOMPLETE       0x0020  /* Auto-negotiation complete   */
-#define BMSR_RESV               0x00c0  /* Unused...                   */
-#define BMSR_ESTATEN		0x0100	/* Extended Status in R15 */
-#define BMSR_100HALF2           0x0200  /* Can do 100BASE-T2 HDX */
-#define BMSR_100FULL2           0x0400  /* Can do 100BASE-T2 FDX */
-#define BMSR_10HALF             0x0800  /* Can do 10mbps, half-duplex  */
-#define BMSR_10FULL             0x1000  /* Can do 10mbps, full-duplex  */
-#define BMSR_100HALF            0x2000  /* Can do 100mbps, half-duplex */
-#define BMSR_100FULL            0x4000  /* Can do 100mbps, full-duplex */
-#define BMSR_100BASE4           0x8000  /* Can do 100mbps, 4k packets  */
+#define BMSR_ERCAP		0x0001	/* Ext-reg capability          */
+#define BMSR_JCD		0x0002	/* Jabber detected             */
+#define BMSR_LSTATUS		0x0004	/* Link status                 */
+#define BMSR_ANEGCAPABLE	0x0008	/* Able to do auto-negotiation */
+#define BMSR_RFAULT		0x0010	/* Remote fault detected       */
+#define BMSR_ANEGCOMPLETE	0x0020	/* Auto-negotiation complete   */
+#define BMSR_RESV		0x00c0	/* Unused...                   */
+#define BMSR_ESTATEN		0x0100	/* Extended Status in R15      */
+#define BMSR_100HALF2		0x0200	/* Can do 100BASE-T2 HDX       */
+#define BMSR_100FULL2		0x0400	/* Can do 100BASE-T2 FDX       */
+#define BMSR_10HALF		0x0800	/* Can do 10mbps, half-duplex  */
+#define BMSR_10FULL		0x1000	/* Can do 10mbps, full-duplex  */
+#define BMSR_100HALF		0x2000	/* Can do 100mbps, half-duplex */
+#define BMSR_100FULL		0x4000	/* Can do 100mbps, full-duplex */
+#define BMSR_100BASE4		0x8000	/* Can do 100mbps, 4k packets  */
 
 /* Advertisement control register. */
-#define ADVERTISE_SLCT          0x001f  /* Selector bits               */
-#define ADVERTISE_CSMA          0x0001  /* Only selector supported     */
-#define ADVERTISE_10HALF        0x0020  /* Try for 10mbps half-duplex  */
-#define ADVERTISE_1000XFULL     0x0020  /* Try for 1000BASE-X full-duplex */
-#define ADVERTISE_10FULL        0x0040  /* Try for 10mbps full-duplex  */
-#define ADVERTISE_1000XHALF     0x0040  /* Try for 1000BASE-X half-duplex */
-#define ADVERTISE_100HALF       0x0080  /* Try for 100mbps half-duplex */
-#define ADVERTISE_1000XPAUSE    0x0080  /* Try for 1000BASE-X pause    */
-#define ADVERTISE_100FULL       0x0100  /* Try for 100mbps full-duplex */
-#define ADVERTISE_1000XPSE_ASYM 0x0100  /* Try for 1000BASE-X asym pause */
-#define ADVERTISE_100BASE4      0x0200  /* Try for 100mbps 4k packets  */
-#define ADVERTISE_PAUSE_CAP     0x0400  /* Try for pause               */
-#define ADVERTISE_PAUSE_ASYM    0x0800  /* Try for asymetric pause     */
-#define ADVERTISE_RESV          0x1000  /* Unused...                   */
-#define ADVERTISE_RFAULT        0x2000  /* Say we can detect faults    */
-#define ADVERTISE_LPACK         0x4000  /* Ack link partners response  */
-#define ADVERTISE_NPAGE         0x8000  /* Next page bit               */
+#define ADVERTISE_SLCT		0x001f	/* Selector bits               */
+#define ADVERTISE_CSMA		0x0001	/* Only selector supported     */
+#define ADVERTISE_10HALF	0x0020	/* Try for 10mbps half-duplex  */
+#define ADVERTISE_1000XFULL	0x0020	/* Try for 1000BASE-X full-duplex */
+#define ADVERTISE_10FULL	0x0040	/* Try for 10mbps full-duplex  */
+#define ADVERTISE_1000XHALF	0x0040	/* Try for 1000BASE-X half-duplex */
+#define ADVERTISE_100HALF	0x0080	/* Try for 100mbps half-duplex */
+#define ADVERTISE_1000XPAUSE	0x0080	/* Try for 1000BASE-X pause    */
+#define ADVERTISE_100FULL	0x0100	/* Try for 100mbps full-duplex */
+#define ADVERTISE_1000XPSE_ASYM	0x0100	/* Try for 1000BASE-X asym pause */
+#define ADVERTISE_100BASE4	0x0200	/* Try for 100mbps 4k packets  */
+#define ADVERTISE_PAUSE_CAP	0x0400	/* Try for pause               */
+#define ADVERTISE_PAUSE_ASYM	0x0800	/* Try for asymetric pause     */
+#define ADVERTISE_RESV		0x1000	/* Unused...                   */
+#define ADVERTISE_RFAULT	0x2000	/* Say we can detect faults    */
+#define ADVERTISE_LPACK		0x4000	/* Ack link partners response  */
+#define ADVERTISE_NPAGE		0x8000	/* Next page bit               */
 
-#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
-			ADVERTISE_CSMA)
-#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
-                       ADVERTISE_100HALF | ADVERTISE_100FULL)
+#define ADVERTISE_FULL		(ADVERTISE_100FULL | ADVERTISE_10FULL | \
+				  ADVERTISE_CSMA)
+#define ADVERTISE_ALL		(ADVERTISE_10HALF | ADVERTISE_10FULL | \
+				  ADVERTISE_100HALF | ADVERTISE_100FULL)
 
 /* Link partner ability register. */
-#define LPA_SLCT                0x001f  /* Same as advertise selector  */
-#define LPA_10HALF              0x0020  /* Can do 10mbps half-duplex   */
-#define LPA_1000XFULL           0x0020  /* Can do 1000BASE-X full-duplex */
-#define LPA_10FULL              0x0040  /* Can do 10mbps full-duplex   */
-#define LPA_1000XHALF           0x0040  /* Can do 1000BASE-X half-duplex */
-#define LPA_100HALF             0x0080  /* Can do 100mbps half-duplex  */
-#define LPA_1000XPAUSE          0x0080  /* Can do 1000BASE-X pause     */
-#define LPA_100FULL             0x0100  /* Can do 100mbps full-duplex  */
-#define LPA_1000XPAUSE_ASYM     0x0100  /* Can do 1000BASE-X pause asym*/
-#define LPA_100BASE4            0x0200  /* Can do 100mbps 4k packets   */
-#define LPA_PAUSE_CAP           0x0400  /* Can pause                   */
-#define LPA_PAUSE_ASYM          0x0800  /* Can pause asymetrically     */
-#define LPA_RESV                0x1000  /* Unused...                   */
-#define LPA_RFAULT              0x2000  /* Link partner faulted        */
-#define LPA_LPACK               0x4000  /* Link partner acked us       */
-#define LPA_NPAGE               0x8000  /* Next page bit               */
+#define LPA_SLCT		0x001f	/* Same as advertise selector  */
+#define LPA_10HALF		0x0020	/* Can do 10mbps half-duplex   */
+#define LPA_1000XFULL		0x0020	/* Can do 1000BASE-X full-duplex */
+#define LPA_10FULL		0x0040	/* Can do 10mbps full-duplex   */
+#define LPA_1000XHALF		0x0040	/* Can do 1000BASE-X half-duplex */
+#define LPA_100HALF		0x0080	/* Can do 100mbps half-duplex  */
+#define LPA_1000XPAUSE		0x0080	/* Can do 1000BASE-X pause     */
+#define LPA_100FULL		0x0100	/* Can do 100mbps full-duplex  */
+#define LPA_1000XPAUSE_ASYM	0x0100	/* Can do 1000BASE-X pause asym*/
+#define LPA_100BASE4		0x0200	/* Can do 100mbps 4k packets   */
+#define LPA_PAUSE_CAP		0x0400	/* Can pause                   */
+#define LPA_PAUSE_ASYM		0x0800	/* Can pause asymetrically     */
+#define LPA_RESV		0x1000	/* Unused...                   */
+#define LPA_RFAULT		0x2000	/* Link partner faulted        */
+#define LPA_LPACK		0x4000	/* Link partner acked us       */
+#define LPA_NPAGE		0x8000	/* Next page bit               */
 
 #define LPA_DUPLEX		(LPA_10FULL | LPA_100FULL)
 #define LPA_100			(LPA_100FULL | LPA_100HALF | LPA_100BASE4)
 
 /* Expansion register for auto-negotiation. */
-#define EXPANSION_NWAY          0x0001  /* Can do N-way auto-nego      */
-#define EXPANSION_LCWP          0x0002  /* Got new RX page code word   */
-#define EXPANSION_ENABLENPAGE   0x0004  /* This enables npage words    */
-#define EXPANSION_NPCAPABLE     0x0008  /* Link partner supports npage */
-#define EXPANSION_MFAULTS       0x0010  /* Multiple faults detected    */
-#define EXPANSION_RESV          0xffe0  /* Unused...                   */
+#define EXPANSION_NWAY		0x0001	/* Can do N-way auto-nego      */
+#define EXPANSION_LCWP		0x0002	/* Got new RX page code word   */
+#define EXPANSION_ENABLENPAGE	0x0004	/* This enables npage words    */
+#define EXPANSION_NPCAPABLE	0x0008	/* Link partner supports npage */
+#define EXPANSION_MFAULTS	0x0010	/* Multiple faults detected    */
+#define EXPANSION_RESV		0xffe0	/* Unused...                   */
 
-#define ESTATUS_1000_TFULL	0x2000	/* Can do 1000BT Full */
-#define ESTATUS_1000_THALF	0x1000	/* Can do 1000BT Half */
+#define ESTATUS_1000_TFULL	0x2000	/* Can do 1000BT Full          */
+#define ESTATUS_1000_THALF	0x1000	/* Can do 1000BT Half          */
 
 /* N-way test register. */
-#define NWAYTEST_RESV1          0x00ff  /* Unused...                   */
-#define NWAYTEST_LOOPBACK       0x0100  /* Enable loopback for N-way   */
-#define NWAYTEST_RESV2          0xfe00  /* Unused...                   */
+#define NWAYTEST_RESV1		0x00ff	/* Unused...                   */
+#define NWAYTEST_LOOPBACK	0x0100	/* Enable loopback for N-way   */
+#define NWAYTEST_RESV2		0xfe00	/* Unused...                   */
 
 /* 1000BASE-T Control register */
-#define ADVERTISE_1000FULL      0x0200  /* Advertise 1000BASE-T full duplex */
-#define ADVERTISE_1000HALF      0x0100  /* Advertise 1000BASE-T half duplex */
+#define ADVERTISE_1000FULL	0x0200  /* Advertise 1000BASE-T full duplex */
+#define ADVERTISE_1000HALF	0x0100  /* Advertise 1000BASE-T half duplex */
+#define CTL1000_AS_MASTER	0x0800
+#define CTL1000_ENABLE_MASTER	0x1000
 
 /* 1000BASE-T Status register */
-#define LPA_1000LOCALRXOK       0x2000  /* Link partner local receiver status */
-#define LPA_1000REMRXOK         0x1000  /* Link partner remote receiver status */
-#define LPA_1000FULL            0x0800  /* Link partner 1000BASE-T full duplex */
-#define LPA_1000HALF            0x0400  /* Link partner 1000BASE-T half duplex */
+#define LPA_1000LOCALRXOK	0x2000	/* Link partner local receiver status */
+#define LPA_1000REMRXOK		0x1000	/* Link partner remote receiver status */
+#define LPA_1000FULL		0x0800	/* Link partner 1000BASE-T full duplex */
+#define LPA_1000HALF		0x0400	/* Link partner 1000BASE-T half duplex */
 
 /* Flow control flags */
 #define FLOW_CTRL_TX		0x01
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/mmc/ioctl.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mmc/ioctl.h
new file mode 100644
index 0000000..8fa5bc5
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mmc/ioctl.h
@@ -0,0 +1,54 @@
+#ifndef LINUX_MMC_IOCTL_H
+#define LINUX_MMC_IOCTL_H
+struct mmc_ioc_cmd {
+	/* Implies direction of data.  true = write, false = read */
+	int write_flag;
+
+	/* Application-specific command.  true = precede with CMD55 */
+	int is_acmd;
+
+	__u32 opcode;
+	__u32 arg;
+	__u32 response[4];  /* CMD response */
+	unsigned int flags;
+	unsigned int blksz;
+	unsigned int blocks;
+
+	/*
+	 * Sleep at least postsleep_min_us useconds, and at most
+	 * postsleep_max_us useconds *after* issuing command.  Needed for
+	 * some read commands for which cards have no other way of indicating
+	 * they're ready for the next command (i.e. there is no equivalent of
+	 * a "busy" indicator for read operations).
+	 */
+	unsigned int postsleep_min_us;
+	unsigned int postsleep_max_us;
+
+	/*
+	 * Override driver-computed timeouts.  Note the difference in units!
+	 */
+	unsigned int data_timeout_ns;
+	unsigned int cmd_timeout_ms;
+
+	/*
+	 * For 64-bit machines, the next member, ``__u64 data_ptr``, wants to
+	 * be 8-byte aligned.  Make sure this struct is the same size when
+	 * built for 32-bit.
+	 */
+	__u32 __pad;
+
+	/* DAT buffer */
+	__u64 data_ptr;
+};
+#define mmc_ioc_cmd_set_data(ic, ptr) ic.data_ptr = (__u64)(unsigned long) ptr
+
+#define MMC_IOC_CMD _IOWR(MMC_BLOCK_MAJOR, 0, struct mmc_ioc_cmd)
+
+/*
+ * Since this ioctl is only meant to enhance (and not replace) normal access
+ * to the mmc bus device, an upper data transfer limit of MMC_IOC_MAX_BYTES
+ * is enforced per ioctl call.  For larger data transfers, use the normal
+ * block device operations.
+ */
+#define MMC_IOC_MAX_BYTES  (512L * 256)
+#endif /* LINUX_MMC_IOCTL_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/mroute.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mroute.h
index ad2289a..76b4127 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/mroute.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mroute.h
@@ -24,7 +24,8 @@
 #define MRT_DEL_MFC	(MRT_BASE+5)	/* Delete a multicast forwarding entry	*/
 #define MRT_VERSION	(MRT_BASE+6)	/* Get the kernel multicast version	*/
 #define MRT_ASSERT	(MRT_BASE+7)	/* Activate PIM assert mode		*/
-#define MRT_PIM		(MRT_BASE+8)	/* enable PIM code	*/
+#define MRT_PIM		(MRT_BASE+8)	/* enable PIM code			*/
+#define MRT_TABLE	(MRT_BASE+9)	/* Specify mroute table ID		*/
 
 #define SIOCGETVIFCNT	SIOCPROTOPRIVATE	/* IP protocol privates */
 #define SIOCGETSGCNT	(SIOCPROTOPRIVATE+1)
@@ -56,20 +57,24 @@
 	unsigned char vifc_flags;	/* VIFF_ flags */
 	unsigned char vifc_threshold;	/* ttl limit */
 	unsigned int vifc_rate_limit;	/* Rate limiter values (NI) */
-	struct in_addr vifc_lcl_addr;	/* Our address */
+	union {
+		struct in_addr vifc_lcl_addr;     /* Local interface address */
+		int            vifc_lcl_ifindex;  /* Local interface index   */
+	};
 	struct in_addr vifc_rmt_addr;	/* IPIP tunnel addr */
 };
 
-#define VIFF_TUNNEL	0x1	/* IPIP tunnel */
-#define VIFF_SRCRT	0x2	/* NI */
-#define VIFF_REGISTER	0x4	/* register vif	*/
+#define VIFF_TUNNEL		0x1	/* IPIP tunnel */
+#define VIFF_SRCRT		0x2	/* NI */
+#define VIFF_REGISTER		0x4	/* register vif	*/
+#define VIFF_USE_IFINDEX	0x8	/* use vifc_lcl_ifindex instead of
+					   vifc_lcl_addr to find an interface */
 
 /*
  *	Cache manipulation structures for mrouted and PIMd
  */
  
-struct mfcctl
-{
+struct mfcctl {
 	struct in_addr mfcc_origin;		/* Origin of mcast	*/
 	struct in_addr mfcc_mcastgrp;		/* Group in question	*/
 	vifi_t	mfcc_parent;			/* Where it arrived	*/
@@ -84,8 +89,7 @@
  *	Group count retrieval for mrouted
  */
  
-struct sioc_sg_req
-{
+struct sioc_sg_req {
 	struct in_addr src;
 	struct in_addr grp;
 	unsigned long pktcnt;
@@ -97,8 +101,7 @@
  *	To get vif packet counts
  */
 
-struct sioc_vif_req
-{
+struct sioc_vif_req {
 	vifi_t	vifi;		/* Which iface */
 	unsigned long icount;	/* In packets */
 	unsigned long ocount;	/* Out packets */
@@ -111,8 +114,7 @@
  *	data. Magically happens to be like an IP packet as per the original
  */
  
-struct igmpmsg
-{
+struct igmpmsg {
 	__u32 unused1,unused2;
 	unsigned char im_msgtype;		/* What is this */
 	unsigned char im_mbz;			/* Must be zero */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/mroute6.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mroute6.h
index fb5843d..77d2bc3 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/mroute6.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mroute6.h
@@ -24,7 +24,8 @@
 #define MRT6_DEL_MFC	(MRT6_BASE+5)	/* Delete a multicast forwarding entry	*/
 #define MRT6_VERSION	(MRT6_BASE+6)	/* Get the kernel multicast version	*/
 #define MRT6_ASSERT	(MRT6_BASE+7)	/* Activate PIM assert mode		*/
-#define MRT6_PIM	(MRT6_BASE+8)	/* enable PIM code	*/
+#define MRT6_PIM	(MRT6_BASE+8)	/* enable PIM code			*/
+#define MRT6_TABLE	(MRT6_BASE+9)	/* Specify mroute table ID		*/
 
 #define SIOCGETMIFCNT_IN6	SIOCPROTOPRIVATE	/* IP protocol privates */
 #define SIOCGETSGCNT_IN6	(SIOCPROTOPRIVATE+1)
@@ -42,7 +43,7 @@
 typedef	__u32		if_mask;
 #define NIFBITS (sizeof(if_mask) * 8)        /* bits per mask */
 
-#if !defined(__KERNEL__) && !defined(DIV_ROUND_UP)
+#if !defined(DIV_ROUND_UP)
 #define	DIV_ROUND_UP(x,y)	(((x) + ((y) - 1)) / (y))
 #endif
 
@@ -75,8 +76,7 @@
  *	Cache manipulation structures for mrouted and PIMd
  */
 
-struct mf6cctl
-{
+struct mf6cctl {
 	struct sockaddr_in6 mf6cc_origin;		/* Origin of mcast	*/
 	struct sockaddr_in6 mf6cc_mcastgrp;		/* Group in question	*/
 	mifi_t	mf6cc_parent;			/* Where it arrived	*/
@@ -87,8 +87,7 @@
  *	Group count retrieval for pim6sd
  */
 
-struct sioc_sg_req6
-{
+struct sioc_sg_req6 {
 	struct sockaddr_in6 src;
 	struct sockaddr_in6 grp;
 	unsigned long pktcnt;
@@ -100,8 +99,7 @@
  *	To get vif packet counts
  */
 
-struct sioc_mif_req6
-{
+struct sioc_mif_req6 {
 	mifi_t	mifi;		/* Which iface */
 	unsigned long icount;	/* In packets */
 	unsigned long ocount;	/* Out packets */
@@ -119,7 +117,7 @@
  * Structure used to communicate from kernel to multicast router.
  * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{}
  * used for IPv4 implementation). This is because this structure will be passed via an
- * IPv6 raw socket, on wich an application will only receiver the payload i.e the data after
+ * IPv6 raw socket, on which an application will only receiver the payload i.e the data after
  * the IPv6 header and all the extension headers. (See section 3 of RFC 3542)
  */
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/msdos_fs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/msdos_fs.h
index 85470e1..5465841 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/msdos_fs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/msdos_fs.h
@@ -15,6 +15,7 @@
 #define MSDOS_DPB_BITS	4		/* log2(MSDOS_DPB) */
 #define MSDOS_DPS	(SECTOR_SIZE / sizeof(struct msdos_dir_entry))
 #define MSDOS_DPS_BITS	4		/* log2(MSDOS_DPS) */
+#define MSDOS_LONGNAME	256		/* maximum name length */
 #define CF_LE_W(v)	le16_to_cpu(v)
 #define CF_LE_L(v)	le32_to_cpu(v)
 #define CT_LE_W(v)	cpu_to_le16(v)
@@ -47,8 +48,8 @@
 #define DELETED_FLAG	0xe5	/* marks file as deleted when in name[0] */
 #define IS_FREE(n)	(!*(n) || *(n) == DELETED_FLAG)
 
+#define FAT_LFN_LEN	255	/* maximum long name length */
 #define MSDOS_NAME	11	/* maximum name length */
-#define MSDOS_LONGNAME	256	/* maximum name length */
 #define MSDOS_SLOTS	21	/* max # of slots for short and long names */
 #define MSDOS_DOT	".          "	/* ".", padded to MSDOS_NAME chars */
 #define MSDOS_DOTDOT	"..         "	/* "..", padded to MSDOS_NAME chars */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/mtio.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mtio.h
index ef01d6a..8f82575 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/mtio.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/mtio.h
@@ -63,6 +63,7 @@
 #define MTCOMPRESSION 32/* control compression with SCSI mode page 15 */
 #define MTSETPART 33	/* Change the active tape partition */
 #define MTMKPART  34	/* Format the tape with one or two partitions */
+#define MTWEOFI	35	/* write an end-of-file record (mark) in immediate mode */
 
 /* structure for MTIOCGET - mag tape get status command */
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/n_r3964.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/n_r3964.h
index f716807..61b5452 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/n_r3964.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/n_r3964.h
@@ -4,7 +4,6 @@
  * Copyright by
  * Philips Automation Projects
  * Kassel (Germany)
- * http://www.pap-philips.de
  * -----------------------------------------------------------
  * This software may be used and distributed according to the terms of
  * the GNU General Public License, incorporated herein by reference.
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nbd.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nbd.h
index 6eab0ab..fdd2989 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nbd.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nbd.h
@@ -54,7 +54,7 @@
 	char handle[8];
 	__be64 from;
 	__be32 len;
-} __attribute__ ((packed));
+} __attribute__((packed));
 
 /*
  * This is the reply packet that nbd-server sends back to the client after
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ncp_fs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ncp_fs.h
index b542047..9b84469 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ncp_fs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ncp_fs.h
@@ -143,5 +143,4 @@
 #define NCP_MAXPATHLEN 255
 #define NCP_MAXNAMELEN 14
 
-
 #endif				/* _LINUX_NCP_FS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ncp_mount.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ncp_mount.h
index ebe4a2e..dfcbea2 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ncp_mount.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ncp_mount.h
@@ -68,5 +68,4 @@
 
 #define NCP_MOUNT_VERSION_V5	(5)	/* Text only */
 
-
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/neighbour.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/neighbour.h
index 12c9de1..b188f68 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/neighbour.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/neighbour.h
@@ -4,8 +4,7 @@
 #include <linux/types.h>
 #include <linux/netlink.h>
 
-struct ndmsg
-{
+struct ndmsg {
 	__u8		ndm_family;
 	__u8		ndm_pad1;
 	__u16		ndm_pad2;
@@ -15,8 +14,7 @@
 	__u8		ndm_type;
 };
 
-enum
-{
+enum {
 	NDA_UNSPEC,
 	NDA_DST,
 	NDA_LLADDR,
@@ -56,8 +54,7 @@
    NUD_PERMANENT is also cannot be deleted by garbage collectors.
  */
 
-struct nda_cacheinfo
-{
+struct nda_cacheinfo {
 	__u32		ndm_confirmed;
 	__u32		ndm_used;
 	__u32		ndm_updated;
@@ -89,8 +86,7 @@
  * device.
  ****/
 
-struct ndt_stats
-{
+struct ndt_stats {
 	__u64		ndts_allocs;
 	__u64		ndts_destroys;
 	__u64		ndts_hash_grows;
@@ -120,19 +116,18 @@
 	NDTPA_PROXY_DELAY,		/* u64, msecs */
 	NDTPA_PROXY_QLEN,		/* u32 */
 	NDTPA_LOCKTIME,			/* u64, msecs */
+	NDTPA_QUEUE_LENBYTES,		/* u32 */
 	__NDTPA_MAX
 };
 #define NDTPA_MAX (__NDTPA_MAX - 1)
 
-struct ndtmsg
-{
+struct ndtmsg {
 	__u8		ndtm_family;
 	__u8		ndtm_pad1;
 	__u16		ndtm_pad2;
 };
 
-struct ndt_config
-{
+struct ndt_config {
 	__u16		ndtc_key_len;
 	__u16		ndtc_entry_size;
 	__u32		ndtc_entries;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/net.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/net.h
index 2b4120b..c577561 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/net.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/net.h
@@ -41,6 +41,8 @@
 #define SYS_SENDMSG	16		/* sys_sendmsg(2)		*/
 #define SYS_RECVMSG	17		/* sys_recvmsg(2)		*/
 #define SYS_ACCEPT4	18		/* sys_accept4(2)		*/
+#define SYS_RECVMMSG	19		/* sys_recvmmsg(2)		*/
+#define SYS_SENDMMSG	20		/* sys_sendmmsg(2)		*/
 
 typedef enum {
 	SS_FREE = 0,			/* not allocated		*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/net_dropmon.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/net_dropmon.h
index 3ceb0cc..2a73946 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/net_dropmon.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/net_dropmon.h
@@ -3,7 +3,6 @@
 
 #include <linux/types.h>
 #include <linux/netlink.h>
-#include <linux/types.h>
 
 struct net_dm_drop_point {
 	__u8 pc[8];
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h
new file mode 100644
index 0000000..ae5df12
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h
@@ -0,0 +1,113 @@
+/*
+ * Userspace API for hardware time stamping of network packets
+ *
+ * Copyright (C) 2008,2009 Intel Corporation
+ * Author: Patrick Ohly <patrick.ohly@intel.com>
+ *
+ */
+
+#ifndef _NET_TIMESTAMPING_H
+#define _NET_TIMESTAMPING_H
+
+#include <linux/socket.h>   /* for SO_TIMESTAMPING */
+
+/* SO_TIMESTAMPING gets an integer bit field comprised of these values */
+enum {
+	SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),
+	SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1),
+	SOF_TIMESTAMPING_RX_HARDWARE = (1<<2),
+	SOF_TIMESTAMPING_RX_SOFTWARE = (1<<3),
+	SOF_TIMESTAMPING_SOFTWARE = (1<<4),
+	SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5),
+	SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6),
+	SOF_TIMESTAMPING_MASK =
+	(SOF_TIMESTAMPING_RAW_HARDWARE - 1) |
+	SOF_TIMESTAMPING_RAW_HARDWARE
+};
+
+/**
+ * struct hwtstamp_config - %SIOCSHWTSTAMP parameter
+ *
+ * @flags:	no flags defined right now, must be zero
+ * @tx_type:	one of HWTSTAMP_TX_*
+ * @rx_type:	one of one of HWTSTAMP_FILTER_*
+ *
+ * %SIOCSHWTSTAMP expects a &struct ifreq with a ifr_data pointer to
+ * this structure. dev_ifsioc() in the kernel takes care of the
+ * translation between 32 bit userspace and 64 bit kernel. The
+ * structure is intentionally chosen so that it has the same layout on
+ * 32 and 64 bit systems, don't break this!
+ */
+struct hwtstamp_config {
+	int flags;
+	int tx_type;
+	int rx_filter;
+};
+
+/* possible values for hwtstamp_config->tx_type */
+enum hwtstamp_tx_types {
+	/*
+	 * No outgoing packet will need hardware time stamping;
+	 * should a packet arrive which asks for it, no hardware
+	 * time stamping will be done.
+	 */
+	HWTSTAMP_TX_OFF,
+
+	/*
+	 * Enables hardware time stamping for outgoing packets;
+	 * the sender of the packet decides which are to be
+	 * time stamped by setting %SOF_TIMESTAMPING_TX_SOFTWARE
+	 * before sending the packet.
+	 */
+	HWTSTAMP_TX_ON,
+
+	/*
+	 * Enables time stamping for outgoing packets just as
+	 * HWTSTAMP_TX_ON does, but also enables time stamp insertion
+	 * directly into Sync packets. In this case, transmitted Sync
+	 * packets will not received a time stamp via the socket error
+	 * queue.
+	 */
+	HWTSTAMP_TX_ONESTEP_SYNC,
+};
+
+/* possible values for hwtstamp_config->rx_filter */
+enum hwtstamp_rx_filters {
+	/* time stamp no incoming packet at all */
+	HWTSTAMP_FILTER_NONE,
+
+	/* time stamp any incoming packet */
+	HWTSTAMP_FILTER_ALL,
+
+	/* return value: time stamp all packets requested plus some others */
+	HWTSTAMP_FILTER_SOME,
+
+	/* PTP v1, UDP, any kind of event packet */
+	HWTSTAMP_FILTER_PTP_V1_L4_EVENT,
+	/* PTP v1, UDP, Sync packet */
+	HWTSTAMP_FILTER_PTP_V1_L4_SYNC,
+	/* PTP v1, UDP, Delay_req packet */
+	HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ,
+	/* PTP v2, UDP, any kind of event packet */
+	HWTSTAMP_FILTER_PTP_V2_L4_EVENT,
+	/* PTP v2, UDP, Sync packet */
+	HWTSTAMP_FILTER_PTP_V2_L4_SYNC,
+	/* PTP v2, UDP, Delay_req packet */
+	HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ,
+
+	/* 802.AS1, Ethernet, any kind of event packet */
+	HWTSTAMP_FILTER_PTP_V2_L2_EVENT,
+	/* 802.AS1, Ethernet, Sync packet */
+	HWTSTAMP_FILTER_PTP_V2_L2_SYNC,
+	/* 802.AS1, Ethernet, Delay_req packet */
+	HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ,
+
+	/* PTP v2/802.AS1, any layer, any kind of event packet */
+	HWTSTAMP_FILTER_PTP_V2_EVENT,
+	/* PTP v2/802.AS1, any layer, Sync packet */
+	HWTSTAMP_FILTER_PTP_V2_SYNC,
+	/* PTP v2/802.AS1, any layer, Delay_req packet */
+	HWTSTAMP_FILTER_PTP_V2_DELAY_REQ,
+};
+
+#endif /* _NET_TIMESTAMPING_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netdevice.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netdevice.h
index 2faed2a..6c10e02 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netdevice.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netdevice.h
@@ -28,54 +28,15 @@
 #include <linux/if.h>
 #include <linux/if_ether.h>
 #include <linux/if_packet.h>
+#include <linux/if_link.h>
 
 
 #define MAX_ADDR_LEN	32		/* Largest hardware address length */
 
-/* Driver transmit return codes */
-#define NETDEV_TX_OK 0		/* driver took care of packet */
-#define NETDEV_TX_BUSY 1	/* driver tx path was busy*/
-#define NETDEV_TX_LOCKED -1	/* driver tx lock was already taken */
+/* Initial net device group. All devices belong to group 0 by default. */
+#define INIT_NETDEV_GROUP	0
 
 
-/*
- *	Network device statistics. Akin to the 2.0 ether stats but
- *	with byte counters.
- */
-
-struct net_device_stats
-{
-	unsigned long	rx_packets;		/* total packets received	*/
-	unsigned long	tx_packets;		/* total packets transmitted	*/
-	unsigned long	rx_bytes;		/* total bytes received 	*/
-	unsigned long	tx_bytes;		/* total bytes transmitted	*/
-	unsigned long	rx_errors;		/* bad packets received		*/
-	unsigned long	tx_errors;		/* packet transmit problems	*/
-	unsigned long	rx_dropped;		/* no space in linux buffers	*/
-	unsigned long	tx_dropped;		/* no space available in linux	*/
-	unsigned long	multicast;		/* multicast packets received	*/
-	unsigned long	collisions;
-
-	/* detailed rx_errors: */
-	unsigned long	rx_length_errors;
-	unsigned long	rx_over_errors;		/* receiver ring buff overflow	*/
-	unsigned long	rx_crc_errors;		/* recved pkt with crc error	*/
-	unsigned long	rx_frame_errors;	/* recv'd frame alignment error */
-	unsigned long	rx_fifo_errors;		/* recv'r fifo overrun		*/
-	unsigned long	rx_missed_errors;	/* receiver missed packet	*/
-
-	/* detailed tx_errors */
-	unsigned long	tx_aborted_errors;
-	unsigned long	tx_carrier_errors;
-	unsigned long	tx_fifo_errors;
-	unsigned long	tx_heartbeat_errors;
-	unsigned long	tx_window_errors;
-	
-	/* for cslip etc */
-	unsigned long	rx_compressed;
-	unsigned long	tx_compressed;
-};
-
 
 /* Media selection options. */
 enum {
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter.h
index e8b4d1e..5477131 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter.h
@@ -1,10 +1,9 @@
-/** Copyright (c) 2013 Qualcomm Atheros, Inc. */
-
 #ifndef __LINUX_NETFILTER_H
 #define __LINUX_NETFILTER_H
 
 #include <linux/types.h>
 
+#include <linux/sysctl.h>
 
 /* Responses from hook functions. */
 #define NF_DROP 0
@@ -16,14 +15,20 @@
 #define NF_MAX_VERDICT NF_STOP
 
 /* we overload the higher bits for encoding auxiliary data such as the queue
- * number. Not nice, but better than additional function arguments. */
-#define NF_VERDICT_MASK 0x0000ffff
-#define NF_VERDICT_BITS 16
+ * number or errno values. Not nice, but better than additional function
+ * arguments. */
+#define NF_VERDICT_MASK 0x000000ff
 
+/* extra verdict flags have mask 0x0000ff00 */
+#define NF_VERDICT_FLAG_QUEUE_BYPASS	0x00008000
+
+/* queue number (NF_QUEUE) or errno (NF_DROP) */
 #define NF_VERDICT_QMASK 0xffff0000
 #define NF_VERDICT_QBITS 16
 
-#define NF_QUEUE_NR(x) ((((x) << NF_VERDICT_BITS) & NF_VERDICT_QMASK) | NF_QUEUE)
+#define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE)
+
+#define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP)
 
 /* only for userspace compatibility */
 /* Generic cache responses from hook functions.
@@ -31,6 +36,9 @@
 #define NFC_UNKNOWN 0x4000
 #define NFC_ALTERED 0x8000
 
+/* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */
+#define NF_VERDICT_BITS 16
+
 enum nf_inet_hooks {
 	NF_INET_PRE_ROUTING,
 	NF_INET_LOCAL_IN,
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set.h
new file mode 100644
index 0000000..4eeb2d6
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set.h
@@ -0,0 +1,172 @@
+#ifndef _IP_SET_H
+#define _IP_SET_H
+
+/* 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>
+ *
+ * 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.
+ */
+
+/* The protocol version */
+#define IPSET_PROTOCOL		6
+
+/* The max length of strings including NUL: set and type identifiers */
+#define IPSET_MAXNAMELEN	32
+
+/* Message types and commands */
+enum ipset_cmd {
+	IPSET_CMD_NONE,
+	IPSET_CMD_PROTOCOL,	/* 1: Return protocol version */
+	IPSET_CMD_CREATE,	/* 2: Create a new (empty) set */
+	IPSET_CMD_DESTROY,	/* 3: Destroy a (empty) set */
+	IPSET_CMD_FLUSH,	/* 4: Remove all elements from a set */
+	IPSET_CMD_RENAME,	/* 5: Rename a set */
+	IPSET_CMD_SWAP,		/* 6: Swap two sets */
+	IPSET_CMD_LIST,		/* 7: List sets */
+	IPSET_CMD_SAVE,		/* 8: Save sets */
+	IPSET_CMD_ADD,		/* 9: Add an element to a set */
+	IPSET_CMD_DEL,		/* 10: Delete an element from a set */
+	IPSET_CMD_TEST,		/* 11: Test an element in a set */
+	IPSET_CMD_HEADER,	/* 12: Get set header data only */
+	IPSET_CMD_TYPE,		/* 13: Get set type */
+	IPSET_MSG_MAX,		/* Netlink message commands */
+
+	/* Commands in userspace: */
+	IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */
+	IPSET_CMD_HELP,		/* 15: Get help */
+	IPSET_CMD_VERSION,	/* 16: Get program version */
+	IPSET_CMD_QUIT,		/* 17: Quit from interactive mode */
+
+	IPSET_CMD_MAX,
+
+	IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */
+};
+
+/* Attributes at command level */
+enum {
+	IPSET_ATTR_UNSPEC,
+	IPSET_ATTR_PROTOCOL,	/* 1: Protocol version */
+	IPSET_ATTR_SETNAME,	/* 2: Name of the set */
+	IPSET_ATTR_TYPENAME,	/* 3: Typename */
+	IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */
+	IPSET_ATTR_REVISION,	/* 4: Settype revision */
+	IPSET_ATTR_FAMILY,	/* 5: Settype family */
+	IPSET_ATTR_FLAGS,	/* 6: Flags at command level */
+	IPSET_ATTR_DATA,	/* 7: Nested attributes */
+	IPSET_ATTR_ADT,		/* 8: Multiple data containers */
+	IPSET_ATTR_LINENO,	/* 9: Restore lineno */
+	IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */
+	IPSET_ATTR_REVISION_MIN	= IPSET_ATTR_PROTOCOL_MIN, /* type rev min */
+	__IPSET_ATTR_CMD_MAX,
+};
+#define IPSET_ATTR_CMD_MAX	(__IPSET_ATTR_CMD_MAX - 1)
+
+/* CADT specific attributes */
+enum {
+	IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1,
+	IPSET_ATTR_IP_FROM = IPSET_ATTR_IP,
+	IPSET_ATTR_IP_TO,	/* 2 */
+	IPSET_ATTR_CIDR,	/* 3 */
+	IPSET_ATTR_PORT,	/* 4 */
+	IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT,
+	IPSET_ATTR_PORT_TO,	/* 5 */
+	IPSET_ATTR_TIMEOUT,	/* 6 */
+	IPSET_ATTR_PROTO,	/* 7 */
+	IPSET_ATTR_CADT_FLAGS,	/* 8 */
+	IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO,	/* 9 */
+	/* Reserve empty slots */
+	IPSET_ATTR_CADT_MAX = 16,
+	/* Create-only specific attributes */
+	IPSET_ATTR_GC,
+	IPSET_ATTR_HASHSIZE,
+	IPSET_ATTR_MAXELEM,
+	IPSET_ATTR_NETMASK,
+	IPSET_ATTR_PROBES,
+	IPSET_ATTR_RESIZE,
+	IPSET_ATTR_SIZE,
+	/* Kernel-only */
+	IPSET_ATTR_ELEMENTS,
+	IPSET_ATTR_REFERENCES,
+	IPSET_ATTR_MEMSIZE,
+
+	__IPSET_ATTR_CREATE_MAX,
+};
+#define IPSET_ATTR_CREATE_MAX	(__IPSET_ATTR_CREATE_MAX - 1)
+
+/* ADT specific attributes */
+enum {
+	IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1,
+	IPSET_ATTR_NAME,
+	IPSET_ATTR_NAMEREF,
+	IPSET_ATTR_IP2,
+	IPSET_ATTR_CIDR2,
+	IPSET_ATTR_IP2_TO,
+	IPSET_ATTR_IFACE,
+	__IPSET_ATTR_ADT_MAX,
+};
+#define IPSET_ATTR_ADT_MAX	(__IPSET_ATTR_ADT_MAX - 1)
+
+/* IP specific attributes */
+enum {
+	IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1,
+	IPSET_ATTR_IPADDR_IPV6,
+	__IPSET_ATTR_IPADDR_MAX,
+};
+#define IPSET_ATTR_IPADDR_MAX	(__IPSET_ATTR_IPADDR_MAX - 1)
+
+/* Error codes */
+enum ipset_errno {
+	IPSET_ERR_PRIVATE = 4096,
+	IPSET_ERR_PROTOCOL,
+	IPSET_ERR_FIND_TYPE,
+	IPSET_ERR_MAX_SETS,
+	IPSET_ERR_BUSY,
+	IPSET_ERR_EXIST_SETNAME2,
+	IPSET_ERR_TYPE_MISMATCH,
+	IPSET_ERR_EXIST,
+	IPSET_ERR_INVALID_CIDR,
+	IPSET_ERR_INVALID_NETMASK,
+	IPSET_ERR_INVALID_FAMILY,
+	IPSET_ERR_TIMEOUT,
+	IPSET_ERR_REFERENCED,
+	IPSET_ERR_IPADDR_IPV4,
+	IPSET_ERR_IPADDR_IPV6,
+
+	/* Type specific error codes */
+	IPSET_ERR_TYPE_SPECIFIC = 4352,
+};
+
+/* Flags at command level */
+enum ipset_cmd_flags {
+	IPSET_FLAG_BIT_EXIST	= 0,
+	IPSET_FLAG_EXIST	= (1 << IPSET_FLAG_BIT_EXIST),
+	IPSET_FLAG_BIT_LIST_SETNAME = 1,
+	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),
+};
+
+/* Flags at CADT attribute level */
+enum ipset_cadt_flags {
+	IPSET_FLAG_BIT_BEFORE	= 0,
+	IPSET_FLAG_BEFORE	= (1 << IPSET_FLAG_BIT_BEFORE),
+	IPSET_FLAG_BIT_PHYSDEV	= 1,
+	IPSET_FLAG_PHYSDEV	= (1 << IPSET_FLAG_BIT_PHYSDEV),
+};
+
+/* Commands with settype-specific attributes */
+enum ipset_adt {
+	IPSET_ADD,
+	IPSET_DEL,
+	IPSET_TEST,
+	IPSET_ADT_MAX,
+	IPSET_CREATE = IPSET_ADT_MAX,
+	IPSET_CADT_MAX,
+};
+
+
+#endif /*_IP_SET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_bitmap.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_bitmap.h
new file mode 100644
index 0000000..061a28e
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_bitmap.h
@@ -0,0 +1,13 @@
+#ifndef __IP_SET_BITMAP_H
+#define __IP_SET_BITMAP_H
+
+/* Bitmap type specific error codes */
+enum {
+	/* The element is out of the range of the set */
+	IPSET_ERR_BITMAP_RANGE = IPSET_ERR_TYPE_SPECIFIC,
+	/* The range exceeds the size limit of the set type */
+	IPSET_ERR_BITMAP_RANGE_SIZE,
+};
+
+
+#endif /* __IP_SET_BITMAP_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_hash.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_hash.h
new file mode 100644
index 0000000..34ac6ce
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_hash.h
@@ -0,0 +1,21 @@
+#ifndef __IP_SET_HASH_H
+#define __IP_SET_HASH_H
+
+/* Hash type specific error codes */
+enum {
+	/* Hash is full */
+	IPSET_ERR_HASH_FULL = IPSET_ERR_TYPE_SPECIFIC,
+	/* Null-valued element */
+	IPSET_ERR_HASH_ELEM,
+	/* Invalid protocol */
+	IPSET_ERR_INVALID_PROTO,
+	/* Protocol missing but must be specified */
+	IPSET_ERR_MISSING_PROTO,
+	/* Range not supported */
+	IPSET_ERR_HASH_RANGE_UNSUPPORTED,
+	/* Invalid range */
+	IPSET_ERR_HASH_RANGE,
+};
+
+
+#endif /* __IP_SET_HASH_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_list.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_list.h
new file mode 100644
index 0000000..75e6175
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/ipset/ip_set_list.h
@@ -0,0 +1,21 @@
+#ifndef __IP_SET_LIST_H
+#define __IP_SET_LIST_H
+
+/* List type specific error codes */
+enum {
+	/* Set name to be added/deleted/tested does not exist. */
+	IPSET_ERR_NAME = IPSET_ERR_TYPE_SPECIFIC,
+	/* list:set type is not permitted to add */
+	IPSET_ERR_LOOP,
+	/* Missing reference set */
+	IPSET_ERR_BEFORE,
+	/* Reference set does not exist */
+	IPSET_ERR_NAMEREF,
+	/* Set is full */
+	IPSET_ERR_LIST_FULL,
+	/* Reference set is not added to the set */
+	IPSET_ERR_REF_EXIST,
+};
+
+
+#endif /* __IP_SET_LIST_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_common.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_common.h
index 46a349c..38aa52d 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_common.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_common.h
@@ -1,12 +1,9 @@
-/** Copyright (c) 2013 Qualcomm Atheros, Inc. */
-
 #ifndef _NF_CONNTRACK_COMMON_H
 #define _NF_CONNTRACK_COMMON_H
 /* Connection state tracking for netfilter.  This is separated from,
    but required by, the NAT layer; it can also be used by an iptables
    extension. */
-enum ip_conntrack_info
-{
+enum ip_conntrack_info {
 	/* Part of an established connection (either direction). */
 	IP_CT_ESTABLISHED,
 
@@ -21,6 +18,9 @@
 	/* >= this indicates reply direction */
 	IP_CT_IS_REPLY,
 
+	IP_CT_ESTABLISHED_REPLY = IP_CT_ESTABLISHED + IP_CT_IS_REPLY,
+	IP_CT_RELATED_REPLY = IP_CT_RELATED + IP_CT_IS_REPLY,
+	IP_CT_NEW_REPLY = IP_CT_NEW + IP_CT_IS_REPLY,	
 	/* Number of distinct IP_CT types (no NEW in reply dirn). */
 	IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1
 };
@@ -76,46 +76,38 @@
 	IPS_FIXED_TIMEOUT_BIT = 10,
 	IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT),
 
-#ifdef CONFIG_ATHRS_HW_NAT
+	/* Conntrack is a template */
+	IPS_TEMPLATE_BIT = 11,
+	IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT),
 
-        /* Marked when a ct/nat help owns this pkt */
-        IPS_NAT_ALG_PKT_BIT = 11,
-        IPS_NAT_ALG_PKT = (1 << IPS_NAT_ALG_PKT_BIT),
-
-        /* Marked when the tuple is added to the h/w nat */
-        IPS_ATHR_HW_NAT_ADDED_BIT = 12,
-        IPS_ATHR_HW_NAT_ADDED = (1 << IPS_ATHR_HW_NAT_ADDED_BIT),
-
-        /* Marked when the tuple is added to the h/w nat for a UDP pkt*/
-        IPS_ATHR_HW_NAT_IS_UDP_BIT = 13,
-        IPS_ATHR_HW_NAT_IS_UDP = (1 << IPS_ATHR_HW_NAT_IS_UDP_BIT),
-
-        /* Marked when the tuple is added to the h/w nat for a UDP pkt*/
-        IPS_ATHR_HW_NAT_IS_ONLY_EGRESS_BIT = 14,
-        IPS_ATHR_HW_NAT_IS_ONLY_EGRESS = (1 << IPS_ATHR_HW_NAT_IS_ONLY_EGRESS_BIT),
-
-        /* Marked when the tuple is added to the h/w nat for a UDP pkt*/
-        IPS_ATHR_SW_NAT_SKIPPED_BIT = 15,
-        IPS_ATHR_SW_NAT_SKIPPED = (1 << IPS_ATHR_SW_NAT_SKIPPED_BIT),
-
-        /*
-         * Addded for nat frag table fast hash entry lookup
-         */
-
-	IPS_ATHR_HW_CT_INGRESS_BIT = 16,
-	IPS_ATHR_HW_CT_INGRESS = (1 << IPS_ATHR_HW_CT_INGRESS_BIT),
-
-	IPS_ATHR_HW_CT_EGRESS_BIT = 17,
-	IPS_ATHR_HW_CT_EGRESS = (1 << IPS_ATHR_HW_CT_EGRESS_BIT),
-
-	/*added for hw nat, mark ct when packet go through unsupported layer2 interface*/
-	IPS_ATHR_HW_SRC_NAT_L2NOSUPPORT_BIT = 18,
-	IPS_ATHR_HW_SRC_NAT_L2NOSUPPORT = (1 << IPS_ATHR_HW_SRC_NAT_L2NOSUPPORT_BIT),
-
-	IPS_ATHR_HW_DST_NAT_L2NOSUPPORT_BIT = 19,
-	IPS_ATHR_HW_DST_NAT_L2NOSUPPORT = (1 << IPS_ATHR_HW_DST_NAT_L2NOSUPPORT_BIT),
-#endif
+	/* Conntrack is a fake untracked entry */
+	IPS_UNTRACKED_BIT = 12,
+	IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
 };
 
+/* Connection tracking event types */
+enum ip_conntrack_events {
+	IPCT_NEW,		/* new conntrack */
+	IPCT_RELATED,		/* related conntrack */
+	IPCT_DESTROY,		/* destroyed conntrack */
+	IPCT_REPLY,		/* connection has seen two-way traffic */
+	IPCT_ASSURED,		/* connection status has changed to assured */
+	IPCT_PROTOINFO,		/* protocol information has changed */
+	IPCT_HELPER,		/* new helper has been set */
+	IPCT_MARK,		/* new mark has been set */
+	IPCT_NATSEQADJ,		/* NAT is doing sequence adjustment */
+	IPCT_SECMARK,		/* new security mark has been set */
+};
+
+enum ip_conntrack_expect_events {
+	IPEXP_NEW,		/* new expectation */
+	IPEXP_DESTROY,		/* destroyed expectation */
+};
+
+/* expectation flags */
+#define NF_CT_EXPECT_PERMANENT		0x1
+#define NF_CT_EXPECT_INACTIVE		0x2
+#define NF_CT_EXPECT_USERSPACE		0x4
+
 
 #endif /* _NF_CONNTRACK_COMMON_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_ftp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_ftp.h
index c0dbb4e..a222fac 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_ftp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_ftp.h
@@ -3,8 +3,7 @@
 /* FTP tracking. */
 
 /* This enum is exposed to userspace */
-enum nf_ct_ftp_type
-{
+enum nf_ct_ftp_type {
 	/* PORT command from client */
 	NF_CT_FTP_PORT,
 	/* PASV response from server */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_sctp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_sctp.h
index 768f78c..ceeefe6 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_sctp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_sctp.h
@@ -16,8 +16,7 @@
 	SCTP_CONNTRACK_MAX
 };
 
-struct ip_ct_sctp
-{
+struct ip_ct_sctp {
 	enum sctp_conntrack state;
 
 	__be32 vtag[IP_CT_DIR_MAX];
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_tuple_common.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
index 8e145f0..2f6bbc5 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_conntrack_tuple_common.h
@@ -1,13 +1,39 @@
 #ifndef _NF_CONNTRACK_TUPLE_COMMON_H
 #define _NF_CONNTRACK_TUPLE_COMMON_H
 
-enum ip_conntrack_dir
-{
+enum ip_conntrack_dir {
 	IP_CT_DIR_ORIGINAL,
 	IP_CT_DIR_REPLY,
 	IP_CT_DIR_MAX
 };
 
+/* The protocol-specific manipulable parts of the tuple: always in
+ * network order
+ */
+union nf_conntrack_man_proto {
+	/* Add other protocols here. */
+	__be16 all;
+
+	struct {
+		__be16 port;
+	} tcp;
+	struct {
+		__be16 port;
+	} udp;
+	struct {
+		__be16 id;
+	} icmp;
+	struct {
+		__be16 port;
+	} dccp;
+	struct {
+		__be16 port;
+	} sctp;
+	struct {
+		__be16 key;	/* GRE key is 32bit, PPtP only uses 16bit */
+	} gre;
+};
+
 #define CTINFO2DIR(ctinfo) ((ctinfo) >= IP_CT_IS_REPLY ? IP_CT_DIR_REPLY : IP_CT_DIR_ORIGINAL)
 
 #endif /* _NF_CONNTRACK_TUPLE_COMMON_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_nat.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_nat.h
new file mode 100644
index 0000000..8df2d13
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nf_nat.h
@@ -0,0 +1,25 @@
+#ifndef _NETFILTER_NF_NAT_H
+#define _NETFILTER_NF_NAT_H
+
+#include <linux/netfilter.h>
+#include <linux/netfilter/nf_conntrack_tuple_common.h>
+
+#define NF_NAT_RANGE_MAP_IPS		1
+#define NF_NAT_RANGE_PROTO_SPECIFIED	2
+#define NF_NAT_RANGE_PROTO_RANDOM	4
+#define NF_NAT_RANGE_PERSISTENT		8
+
+struct nf_nat_ipv4_range {
+	unsigned int			flags;
+	__be32				min_ip;
+	__be32				max_ip;
+	union nf_conntrack_man_proto	min;
+	union nf_conntrack_man_proto	max;
+};
+
+struct nf_nat_ipv4_multi_range_compat {
+	unsigned int			rangesize;
+	struct nf_nat_ipv4_range	range[1];
+};
+
+#endif /* _NETFILTER_NF_NAT_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink.h
index 610f1c6..73b2f0c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink.h
@@ -47,6 +47,8 @@
 #define NFNL_SUBSYS_QUEUE		3
 #define NFNL_SUBSYS_ULOG		4
 #define NFNL_SUBSYS_OSF			5
-#define NFNL_SUBSYS_COUNT		6
+#define NFNL_SUBSYS_IPSET		6
+#define NFNL_SUBSYS_ACCT		7
+#define NFNL_SUBSYS_COUNT		8
 
 #endif	/* _NFNETLINK_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_acct.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_acct.h
new file mode 100644
index 0000000..3995101
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_acct.h
@@ -0,0 +1,27 @@
+#ifndef _NFNL_ACCT_H_
+#define _NFNL_ACCT_H_
+
+#ifndef NFACCT_NAME_MAX
+#define NFACCT_NAME_MAX		32
+#endif
+
+enum nfnl_acct_msg_types {
+	NFNL_MSG_ACCT_NEW,
+	NFNL_MSG_ACCT_GET,
+	NFNL_MSG_ACCT_GET_CTRZERO,
+	NFNL_MSG_ACCT_DEL,
+	NFNL_MSG_ACCT_MAX
+};
+
+enum nfnl_acct_type {
+	NFACCT_UNSPEC,
+	NFACCT_NAME,
+	NFACCT_PKTS,
+	NFACCT_BYTES,
+	NFACCT_USE,
+	__NFACCT_MAX
+};
+#define NFACCT_MAX (__NFACCT_MAX - 1)
+
+
+#endif /* _NFNL_ACCT_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_compat.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_compat.h
index 343ecb7..74b9e55 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_compat.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_compat.h
@@ -20,8 +20,7 @@
  * ! nfnetlink use the same attributes methods. - J. Schulist.
  */
 
-struct nfattr
-{
+struct nfattr {
 	__u16 nfa_len;
 	__u16 nfa_type;	/* we use 15 bits for the type, and the highest
 				 * bit to indicate whether the payload is nested */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_conntrack.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_conntrack.h
index ed4ef8d..debf1ae 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_conntrack.h
@@ -39,7 +39,10 @@
 	CTA_TUPLE_MASTER,
 	CTA_NAT_SEQ_ADJ_ORIG,
 	CTA_NAT_SEQ_ADJ_REPLY,
-	CTA_SECMARK,
+	CTA_SECMARK,		/* obsolete */
+	CTA_ZONE,
+	CTA_SECCTX,
+	CTA_TIMESTAMP,
 	__CTA_MAX
 };
 #define CTA_MAX (__CTA_MAX - 1)
@@ -125,6 +128,14 @@
 };
 #define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1)
 
+enum ctattr_tstamp {
+	CTA_TIMESTAMP_UNSPEC,
+	CTA_TIMESTAMP_START,
+	CTA_TIMESTAMP_STOP,
+	__CTA_TIMESTAMP_MAX
+};
+#define CTA_TIMESTAMP_MAX (__CTA_TIMESTAMP_MAX - 1)
+
 enum ctattr_nat {
 	CTA_NAT_UNSPEC,
 	CTA_NAT_MINIP,
@@ -159,6 +170,8 @@
 	CTA_EXPECT_TIMEOUT,
 	CTA_EXPECT_ID,
 	CTA_EXPECT_HELP_NAME,
+	CTA_EXPECT_ZONE,
+	CTA_EXPECT_FLAGS,
 	__CTA_EXPECT_MAX
 };
 #define CTA_EXPECT_MAX (__CTA_EXPECT_MAX - 1)
@@ -170,4 +183,11 @@
 };
 #define CTA_HELP_MAX (__CTA_HELP_MAX - 1)
 
+enum ctattr_secctx {
+	CTA_SECCTX_UNSPEC,
+	CTA_SECCTX_NAME,
+	__CTA_SECCTX_MAX
+};
+#define CTA_SECCTX_MAX (__CTA_SECCTX_MAX - 1)
+
 #endif /* _IPCONNTRACK_NETLINK_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_log.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_log.h
index d3bab7a..90c2c95 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_log.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_log.h
@@ -28,8 +28,8 @@
 };
 
 struct nfulnl_msg_packet_timestamp {
-	aligned_be64	sec;
-	aligned_be64	usec;
+	__aligned_be64	sec;
+	__aligned_be64	usec;
 };
 
 enum nfulnl_attr_type {
@@ -89,6 +89,7 @@
 #define NFULNL_COPY_NONE	0x00
 #define NFULNL_COPY_META	0x01
 #define NFULNL_COPY_PACKET	0x02
+/* 0xff is reserved, don't use it for new copy modes. */
 
 #define NFULNL_CFG_F_SEQ	0x0001
 #define NFULNL_CFG_F_SEQ_GLOBAL	0x0002
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_queue.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_queue.h
index 2455fe5..24b32e6 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_queue.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/nfnetlink_queue.h
@@ -8,6 +8,7 @@
 	NFQNL_MSG_PACKET,		/* packet from kernel to userspace */
 	NFQNL_MSG_VERDICT,		/* verdict from userspace to kernel */
 	NFQNL_MSG_CONFIG,		/* connect to a particular queue */
+	NFQNL_MSG_VERDICT_BATCH,	/* batchv from userspace to kernel */
 
 	NFQNL_MSG_MAX
 };
@@ -25,8 +26,8 @@
 };
 
 struct nfqnl_msg_packet_timestamp {
-	aligned_be64	sec;
-	aligned_be64	usec;
+	__aligned_be64	sec;
+	__aligned_be64	usec;
 };
 
 enum nfqnl_attr_type {
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/x_tables.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/x_tables.h
index 2794d97..4120970 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/x_tables.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/x_tables.h
@@ -1,20 +1,19 @@
 #ifndef _X_TABLES_H
 #define _X_TABLES_H
-
+#include <linux/kernel.h>
 #include <linux/types.h>
 
 #define XT_FUNCTION_MAXNAMELEN 30
+#define XT_EXTENSION_MAXNAMELEN 29
 #define XT_TABLE_MAXNAMELEN 32
 
-struct xt_entry_match
-{
+struct xt_entry_match {
 	union {
 		struct {
 			__u16 match_size;
 
 			/* Used by userspace */
-			char name[XT_FUNCTION_MAXNAMELEN-1];
-
+			char name[XT_EXTENSION_MAXNAMELEN];
 			__u8 revision;
 		} user;
 		struct {
@@ -31,15 +30,13 @@
 	unsigned char data[0];
 };
 
-struct xt_entry_target
-{
+struct xt_entry_target {
 	union {
 		struct {
 			__u16 target_size;
 
 			/* Used by userspace */
-			char name[XT_FUNCTION_MAXNAMELEN-1];
-
+			char name[XT_EXTENSION_MAXNAMELEN];
 			__u8 revision;
 		} user;
 		struct {
@@ -64,18 +61,20 @@
 	},								       \
 }
 
-struct xt_standard_target
-{
+struct xt_standard_target {
 	struct xt_entry_target target;
 	int verdict;
 };
 
+struct xt_error_target {
+	struct xt_entry_target target;
+	char errorname[XT_FUNCTION_MAXNAMELEN];
+};
+
 /* The argument to IPT_SO_GET_REVISION_*.  Returns highest revision
  * kernel supports, if >= revision. */
-struct xt_get_revision
-{
-	char name[XT_FUNCTION_MAXNAMELEN-1];
-
+struct xt_get_revision {
+	char name[XT_EXTENSION_MAXNAMELEN];
 	__u8 revision;
 };
 
@@ -90,16 +89,14 @@
  * ip6t_entry and arpt_entry.  This sucks, and it is a hack.  It will be my
  * personal pleasure to remove it -HW
  */
-struct _xt_align
-{
+struct _xt_align {
 	__u8 u8;
 	__u16 u16;
 	__u32 u32;
 	__u64 u64;
 };
 
-#define XT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) 	\
-			& ~(__alignof__(struct _xt_align)-1))
+#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
 
 /* Standard return verdict, or do jump. */
 #define XT_STANDARD_TARGET ""
@@ -109,14 +106,12 @@
 #define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
 #define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
 
-struct xt_counters
-{
+struct xt_counters {
 	__u64 pcnt, bcnt;			/* Packet and byte counters */
 };
 
 /* The argument to IPT_SO_ADD_COUNTERS. */
-struct xt_counters_info
-{
+struct xt_counters_info {
 	/* Which table. */
 	char name[XT_TABLE_MAXNAMELEN];
 
@@ -172,4 +167,19 @@
 	XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args)
 
 
+/* pos is normally a struct ipt_entry/ip6t_entry/etc. */
+#define xt_entry_foreach(pos, ehead, esize) \
+	for ((pos) = (typeof(pos))(ehead); \
+	     (pos) < (typeof(pos))((char *)(ehead) + (esize)); \
+	     (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset))
+
+/* can only be xt_entry_match, so no use of typeof here */
+#define xt_ematch_foreach(pos, entry) \
+	for ((pos) = (struct xt_entry_match *)entry->elems; \
+	     (pos) < (struct xt_entry_match *)((char *)(entry) + \
+	             (entry)->target_offset); \
+	     (pos) = (struct xt_entry_match *)((char *)(pos) + \
+	             (pos)->u.match_size))
+
+
 #endif /* _X_TABLES_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_AUDIT.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_AUDIT.h
new file mode 100644
index 0000000..38751d2
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_AUDIT.h
@@ -0,0 +1,30 @@
+/*
+ * Header file for iptables xt_AUDIT target
+ *
+ * (C) 2010-2011 Thomas Graf <tgraf@redhat.com>
+ * (C) 2010-2011 Red Hat, 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 _XT_AUDIT_TARGET_H
+#define _XT_AUDIT_TARGET_H
+
+#include <linux/types.h>
+
+enum {
+	XT_AUDIT_TYPE_ACCEPT = 0,
+	XT_AUDIT_TYPE_DROP,
+	XT_AUDIT_TYPE_REJECT,
+	__XT_AUDIT_TYPE_MAX,
+};
+
+#define XT_AUDIT_TYPE_MAX (__XT_AUDIT_TYPE_MAX - 1)
+
+struct xt_audit_info {
+	__u8 type; /* XT_AUDIT_TYPE_* */
+};
+
+#endif /* _XT_AUDIT_TARGET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CHECKSUM.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CHECKSUM.h
new file mode 100644
index 0000000..9a2e466
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CHECKSUM.h
@@ -0,0 +1,20 @@
+/* Header file for iptables ipt_CHECKSUM target
+ *
+ * (C) 2002 by Harald Welte <laforge@gnumonks.org>
+ * (C) 2010 Red Hat Inc
+ * Author: Michael S. Tsirkin <mst@redhat.com>
+ *
+ * This software is distributed under GNU GPL v2, 1991
+*/
+#ifndef _XT_CHECKSUM_TARGET_H
+#define _XT_CHECKSUM_TARGET_H
+
+#include <linux/types.h>
+
+#define XT_CHECKSUM_OP_FILL	0x01	/* fill in checksum in IP header */
+
+struct xt_CHECKSUM_info {
+	__u8 operation;	/* bitset of operations */
+};
+
+#endif /* _XT_CHECKSUM_TARGET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CONNMARK.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CONNMARK.h
index 7635c8f..2f2e48e 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CONNMARK.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CONNMARK.h
@@ -1,32 +1,6 @@
 #ifndef _XT_CONNMARK_H_target
 #define _XT_CONNMARK_H_target
 
-#include <linux/types.h>
-
-/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
- * by Henrik Nordstrom <hno@marasystems.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.
- */
-
-enum {
-	XT_CONNMARK_SET = 0,
-	XT_CONNMARK_SAVE,
-	XT_CONNMARK_RESTORE
-};
-
-struct xt_connmark_target_info {
-	unsigned long mark;
-	unsigned long mask;
-	__u8 mode;
-};
-
-struct xt_connmark_tginfo1 {
-	__u32 ctmark, ctmask, nfmask;
-	__u8 mode;
-};
+#include <linux/netfilter/xt_connmark.h>
 
 #endif /*_XT_CONNMARK_H_target*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CT.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CT.h
new file mode 100644
index 0000000..b56e768
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_CT.h
@@ -0,0 +1,19 @@
+#ifndef _XT_CT_H
+#define _XT_CT_H
+
+#include <linux/types.h>
+
+#define XT_CT_NOTRACK	0x1
+
+struct xt_ct_target_info {
+	__u16 flags;
+	__u16 zone;
+	__u32 ct_events;
+	__u32 exp_events;
+	char helper[16];
+
+	/* Used internally by the kernel */
+	struct nf_conn	*ct __attribute__((aligned(8)));
+};
+
+#endif /* _XT_CT_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_IDLETIMER.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_IDLETIMER.h
new file mode 100644
index 0000000..208ae93
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_IDLETIMER.h
@@ -0,0 +1,45 @@
+/*
+ * linux/include/linux/netfilter/xt_IDLETIMER.h
+ *
+ * Header file for Xtables timer target module.
+ *
+ * Copyright (C) 2004, 2010 Nokia Corporation
+ * Written by Timo Teras <ext-timo.teras@nokia.com>
+ *
+ * Converted to x_tables and forward-ported to 2.6.34
+ * by Luciano Coelho <luciano.coelho@nokia.com>
+ *
+ * Contact: Luciano Coelho <luciano.coelho@nokia.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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef _XT_IDLETIMER_H
+#define _XT_IDLETIMER_H
+
+#include <linux/types.h>
+
+#define MAX_IDLETIMER_LABEL_SIZE 28
+
+struct idletimer_tg_info {
+	__u32 timeout;
+
+	char label[MAX_IDLETIMER_LABEL_SIZE];
+
+	/* for kernel module internal use only */
+	struct idletimer_tg *timer __attribute__((aligned(8)));
+};
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_MARK.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_MARK.h
index 028304b..41c456d 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_MARK.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_MARK.h
@@ -1,27 +1,6 @@
 #ifndef _XT_MARK_H_target
 #define _XT_MARK_H_target
 
-#include <linux/types.h>
-
-/* Version 0 */
-struct xt_mark_target_info {
-	unsigned long mark;
-};
-
-/* Version 1 */
-enum {
-	XT_MARK_SET=0,
-	XT_MARK_AND,
-	XT_MARK_OR,
-};
-
-struct xt_mark_target_info_v1 {
-	unsigned long mark;
-	__u8 mode;
-};
-
-struct xt_mark_tginfo2 {
-	__u32 mark, mask;
-};
+#include <linux/netfilter/xt_mark.h>
 
 #endif /*_XT_MARK_H_target */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_NFQUEUE.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_NFQUEUE.h
index 2584f4a..9eafdbb 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_NFQUEUE.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_NFQUEUE.h
@@ -20,4 +20,10 @@
 	__u16 queues_total;
 };
 
+struct xt_NFQ_info_v2 {
+	__u16 queuenum;
+	__u16 queues_total;
+	__u16 bypass;
+};
+
 #endif /* _XT_NFQ_TARGET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_SECMARK.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_SECMARK.h
index 6fcd344..989092b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_SECMARK.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_SECMARK.h
@@ -11,18 +11,12 @@
  * packets are being marked for.
  */
 #define SECMARK_MODE_SEL	0x01		/* SELinux */
-#define SECMARK_SELCTX_MAX	256
-
-struct xt_secmark_target_selinux_info {
-	__u32 selsid;
-	char selctx[SECMARK_SELCTX_MAX];
-};
+#define SECMARK_SECCTX_MAX	256
 
 struct xt_secmark_target_info {
 	__u8 mode;
-	union {
-		struct xt_secmark_target_selinux_info sel;
-	} u;
+	__u32 secid;
+	char secctx[SECMARK_SECCTX_MAX];
 };
 
 #endif /*_XT_SECMARK_H_target */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TCPOPTSTRIP.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TCPOPTSTRIP.h
index 2db5432..7157318 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TCPOPTSTRIP.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TCPOPTSTRIP.h
@@ -1,13 +1,15 @@
 #ifndef _XT_TCPOPTSTRIP_H
 #define _XT_TCPOPTSTRIP_H
 
+#include <linux/types.h>
+
 #define tcpoptstrip_set_bit(bmap, idx) \
 	(bmap[(idx) >> 5] |= 1U << (idx & 31))
 #define tcpoptstrip_test_bit(bmap, idx) \
 	(((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0)
 
 struct xt_tcpoptstrip_target_info {
-	u_int32_t strip_bmap[8];
+	__u32 strip_bmap[8];
 };
 
 #endif /* _XT_TCPOPTSTRIP_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TEE.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TEE.h
new file mode 100644
index 0000000..5c21d5c
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TEE.h
@@ -0,0 +1,12 @@
+#ifndef _XT_TEE_TARGET_H
+#define _XT_TEE_TARGET_H
+
+struct xt_tee_tginfo {
+	union nf_inet_addr gw;
+	char oif[16];
+
+	/* used internally by the kernel */
+	struct xt_tee_priv *priv __attribute__((aligned(8)));
+};
+
+#endif /* _XT_TEE_TARGET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TPROXY.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TPROXY.h
index 152e8f9..902043c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TPROXY.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_TPROXY.h
@@ -1,14 +1,23 @@
-#ifndef _XT_TPROXY_H_target
-#define _XT_TPROXY_H_target
+#ifndef _XT_TPROXY_H
+#define _XT_TPROXY_H
+
+#include <linux/types.h>
 
 /* TPROXY target is capable of marking the packet to perform
  * redirection. We can get rid of that whenever we get support for
  * mutliple targets in the same rule. */
 struct xt_tproxy_target_info {
-	u_int32_t mark_mask;
-	u_int32_t mark_value;
+	__u32 mark_mask;
+	__u32 mark_value;
 	__be32 laddr;
 	__be16 lport;
 };
 
-#endif /* _XT_TPROXY_H_target */
+struct xt_tproxy_target_info_v1 {
+	__u32 mark_mask;
+	__u32 mark_value;
+	union nf_inet_addr laddr;
+	__be16 lport;
+};
+
+#endif /* _XT_TPROXY_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_addrtype.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_addrtype.h
new file mode 100644
index 0000000..b156baa
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_addrtype.h
@@ -0,0 +1,44 @@
+#ifndef _XT_ADDRTYPE_H
+#define _XT_ADDRTYPE_H
+
+#include <linux/types.h>
+
+enum {
+	XT_ADDRTYPE_INVERT_SOURCE	= 0x0001,
+	XT_ADDRTYPE_INVERT_DEST		= 0x0002,
+	XT_ADDRTYPE_LIMIT_IFACE_IN	= 0x0004,
+	XT_ADDRTYPE_LIMIT_IFACE_OUT	= 0x0008,
+};
+
+
+/* rtn_type enum values from rtnetlink.h, but shifted */
+enum {
+	XT_ADDRTYPE_UNSPEC = 1 << 0,
+	XT_ADDRTYPE_UNICAST = 1 << 1,	/* 1 << RTN_UNICAST */
+	XT_ADDRTYPE_LOCAL  = 1 << 2,	/* 1 << RTN_LOCAL, etc */
+	XT_ADDRTYPE_BROADCAST = 1 << 3,
+	XT_ADDRTYPE_ANYCAST = 1 << 4,
+	XT_ADDRTYPE_MULTICAST = 1 << 5,
+	XT_ADDRTYPE_BLACKHOLE = 1 << 6,
+	XT_ADDRTYPE_UNREACHABLE = 1 << 7,
+	XT_ADDRTYPE_PROHIBIT = 1 << 8,
+	XT_ADDRTYPE_THROW = 1 << 9,
+	XT_ADDRTYPE_NAT = 1 << 10,
+	XT_ADDRTYPE_XRESOLVE = 1 << 11,
+};
+
+struct xt_addrtype_info_v1 {
+	__u16	source;		/* source-type mask */
+	__u16	dest;		/* dest-type mask */
+	__u32	flags;
+};
+
+/* revision 0 */
+struct xt_addrtype_info {
+	__u16	source;		/* source-type mask */
+	__u16	dest;		/* dest-type mask */
+	__u32	invert_source;
+	__u32	invert_dest;
+};
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_cluster.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_cluster.h
index 8866826..9b883c8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_cluster.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_cluster.h
@@ -1,15 +1,17 @@
 #ifndef _XT_CLUSTER_MATCH_H
 #define _XT_CLUSTER_MATCH_H
 
+#include <linux/types.h>
+
 enum xt_cluster_flags {
 	XT_CLUSTER_F_INV	= (1 << 0)
 };
 
 struct xt_cluster_match_info {
-	u_int32_t		total_nodes;
-	u_int32_t		node_mask;
-	u_int32_t		hash_seed;
-	u_int32_t		flags;
+	__u32 total_nodes;
+	__u32 node_mask;
+	__u32 hash_seed;
+	__u32 flags;
 };
 
 #define XT_CLUSTER_NODES_MAX	32
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_comment.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_comment.h
index eacfedc..0ea5e79 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_comment.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_comment.h
@@ -4,7 +4,7 @@
 #define XT_MAX_COMMENT_LEN 256
 
 struct xt_comment_info {
-	unsigned char comment[XT_MAX_COMMENT_LEN];
+	char comment[XT_MAX_COMMENT_LEN];
 };
 
 #endif /* XT_COMMENT_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connbytes.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connbytes.h
index 52bd615..f1d6c15 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connbytes.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connbytes.h
@@ -15,11 +15,10 @@
 	XT_CONNBYTES_DIR_BOTH,
 };
 
-struct xt_connbytes_info
-{
+struct xt_connbytes_info {
 	struct {
-		aligned_u64 from;	/* count to be matched */
-		aligned_u64 to;		/* count to be matched */
+		__aligned_u64 from;	/* count to be matched */
+		__aligned_u64 to;	/* count to be matched */
 	} count;
 	__u8 what;		/* ipt_connbytes_what */
 	__u8 direction;	/* ipt_connbytes_direction */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connlimit.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connlimit.h
index 9ba54e4..c0c1824 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connlimit.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connlimit.h
@@ -1,8 +1,16 @@
 #ifndef _XT_CONNLIMIT_H
 #define _XT_CONNLIMIT_H
 
+#include <linux/types.h>
+#include <linux/netfilter.h>
+
 struct xt_connlimit_data;
 
+enum {
+	XT_CONNLIMIT_INVERT = 1 << 0,
+	XT_CONNLIMIT_DADDR  = 1 << 1,
+};
+
 struct xt_connlimit_info {
 	union {
 		union nf_inet_addr mask;
@@ -11,7 +19,14 @@
 			__be32 v6_mask[4];
 		};
 	};
-	unsigned int limit, inverse;
+	unsigned int limit;
+	union {
+		/* revision 0 */
+		unsigned int inverse;
+
+		/* revision 1 */
+		__u32 flags;
+	};
 
 	/* Used internally by the kernel */
 	struct xt_connlimit_data *data __attribute__((aligned(8)));
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connmark.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connmark.h
index 571e266..efc17a8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connmark.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_connmark.h
@@ -12,9 +12,15 @@
  * (at your option) any later version.
  */
 
-struct xt_connmark_info {
-	unsigned long mark, mask;
-	__u8 invert;
+enum {
+	XT_CONNMARK_SET = 0,
+	XT_CONNMARK_SAVE,
+	XT_CONNMARK_RESTORE
+};
+
+struct xt_connmark_tginfo1 {
+	__u32 ctmark, ctmask, nfmask;
+	__u8 mode;
 };
 
 struct xt_connmark_mtinfo1 {
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_conntrack.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_conntrack.h
index 7ae0533..e3c041d 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_conntrack.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_conntrack.h
@@ -6,6 +6,7 @@
 #define _XT_CONNTRACK_H
 
 #include <linux/types.h>
+#include <linux/netfilter.h>
 #include <linux/netfilter/nf_conntrack_tuple_common.h>
 
 #define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
@@ -32,42 +33,6 @@
 	XT_CONNTRACK_DIRECTION    = 1 << 12,
 };
 
-/* This is exposed to userspace, so remains frozen in time. */
-struct ip_conntrack_old_tuple
-{
-	struct {
-		__be32 ip;
-		union {
-			__u16 all;
-		} u;
-	} src;
-
-	struct {
-		__be32 ip;
-		union {
-			__u16 all;
-		} u;
-
-		/* The protocol. */
-		__u16 protonum;
-	} dst;
-};
-
-struct xt_conntrack_info
-{
-	unsigned int statemask, statusmask;
-
-	struct ip_conntrack_old_tuple tuple[IP_CT_DIR_MAX];
-	struct in_addr sipmsk[IP_CT_DIR_MAX], dipmsk[IP_CT_DIR_MAX];
-
-	unsigned long expires_min, expires_max;
-
-	/* Flags word */
-	__u8 flags;
-	/* Inverse flags */
-	__u8 invflags;
-};
-
 struct xt_conntrack_mtinfo1 {
 	union nf_inet_addr origsrc_addr, origsrc_mask;
 	union nf_inet_addr origdst_addr, origdst_mask;
@@ -94,4 +59,19 @@
 	__u16 state_mask, status_mask;
 };
 
+struct xt_conntrack_mtinfo3 {
+	union nf_inet_addr origsrc_addr, origsrc_mask;
+	union nf_inet_addr origdst_addr, origdst_mask;
+	union nf_inet_addr replsrc_addr, replsrc_mask;
+	union nf_inet_addr repldst_addr, repldst_mask;
+	__u32 expires_min, expires_max;
+	__u16 l4proto;
+	__u16 origsrc_port, origdst_port;
+	__u16 replsrc_port, repldst_port;
+	__u16 match_flags, invert_flags;
+	__u16 state_mask, status_mask;
+	__u16 origsrc_port_high, origdst_port_high;
+	__u16 replsrc_port_high, repldst_port_high;
+};
+
 #endif /*_XT_CONNTRACK_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_cpu.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_cpu.h
new file mode 100644
index 0000000..93c7f11
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_cpu.h
@@ -0,0 +1,11 @@
+#ifndef _XT_CPU_H
+#define _XT_CPU_H
+
+#include <linux/types.h>
+
+struct xt_cpu_info {
+	__u32	cpu;
+	__u32	invert;
+};
+
+#endif /*_XT_CPU_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_devgroup.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_devgroup.h
new file mode 100644
index 0000000..1babde0
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_devgroup.h
@@ -0,0 +1,21 @@
+#ifndef _XT_DEVGROUP_H
+#define _XT_DEVGROUP_H
+
+#include <linux/types.h>
+
+enum xt_devgroup_flags {
+	XT_DEVGROUP_MATCH_SRC	= 0x1,
+	XT_DEVGROUP_INVERT_SRC	= 0x2,
+	XT_DEVGROUP_MATCH_DST	= 0x4,
+	XT_DEVGROUP_INVERT_DST	= 0x8,
+};
+
+struct xt_devgroup_info {
+	__u32	flags;
+	__u32	src_group;
+	__u32	src_mask;
+	__u32	dst_group;
+	__u32	dst_mask;
+};
+
+#endif /* _XT_DEVGROUP_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_ecn.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_ecn.h
new file mode 100644
index 0000000..7158fca
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_ecn.h
@@ -0,0 +1,35 @@
+/* iptables module for matching the ECN header in IPv4 and TCP header
+ *
+ * (C) 2002 Harald Welte <laforge@gnumonks.org>
+ *
+ * This software is distributed under GNU GPL v2, 1991
+ * 
+ * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
+*/
+#ifndef _XT_ECN_H
+#define _XT_ECN_H
+
+#include <linux/types.h>
+#include <linux/netfilter/xt_dscp.h>
+
+#define XT_ECN_IP_MASK	(~XT_DSCP_MASK)
+
+#define XT_ECN_OP_MATCH_IP	0x01
+#define XT_ECN_OP_MATCH_ECE	0x10
+#define XT_ECN_OP_MATCH_CWR	0x20
+
+#define XT_ECN_OP_MATCH_MASK	0xce
+
+/* match info */
+struct xt_ecn_info {
+	__u8 operation;
+	__u8 invert;
+	__u8 ip_ect;
+	union {
+		struct {
+			__u8 ect;
+		} tcp;
+	} proto;
+};
+
+#endif /* _XT_ECN_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_esp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_esp.h
index ef6fa47..ee68824 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_esp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_esp.h
@@ -3,8 +3,7 @@
 
 #include <linux/types.h>
 
-struct xt_esp
-{
+struct xt_esp {
 	__u32 spis[2];	/* Security Parameter Index */
 	__u8  invflags;	/* Inverse flags */
 };
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_iprange.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_iprange.h
index c1f21a7..25fd7cf 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_iprange.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_iprange.h
@@ -2,6 +2,7 @@
 #define _LINUX_NETFILTER_XT_IPRANGE_H 1
 
 #include <linux/types.h>
+#include <linux/netfilter.h>
 
 enum {
 	IPRANGE_SRC     = 1 << 0,	/* match source IP address */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_ipvs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_ipvs.h
new file mode 100644
index 0000000..eff34ac
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_ipvs.h
@@ -0,0 +1,29 @@
+#ifndef _XT_IPVS_H
+#define _XT_IPVS_H
+
+#include <linux/types.h>
+
+enum {
+	XT_IPVS_IPVS_PROPERTY =	1 << 0, /* all other options imply this one */
+	XT_IPVS_PROTO =		1 << 1,
+	XT_IPVS_VADDR =		1 << 2,
+	XT_IPVS_VPORT =		1 << 3,
+	XT_IPVS_DIR =		1 << 4,
+	XT_IPVS_METHOD =	1 << 5,
+	XT_IPVS_VPORTCTL =	1 << 6,
+	XT_IPVS_MASK =		(1 << 7) - 1,
+	XT_IPVS_ONCE_MASK =	XT_IPVS_MASK & ~XT_IPVS_IPVS_PROPERTY
+};
+
+struct xt_ipvs_mtinfo {
+	union nf_inet_addr	vaddr, vmask;
+	__be16			vport;
+	__u8			l4proto;
+	__u8			fwd_method;
+	__be16			vportctl;
+
+	__u8			invert;
+	__u8			bitmask;
+};
+
+#endif /* _XT_IPVS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_layer7.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_layer7.h
new file mode 100644
index 0000000..c38d3c4
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_layer7.h
@@ -0,0 +1,14 @@
+#ifndef _XT_LAYER7_H
+#define _XT_LAYER7_H
+
+#define MAX_PATTERN_LEN 8192
+#define MAX_PROTOCOL_LEN 256
+
+struct xt_layer7_info {
+    char protocol[MAX_PROTOCOL_LEN];
+    char pattern[MAX_PATTERN_LEN];
+    u_int8_t invert;
+    u_int8_t pkt;
+};
+
+#endif /* _XT_LAYER7_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_mark.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_mark.h
index 6fa460a..ecadc40 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_mark.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_mark.h
@@ -3,9 +3,8 @@
 
 #include <linux/types.h>
 
-struct xt_mark_info {
-    unsigned long mark, mask;
-    __u8 invert;
+struct xt_mark_tginfo2 {
+	__u32 mark, mask;
 };
 
 struct xt_mark_mtinfo1 {
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_multiport.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_multiport.h
index 185db49..5b7e72d 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_multiport.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_multiport.h
@@ -3,8 +3,7 @@
 
 #include <linux/types.h>
 
-enum xt_multiport_flags
-{
+enum xt_multiport_flags {
 	XT_MULTIPORT_SOURCE,
 	XT_MULTIPORT_DESTINATION,
 	XT_MULTIPORT_EITHER
@@ -13,15 +12,13 @@
 #define XT_MULTI_PORTS	15
 
 /* Must fit inside union xt_matchinfo: 16 bytes */
-struct xt_multiport
-{
+struct xt_multiport {
 	__u8 flags;				/* Type of comparison */
 	__u8 count;				/* Number of ports */
 	__u16 ports[XT_MULTI_PORTS];	/* Ports */
 };
 
-struct xt_multiport_v1
-{
+struct xt_multiport_v1 {
 	__u8 flags;				/* Type of comparison */
 	__u8 count;				/* Number of ports */
 	__u16 ports[XT_MULTI_PORTS];	/* Ports */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_nfacct.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_nfacct.h
new file mode 100644
index 0000000..3e19c8a
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_nfacct.h
@@ -0,0 +1,13 @@
+#ifndef _XT_NFACCT_MATCH_H
+#define _XT_NFACCT_MATCH_H
+
+#include <linux/netfilter/nfnetlink_acct.h>
+
+struct nf_acct;
+
+struct xt_nfacct_match_info {
+	char		name[NFACCT_NAME_MAX];
+	struct nf_acct	*nfacct;
+};
+
+#endif /* _XT_NFACCT_MATCH_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_policy.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_policy.h
index f8a2690..d246eac 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_policy.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_policy.h
@@ -5,22 +5,19 @@
 
 #define XT_POLICY_MAX_ELEM	4
 
-enum xt_policy_flags
-{
+enum xt_policy_flags {
 	XT_POLICY_MATCH_IN	= 0x1,
 	XT_POLICY_MATCH_OUT	= 0x2,
 	XT_POLICY_MATCH_NONE	= 0x4,
 	XT_POLICY_MATCH_STRICT	= 0x8,
 };
 
-enum xt_policy_modes
-{
+enum xt_policy_modes {
 	XT_POLICY_MODE_TRANSPORT,
 	XT_POLICY_MODE_TUNNEL
 };
 
-struct xt_policy_spec
-{
+struct xt_policy_spec {
 	__u8	saddr:1,
 			daddr:1,
 			proto:1,
@@ -29,14 +26,12 @@
 			reqid:1;
 };
 
-union xt_policy_addr
-{
+union xt_policy_addr {
 	struct in_addr	a4;
 	struct in6_addr	a6;
 };
 
-struct xt_policy_elem
-{
+struct xt_policy_elem {
 	union {
 		struct {
 			union xt_policy_addr saddr;
@@ -54,8 +49,7 @@
 	struct xt_policy_spec	invert;
 };
 
-struct xt_policy_info
-{
+struct xt_policy_info {
 	struct xt_policy_elem pol[XT_POLICY_MAX_ELEM];
 	__u16 flags;
 	__u16 len;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_quota.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_quota.h
index 8dc89df..9314723 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_quota.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_quota.h
@@ -1,6 +1,8 @@
 #ifndef _XT_QUOTA_H
 #define _XT_QUOTA_H
 
+#include <linux/types.h>
+
 enum xt_quota_flags {
 	XT_QUOTA_INVERT		= 0x1,
 };
@@ -9,11 +11,11 @@
 struct xt_quota_priv;
 
 struct xt_quota_info {
-	u_int32_t		flags;
-	u_int32_t		pad;
+	__u32 flags;
+	__u32 pad;
+	__aligned_u64 quota;
 
 	/* Used internally by the kernel */
-	aligned_u64		quota;
 	struct xt_quota_priv	*master;
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_recent.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_recent.h
index d2c2766..83318e0 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_recent.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_recent.h
@@ -9,6 +9,7 @@
 	XT_RECENT_UPDATE   = 1 << 2,
 	XT_RECENT_REMOVE   = 1 << 3,
 	XT_RECENT_TTL      = 1 << 4,
+	XT_RECENT_REAP     = 1 << 5,
 
 	XT_RECENT_SOURCE   = 0,
 	XT_RECENT_DEST     = 1,
@@ -16,6 +17,12 @@
 	XT_RECENT_NAME_LEN = 200,
 };
 
+/* Only allowed with --rcheck and --update */
+#define XT_RECENT_MODIFIERS (XT_RECENT_TTL|XT_RECENT_REAP)
+
+#define XT_RECENT_VALID_FLAGS (XT_RECENT_CHECK|XT_RECENT_SET|XT_RECENT_UPDATE|\
+			       XT_RECENT_REMOVE|XT_RECENT_TTL|XT_RECENT_REAP)
+
 struct xt_recent_mtinfo {
 	__u32 seconds;
 	__u32 hit_count;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_set.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_set.h
new file mode 100644
index 0000000..c0405ac
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_set.h
@@ -0,0 +1,65 @@
+#ifndef _XT_SET_H
+#define _XT_SET_H
+
+#include <linux/types.h>
+#include <linux/netfilter/ipset/ip_set.h>
+
+/* Revision 0 interface: backward compatible with netfilter/iptables */
+
+/*
+ * Option flags for kernel operations (xt_set_info_v0)
+ */
+#define IPSET_SRC		0x01	/* Source match/add */
+#define IPSET_DST		0x02	/* Destination match/add */
+#define IPSET_MATCH_INV		0x04	/* Inverse matching */
+
+struct xt_set_info_v0 {
+	ip_set_id_t index;
+	union {
+		__u32 flags[IPSET_DIM_MAX + 1];
+		struct {
+			__u32 __flags[IPSET_DIM_MAX];
+			__u8 dim;
+			__u8 flags;
+		} compat;
+	} u;
+};
+
+/* match and target infos */
+struct xt_set_info_match_v0 {
+	struct xt_set_info_v0 match_set;
+};
+
+struct xt_set_info_target_v0 {
+	struct xt_set_info_v0 add_set;
+	struct xt_set_info_v0 del_set;
+};
+
+/* Revision 1  match and target */
+
+struct xt_set_info {
+	ip_set_id_t index;
+	__u8 dim;
+	__u8 flags;
+};
+
+/* match and target infos */
+struct xt_set_info_match_v1 {
+	struct xt_set_info match_set;
+};
+
+struct xt_set_info_target_v1 {
+	struct xt_set_info add_set;
+	struct xt_set_info del_set;
+};
+
+/* Revision 2 target */
+
+struct xt_set_info_target_v2 {
+	struct xt_set_info add_set;
+	struct xt_set_info del_set;
+	u32 flags;
+	u32 timeout;
+};
+
+#endif /*_XT_SET_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_socket.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_socket.h
new file mode 100644
index 0000000..26d7217
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_socket.h
@@ -0,0 +1,14 @@
+#ifndef _XT_SOCKET_H
+#define _XT_SOCKET_H
+
+#include <linux/types.h>
+
+enum {
+	XT_SOCKET_TRANSPARENT = 1 << 0,
+};
+
+struct xt_socket_mtinfo1 {
+	__u8 flags;
+};
+
+#endif /* _XT_SOCKET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_state.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_state.h
index c06f32e..7b32de8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_state.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_state.h
@@ -6,8 +6,7 @@
 
 #define XT_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 1))
 
-struct xt_state_info
-{
+struct xt_state_info {
 	unsigned int statemask;
 };
 #endif /*_XT_STATE_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_string.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_string.h
index ecbb95f..235347c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_string.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_string.h
@@ -11,8 +11,7 @@
 	XT_STRING_FLAG_IGNORECASE	= 0x02
 };
 
-struct xt_string_info
-{
+struct xt_string_info {
 	__u16 from_offset;
 	__u16 to_offset;
 	char	  algo[XT_STRING_MAX_ALGO_NAME_SIZE];
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_tcpudp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_tcpudp.h
index a490a0b..38aa7b3 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_tcpudp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_tcpudp.h
@@ -4,8 +4,7 @@
 #include <linux/types.h>
 
 /* TCP matching stuff */
-struct xt_tcp
-{
+struct xt_tcp {
 	__u16 spts[2];			/* Source port range. */
 	__u16 dpts[2];			/* Destination port range. */
 	__u8 option;			/* TCP Option iff non-zero*/
@@ -22,8 +21,7 @@
 #define XT_TCP_INV_MASK		0x0F	/* All possible flags. */
 
 /* UDP matching stuff */
-struct xt_udp
-{
+struct xt_udp {
 	__u16 spts[2];			/* Source port range. */
 	__u16 dpts[2];			/* Destination port range. */
 	__u8 invflags;			/* Inverse flags */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_time.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_time.h
index 14b6df4..7c37fac 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_time.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_time.h
@@ -1,14 +1,16 @@
 #ifndef _XT_TIME_H
 #define _XT_TIME_H 1
 
+#include <linux/types.h>
+
 struct xt_time_info {
-	u_int32_t date_start;
-	u_int32_t date_stop;
-	u_int32_t daytime_start;
-	u_int32_t daytime_stop;
-	u_int32_t monthdays_match;
-	u_int8_t weekdays_match;
-	u_int8_t flags;
+	__u32 date_start;
+	__u32 date_stop;
+	__u32 daytime_start;
+	__u32 daytime_stop;
+	__u32 monthdays_match;
+	__u8 weekdays_match;
+	__u8 flags;
 };
 
 enum {
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_u32.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_u32.h
index 9947f56..04d1bfe 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_u32.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter/xt_u32.h
@@ -1,6 +1,8 @@
 #ifndef _XT_U32_H
 #define _XT_U32_H 1
 
+#include <linux/types.h>
+
 enum xt_u32_ops {
 	XT_U32_AND,
 	XT_U32_LEFTSH,
@@ -9,13 +11,13 @@
 };
 
 struct xt_u32_location_element {
-	u_int32_t number;
-	u_int8_t nextop;
+	__u32 number;
+	__u8 nextop;
 };
 
 struct xt_u32_value_element {
-	u_int32_t min;
-	u_int32_t max;
+	__u32 min;
+	__u32 max;
 };
 
 /*
@@ -27,14 +29,14 @@
 struct xt_u32_test {
 	struct xt_u32_location_element location[XT_U32_MAXSIZE+1];
 	struct xt_u32_value_element value[XT_U32_MAXSIZE+1];
-	u_int8_t nnums;
-	u_int8_t nvalues;
+	__u8 nnums;
+	__u8 nvalues;
 };
 
 struct xt_u32 {
 	struct xt_u32_test tests[XT_U32_MAXSIZE+1];
-	u_int8_t ntests;
-	u_int8_t invert;
+	__u8 ntests;
+	__u8 invert;
 };
 
 #endif /* _XT_U32_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_arp/arp_tables.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_arp/arp_tables.h
index 16ae7c3..bb1ec64 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_arp/arp_tables.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_arp/arp_tables.h
@@ -17,6 +17,17 @@
 
 #define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
 #define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
+#define arpt_entry_target xt_entry_target
+#define arpt_standard_target xt_standard_target
+#define arpt_error_target xt_error_target
+#define ARPT_CONTINUE XT_CONTINUE
+#define ARPT_RETURN XT_RETURN
+#define arpt_counters_info xt_counters_info
+#define arpt_counters xt_counters
+#define ARPT_STANDARD_TARGET XT_STANDARD_TARGET
+#define ARPT_ERROR_TARGET XT_ERROR_TARGET
+#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
+	XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args)
 
 #define ARPT_DEV_ADDR_LEN_MAX 16
 
@@ -33,7 +44,7 @@
 	struct in_addr smsk, tmsk;
 
 	/* Device hw address length, src+target device addresses */
-	u_int8_t arhln, arhln_mask;
+	__u8 arhln, arhln_mask;
 	struct arpt_devaddr_info src_devaddr;
 	struct arpt_devaddr_info tgt_devaddr;
 
@@ -52,14 +63,11 @@
 	unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
 
 	/* Flags word */
-	u_int8_t flags;
+	__u8 flags;
 	/* Inverse flags */
-	u_int16_t invflags;
+	__u16 invflags;
 };
 
-#define arpt_entry_target xt_entry_target
-#define arpt_standard_target xt_standard_target
-
 /* Values for "flag" field in struct arpt_ip (general arp structure).
  * No flags defined yet.
  */
@@ -86,9 +94,9 @@
 	struct arpt_arp arp;
 
 	/* Size of arpt_entry + matches */
-	u_int16_t target_offset;
+	__u16 target_offset;
 	/* Size of arpt_entry + matches + target */
-	u_int16_t next_offset;
+	__u16 next_offset;
 
 	/* Back pointer */
 	unsigned int comefrom;
@@ -119,17 +127,10 @@
 #define ARPT_SO_GET_REVISION_TARGET	(ARPT_BASE_CTL + 3)
 #define ARPT_SO_GET_MAX			(ARPT_SO_GET_REVISION_TARGET)
 
-/* CONTINUE verdict for targets */
-#define ARPT_CONTINUE XT_CONTINUE
-
-/* For standard target */
-#define ARPT_RETURN XT_RETURN
-
 /* The argument to ARPT_SO_GET_INFO */
-struct arpt_getinfo
-{
+struct arpt_getinfo {
 	/* Which table: caller fills this in. */
-	char name[ARPT_TABLE_MAXNAMELEN];
+	char name[XT_TABLE_MAXNAMELEN];
 
 	/* Kernel fills these in. */
 	/* Which hook entry points are valid: bitmask */
@@ -149,10 +150,9 @@
 };
 
 /* The argument to ARPT_SO_SET_REPLACE. */
-struct arpt_replace
-{
+struct arpt_replace {
 	/* Which table. */
-	char name[ARPT_TABLE_MAXNAMELEN];
+	char name[XT_TABLE_MAXNAMELEN];
 
 	/* Which hook entry points are valid: bitmask.  You can't
            change this. */
@@ -180,15 +180,10 @@
 	struct arpt_entry entries[0];
 };
 
-/* The argument to ARPT_SO_ADD_COUNTERS. */
-#define arpt_counters_info xt_counters_info
-#define arpt_counters xt_counters
-
 /* The argument to ARPT_SO_GET_ENTRIES. */
-struct arpt_get_entries
-{
+struct arpt_get_entries {
 	/* Which table: user fills this in. */
-	char name[ARPT_TABLE_MAXNAMELEN];
+	char name[XT_TABLE_MAXNAMELEN];
 
 	/* User fills this in: total entry size. */
 	unsigned int size;
@@ -197,21 +192,12 @@
 	struct arpt_entry entrytable[0];
 };
 
-/* Standard return verdict, or do jump. */
-#define ARPT_STANDARD_TARGET XT_STANDARD_TARGET
-/* Error verdict. */
-#define ARPT_ERROR_TARGET XT_ERROR_TARGET
-
 /* Helper functions */
-static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e)
+static __inline__ struct xt_entry_target *arpt_get_target(struct arpt_entry *e)
 {
 	return (void *)e + e->target_offset;
 }
 
-/* fn returns 0 to continue iteration */
-#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
-	XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args)
-
 /*
  *	Main firewall chains definitions and global var's definitions.
  */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_802_3.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_802_3.h
index b61e308..76687d5 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_802_3.h
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_802_3_H
 #define __LINUX_BRIDGE_EBT_802_3_H
 
+#include <linux/types.h>
+
 #define EBT_802_3_SAP 0x01
 #define EBT_802_3_TYPE 0x02
 
@@ -24,24 +26,24 @@
 
 /* ui has one byte ctrl, ni has two */
 struct hdr_ui {
-	uint8_t dsap;
-	uint8_t ssap;
-	uint8_t ctrl;
-	uint8_t orig[3];
+	__u8 dsap;
+	__u8 ssap;
+	__u8 ctrl;
+	__u8 orig[3];
 	__be16 type;
 };
 
 struct hdr_ni {
-	uint8_t dsap;
-	uint8_t ssap;
+	__u8 dsap;
+	__u8 ssap;
 	__be16 ctrl;
-	uint8_t  orig[3];
+	__u8  orig[3];
 	__be16 type;
 };
 
 struct ebt_802_3_hdr {
-	uint8_t  daddr[6];
-	uint8_t  saddr[6];
+	__u8  daddr[6];
+	__u8  saddr[6];
 	__be16 len;
 	union {
 		struct hdr_ui ui;
@@ -50,12 +52,11 @@
 };
 
 
-struct ebt_802_3_info 
-{
-	uint8_t  sap;
+struct ebt_802_3_info {
+	__u8  sap;
 	__be16 type;
-	uint8_t  bitmask;
-	uint8_t  invflags;
+	__u8  bitmask;
+	__u8  invflags;
 };
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_among.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_among.h
index 7654069..bd4e3ad 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_among.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_among.h
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_AMONG_H
 #define __LINUX_BRIDGE_EBT_AMONG_H
 
+#include <linux/types.h>
+
 #define EBT_AMONG_DST 0x01
 #define EBT_AMONG_SRC 0x02
 
@@ -29,14 +31,12 @@
  * Yes, it is a memory overhead, but in 2003 AD, who cares?
  */
 
-struct ebt_mac_wormhash_tuple
-{
-	uint32_t cmp[2];
+struct ebt_mac_wormhash_tuple {
+	__u32 cmp[2];
 	__be32 ip;
 };
 
-struct ebt_mac_wormhash
-{
+struct ebt_mac_wormhash {
 	int table[257];
 	int poolsize;
 	struct ebt_mac_wormhash_tuple pool[0];
@@ -45,8 +45,7 @@
 #define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \
 		+ (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0)
 
-struct ebt_among_info
-{
+struct ebt_among_info {
 	int wh_dst_ofs;
 	int wh_src_ofs;
 	int bitmask;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_arp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_arp.h
index cbf4843..522f3e4 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_arp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_arp.h
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_ARP_H
 #define __LINUX_BRIDGE_EBT_ARP_H
 
+#include <linux/types.h>
+
 #define EBT_ARP_OPCODE 0x01
 #define EBT_ARP_HTYPE 0x02
 #define EBT_ARP_PTYPE 0x04
@@ -27,8 +29,8 @@
 	unsigned char smmsk[ETH_ALEN];
 	unsigned char dmaddr[ETH_ALEN];
 	unsigned char dmmsk[ETH_ALEN];
-	uint8_t  bitmask;
-	uint8_t  invflags;
+	__u8  bitmask;
+	__u8  invflags;
 };
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_arpreply.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_arpreply.h
index 96a8339..7e77896 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_arpreply.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_arpreply.h
@@ -1,8 +1,7 @@
 #ifndef __LINUX_BRIDGE_EBT_ARPREPLY_H
 #define __LINUX_BRIDGE_EBT_ARPREPLY_H
 
-struct ebt_arpreply_info
-{
+struct ebt_arpreply_info {
 	unsigned char mac[ETH_ALEN];
 	int target;
 };
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ip.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ip.h
index d684747..c4bbc41 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ip.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ip.h
@@ -15,6 +15,8 @@
 #ifndef __LINUX_BRIDGE_EBT_IP_H
 #define __LINUX_BRIDGE_EBT_IP_H
 
+#include <linux/types.h>
+
 #define EBT_IP_SOURCE 0x01
 #define EBT_IP_DEST 0x02
 #define EBT_IP_TOS 0x04
@@ -26,18 +28,17 @@
 #define EBT_IP_MATCH "ip"
 
 /* the same values are used for the invflags */
-struct ebt_ip_info
-{
+struct ebt_ip_info {
 	__be32 saddr;
 	__be32 daddr;
 	__be32 smsk;
 	__be32 dmsk;
-	uint8_t  tos;
-	uint8_t  protocol;
-	uint8_t  bitmask;
-	uint8_t  invflags;
-	uint16_t sport[2];
-	uint16_t dport[2];
+	__u8  tos;
+	__u8  protocol;
+	__u8  bitmask;
+	__u8  invflags;
+	__u16 sport[2];
+	__u16 dport[2];
 };
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ip6.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ip6.h
new file mode 100644
index 0000000..42b8896
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ip6.h
@@ -0,0 +1,50 @@
+/*
+ *  ebt_ip6
+ *
+ *	Authors:
+ * Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
+ * Manohar Castelino <manohar.r.castelino@intel.com>
+ *
+ *  Jan 11, 2008
+ *
+ */
+
+#ifndef __LINUX_BRIDGE_EBT_IP6_H
+#define __LINUX_BRIDGE_EBT_IP6_H
+
+#include <linux/types.h>
+
+#define EBT_IP6_SOURCE 0x01
+#define EBT_IP6_DEST 0x02
+#define EBT_IP6_TCLASS 0x04
+#define EBT_IP6_PROTO 0x08
+#define EBT_IP6_SPORT 0x10
+#define EBT_IP6_DPORT 0x20
+#define EBT_IP6_ICMP6 0x40
+
+#define EBT_IP6_MASK (EBT_IP6_SOURCE | EBT_IP6_DEST | EBT_IP6_TCLASS |\
+		      EBT_IP6_PROTO | EBT_IP6_SPORT | EBT_IP6_DPORT | \
+		      EBT_IP6_ICMP6)
+#define EBT_IP6_MATCH "ip6"
+
+/* the same values are used for the invflags */
+struct ebt_ip6_info {
+	struct in6_addr saddr;
+	struct in6_addr daddr;
+	struct in6_addr smsk;
+	struct in6_addr dmsk;
+	__u8  tclass;
+	__u8  protocol;
+	__u8  bitmask;
+	__u8  invflags;
+	union {
+		__u16 sport[2];
+		__u8 icmpv6_type[2];
+	};
+	union {
+		__u16 dport[2];
+		__u8 icmpv6_code[2];
+	};
+};
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_limit.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_limit.h
index d8b6500..66d80b3 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_limit.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_limit.h
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_LIMIT_H
 #define __LINUX_BRIDGE_EBT_LIMIT_H
 
+#include <linux/types.h>
+
 #define EBT_LIMIT_MATCH "limit"
 
 /* timings are in milliseconds. */
@@ -9,15 +11,14 @@
 /* 1/10,000 sec period => max of 10,000/sec.  Min rate is then 429490
    seconds, or one every 59 hours. */
 
-struct ebt_limit_info
-{
-	u_int32_t avg;    /* Average secs between packets * scale */
-	u_int32_t burst;  /* Period multiplier for upper limit. */
+struct ebt_limit_info {
+	__u32 avg;    /* Average secs between packets * scale */
+	__u32 burst;  /* Period multiplier for upper limit. */
 
 	/* Used internally by the kernel */
 	unsigned long prev;
-	u_int32_t credit;
-	u_int32_t credit_cap, cost;
+	__u32 credit;
+	__u32 credit_cap, cost;
 };
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_log.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_log.h
index b76e653..7e7f1d1 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_log.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_log.h
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_LOG_H
 #define __LINUX_BRIDGE_EBT_LOG_H
 
+#include <linux/types.h>
+
 #define EBT_LOG_IP 0x01 /* if the frame is made by ip, log the ip information */
 #define EBT_LOG_ARP 0x02
 #define EBT_LOG_NFLOG 0x04
@@ -9,11 +11,10 @@
 #define EBT_LOG_PREFIX_SIZE 30
 #define EBT_LOG_WATCHER "log"
 
-struct ebt_log_info
-{
-	uint8_t loglevel;
-	uint8_t prefix[EBT_LOG_PREFIX_SIZE];
-	uint32_t bitmask;
+struct ebt_log_info {
+	__u8 loglevel;
+	__u8 prefix[EBT_LOG_PREFIX_SIZE];
+	__u32 bitmask;
 };
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_mark_m.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_mark_m.h
index 301524f..410f9e5 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_mark_m.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_mark_m.h
@@ -1,14 +1,15 @@
 #ifndef __LINUX_BRIDGE_EBT_MARK_M_H
 #define __LINUX_BRIDGE_EBT_MARK_M_H
 
+#include <linux/types.h>
+
 #define EBT_MARK_AND 0x01
 #define EBT_MARK_OR 0x02
 #define EBT_MARK_MASK (EBT_MARK_AND | EBT_MARK_OR)
-struct ebt_mark_m_info
-{
+struct ebt_mark_m_info {
 	unsigned long mark, mask;
-	uint8_t invert;
-	uint8_t bitmask;
+	__u8 invert;
+	__u8 bitmask;
 };
 #define EBT_MARK_MATCH "mark_m"
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_mark_t.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_mark_t.h
index 6270f6f..7d5a268 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_mark_t.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_mark_t.h
@@ -13,8 +13,7 @@
 #define MARK_AND_VALUE (0xffffffd0)
 #define MARK_XOR_VALUE (0xffffffc0)
 
-struct ebt_mark_t_info
-{
+struct ebt_mark_t_info {
 	unsigned long mark;
 	/* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */
 	int target;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_nat.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_nat.h
index 435b886..5e74e3b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_nat.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_nat.h
@@ -2,8 +2,7 @@
 #define __LINUX_BRIDGE_EBT_NAT_H
 
 #define NAT_ARP_BIT  (0x00000010)
-struct ebt_nat_info
-{
+struct ebt_nat_info {
 	unsigned char mac[ETH_ALEN];
 	/* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */
 	int target;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_nflog.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_nflog.h
new file mode 100644
index 0000000..df829fc
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_nflog.h
@@ -0,0 +1,23 @@
+#ifndef __LINUX_BRIDGE_EBT_NFLOG_H
+#define __LINUX_BRIDGE_EBT_NFLOG_H
+
+#include <linux/types.h>
+
+#define EBT_NFLOG_MASK 0x0
+
+#define EBT_NFLOG_PREFIX_SIZE 64
+#define EBT_NFLOG_WATCHER "nflog"
+
+#define EBT_NFLOG_DEFAULT_GROUP		0x1
+#define EBT_NFLOG_DEFAULT_THRESHOLD	1
+
+struct ebt_nflog_info {
+	__u32 len;
+	__u16 group;
+	__u16 threshold;
+	__u16 flags;
+	__u16 pad;
+	char prefix[EBT_NFLOG_PREFIX_SIZE];
+};
+
+#endif				/* __LINUX_BRIDGE_EBT_NFLOG_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_pkttype.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_pkttype.h
index 0d64bbb..c241bad 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_pkttype.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_pkttype.h
@@ -1,10 +1,11 @@
 #ifndef __LINUX_BRIDGE_EBT_PKTTYPE_H
 #define __LINUX_BRIDGE_EBT_PKTTYPE_H
 
-struct ebt_pkttype_info
-{
-	uint8_t pkt_type;
-	uint8_t invert;
+#include <linux/types.h>
+
+struct ebt_pkttype_info {
+	__u8 pkt_type;
+	__u8 invert;
 };
 #define EBT_PKTTYPE_MATCH "pkttype"
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_redirect.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_redirect.h
index 5c67990..dd9622c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_redirect.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_redirect.h
@@ -1,8 +1,7 @@
 #ifndef __LINUX_BRIDGE_EBT_REDIRECT_H
 #define __LINUX_BRIDGE_EBT_REDIRECT_H
 
-struct ebt_redirect_info
-{
+struct ebt_redirect_info {
 	/* EBT_ACCEPT, EBT_DROP, EBT_CONTINUE or EBT_RETURN */
 	int target;
 };
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_stp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_stp.h
index e5fd678..1025b9f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_stp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_stp.h
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_STP_H
 #define __LINUX_BRIDGE_EBT_STP_H
 
+#include <linux/types.h>
+
 #define EBT_STP_TYPE		0x0001
 
 #define EBT_STP_FLAGS		0x0002
@@ -20,27 +22,25 @@
 
 #define EBT_STP_MATCH "stp"
 
-struct ebt_stp_config_info
-{
-	uint8_t flags;
-	uint16_t root_priol, root_priou;
+struct ebt_stp_config_info {
+	__u8 flags;
+	__u16 root_priol, root_priou;
 	char root_addr[6], root_addrmsk[6];
-	uint32_t root_costl, root_costu;
-	uint16_t sender_priol, sender_priou;
+	__u32 root_costl, root_costu;
+	__u16 sender_priol, sender_priou;
 	char sender_addr[6], sender_addrmsk[6];
-	uint16_t portl, portu;
-	uint16_t msg_agel, msg_ageu;
-	uint16_t max_agel, max_ageu;
-	uint16_t hello_timel, hello_timeu;
-	uint16_t forward_delayl, forward_delayu;
+	__u16 portl, portu;
+	__u16 msg_agel, msg_ageu;
+	__u16 max_agel, max_ageu;
+	__u16 hello_timel, hello_timeu;
+	__u16 forward_delayl, forward_delayu;
 };
 
-struct ebt_stp_info
-{
-	uint8_t type;
+struct ebt_stp_info {
+	__u8 type;
 	struct ebt_stp_config_info config;
-	uint16_t bitmask;
-	uint16_t invflags;
+	__u16 bitmask;
+	__u16 invflags;
 };
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ulog.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ulog.h
index b677e26..89a6bec 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ulog.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_ulog.h
@@ -1,6 +1,8 @@
 #ifndef _EBT_ULOG_H
 #define _EBT_ULOG_H
 
+#include <linux/types.h>
+
 #define EBT_ULOG_DEFAULT_NLGROUP 0
 #define EBT_ULOG_DEFAULT_QTHRESHOLD 1
 #define EBT_ULOG_MAXNLGROUPS 32 /* hardcoded netlink max */
@@ -10,7 +12,7 @@
 #define EBT_ULOG_VERSION 1
 
 struct ebt_ulog_info {
-	uint32_t nlgroup;
+	__u32 nlgroup;
 	unsigned int cprange;
 	unsigned int qthreshold;
 	char prefix[EBT_ULOG_PREFIX_LEN];
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_vlan.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_vlan.h
index 1d98be4..967d1d5 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_vlan.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebt_vlan.h
@@ -1,6 +1,8 @@
 #ifndef __LINUX_BRIDGE_EBT_VLAN_H
 #define __LINUX_BRIDGE_EBT_VLAN_H
 
+#include <linux/types.h>
+
 #define EBT_VLAN_ID	0x01
 #define EBT_VLAN_PRIO	0x02
 #define EBT_VLAN_ENCAP	0x04
@@ -8,12 +10,12 @@
 #define EBT_VLAN_MATCH "vlan"
 
 struct ebt_vlan_info {
-	uint16_t id;		/* VLAN ID {1-4095} */
-	uint8_t prio;		/* VLAN User Priority {0-7} */
+	__u16 id;		/* VLAN ID {1-4095} */
+	__u8 prio;		/* VLAN User Priority {0-7} */
 	__be16 encap;		/* VLAN Encapsulated frame code {0-65535} */
-	uint8_t bitmask;		/* Args bitmask bit 1=1 - ID arg,
+	__u8 bitmask;		/* Args bitmask bit 1=1 - ID arg,
 				   bit 2=1 User-Priority arg, bit 3=1 encap*/
-	uint8_t invflags;		/* Inverse bitmask  bit 1=1 - inversed ID arg, 
+	__u8 invflags;		/* Inverse bitmask  bit 1=1 - inversed ID arg, 
 				   bit 2=1 - inversed Pirority arg */
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebtables.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebtables.h
index 1272888..19a6444 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebtables.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_bridge/ebtables.h
@@ -34,14 +34,12 @@
 struct xt_match;
 struct xt_target;
 
-struct ebt_counter
-{
+struct ebt_counter {
 	uint64_t pcnt;
 	uint64_t bcnt;
 };
 
-struct ebt_replace
-{
+struct ebt_replace {
 	char name[EBT_TABLE_MAXNAMELEN];
 	unsigned int valid_hooks;
 	/* nr of rules in the table */
@@ -57,8 +55,7 @@
 	char *entries;
 };
 
-struct ebt_replace_kernel
-{
+struct ebt_replace_kernel {
 	char name[EBT_TABLE_MAXNAMELEN];
 	unsigned int valid_hooks;
 	/* nr of rules in the table */
@@ -95,7 +92,7 @@
 
 /* This is a hack to make a difference between an ebt_entry struct and an
  * ebt_entries struct when traversing the entries from start to end.
- * Using this simplifies the code alot, while still being able to use
+ * Using this simplifies the code a lot, while still being able to use
  * ebt_entries.
  * Contrary, iptables doesn't use something like ebt_entries and therefore uses
  * different techniques for naming the policy and such. So, iptables doesn't
@@ -120,8 +117,7 @@
 #define EBT_INV_MASK (EBT_IPROTO | EBT_IIN | EBT_IOUT | EBT_ILOGICALIN \
    | EBT_ILOGICALOUT | EBT_ISOURCE | EBT_IDEST)
 
-struct ebt_entry_match
-{
+struct ebt_entry_match {
 	union {
 		char name[EBT_FUNCTION_MAXNAMELEN];
 		struct xt_match *match;
@@ -131,8 +127,7 @@
 	unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
 };
 
-struct ebt_entry_watcher
-{
+struct ebt_entry_watcher {
 	union {
 		char name[EBT_FUNCTION_MAXNAMELEN];
 		struct xt_target *watcher;
@@ -142,8 +137,7 @@
 	unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
 };
 
-struct ebt_entry_target
-{
+struct ebt_entry_target {
 	union {
 		char name[EBT_FUNCTION_MAXNAMELEN];
 		struct xt_target *target;
@@ -154,8 +148,7 @@
 };
 
 #define EBT_STANDARD_TARGET "standard"
-struct ebt_standard_target
-{
+struct ebt_standard_target {
 	struct ebt_entry_target target;
 	int verdict;
 };
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_decnet.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_decnet.h
index ca70c6c..f1e80a9 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_decnet.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_decnet.h
@@ -10,6 +10,9 @@
 #include <linux/netfilter.h>
 
 /* only for userspace compatibility */
+
+#include <limits.h> /* for INT_MIN, INT_MAX */
+
 /* IP Cache bits. */
 /* Src IP address. */
 #define NFC_DN_SRC		0x0001
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4.h
index 4d7ba3e..5490309 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4.h
@@ -8,6 +8,9 @@
 #include <linux/netfilter.h>
 
 /* only for userspace compatibility */
+
+#include <limits.h> /* for INT_MIN, INT_MAX */
+
 /* IP Cache bits. */
 /* Src IP address. */
 #define NFC_IP_SRC		0x0001
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ip_tables.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ip_tables.h
index d734979..2c54e32 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ip_tables.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ip_tables.h
@@ -1,5 +1,3 @@
-/** Copyright (c) 2013 Qualcomm Atheros, Inc. */
-
 /*
  * 25-Jul-1998 Major changes to allow for ip chain table
  *
@@ -29,15 +27,42 @@
 #define ipt_target xt_target
 #define ipt_table xt_table
 #define ipt_get_revision xt_get_revision
+#define ipt_entry_match xt_entry_match
+#define ipt_entry_target xt_entry_target
+#define ipt_standard_target xt_standard_target
+#define ipt_error_target xt_error_target
+#define ipt_counters xt_counters
+#define IPT_CONTINUE XT_CONTINUE
+#define IPT_RETURN XT_RETURN
 
-#ifdef CONFIG_ATHRS_HW_ACL
+/* This group is older than old (iptables < v1.4.0-rc1~89) */
+#include <linux/netfilter/xt_tcpudp.h>
+#define ipt_udp xt_udp
+#define ipt_tcp xt_tcp
+#define IPT_TCP_INV_SRCPT	XT_TCP_INV_SRCPT
+#define IPT_TCP_INV_DSTPT	XT_TCP_INV_DSTPT
+#define IPT_TCP_INV_FLAGS	XT_TCP_INV_FLAGS
+#define IPT_TCP_INV_OPTION	XT_TCP_INV_OPTION
+#define IPT_TCP_INV_MASK	XT_TCP_INV_MASK
+#define IPT_UDP_INV_SRCPT	XT_UDP_INV_SRCPT
+#define IPT_UDP_INV_DSTPT	XT_UDP_INV_DSTPT
+#define IPT_UDP_INV_MASK	XT_UDP_INV_MASK
 
-typedef struct {
-    void    (*nf_parse_tables)        (void *entry0, unsigned int size, char *name);
-} athr_nf_acl_ops_t;
+/* The argument to IPT_SO_ADD_COUNTERS. */
+#define ipt_counters_info xt_counters_info
+/* Standard return verdict, or do jump. */
+#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
+/* Error verdict. */
+#define IPT_ERROR_TARGET XT_ERROR_TARGET
 
-extern athr_nf_acl_ops_t *athr_acl_sw_ops;
-#endif
+/* fn returns 0 to continue iteration */
+#define IPT_MATCH_ITERATE(e, fn, args...) \
+	XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args)
+
+/* fn returns 0 to continue iteration */
+#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
+	XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args)
+
 /* Yes, Virginia, you have to zero the padding. */
 struct ipt_ip {
 	/* Source and destination IP addr */
@@ -48,25 +73,19 @@
 	unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
 
 	/* Protocol, 0 = ANY */
-	u_int16_t proto;
+	__u16 proto;
 
 	/* Flags word */
-	u_int8_t flags;
+	__u8 flags;
 	/* Inverse flags */
-	u_int8_t invflags;
+	__u8 invflags;
 };
 
-#define ipt_entry_match xt_entry_match
-#define ipt_entry_target xt_entry_target
-#define ipt_standard_target xt_standard_target
-
-#define ipt_counters xt_counters
-
 /* Values for "flag" field in struct ipt_ip (general ip structure). */
 #define IPT_F_FRAG		0x01	/* Set if rule is a fragment rule */
 #define IPT_F_GOTO		0x02	/* Set if jump is a goto */
 #define IPT_F_MASK		0x03	/* All possible flag bits mask. */
-#define IPT_F_NO_DEF_MATCH      0x80    /* Internal: no default match rules present */
+#define IPT_F_NO_DEF_MATCH	0x80	/* Internal: no default match rules present */
 
 /* Values for "inv" field in struct ipt_ip. */
 #define IPT_INV_VIA_IN		0x01	/* Invert the sense of IN IFACE. */
@@ -81,17 +100,16 @@
 /* This structure defines each of the firewall rules.  Consists of 3
    parts which are 1) general IP header stuff 2) match specific
    stuff 3) the target to perform if the rule matches */
-struct ipt_entry
-{
+struct ipt_entry {
 	struct ipt_ip ip;
 
 	/* Mark with fields that we care about. */
 	unsigned int nfcache;
 
 	/* Size of ipt_entry + matches */
-	u_int16_t target_offset;
+	__u16 target_offset;
 	/* Size of ipt_entry + matches + target */
-	u_int16_t next_offset;
+	__u16 next_offset;
 
 	/* Back pointer */
 	unsigned int comefrom;
@@ -122,39 +140,20 @@
 #define IPT_SO_GET_REVISION_TARGET	(IPT_BASE_CTL + 3)
 #define IPT_SO_GET_MAX			IPT_SO_GET_REVISION_TARGET
 
-#define IPT_CONTINUE XT_CONTINUE
-#define IPT_RETURN XT_RETURN
-
-#include <linux/netfilter/xt_tcpudp.h>
-#define ipt_udp xt_udp
-#define ipt_tcp xt_tcp
-
-#define IPT_TCP_INV_SRCPT	XT_TCP_INV_SRCPT
-#define IPT_TCP_INV_DSTPT	XT_TCP_INV_DSTPT
-#define IPT_TCP_INV_FLAGS	XT_TCP_INV_FLAGS
-#define IPT_TCP_INV_OPTION	XT_TCP_INV_OPTION
-#define IPT_TCP_INV_MASK	XT_TCP_INV_MASK
-
-#define IPT_UDP_INV_SRCPT	XT_UDP_INV_SRCPT
-#define IPT_UDP_INV_DSTPT	XT_UDP_INV_DSTPT
-#define IPT_UDP_INV_MASK	XT_UDP_INV_MASK
-
 /* ICMP matching stuff */
-struct ipt_icmp
-{
-	u_int8_t type;				/* type to match */
-	u_int8_t code[2];			/* range of code */
-	u_int8_t invflags;			/* Inverse flags */
+struct ipt_icmp {
+	__u8 type;				/* type to match */
+	__u8 code[2];				/* range of code */
+	__u8 invflags;				/* Inverse flags */
 };
 
 /* Values for "inv" field for struct ipt_icmp. */
 #define IPT_ICMP_INV	0x01	/* Invert the sense of type/code test */
 
 /* The argument to IPT_SO_GET_INFO */
-struct ipt_getinfo
-{
+struct ipt_getinfo {
 	/* Which table: caller fills this in. */
-	char name[IPT_TABLE_MAXNAMELEN];
+	char name[XT_TABLE_MAXNAMELEN];
 
 	/* Kernel fills these in. */
 	/* Which hook entry points are valid: bitmask */
@@ -174,10 +173,9 @@
 };
 
 /* The argument to IPT_SO_SET_REPLACE. */
-struct ipt_replace
-{
+struct ipt_replace {
 	/* Which table. */
-	char name[IPT_TABLE_MAXNAMELEN];
+	char name[XT_TABLE_MAXNAMELEN];
 
 	/* Which hook entry points are valid: bitmask.  You can't
            change this. */
@@ -205,14 +203,10 @@
 	struct ipt_entry entries[0];
 };
 
-/* The argument to IPT_SO_ADD_COUNTERS. */
-#define ipt_counters_info xt_counters_info
-
 /* The argument to IPT_SO_GET_ENTRIES. */
-struct ipt_get_entries
-{
+struct ipt_get_entries {
 	/* Which table: user fills this in. */
-	char name[IPT_TABLE_MAXNAMELEN];
+	char name[XT_TABLE_MAXNAMELEN];
 
 	/* User fills this in: total entry size. */
 	unsigned int size;
@@ -221,26 +215,13 @@
 	struct ipt_entry entrytable[0];
 };
 
-/* Standard return verdict, or do jump. */
-#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
-/* Error verdict. */
-#define IPT_ERROR_TARGET XT_ERROR_TARGET
-
 /* Helper functions */
-static __inline__ struct ipt_entry_target *
+static __inline__ struct xt_entry_target *
 ipt_get_target(struct ipt_entry *e)
 {
 	return (void *)e + e->target_offset;
 }
 
-/* fn returns 0 to continue iteration */
-#define IPT_MATCH_ITERATE(e, fn, args...) \
-	XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args)
-
-/* fn returns 0 to continue iteration */
-#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
-	XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args)
-
 /*
  *	Main firewall chains definitions and global var's definitions.
  */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
deleted file mode 100644
index a46d511..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_CLASSIFY.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _IPT_CLASSIFY_H
-#define _IPT_CLASSIFY_H
-
-#include <linux/netfilter/xt_CLASSIFY.h>
-#define ipt_classify_target_info xt_classify_target_info
-
-#endif /*_IPT_CLASSIFY_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
index e5a3687..c6a204c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
@@ -1,6 +1,8 @@
 #ifndef _IPT_CLUSTERIP_H_target
 #define _IPT_CLUSTERIP_H_target
 
+#include <linux/types.h>
+
 enum clusterip_hashmode {
     CLUSTERIP_HASHMODE_SIP = 0,
     CLUSTERIP_HASHMODE_SIP_SPT,
@@ -17,15 +19,15 @@
 
 struct ipt_clusterip_tgt_info {
 
-	u_int32_t flags;
+	__u32 flags;
 
 	/* only relevant for new ones */
-	u_int8_t clustermac[6];
-	u_int16_t num_total_nodes;
-	u_int16_t num_local_nodes;
-	u_int16_t local_nodes[CLUSTERIP_MAX_NODES];
-	u_int32_t hash_mode;
-	u_int32_t hash_initval;
+	__u8 clustermac[6];
+	__u16 num_total_nodes;
+	__u16 num_local_nodes;
+	__u16 local_nodes[CLUSTERIP_MAX_NODES];
+	__u32 hash_mode;
+	__u32 hash_initval;
 
 	/* Used internally by the kernel */
 	struct clusterip_config *config;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_CONNMARK.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_CONNMARK.h
deleted file mode 100644
index 9ecfee0..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_CONNMARK.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _IPT_CONNMARK_H_target
-#define _IPT_CONNMARK_H_target
-
-/* Copyright (C) 2002,2004 MARA Systems AB <http://www.marasystems.com>
- * by Henrik Nordstrom <hno@marasystems.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.
- */
-#include <linux/netfilter/xt_CONNMARK.h>
-#define IPT_CONNMARK_SET	XT_CONNMARK_SET
-#define IPT_CONNMARK_SAVE	XT_CONNMARK_SAVE
-#define	IPT_CONNMARK_RESTORE	XT_CONNMARK_RESTORE
-
-#define ipt_connmark_target_info xt_connmark_target_info
-
-#endif /*_IPT_CONNMARK_H_target*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_DSCP.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
deleted file mode 100644
index 3491e52..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* iptables module for setting the IPv4 DSCP field
- *
- * (C) 2002 Harald Welte <laforge@gnumonks.org>
- * based on ipt_FTOS.c (C) 2000 by Matthew G. Marsh <mgm@paktronix.com>
- * This software is distributed under GNU GPL v2, 1991
- * 
- * See RFC2474 for a description of the DSCP field within the IP Header.
- *
- * ipt_DSCP.h,v 1.7 2002/03/14 12:03:13 laforge Exp
-*/
-#ifndef _IPT_DSCP_TARGET_H
-#define _IPT_DSCP_TARGET_H
-#include <linux/netfilter_ipv4/ipt_dscp.h>
-#include <linux/netfilter/xt_DSCP.h>
-
-#define ipt_DSCP_info xt_DSCP_info
-
-#endif /* _IPT_DSCP_TARGET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ECN.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ECN.h
index 94e0d98..bb88d53 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ECN.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ECN.h
@@ -8,9 +8,11 @@
 */
 #ifndef _IPT_ECN_TARGET_H
 #define _IPT_ECN_TARGET_H
-#include <linux/netfilter_ipv4/ipt_DSCP.h>
 
-#define IPT_ECN_IP_MASK	(~IPT_DSCP_MASK)
+#include <linux/types.h>
+#include <linux/netfilter/xt_DSCP.h>
+
+#define IPT_ECN_IP_MASK	(~XT_DSCP_MASK)
 
 #define IPT_ECN_OP_SET_IP	0x01	/* set ECN bits of IPv4 header */
 #define IPT_ECN_OP_SET_ECE	0x10	/* set ECE bit of TCP header */
@@ -19,11 +21,11 @@
 #define IPT_ECN_OP_MASK		0xce
 
 struct ipt_ECN_info {
-	u_int8_t operation;	/* bitset of operations */
-	u_int8_t ip_ect;	/* ECT codepoint of IPv4 header, pre-shifted */
+	__u8 operation;	/* bitset of operations */
+	__u8 ip_ect;	/* ECT codepoint of IPv4 header, pre-shifted */
 	union {
 		struct {
-			u_int8_t ece:1, cwr:1; /* TCP ECT bits */
+			__u8 ece:1, cwr:1; /* TCP ECT bits */
 		} tcp;
 	} proto;
 };
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_LOG.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_LOG.h
index 90fa652..dcdbadf 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_LOG.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_LOG.h
@@ -7,7 +7,8 @@
 #define IPT_LOG_IPOPT		0x04	/* Log IP options */
 #define IPT_LOG_UID		0x08	/* Log UID owning local socket */
 #define IPT_LOG_NFLOG		0x10	/* Unsupported, don't reuse */
-#define IPT_LOG_MASK		0x1f
+#define IPT_LOG_MACDECODE	0x20	/* Decode MAC header */
+#define IPT_LOG_MASK		0x2f
 
 struct ipt_log_info {
 	unsigned char level;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_MARK.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_MARK.h
deleted file mode 100644
index 697a486..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_MARK.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _IPT_MARK_H_target
-#define _IPT_MARK_H_target
-
-/* Backwards compatibility for old userspace */
-
-#include <linux/netfilter/xt_MARK.h>
-
-/* Version 0 */
-#define ipt_mark_target_info xt_mark_target_info
-
-/* Version 1 */
-#define IPT_MARK_SET	XT_MARK_SET
-#define IPT_MARK_AND	XT_MARK_AND
-#define	IPT_MARK_OR	XT_MARK_OR
-
-#define ipt_mark_target_info_v1 xt_mark_target_info_v1
-
-#endif /*_IPT_MARK_H_target*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
deleted file mode 100644
index 97a2a75..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_NFQUEUE.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* iptables module for using NFQUEUE mechanism
- *
- * (C) 2005 Harald Welte <laforge@netfilter.org>
- *
- * This software is distributed under GNU GPL v2, 1991
- * 
-*/
-#ifndef _IPT_NFQ_TARGET_H
-#define _IPT_NFQ_TARGET_H
-
-/* Backwards compatibility for old userspace */
-#include <linux/netfilter/xt_NFQUEUE.h>
-
-#define ipt_NFQ_info xt_NFQ_info
-
-#endif /* _IPT_DSCP_TARGET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_SAME.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_SAME.h
index be6e682..5bca782 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_SAME.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_SAME.h
@@ -1,16 +1,17 @@
 #ifndef _IPT_SAME_H
 #define _IPT_SAME_H
 
+#include <linux/types.h>
+
 #define IPT_SAME_MAX_RANGE	10
 
 #define IPT_SAME_NODST		0x01
 
-struct ipt_same_info
-{
+struct ipt_same_info {
 	unsigned char info;
-	u_int32_t rangesize;
-	u_int32_t ipnum;
-	u_int32_t *iparray;
+	__u32 rangesize;
+	__u32 ipnum;
+	__u32 *iparray;
 
 	/* hangs off end. */
 	struct nf_nat_range range[IPT_SAME_MAX_RANGE];
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
deleted file mode 100644
index 7a850f9..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _IPT_TCPMSS_H
-#define _IPT_TCPMSS_H
-
-#include <linux/netfilter/xt_TCPMSS.h>
-
-#define ipt_tcpmss_info		xt_tcpmss_info
-#define IPT_TCPMSS_CLAMP_PMTU	XT_TCPMSS_CLAMP_PMTU
-
-#endif /*_IPT_TCPMSS_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_TOS.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_TOS.h
deleted file mode 100644
index 6bf9e1f..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_TOS.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _IPT_TOS_H_target
-#define _IPT_TOS_H_target
-
-#ifndef IPTOS_NORMALSVC
-#define IPTOS_NORMALSVC 0
-#endif
-
-struct ipt_tos_target_info {
-	u_int8_t tos;
-};
-
-#endif /*_IPT_TOS_H_target*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_TTL.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_TTL.h
index ee6611e..f6ac169 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_TTL.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_TTL.h
@@ -4,6 +4,8 @@
 #ifndef _IPT_TTL_H
 #define _IPT_TTL_H
 
+#include <linux/types.h>
+
 enum {
 	IPT_TTL_SET = 0,
 	IPT_TTL_INC,
@@ -13,8 +15,8 @@
 #define IPT_TTL_MAXMODE	IPT_TTL_DEC
 
 struct ipt_TTL_info {
-	u_int8_t	mode;
-	u_int8_t	ttl;
+	__u8	mode;
+	__u8	ttl;
 };
 
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_addrtype.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
index 446de6a..0da4223 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_addrtype.h
@@ -1,6 +1,8 @@
 #ifndef _IPT_ADDRTYPE_H
 #define _IPT_ADDRTYPE_H
 
+#include <linux/types.h>
+
 enum {
 	IPT_ADDRTYPE_INVERT_SOURCE	= 0x0001,
 	IPT_ADDRTYPE_INVERT_DEST	= 0x0002,
@@ -9,17 +11,17 @@
 };
 
 struct ipt_addrtype_info_v1 {
-	u_int16_t	source;		/* source-type mask */
-	u_int16_t	dest;		/* dest-type mask */
-	u_int32_t	flags;
+	__u16	source;		/* source-type mask */
+	__u16	dest;		/* dest-type mask */
+	__u32	flags;
 };
 
 /* revision 0 */
 struct ipt_addrtype_info {
-	u_int16_t	source;		/* source-type mask */
-	u_int16_t	dest;		/* dest-type mask */
-	u_int32_t	invert_source;
-	u_int32_t	invert_dest;
+	__u16	source;		/* source-type mask */
+	__u16	dest;		/* dest-type mask */
+	__u32	invert_source;
+	__u32	invert_dest;
 };
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ah.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ah.h
index 7b9a2ac..4e02bb0 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ah.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ah.h
@@ -1,10 +1,11 @@
 #ifndef _IPT_AH_H
 #define _IPT_AH_H
 
-struct ipt_ah
-{
-	u_int32_t spis[2];			/* Security Parameter Index */
-	u_int8_t  invflags;			/* Inverse flags */
+#include <linux/types.h>
+
+struct ipt_ah {
+	__u32 spis[2];			/* Security Parameter Index */
+	__u8  invflags;			/* Inverse flags */
 };
 
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_comment.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_comment.h
deleted file mode 100644
index ae2afc2..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_comment.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _IPT_COMMENT_H
-#define _IPT_COMMENT_H
-
-#include <linux/netfilter/xt_comment.h>
-
-#define IPT_MAX_COMMENT_LEN XT_MAX_COMMENT_LEN
-
-#define ipt_comment_info xt_comment_info
-
-#endif /* _IPT_COMMENT_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_connbytes.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
deleted file mode 100644
index f63e6ee..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_connbytes.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _IPT_CONNBYTES_H
-#define _IPT_CONNBYTES_H
-
-#include <linux/netfilter/xt_connbytes.h>
-#define ipt_connbytes_what xt_connbytes_what
-
-#define IPT_CONNBYTES_PKTS	XT_CONNBYTES_PKTS
-#define IPT_CONNBYTES_BYTES	XT_CONNBYTES_BYTES
-#define IPT_CONNBYTES_AVGPKT	XT_CONNBYTES_AVGPKT
-
-#define ipt_connbytes_direction 	xt_connbytes_direction
-#define IPT_CONNBYTES_DIR_ORIGINAL 	XT_CONNBYTES_DIR_ORIGINAL
-#define IPT_CONNBYTES_DIR_REPLY 	XT_CONNBYTES_DIR_REPLY
-#define IPT_CONNBYTES_DIR_BOTH		XT_CONNBYTES_DIR_BOTH
-
-#define ipt_connbytes_info xt_connbytes_info
-
-#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_connmark.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_connmark.h
deleted file mode 100644
index c7ba656..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_connmark.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _IPT_CONNMARK_H
-#define _IPT_CONNMARK_H
-
-#include <linux/netfilter/xt_connmark.h>
-#define ipt_connmark_info xt_connmark_info
-
-#endif /*_IPT_CONNMARK_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_conntrack.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_conntrack.h
deleted file mode 100644
index cde6762..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_conntrack.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Header file for kernel module to match connection tracking information.
- * GPL (C) 2001  Marc Boucher (marc@mbsi.ca).
- */
-
-#ifndef _IPT_CONNTRACK_H
-#define _IPT_CONNTRACK_H
-
-#include <linux/netfilter/xt_conntrack.h>
-
-#define IPT_CONNTRACK_STATE_BIT(ctinfo) XT_CONNTRACK_STATE_BIT(ctinfo)
-#define IPT_CONNTRACK_STATE_INVALID 	XT_CONNTRACK_STATE_INVALID
-
-#define IPT_CONNTRACK_STATE_SNAT 	XT_CONNTRACK_STATE_SNAT
-#define IPT_CONNTRACK_STATE_DNAT	XT_CONNTRACK_STATE_DNAT
-#define IPT_CONNTRACK_STATE_UNTRACKED	XT_CONNTRACK_STATE_UNTRACKED
-
-/* flags, invflags: */
-#define IPT_CONNTRACK_STATE		XT_CONNTRACK_STATE
-#define IPT_CONNTRACK_PROTO		XT_CONNTRACK_PROTO
-#define IPT_CONNTRACK_ORIGSRC		XT_CONNTRACK_ORIGSRC
-#define IPT_CONNTRACK_ORIGDST		XT_CONNTRACK_ORIGDST
-#define IPT_CONNTRACK_REPLSRC		XT_CONNTRACK_REPLSRC
-#define IPT_CONNTRACK_REPLDST		XT_CONNTRACK_REPLDST
-#define IPT_CONNTRACK_STATUS		XT_CONNTRACK_STATUS
-#define IPT_CONNTRACK_EXPIRES		XT_CONNTRACK_EXPIRES
-
-#define ipt_conntrack_info		xt_conntrack_info
-#endif /*_IPT_CONNTRACK_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_dccp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_dccp.h
deleted file mode 100644
index e70d11e..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_dccp.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _IPT_DCCP_H_
-#define _IPT_DCCP_H_
-
-#include <linux/netfilter/xt_dccp.h>
-#define IPT_DCCP_SRC_PORTS	XT_DCCP_SRC_PORTS
-#define IPT_DCCP_DEST_PORTS	XT_DCCP_DEST_PORTS
-#define IPT_DCCP_TYPE		XT_DCCP_TYPE
-#define IPT_DCCP_OPTION		XT_DCCP_OPTION
-
-#define IPT_DCCP_VALID_FLAGS 	XT_DCCP_VALID_FLAGS
-
-#define ipt_dccp_info xt_dccp_info
-
-#endif /* _IPT_DCCP_H_ */
-
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_dscp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_dscp.h
deleted file mode 100644
index 4b82ca9..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_dscp.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* iptables module for matching the IPv4 DSCP field
- *
- * (C) 2002 Harald Welte <laforge@gnumonks.org>
- * This software is distributed under GNU GPL v2, 1991
- * 
- * See RFC2474 for a description of the DSCP field within the IP Header.
- *
- * ipt_dscp.h,v 1.3 2002/08/05 19:00:21 laforge Exp
-*/
-#ifndef _IPT_DSCP_H
-#define _IPT_DSCP_H
-
-#include <linux/netfilter/xt_dscp.h>
-
-#define IPT_DSCP_MASK	XT_DSCP_MASK
-#define IPT_DSCP_SHIFT	XT_DSCP_SHIFT
-#define IPT_DSCP_MAX	XT_DSCP_MAX
-
-#define ipt_dscp_info	xt_dscp_info
-
-#endif /* _IPT_DSCP_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ecn.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ecn.h
index 1f0d9a4..0e0c063 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ecn.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ecn.h
@@ -1,33 +1,15 @@
-/* iptables module for matching the ECN header in IPv4 and TCP header
- *
- * (C) 2002 Harald Welte <laforge@gnumonks.org>
- *
- * This software is distributed under GNU GPL v2, 1991
- * 
- * ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
-*/
 #ifndef _IPT_ECN_H
 #define _IPT_ECN_H
-#include <linux/netfilter_ipv4/ipt_dscp.h>
 
-#define IPT_ECN_IP_MASK	(~IPT_DSCP_MASK)
+#include <linux/netfilter/xt_ecn.h>
+#define ipt_ecn_info xt_ecn_info
 
-#define IPT_ECN_OP_MATCH_IP	0x01
-#define IPT_ECN_OP_MATCH_ECE	0x10
-#define IPT_ECN_OP_MATCH_CWR	0x20
-
-#define IPT_ECN_OP_MATCH_MASK	0xce
-
-/* match info */
-struct ipt_ecn_info {
-	u_int8_t operation;
-	u_int8_t invert;
-	u_int8_t ip_ect;
-	union {
-		struct {
-			u_int8_t ect;
-		} tcp;
-	} proto;
+enum {
+	IPT_ECN_IP_MASK       = XT_ECN_IP_MASK,
+	IPT_ECN_OP_MATCH_IP   = XT_ECN_OP_MATCH_IP,
+	IPT_ECN_OP_MATCH_ECE  = XT_ECN_OP_MATCH_ECE,
+	IPT_ECN_OP_MATCH_CWR  = XT_ECN_OP_MATCH_CWR,
+	IPT_ECN_OP_MATCH_MASK = XT_ECN_OP_MATCH_MASK,
 };
 
-#endif /* _IPT_ECN_H */
+#endif /* IPT_ECN_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_esp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_esp.h
deleted file mode 100644
index 78296e7..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_esp.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _IPT_ESP_H
-#define _IPT_ESP_H
-
-#include <linux/netfilter/xt_esp.h>
-
-#define ipt_esp xt_esp
-#define IPT_ESP_INV_SPI		XT_ESP_INV_SPI
-#define IPT_ESP_INV_MASK	XT_ESP_INV_MASK
-
-#endif /*_IPT_ESP_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
deleted file mode 100644
index 5662120..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_hashlimit.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _IPT_HASHLIMIT_H
-#define _IPT_HASHLIMIT_H
-
-#include <linux/netfilter/xt_hashlimit.h>
-
-#define IPT_HASHLIMIT_SCALE	XT_HASHLIMIT_SCALE
-#define IPT_HASHLIMIT_HASH_DIP	XT_HASHLIMIT_HASH_DIP
-#define IPT_HASHLIMIT_HASH_DPT	XT_HASHLIMIT_HASH_DPT
-#define IPT_HASHLIMIT_HASH_SIP	XT_HASHLIMIT_HASH_SIP
-#define IPT_HASHLIMIT_HASH_SPT	XT_HASHLIMIT_HASH_SPT
-
-#define ipt_hashlimit_info xt_hashlimit_info
-
-#endif /* _IPT_HASHLIMIT_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_helper.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_helper.h
deleted file mode 100644
index 80452c2..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_helper.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _IPT_HELPER_H
-#define _IPT_HELPER_H
-
-#include <linux/netfilter/xt_helper.h>
-#define ipt_helper_info xt_helper_info
-
-#endif /* _IPT_HELPER_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_iprange.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_iprange.h
deleted file mode 100644
index 5f1aebd..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_iprange.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _IPT_IPRANGE_H
-#define _IPT_IPRANGE_H
-
-#include <linux/types.h>
-#include <linux/netfilter/xt_iprange.h>
-
-struct ipt_iprange {
-	/* Inclusive: network order. */
-	__be32 min_ip, max_ip;
-};
-
-struct ipt_iprange_info
-{
-	struct ipt_iprange src;
-	struct ipt_iprange dst;
-
-	/* Flags from above */
-	u_int8_t flags;
-};
-
-#endif /* _IPT_IPRANGE_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_length.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_length.h
deleted file mode 100644
index 9b45206..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_length.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _IPT_LENGTH_H
-#define _IPT_LENGTH_H
-
-#include <linux/netfilter/xt_length.h>
-#define ipt_length_info xt_length_info
-
-#endif /*_IPT_LENGTH_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_limit.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_limit.h
deleted file mode 100644
index 92f5cd0..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_limit.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _IPT_RATE_H
-#define _IPT_RATE_H
-
-#include <linux/netfilter/xt_limit.h>
-#define IPT_LIMIT_SCALE XT_LIMIT_SCALE
-#define ipt_rateinfo xt_rateinfo
-
-#endif /*_IPT_RATE_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_mac.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_mac.h
deleted file mode 100644
index b186008..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_mac.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _IPT_MAC_H
-#define _IPT_MAC_H
-
-#include <linux/netfilter/xt_mac.h>
-#define ipt_mac_info xt_mac_info
-
-#endif /*_IPT_MAC_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_mark.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_mark.h
deleted file mode 100644
index bfde67c..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_mark.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _IPT_MARK_H
-#define _IPT_MARK_H
-
-/* Backwards compatibility for old userspace */
-#include <linux/netfilter/xt_mark.h>
-
-#define ipt_mark_info xt_mark_info
-
-#endif /*_IPT_MARK_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_multiport.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_multiport.h
deleted file mode 100644
index 55fe85e..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_multiport.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _IPT_MULTIPORT_H
-#define _IPT_MULTIPORT_H
-
-#include <linux/netfilter/xt_multiport.h>
-
-#define IPT_MULTIPORT_SOURCE		XT_MULTIPORT_SOURCE
-#define IPT_MULTIPORT_DESTINATION	XT_MULTIPORT_DESTINATION
-#define IPT_MULTIPORT_EITHER		XT_MULTIPORT_EITHER
-
-#define IPT_MULTI_PORTS			XT_MULTI_PORTS
-
-#define ipt_multiport			xt_multiport
-#define ipt_multiport_v1		xt_multiport_v1
-
-#endif /*_IPT_MULTIPORT_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_owner.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_owner.h
deleted file mode 100644
index a78445b..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_owner.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _IPT_OWNER_H
-#define _IPT_OWNER_H
-
-/* match and invert flags */
-#define IPT_OWNER_UID	0x01
-#define IPT_OWNER_GID	0x02
-#define IPT_OWNER_PID	0x04
-#define IPT_OWNER_SID	0x08
-#define IPT_OWNER_COMM	0x10
-
-struct ipt_owner_info {
-    __kernel_uid32_t uid;
-    __kernel_gid32_t gid;
-    __kernel_pid_t pid;
-    __kernel_pid_t sid;
-    char comm[16];
-    u_int8_t match, invert;	/* flags */
-};
-
-#endif /*_IPT_OWNER_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_physdev.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_physdev.h
deleted file mode 100644
index 2400e71..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_physdev.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _IPT_PHYSDEV_H
-#define _IPT_PHYSDEV_H
-
-/* Backwards compatibility for old userspace */
-
-#include <linux/netfilter/xt_physdev.h>
-
-#define IPT_PHYSDEV_OP_IN		XT_PHYSDEV_OP_IN
-#define IPT_PHYSDEV_OP_OUT		XT_PHYSDEV_OP_OUT
-#define IPT_PHYSDEV_OP_BRIDGED		XT_PHYSDEV_OP_BRIDGED
-#define IPT_PHYSDEV_OP_ISIN		XT_PHYSDEV_OP_ISIN
-#define IPT_PHYSDEV_OP_ISOUT		XT_PHYSDEV_OP_ISOUT
-#define IPT_PHYSDEV_OP_MASK		XT_PHYSDEV_OP_MASK
-
-#define ipt_physdev_info xt_physdev_info
-
-#endif /*_IPT_PHYSDEV_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_pkttype.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
deleted file mode 100644
index ff1fbc9..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_pkttype.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _IPT_PKTTYPE_H
-#define _IPT_PKTTYPE_H
-
-#include <linux/netfilter/xt_pkttype.h>
-#define ipt_pkttype_info xt_pkttype_info
-
-#endif /*_IPT_PKTTYPE_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_policy.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_policy.h
deleted file mode 100644
index 1037fb2..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_policy.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef _IPT_POLICY_H
-#define _IPT_POLICY_H
-
-#include <linux/netfilter/xt_policy.h>
-
-#define IPT_POLICY_MAX_ELEM		XT_POLICY_MAX_ELEM
-
-/* ipt_policy_flags */
-#define IPT_POLICY_MATCH_IN		XT_POLICY_MATCH_IN
-#define IPT_POLICY_MATCH_OUT		XT_POLICY_MATCH_OUT
-#define IPT_POLICY_MATCH_NONE		XT_POLICY_MATCH_NONE
-#define IPT_POLICY_MATCH_STRICT		XT_POLICY_MATCH_STRICT
-
-/* ipt_policy_modes */
-#define IPT_POLICY_MODE_TRANSPORT	XT_POLICY_MODE_TRANSPORT
-#define IPT_POLICY_MODE_TUNNEL		XT_POLICY_MODE_TUNNEL
-
-#define ipt_policy_spec			xt_policy_spec
-#define ipt_policy_addr			xt_policy_addr
-#define ipt_policy_elem			xt_policy_elem
-#define ipt_policy_info			xt_policy_info
-
-#endif /* _IPT_POLICY_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_recent.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_recent.h
deleted file mode 100644
index d636cca..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_recent.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _IPT_RECENT_H
-#define _IPT_RECENT_H
-
-#include <linux/netfilter/xt_recent.h>
-
-#define ipt_recent_info xt_recent_mtinfo
-
-enum {
-	IPT_RECENT_CHECK    = XT_RECENT_CHECK,
-	IPT_RECENT_SET      = XT_RECENT_SET,
-	IPT_RECENT_UPDATE   = XT_RECENT_UPDATE,
-	IPT_RECENT_REMOVE   = XT_RECENT_REMOVE,
-	IPT_RECENT_TTL      = XT_RECENT_TTL,
-
-	IPT_RECENT_SOURCE   = XT_RECENT_SOURCE,
-	IPT_RECENT_DEST     = XT_RECENT_DEST,
-
-	IPT_RECENT_NAME_LEN = XT_RECENT_NAME_LEN,
-};
-
-#endif /*_IPT_RECENT_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_sctp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_sctp.h
deleted file mode 100644
index 80b3dba..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_sctp.h
+++ /dev/null
@@ -1,105 +0,0 @@
-#ifndef _IPT_SCTP_H_
-#define _IPT_SCTP_H_
-
-#define IPT_SCTP_SRC_PORTS	        0x01
-#define IPT_SCTP_DEST_PORTS	        0x02
-#define IPT_SCTP_CHUNK_TYPES		0x04
-
-#define IPT_SCTP_VALID_FLAGS		0x07
-
-
-struct ipt_sctp_flag_info {
-	u_int8_t chunktype;
-	u_int8_t flag;
-	u_int8_t flag_mask;
-};
-
-#define IPT_NUM_SCTP_FLAGS	4
-
-struct ipt_sctp_info {
-	u_int16_t dpts[2];  /* Min, Max */
-	u_int16_t spts[2];  /* Min, Max */
-
-	u_int32_t chunkmap[256 / sizeof (u_int32_t)];  /* Bit mask of chunks to be matched according to RFC 2960 */
-
-#define SCTP_CHUNK_MATCH_ANY   0x01  /* Match if any of the chunk types are present */
-#define SCTP_CHUNK_MATCH_ALL   0x02  /* Match if all of the chunk types are present */
-#define SCTP_CHUNK_MATCH_ONLY  0x04  /* Match if these are the only chunk types present */
-
-	u_int32_t chunk_match_type;
-	struct ipt_sctp_flag_info flag_info[IPT_NUM_SCTP_FLAGS];
-	int flag_count;
-
-	u_int32_t flags;
-	u_int32_t invflags;
-};
-
-#define bytes(type) (sizeof(type) * 8)
-
-#define SCTP_CHUNKMAP_SET(chunkmap, type) 		\
-	do { 						\
-		chunkmap[type / bytes(u_int32_t)] |= 	\
-			1 << (type % bytes(u_int32_t));	\
-	} while (0)
-
-#define SCTP_CHUNKMAP_CLEAR(chunkmap, type)		 	\
-	do {							\
-		chunkmap[type / bytes(u_int32_t)] &= 		\
-			~(1 << (type % bytes(u_int32_t)));	\
-	} while (0)
-
-#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) 			\
-({								\
-	(chunkmap[type / bytes (u_int32_t)] & 			\
-		(1 << (type % bytes (u_int32_t)))) ? 1: 0;	\
-})
-
-#define SCTP_CHUNKMAP_RESET(chunkmap) 				\
-	do {							\
-		int i; 						\
-		for (i = 0; i < ARRAY_SIZE(chunkmap); i++)	\
-			chunkmap[i] = 0;			\
-	} while (0)
-
-#define SCTP_CHUNKMAP_SET_ALL(chunkmap) 			\
-	do {							\
-		int i; 						\
-		for (i = 0; i < ARRAY_SIZE(chunkmap); i++)	\
-			chunkmap[i] = ~0;			\
-	} while (0)
-
-#define SCTP_CHUNKMAP_COPY(destmap, srcmap) 			\
-	do {							\
-		int i; 						\
-		for (i = 0; i < ARRAY_SIZE(chunkmap); i++)	\
-			destmap[i] = srcmap[i];			\
-	} while (0)
-
-#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) 		\
-({							\
-	int i; 						\
-	int flag = 1;					\
-	for (i = 0; i < ARRAY_SIZE(chunkmap); i++) {	\
-		if (chunkmap[i]) {			\
-			flag = 0;			\
-			break;				\
-		}					\
-	}						\
-        flag;						\
-})
-
-#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) 		\
-({							\
-	int i; 						\
-	int flag = 1;					\
-	for (i = 0; i < ARRAY_SIZE(chunkmap); i++) {	\
-		if (chunkmap[i] != ~0) {		\
-			flag = 0;			\
-				break;			\
-		}					\
-	}						\
-        flag;						\
-})
-
-#endif /* _IPT_SCTP_H_ */
-
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_state.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_state.h
deleted file mode 100644
index a44a99c..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_state.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _IPT_STATE_H
-#define _IPT_STATE_H
-
-/* Backwards compatibility for old userspace */
-
-#include <linux/netfilter/xt_state.h>
-
-#define IPT_STATE_BIT		XT_STATE_BIT
-#define IPT_STATE_INVALID	XT_STATE_INVALID
-
-#define IPT_STATE_UNTRACKED	XT_STATE_UNTRACKED
-
-#define ipt_state_info		xt_state_info
-
-#endif /*_IPT_STATE_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_string.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_string.h
deleted file mode 100644
index c26de30..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_string.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _IPT_STRING_H
-#define _IPT_STRING_H
-
-#include <linux/netfilter/xt_string.h>
-
-#define IPT_STRING_MAX_PATTERN_SIZE XT_STRING_MAX_PATTERN_SIZE
-#define IPT_STRING_MAX_ALGO_NAME_SIZE XT_STRING_MAX_ALGO_NAME_SIZE
-#define ipt_string_info xt_string_info
-
-#endif /*_IPT_STRING_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_tcpmss.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_tcpmss.h
deleted file mode 100644
index 18bbc8e..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_tcpmss.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _IPT_TCPMSS_MATCH_H
-#define _IPT_TCPMSS_MATCH_H
-
-#include <linux/netfilter/xt_tcpmss.h>
-#define ipt_tcpmss_match_info xt_tcpmss_match_info
-
-#endif /*_IPT_TCPMSS_MATCH_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_tos.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_tos.h
deleted file mode 100644
index a21f5df..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_tos.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _IPT_TOS_H
-#define _IPT_TOS_H
-
-struct ipt_tos_info {
-    u_int8_t tos;
-    u_int8_t invert;
-};
-
-#ifndef IPTOS_NORMALSVC
-#define IPTOS_NORMALSVC 0
-#endif
-
-#endif /*_IPT_TOS_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ttl.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ttl.h
index ee24fd8..37bee44 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ttl.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv4/ipt_ttl.h
@@ -4,6 +4,8 @@
 #ifndef _IPT_TTL_H
 #define _IPT_TTL_H
 
+#include <linux/types.h>
+
 enum {
 	IPT_TTL_EQ = 0,		/* equals */
 	IPT_TTL_NE,		/* not equals */
@@ -13,8 +15,8 @@
 
 
 struct ipt_ttl_info {
-	u_int8_t	mode;
-	u_int8_t	ttl;
+	__u8	mode;
+	__u8	ttl;
 };
 
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6.h
index 7430b39..f8ebda2 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6.h
@@ -11,6 +11,9 @@
 #include <linux/netfilter.h>
 
 /* only for userspace compatibility */
+
+#include <limits.h> /* for INT_MIN, INT_MAX */
+
 /* IP Cache bits. */
 /* Src IP address. */
 #define NFC_IP6_SRC              0x0001
@@ -57,6 +60,7 @@
 enum nf_ip6_hook_priorities {
 	NF_IP6_PRI_FIRST = INT_MIN,
 	NF_IP6_PRI_CONNTRACK_DEFRAG = -400,
+	NF_IP6_PRI_RAW = -300,
 	NF_IP6_PRI_SELINUX_FIRST = -225,
 	NF_IP6_PRI_CONNTRACK = -200,
 	NF_IP6_PRI_MANGLE = -150,
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6_tables.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6_tables.h
index 70ed8a1..4432dd1 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6_tables.h
@@ -23,11 +23,38 @@
 
 #define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
 #define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
-
 #define ip6t_match xt_match
 #define ip6t_target xt_target
 #define ip6t_table xt_table
 #define ip6t_get_revision xt_get_revision
+#define ip6t_entry_match xt_entry_match
+#define ip6t_entry_target xt_entry_target
+#define ip6t_standard_target xt_standard_target
+#define ip6t_error_target xt_error_target
+#define ip6t_counters xt_counters
+#define IP6T_CONTINUE XT_CONTINUE
+#define IP6T_RETURN XT_RETURN
+
+/* Pre-iptables-1.4.0 */
+#include <linux/netfilter/xt_tcpudp.h>
+#define ip6t_tcp xt_tcp
+#define ip6t_udp xt_udp
+#define IP6T_TCP_INV_SRCPT	XT_TCP_INV_SRCPT
+#define IP6T_TCP_INV_DSTPT	XT_TCP_INV_DSTPT
+#define IP6T_TCP_INV_FLAGS	XT_TCP_INV_FLAGS
+#define IP6T_TCP_INV_OPTION	XT_TCP_INV_OPTION
+#define IP6T_TCP_INV_MASK	XT_TCP_INV_MASK
+#define IP6T_UDP_INV_SRCPT	XT_UDP_INV_SRCPT
+#define IP6T_UDP_INV_DSTPT	XT_UDP_INV_DSTPT
+#define IP6T_UDP_INV_MASK	XT_UDP_INV_MASK
+
+#define ip6t_counters_info xt_counters_info
+#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET
+#define IP6T_ERROR_TARGET XT_ERROR_TARGET
+#define IP6T_MATCH_ITERATE(e, fn, args...) \
+	XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args)
+#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
+	XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args)
 
 /* Yes, Virginia, you have to zero the padding. */
 struct ip6t_ip6 {
@@ -46,22 +73,16 @@
 	 *   MH do not match any packets.
 	 * - You also need to set IP6T_FLAGS_PROTO to "flags" to check protocol.
 	 */
-	u_int16_t proto;
+	__u16 proto;
 	/* TOS to match iff flags & IP6T_F_TOS */
-	u_int8_t tos;
+	__u8 tos;
 
 	/* Flags word */
-	u_int8_t flags;
+	__u8 flags;
 	/* Inverse flags */
-	u_int8_t invflags;
+	__u8 invflags;
 };
 
-#define ip6t_entry_match xt_entry_match
-#define ip6t_entry_target xt_entry_target
-#define ip6t_standard_target xt_standard_target
-
-#define ip6t_counters	xt_counters
-
 /* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */
 #define IP6T_F_PROTO		0x01	/* Set if rule cares about upper 
 					   protocols */
@@ -82,17 +103,16 @@
 /* This structure defines each of the firewall rules.  Consists of 3
    parts which are 1) general IP header stuff 2) match specific
    stuff 3) the target to perform if the rule matches */
-struct ip6t_entry
-{
+struct ip6t_entry {
 	struct ip6t_ip6 ipv6;
 
 	/* Mark with fields that we care about. */
 	unsigned int nfcache;
 
 	/* Size of ipt_entry + matches */
-	u_int16_t target_offset;
+	__u16 target_offset;
 	/* Size of ipt_entry + matches + target */
-	u_int16_t next_offset;
+	__u16 next_offset;
 
 	/* Back pointer */
 	unsigned int comefrom;
@@ -105,22 +125,14 @@
 };
 
 /* Standard entry */
-struct ip6t_standard
-{
+struct ip6t_standard {
 	struct ip6t_entry entry;
-	struct ip6t_standard_target target;
+	struct xt_standard_target target;
 };
 
-struct ip6t_error_target
-{
-	struct ip6t_entry_target target;
-	char errorname[IP6T_FUNCTION_MAXNAMELEN];
-};
-
-struct ip6t_error
-{
+struct ip6t_error {
 	struct ip6t_entry entry;
-	struct ip6t_error_target target;
+	struct xt_error_target target;
 };
 
 #define IP6T_ENTRY_INIT(__size)						       \
@@ -132,16 +144,16 @@
 #define IP6T_STANDARD_INIT(__verdict)					       \
 {									       \
 	.entry		= IP6T_ENTRY_INIT(sizeof(struct ip6t_standard)),       \
-	.target		= XT_TARGET_INIT(IP6T_STANDARD_TARGET,		       \
-					 sizeof(struct ip6t_standard_target)), \
+	.target		= XT_TARGET_INIT(XT_STANDARD_TARGET,		       \
+					 sizeof(struct xt_standard_target)),   \
 	.target.verdict	= -(__verdict) - 1,				       \
 }
 
 #define IP6T_ERROR_INIT							       \
 {									       \
 	.entry		= IP6T_ENTRY_INIT(sizeof(struct ip6t_error)),	       \
-	.target		= XT_TARGET_INIT(IP6T_ERROR_TARGET,		       \
-					 sizeof(struct ip6t_error_target)),    \
+	.target		= XT_TARGET_INIT(XT_ERROR_TARGET,		       \
+					 sizeof(struct xt_error_target)),      \
 	.target.errorname = "ERROR",					       \
 }
 
@@ -164,46 +176,20 @@
 #define IP6T_SO_GET_REVISION_TARGET	(IP6T_BASE_CTL + 5)
 #define IP6T_SO_GET_MAX			IP6T_SO_GET_REVISION_TARGET
 
-/* CONTINUE verdict for targets */
-#define IP6T_CONTINUE XT_CONTINUE
-
-/* For standard target */
-#define IP6T_RETURN XT_RETURN
-
-/* TCP/UDP matching stuff */
-#include <linux/netfilter/xt_tcpudp.h>
-
-#define ip6t_tcp xt_tcp
-#define ip6t_udp xt_udp
-
-/* Values for "inv" field in struct ipt_tcp. */
-#define IP6T_TCP_INV_SRCPT	XT_TCP_INV_SRCPT
-#define IP6T_TCP_INV_DSTPT	XT_TCP_INV_DSTPT
-#define IP6T_TCP_INV_FLAGS	XT_TCP_INV_FLAGS
-#define IP6T_TCP_INV_OPTION	XT_TCP_INV_OPTION
-#define IP6T_TCP_INV_MASK	XT_TCP_INV_MASK
-
-/* Values for "invflags" field in struct ipt_udp. */
-#define IP6T_UDP_INV_SRCPT	XT_UDP_INV_SRCPT
-#define IP6T_UDP_INV_DSTPT	XT_UDP_INV_DSTPT
-#define IP6T_UDP_INV_MASK	XT_UDP_INV_MASK
-
 /* ICMP matching stuff */
-struct ip6t_icmp
-{
-	u_int8_t type;				/* type to match */
-	u_int8_t code[2];			/* range of code */
-	u_int8_t invflags;			/* Inverse flags */
+struct ip6t_icmp {
+	__u8 type;				/* type to match */
+	__u8 code[2];				/* range of code */
+	__u8 invflags;				/* Inverse flags */
 };
 
 /* Values for "inv" field for struct ipt_icmp. */
 #define IP6T_ICMP_INV	0x01	/* Invert the sense of type/code test */
 
 /* The argument to IP6T_SO_GET_INFO */
-struct ip6t_getinfo
-{
+struct ip6t_getinfo {
 	/* Which table: caller fills this in. */
-	char name[IP6T_TABLE_MAXNAMELEN];
+	char name[XT_TABLE_MAXNAMELEN];
 
 	/* Kernel fills these in. */
 	/* Which hook entry points are valid: bitmask */
@@ -223,10 +209,9 @@
 };
 
 /* The argument to IP6T_SO_SET_REPLACE. */
-struct ip6t_replace
-{
+struct ip6t_replace {
 	/* Which table. */
-	char name[IP6T_TABLE_MAXNAMELEN];
+	char name[XT_TABLE_MAXNAMELEN];
 
 	/* Which hook entry points are valid: bitmask.  You can't
            change this. */
@@ -254,14 +239,10 @@
 	struct ip6t_entry entries[0];
 };
 
-/* The argument to IP6T_SO_ADD_COUNTERS. */
-#define ip6t_counters_info xt_counters_info
-
 /* The argument to IP6T_SO_GET_ENTRIES. */
-struct ip6t_get_entries
-{
+struct ip6t_get_entries {
 	/* Which table: user fills this in. */
-	char name[IP6T_TABLE_MAXNAMELEN];
+	char name[XT_TABLE_MAXNAMELEN];
 
 	/* User fills this in: total entry size. */
 	unsigned int size;
@@ -270,26 +251,13 @@
 	struct ip6t_entry entrytable[0];
 };
 
-/* Standard return verdict, or do jump. */
-#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET
-/* Error verdict. */
-#define IP6T_ERROR_TARGET XT_ERROR_TARGET
-
 /* Helper functions */
-static __inline__ struct ip6t_entry_target *
+static __inline__ struct xt_entry_target *
 ip6t_get_target(struct ip6t_entry *e)
 {
 	return (void *)e + e->target_offset;
 }
 
-/* fn returns 0 to continue iteration */
-#define IP6T_MATCH_ITERATE(e, fn, args...) \
-	XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args)
-
-/* fn returns 0 to continue iteration */
-#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
-	XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args)
-
 /*
  *	Main firewall chains definitions and global var's definitions.
  */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_HL.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_HL.h
index afb7813..ebd8ead 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_HL.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_HL.h
@@ -5,6 +5,8 @@
 #ifndef _IP6T_HL_H
 #define _IP6T_HL_H
 
+#include <linux/types.h>
+
 enum {
 	IP6T_HL_SET = 0,
 	IP6T_HL_INC,
@@ -14,8 +16,8 @@
 #define IP6T_HL_MAXMODE	IP6T_HL_DEC
 
 struct ip6t_HL_info {
-	u_int8_t	mode;
-	u_int8_t	hop_limit;
+	__u8	mode;
+	__u8	hop_limit;
 };
 
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_LOG.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
index 0d0119b..9dd5579 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_LOG.h
@@ -7,7 +7,8 @@
 #define IP6T_LOG_IPOPT		0x04	/* Log IP options */
 #define IP6T_LOG_UID		0x08	/* Log UID owning local socket */
 #define IP6T_LOG_NFLOG		0x10	/* Unsupported, don't use */
-#define IP6T_LOG_MASK		0x1f
+#define IP6T_LOG_MACDECODE	0x20	/* Decode MAC header */
+#define IP6T_LOG_MASK		0x2f
 
 struct ip6t_log_info {
 	unsigned char level;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_MARK.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_MARK.h
deleted file mode 100644
index 7cf629a..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_MARK.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _IP6T_MARK_H_target
-#define _IP6T_MARK_H_target
-
-/* Backwards compatibility for old userspace */
-#include <linux/netfilter/xt_MARK.h>
-
-#define ip6t_mark_target_info xt_mark_target_info
-
-#endif /*_IP6T_MARK_H_target*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
index 6be6504..205ed62 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_REJECT.h
@@ -1,6 +1,8 @@
 #ifndef _IP6T_REJECT_H
 #define _IP6T_REJECT_H
 
+#include <linux/types.h>
+
 enum ip6t_reject_with {
 	IP6T_ICMP6_NO_ROUTE,
 	IP6T_ICMP6_ADM_PROHIBITED,
@@ -12,7 +14,7 @@
 };
 
 struct ip6t_reject_info {
-	u_int32_t	with;	/* reject type */
+	__u32	with;	/* reject type */
 };
 
 #endif /*_IP6T_REJECT_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_ah.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_ah.h
index 8531879..5da2b65 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_ah.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_ah.h
@@ -1,12 +1,13 @@
 #ifndef _IP6T_AH_H
 #define _IP6T_AH_H
 
-struct ip6t_ah
-{
-	u_int32_t spis[2];			/* Security Parameter Index */
-	u_int32_t hdrlen;			/* Header Length */
-	u_int8_t  hdrres;			/* Test of the Reserved Filed */
-	u_int8_t  invflags;			/* Inverse flags */
+#include <linux/types.h>
+
+struct ip6t_ah {
+	__u32 spis[2];			/* Security Parameter Index */
+	__u32 hdrlen;			/* Header Length */
+	__u8  hdrres;			/* Test of the Reserved Filed */
+	__u8  invflags;			/* Inverse flags */
 };
 
 #define IP6T_AH_SPI 0x01
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_esp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_esp.h
deleted file mode 100644
index f62eaf5..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_esp.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _IP6T_ESP_H
-#define _IP6T_ESP_H
-
-#include <linux/netfilter/xt_esp.h>
-
-#define ip6t_esp xt_esp
-#define IP6T_ESP_INV_SPI	XT_ESP_INV_SPI
-#define IP6T_ESP_INV_MASK	XT_ESP_INV_MASK
-
-#endif /*_IP6T_ESP_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_frag.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_frag.h
index 66070a0..b47f61b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_frag.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_frag.h
@@ -1,12 +1,13 @@
 #ifndef _IP6T_FRAG_H
 #define _IP6T_FRAG_H
 
-struct ip6t_frag
-{
-	u_int32_t ids[2];			/* Security Parameter Index */
-	u_int32_t hdrlen;			/* Header Length */
-	u_int8_t  flags;			/*  */
-	u_int8_t  invflags;			/* Inverse flags */
+#include <linux/types.h>
+
+struct ip6t_frag {
+	__u32 ids[2];			/* Security Parameter Index */
+	__u32 hdrlen;			/* Header Length */
+	__u8  flags;			/*  */
+	__u8  invflags;			/* Inverse flags */
 };
 
 #define IP6T_FRAG_IDS 		0x01
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_hl.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_hl.h
index 5ef91b8..6e76dbc 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_hl.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_hl.h
@@ -5,6 +5,8 @@
 #ifndef _IP6T_HL_H
 #define _IP6T_HL_H
 
+#include <linux/types.h>
+
 enum {
 	IP6T_HL_EQ = 0,		/* equals */
 	IP6T_HL_NE,		/* not equals */
@@ -14,8 +16,8 @@
 
 
 struct ip6t_hl_info {
-	u_int8_t	mode;
-	u_int8_t	hop_limit;
+	__u8	mode;
+	__u8	hop_limit;
 };
 
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
index 51c53fc..efae3a2 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_ipv6header.h
@@ -8,11 +8,12 @@
 #ifndef __IPV6HEADER_H
 #define __IPV6HEADER_H
 
-struct ip6t_ipv6header_info
-{
-	u_int8_t matchflags;
-	u_int8_t invflags;
-	u_int8_t modeflag;
+#include <linux/types.h>
+
+struct ip6t_ipv6header_info {
+	__u8 matchflags;
+	__u8 invflags;
+	__u8 modeflag;
 };
 
 #define MASK_HOPOPTS    128
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_length.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_length.h
deleted file mode 100644
index 9e9689d..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_length.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _IP6T_LENGTH_H
-#define _IP6T_LENGTH_H
-
-#include <linux/netfilter/xt_length.h>
-#define ip6t_length_info xt_length_info
-
-#endif /*_IP6T_LENGTH_H*/
-	
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_limit.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_limit.h
deleted file mode 100644
index 487e5ea..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_limit.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _IP6T_RATE_H
-#define _IP6T_RATE_H
-
-#include <linux/netfilter/xt_limit.h>
-#define IP6T_LIMIT_SCALE XT_LIMIT_SCALE
-#define ip6t_rateinfo xt_rateinfo
-
-#endif /*_IP6T_RATE_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_mac.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_mac.h
deleted file mode 100644
index ac58e83..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_mac.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _IP6T_MAC_H
-#define _IP6T_MAC_H
-
-#include <linux/netfilter/xt_mac.h>
-#define ip6t_mac_info xt_mac_info
-
-#endif /*_IP6T_MAC_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_mark.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_mark.h
deleted file mode 100644
index ff20495..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_mark.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _IP6T_MARK_H
-#define _IP6T_MARK_H
-
-/* Backwards compatibility for old userspace */
-#include <linux/netfilter/xt_mark.h>
-
-#define ip6t_mark_info xt_mark_info
-
-#endif /*_IPT_MARK_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_mh.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_mh.h
index b9ca9a5..a7729a5 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_mh.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_mh.h
@@ -1,11 +1,12 @@
 #ifndef _IP6T_MH_H
 #define _IP6T_MH_H
 
+#include <linux/types.h>
+
 /* MH matching stuff */
-struct ip6t_mh
-{
-	u_int8_t types[2];	/* MH type range */
-	u_int8_t invflags;	/* Inverse flags */
+struct ip6t_mh {
+	__u8 types[2];	/* MH type range */
+	__u8 invflags;	/* Inverse flags */
 };
 
 /* Values for "invflags" field in struct ip6t_mh. */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_multiport.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_multiport.h
deleted file mode 100644
index 042c926..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_multiport.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _IP6T_MULTIPORT_H
-#define _IP6T_MULTIPORT_H
-
-#include <linux/netfilter/xt_multiport.h>
-
-#define IP6T_MULTIPORT_SOURCE		XT_MULTIPORT_SOURCE
-#define IP6T_MULTIPORT_DESTINATION	XT_MULTIPORT_DESTINATION
-#define IP6T_MULTIPORT_EITHER		XT_MULTIPORT_EITHER
-
-#define IP6T_MULTI_PORTS		XT_MULTI_PORTS
-
-#define ip6t_multiport			xt_multiport
-
-#endif /*_IP6T_MULTIPORT_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_opts.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_opts.h
index a07e363..17d419a 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_opts.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_opts.h
@@ -1,15 +1,16 @@
 #ifndef _IP6T_OPTS_H
 #define _IP6T_OPTS_H
 
+#include <linux/types.h>
+
 #define IP6T_OPTS_OPTSNR 16
 
-struct ip6t_opts
-{
-	u_int32_t hdrlen;			/* Header Length */
-	u_int8_t flags;				/*  */
-	u_int8_t invflags;			/* Inverse flags */
-	u_int16_t opts[IP6T_OPTS_OPTSNR];	/* opts */
-	u_int8_t optsnr;			/* Nr of OPts */
+struct ip6t_opts {
+	__u32 hdrlen;			/* Header Length */
+	__u8 flags;				/*  */
+	__u8 invflags;			/* Inverse flags */
+	__u16 opts[IP6T_OPTS_OPTSNR];	/* opts */
+	__u8 optsnr;			/* Nr of OPts */
 };
 
 #define IP6T_OPTS_LEN 		0x01
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_owner.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_owner.h
deleted file mode 100644
index ec5cc7a..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_owner.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _IP6T_OWNER_H
-#define _IP6T_OWNER_H
-
-/* match and invert flags */
-#define IP6T_OWNER_UID	0x01
-#define IP6T_OWNER_GID	0x02
-#define IP6T_OWNER_PID	0x04
-#define IP6T_OWNER_SID	0x08
-
-struct ip6t_owner_info {
-    __kernel_uid32_t uid;
-    __kernel_gid32_t gid;
-    __kernel_pid_t pid;
-    __kernel_pid_t sid;
-    u_int8_t match, invert;	/* flags */
-};
-
-#endif /*_IPT_OWNER_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_physdev.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
deleted file mode 100644
index c161c0a..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_physdev.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _IP6T_PHYSDEV_H
-#define _IP6T_PHYSDEV_H
-
-/* Backwards compatibility for old userspace */
-
-#include <linux/netfilter/xt_physdev.h>
-
-#define IP6T_PHYSDEV_OP_IN		XT_PHYSDEV_OP_IN
-#define IP6T_PHYSDEV_OP_OUT		XT_PHYSDEV_OP_OUT
-#define IP6T_PHYSDEV_OP_BRIDGED		XT_PHYSDEV_OP_BRIDGED
-#define IP6T_PHYSDEV_OP_ISIN		XT_PHYSDEV_OP_ISIN
-#define IP6T_PHYSDEV_OP_ISOUT		XT_PHYSDEV_OP_ISOUT
-#define IP6T_PHYSDEV_OP_MASK		XT_PHYSDEV_OP_MASK
-
-#define ip6t_physdev_info xt_physdev_info
-
-#endif /*_IP6T_PHYSDEV_H*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_policy.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_policy.h
deleted file mode 100644
index b1c449d..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_policy.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef _IP6T_POLICY_H
-#define _IP6T_POLICY_H
-
-#include <linux/netfilter/xt_policy.h>
-
-#define IP6T_POLICY_MAX_ELEM		XT_POLICY_MAX_ELEM
-
-/* ip6t_policy_flags */
-#define IP6T_POLICY_MATCH_IN		XT_POLICY_MATCH_IN
-#define IP6T_POLICY_MATCH_OUT		XT_POLICY_MATCH_OUT
-#define IP6T_POLICY_MATCH_NONE		XT_POLICY_MATCH_NONE
-#define IP6T_POLICY_MATCH_STRICT	XT_POLICY_MATCH_STRICT
-
-/* ip6t_policy_modes */
-#define IP6T_POLICY_MODE_TRANSPORT	XT_POLICY_MODE_TRANSPORT
-#define IP6T_POLICY_MODE_TUNNEL		XT_POLICY_MODE_TUNNEL
-
-#define ip6t_policy_spec		xt_policy_spec
-#define ip6t_policy_addr		xt_policy_addr
-#define ip6t_policy_elem		xt_policy_elem
-#define ip6t_policy_info		xt_policy_info
-
-#endif /* _IP6T_POLICY_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_rt.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_rt.h
index 5215602..7605a5f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_rt.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netfilter_ipv6/ip6t_rt.h
@@ -1,19 +1,19 @@
 #ifndef _IP6T_RT_H
 #define _IP6T_RT_H
 
+#include <linux/types.h>
 /*#include <linux/in6.h>*/
 
 #define IP6T_RT_HOPS 16
 
-struct ip6t_rt
-{
-	u_int32_t rt_type;			/* Routing Type */
-	u_int32_t segsleft[2];			/* Segments Left */
-	u_int32_t hdrlen;			/* Header Length */
-	u_int8_t  flags;			/*  */
-	u_int8_t  invflags;			/* Inverse flags */
+struct ip6t_rt {
+	__u32 rt_type;			/* Routing Type */
+	__u32 segsleft[2];			/* Segments Left */
+	__u32 hdrlen;			/* Header Length */
+	__u8  flags;			/*  */
+	__u8  invflags;			/* Inverse flags */
 	struct in6_addr addrs[IP6T_RT_HOPS];	/* Hops */
-	u_int8_t addrnr;			/* Nr of Addresses */
+	__u8 addrnr;			/* Nr of Addresses */
 };
 
 #define IP6T_RT_TYP 		0x01
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netlink.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netlink.h
index ec780bb..5c4f087 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netlink.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netlink.h
@@ -1,14 +1,14 @@
 #ifndef __LINUX_NETLINK_H
 #define __LINUX_NETLINK_H
 
-#include <linux/socket.h> /* for sa_family_t */
+#include <linux/socket.h> /* for __kernel_sa_family_t */
 #include <linux/types.h>
 
 #define NETLINK_ROUTE		0	/* Routing/device hook				*/
 #define NETLINK_UNUSED		1	/* Unused number				*/
 #define NETLINK_USERSOCK	2	/* Reserved for user mode socket protocols 	*/
 #define NETLINK_FIREWALL	3	/* Firewalling hook				*/
-#define NETLINK_INET_DIAG	4	/* INET socket monitoring			*/
+#define NETLINK_SOCK_DIAG	4	/* socket monitoring				*/
 #define NETLINK_NFLOG		5	/* netfilter/iptables ULOG */
 #define NETLINK_XFRM		6	/* ipsec */
 #define NETLINK_SELINUX		7	/* SELinux event notifications */
@@ -24,21 +24,21 @@
 /* leave room for NETLINK_DM (DM Events) */
 #define NETLINK_SCSITRANSPORT	18	/* SCSI Transports */
 #define NETLINK_ECRYPTFS	19
+#define NETLINK_RDMA		20
+#define NETLINK_CRYPTO		21	/* Crypto layer */
+
+#define NETLINK_INET_DIAG	NETLINK_SOCK_DIAG
 
 #define MAX_LINKS 32		
 
-struct net;
-
-struct sockaddr_nl
-{
-	sa_family_t	nl_family;	/* AF_NETLINK	*/
+struct sockaddr_nl {
+	__kernel_sa_family_t	nl_family;	/* AF_NETLINK	*/
 	unsigned short	nl_pad;		/* zero		*/
 	__u32		nl_pid;		/* port ID	*/
        	__u32		nl_groups;	/* multicast groups mask */
 };
 
-struct nlmsghdr
-{
+struct nlmsghdr {
 	__u32		nlmsg_len;	/* Length of message including header */
 	__u16		nlmsg_type;	/* Message content */
 	__u16		nlmsg_flags;	/* Additional flags */
@@ -52,6 +52,7 @@
 #define NLM_F_MULTI		2	/* Multipart message, terminated by NLMSG_DONE */
 #define NLM_F_ACK		4	/* Reply with ack, with zero or error code */
 #define NLM_F_ECHO		8	/* Echo this request 		*/
+#define NLM_F_DUMP_INTR		16	/* Dump was inconsistent due to sequence change */
 
 /* Modifiers to GET request */
 #define NLM_F_ROOT	0x100	/* specify tree	root	*/
@@ -74,7 +75,7 @@
    Check		NLM_F_EXCL
  */
 
-#define NLMSG_ALIGNTO	4
+#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))
@@ -94,8 +95,7 @@
 
 #define NLMSG_MIN_TYPE		0x10	/* < 0x10: reserved control messages */
 
-struct nlmsgerr
-{
+struct nlmsgerr {
 	int		error;
 	struct nlmsghdr msg;
 };
@@ -106,8 +106,7 @@
 #define NETLINK_BROADCAST_ERROR	4
 #define NETLINK_NO_ENOBUFS	5
 
-struct nl_pktinfo
-{
+struct nl_pktinfo {
 	__u32	group;
 };
 
@@ -127,8 +126,7 @@
  *  <-------------- nlattr->nla_len -------------->
  */
 
-struct nlattr
-{
+struct nlattr {
 	__u16           nla_len;
 	__u16           nla_type;
 };
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netrom.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netrom.h
index 6939b32..af7313c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/netrom.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/netrom.h
@@ -7,6 +7,8 @@
 #ifndef	NETROM_KERNEL_H
 #define	NETROM_KERNEL_H
 
+#include <linux/ax25.h>
+
 #define NETROM_MTU	236
 
 #define NETROM_T1	1
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs.h
index e2eae87..7705b44 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs.h
@@ -29,6 +29,8 @@
 #define NFS_MNT_VERSION		1
 #define NFS_MNT3_VERSION	3
 
+#define NFS_PIPE_DIRNAME "/nfs"
+
 /*
  * NFS stats. The good thing with these values is that NFSv3 errors are
  * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs3.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs3.h
index 56fa62a..bacfe41 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs3.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs3.h
@@ -11,6 +11,9 @@
 #define NFS3_MAXGROUPS		16
 #define NFS3_FHSIZE		64
 #define NFS3_COOKIESIZE		4
+#define NFS3_CREATEVERFSIZE	8
+#define NFS3_COOKIEVERFSIZE	8
+#define NFS3_WRITEVERFSIZE	8
 #define NFS3_FIFO_DEV		(-1)
 #define NFS3MODE_FMT		0170000
 #define NFS3MODE_DIR		0040000
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs4.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs4.h
index dc89916..acd8db6 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs4.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs4.h
@@ -17,7 +17,9 @@
 
 #define NFS4_BITMAP_SIZE	2
 #define NFS4_VERIFIER_SIZE	8
-#define NFS4_STATEID_SIZE	16
+#define NFS4_STATEID_SEQID_SIZE 4
+#define NFS4_STATEID_OTHER_SIZE 12
+#define NFS4_STATEID_SIZE	(NFS4_STATEID_SEQID_SIZE + NFS4_STATEID_OTHER_SIZE)
 #define NFS4_FHSIZE		128
 #define NFS4_MAXPATHLEN		PATH_MAX
 #define NFS4_MAXNAMLEN		NAME_MAX
@@ -61,6 +63,12 @@
 #define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL	0x10000
 #define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED		0x20000
 
+#define NFS4_CDFC4_FORE	0x1
+#define NFS4_CDFC4_BACK 0x2
+#define NFS4_CDFC4_BOTH 0x3
+#define NFS4_CDFC4_FORE_OR_BOTH 0x3
+#define NFS4_CDFC4_BACK_OR_BOTH 0x7
+
 #define NFS4_SET_TO_SERVER_TIME	0
 #define NFS4_SET_TO_CLIENT_TIME	1
 
@@ -106,9 +114,13 @@
 
 #define EXCHGID4_FLAG_SUPP_MOVED_REFER		0x00000001
 #define EXCHGID4_FLAG_SUPP_MOVED_MIGR		0x00000002
+#define EXCHGID4_FLAG_BIND_PRINC_STATEID	0x00000100
+
 #define EXCHGID4_FLAG_USE_NON_PNFS		0x00010000
 #define EXCHGID4_FLAG_USE_PNFS_MDS		0x00020000
 #define EXCHGID4_FLAG_USE_PNFS_DS		0x00040000
+#define EXCHGID4_FLAG_MASK_PNFS			0x00070000
+
 #define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A	0x40000000
 #define EXCHGID4_FLAG_CONFIRMED_R		0x80000000
 /*
@@ -116,8 +128,8 @@
  * they're set in the argument or response, have separate
  * invalid flag masks for arg (_A) and resp (_R).
  */
-#define EXCHGID4_FLAG_MASK_A			0x40070003
-#define EXCHGID4_FLAG_MASK_R			0x80070003
+#define EXCHGID4_FLAG_MASK_A			0x40070103
+#define EXCHGID4_FLAG_MASK_R			0x80070103
 
 #define SEQ4_STATUS_CB_PATH_DOWN		0x00000001
 #define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING	0x00000002
@@ -128,6 +140,11 @@
 #define SEQ4_STATUS_RECALLABLE_STATE_REVOKED	0x00000040
 #define SEQ4_STATUS_LEASE_MOVED			0x00000080
 #define SEQ4_STATUS_RESTART_RECLAIM_NEEDED	0x00000100
+#define SEQ4_STATUS_CB_PATH_DOWN_SESSION	0x00000200
+#define SEQ4_STATUS_BACKCHANNEL_FAULT		0x00000400
+
+#define NFS4_SECINFO_STYLE4_CURRENT_FH	0
+#define NFS4_SECINFO_STYLE4_PARENT	1
 
 #define NFS4_MAX_UINT64	(~(u64)0)
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs_fs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs_fs.h
index 534aeee..a2bf564 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs_fs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs_fs.h
@@ -33,9 +33,8 @@
 #define FLUSH_STABLE		4	/* commit to stable storage */
 #define FLUSH_LOWPRI		8	/* low priority background flush */
 #define FLUSH_HIGHPRI		16	/* high priority memory reclaim flush */
-#define FLUSH_NOCOMMIT		32	/* Don't send the NFSv3/v4 COMMIT */
-#define FLUSH_INVALIDATE	64	/* Invalidate the page cache */
-#define FLUSH_NOWRITEPAGE	128	/* Don't call writepage() */
+#define FLUSH_COND_STABLE	32	/* conditional stable write - only stable
+					 * if everything fits in one RPC */
 
 
 /*
@@ -53,6 +52,8 @@
 #define NFSDBG_CLIENT		0x0200
 #define NFSDBG_MOUNT		0x0400
 #define NFSDBG_FSCACHE		0x0800
+#define NFSDBG_PNFS		0x1000
+#define NFSDBG_PNFS_LD		0x2000
 #define NFSDBG_ALL		0xFFFF
 
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs_mount.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs_mount.h
index 4499016..576bddd 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs_mount.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfs_mount.h
@@ -69,5 +69,9 @@
 #define NFS_MOUNT_LOOKUP_CACHE_NONEG	0x10000
 #define NFS_MOUNT_LOOKUP_CACHE_NONE	0x20000
 #define NFS_MOUNT_NORESVPORT		0x40000
+#define NFS_MOUNT_LEGACY_INTERFACE	0x80000
+
+#define NFS_MOUNT_LOCAL_FLOCK	0x100000
+#define NFS_MOUNT_LOCAL_FCNTL	0x200000
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/const.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/const.h
deleted file mode 100644
index 22ffb9a..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/const.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * include/linux/nfsd/const.h
- *
- * Various constants related to NFS.
- *
- * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
- */
-
-#ifndef _LINUX_NFSD_CONST_H
-#define _LINUX_NFSD_CONST_H
-
-#include <linux/nfs.h>
-#include <linux/nfs2.h>
-#include <linux/nfs3.h>
-#include <linux/nfs4.h>
-
-/*
- * Maximum protocol version supported by knfsd
- */
-#define NFSSVC_MAXVERS		3
-
-/*
- * Maximum blocksizes supported by daemon under various circumstances.
- */
-#define NFSSVC_MAXBLKSIZE	RPCSVC_MAXPAYLOAD
-/* NFSv2 is limited by the protocol specification, see RFC 1094 */
-#define NFSSVC_MAXBLKSIZE_V2	(8*1024)
-
-
-#endif /* _LINUX_NFSD_CONST_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/export.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/export.h
index 8429a17..6b20142 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/export.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/export.h
@@ -32,15 +32,27 @@
 #define NFSEXP_NOHIDE		0x0200
 #define NFSEXP_NOSUBTREECHECK	0x0400
 #define	NFSEXP_NOAUTHNLM	0x0800		/* Don't authenticate NLM requests - just trust */
-#define NFSEXP_MSNFS		0x1000	/* do silly things that MS clients expect */
+#define NFSEXP_MSNFS		0x1000	/* do silly things that MS clients expect; no longer supported */
 #define NFSEXP_FSID		0x2000
 #define	NFSEXP_CROSSMOUNT	0x4000
 #define	NFSEXP_NOACL		0x8000	/* reserved for possible ACL related use */
-#define NFSEXP_ALLFLAGS		0xFE3F
+/*
+ * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4
+ * clients, and only to the single directory that is the root of the
+ * export; further lookup and readdir operations are treated as if every
+ * subdirectory was a mountpoint, and ignored if they are not themselves
+ * exported.  This is used by nfsd and mountd to construct the NFSv4
+ * pseudofilesystem, which provides access only to paths leading to each
+ * exported filesystem.
+ */
+#define	NFSEXP_V4ROOT		0x10000
+/* All flags that we claim to support.  (Note we don't support NOACL.) */
+#define NFSEXP_ALLFLAGS		0x17E3F
 
 /* The flags that may vary depending on security flavor: */
 #define NFSEXP_SECINFO_FLAGS	(NFSEXP_READONLY | NFSEXP_ROOTSQUASH \
-					| NFSEXP_ALLSQUASH)
+					| NFSEXP_ALLSQUASH \
+					| NFSEXP_INSECURE_PORT)
 
 
 #endif /* NFSD_EXPORT_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/nfsfh.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/nfsfh.h
index 043273c..07f80e6 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/nfsfh.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/nfsfh.h
@@ -14,9 +14,11 @@
 #ifndef _LINUX_NFSD_FH_H
 #define _LINUX_NFSD_FH_H
 
-# include <linux/types.h>
-#include <linux/nfsd/const.h>
-#include <linux/nfsd/debug.h>
+#include <linux/types.h>
+#include <linux/nfs.h>
+#include <linux/nfs2.h>
+#include <linux/nfs3.h>
+#include <linux/nfs4.h>
 
 /*
  * This is the old "dentry style" Linux NFSv2 file handle.
@@ -38,16 +40,16 @@
  * This is the new flexible, extensible style NFSv2/v3 file handle.
  * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
  *
- * The file handle is seens as a list of 4byte words.
- * The first word contains a version number (1) and four descriptor bytes
+ * The file handle starts with a sequence of four-byte words.
+ * The first word contains a version number (1) and three descriptor bytes
  * that tell how the remaining 3 variable length fields should be handled.
  * These three bytes are auth_type, fsid_type and fileid_type.
  *
- * All 4byte values are in host-byte-order.
+ * All four-byte values are in host-byte-order.
  *
  * The auth_type field specifies how the filehandle can be authenticated
  * This might allow a file to be confirmed to be in a writable part of a
- * filetree without checking the path from it upto the root.
+ * filetree without checking the path from it up to the root.
  * Current values:
  *     0  - No authentication.  fb_auth is 0 bytes long
  * Possible future values:
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/syscall.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/syscall.h
deleted file mode 100644
index d6004ad..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nfsd/syscall.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * include/linux/nfsd/syscall.h
- *
- * This file holds all declarations for the knfsd syscall interface.
- *
- * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
- */
-
-#ifndef NFSD_SYSCALL_H
-#define NFSD_SYSCALL_H
-
-# include <linux/types.h>
-#include <linux/posix_types.h>
-#include <linux/nfsd/const.h>
-#include <linux/nfsd/export.h>
-#include <linux/nfsd/nfsfh.h>
-
-/*
- * Version of the syscall interface
- */
-#define NFSCTL_VERSION		0x0201
-
-/*
- * These are the commands understood by nfsctl().
- */
-#define NFSCTL_SVC		0	/* This is a server process. */
-#define NFSCTL_ADDCLIENT	1	/* Add an NFS client. */
-#define NFSCTL_DELCLIENT	2	/* Remove an NFS client. */
-#define NFSCTL_EXPORT		3	/* export a file system. */
-#define NFSCTL_UNEXPORT		4	/* unexport a file system. */
-/*#define NFSCTL_UGIDUPDATE	5	/ * update a client's uid/gid map. DISCARDED */
-/*#define NFSCTL_GETFH		6	/ * get an fh by ino DISCARDED */
-#define NFSCTL_GETFD		7	/* get an fh by path (used by mountd) */
-#define	NFSCTL_GETFS		8	/* get an fh by path with max FH len */
-
-/* SVC */
-struct nfsctl_svc {
-	unsigned short		svc_port;
-	int			svc_nthreads;
-};
-
-/* ADDCLIENT/DELCLIENT */
-struct nfsctl_client {
-	char			cl_ident[NFSCLNT_IDMAX+1];
-	int			cl_naddr;
-	struct in_addr		cl_addrlist[NFSCLNT_ADDRMAX];
-	int			cl_fhkeytype;
-	int			cl_fhkeylen;
-	unsigned char		cl_fhkey[NFSCLNT_KEYMAX];
-};
-
-/* EXPORT/UNEXPORT */
-struct nfsctl_export {
-	char			ex_client[NFSCLNT_IDMAX+1];
-	char			ex_path[NFS_MAXPATHLEN+1];
-	__kernel_old_dev_t	ex_dev;
-	__kernel_ino_t		ex_ino;
-	int			ex_flags;
-	__kernel_uid_t		ex_anon_uid;
-	__kernel_gid_t		ex_anon_gid;
-};
-
-/* GETFD */
-struct nfsctl_fdparm {
-	struct sockaddr		gd_addr;
-	char			gd_path[NFS_MAXPATHLEN+1];
-	int			gd_version;
-};
-
-/* GETFS - GET Filehandle with Size */
-struct nfsctl_fsparm {
-	struct sockaddr		gd_addr;
-	char			gd_path[NFS_MAXPATHLEN+1];
-	int			gd_maxlen;
-};
-
-/*
- * This is the argument union.
- */
-struct nfsctl_arg {
-	int			ca_version;	/* safeguard */
-	union {
-		struct nfsctl_svc	u_svc;
-		struct nfsctl_client	u_client;
-		struct nfsctl_export	u_export;
-		struct nfsctl_fdparm	u_getfd;
-		struct nfsctl_fsparm	u_getfs;
-		/*
-		 * The following dummy member is needed to preserve binary compatibility
-		 * on platforms where alignof(void*)>alignof(int).  It's needed because
-		 * this union used to contain a member (u_umap) which contained a
-		 * pointer.
-		 */
-		void *u_ptr;
-	} u;
-#define ca_svc		u.u_svc
-#define ca_client	u.u_client
-#define ca_export	u.u_export
-#define ca_getfd	u.u_getfd
-#define	ca_getfs	u.u_getfs
-};
-
-union nfsctl_res {
-	__u8			cr_getfh[NFS_FHSIZE];
-	struct knfsd_fh		cr_getfs;
-};
-
-
-#endif /* NFSD_SYSCALL_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nl80211.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nl80211.h
index dbea93b..0f5ff37 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/nl80211.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/nl80211.h
@@ -3,10 +3,10 @@
 /*
  * 802.11 netlink interface public header
  *
- * Copyright 2006, 2007, 2008 Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
  * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
- * Copyright 2008 Michael Buesch <mb@bu3sch.de>
+ * Copyright 2008 Michael Buesch <m@bues.ch>
  * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com>
  * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
  * Copyright 2008 Colin McCabe <colin@cozybit.com>
@@ -40,6 +40,76 @@
  */
 
 /**
+ * DOC: Frame transmission/registration support
+ *
+ * Frame transmission and registration support exists to allow userspace
+ * management entities such as wpa_supplicant react to management frames
+ * that are not being handled by the kernel. This includes, for example,
+ * certain classes of action frames that cannot be handled in the kernel
+ * for various reasons.
+ *
+ * Frame registration is done on a per-interface basis and registrations
+ * cannot be removed other than by closing the socket. It is possible to
+ * specify a registration filter to register, for example, only for a
+ * certain type of action frame. In particular with action frames, those
+ * that userspace registers for will not be returned as unhandled by the
+ * driver, so that the registered application has to take responsibility
+ * for doing that.
+ *
+ * The type of frame that can be registered for is also dependent on the
+ * driver and interface type. The frame types are advertised in wiphy
+ * attributes so applications know what to expect.
+ *
+ * NOTE: When an interface changes type while registrations are active,
+ *       these registrations are ignored until the interface type is
+ *       changed again. This means that changing the interface type can
+ *       lead to a situation that couldn't otherwise be produced, but
+ *       any such registrations will be dormant in the sense that they
+ *       will not be serviced, i.e. they will not receive any frames.
+ *
+ * Frame transmission allows userspace to send for example the required
+ * responses to action frames. It is subject to some sanity checking,
+ * but many frames can be transmitted. When a frame was transmitted, its
+ * status is indicated to the sending socket.
+ *
+ * For more technical details, see the corresponding command descriptions
+ * below.
+ */
+
+/**
+ * DOC: Virtual interface / concurrency capabilities
+ *
+ * Some devices are able to operate with virtual MACs, they can have
+ * more than one virtual interface. The capability handling for this
+ * is a bit complex though, as there may be a number of restrictions
+ * on the types of concurrency that are supported.
+ *
+ * To start with, each device supports the interface types listed in
+ * the %NL80211_ATTR_SUPPORTED_IFTYPES attribute, but by listing the
+ * types there no concurrency is implied.
+ *
+ * Once concurrency is desired, more attributes must be observed:
+ * To start with, since some interface types are purely managed in
+ * software, like the AP-VLAN type in mac80211 for example, there's
+ * an additional list of these, they can be added at any time and
+ * are only restricted by some semantic restrictions (e.g. AP-VLAN
+ * cannot be added without a corresponding AP interface). This list
+ * is exported in the %NL80211_ATTR_SOFTWARE_IFTYPES attribute.
+ *
+ * Further, the list of supported combinations is exported. This is
+ * in the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute. Basically,
+ * it exports a list of "groups", and at any point in time the
+ * interfaces that are currently active must fall into any one of
+ * the advertised groups. Within each group, there are restrictions
+ * on the number of interfaces of different types that are supported
+ * and also the number of different channels, along with potentially
+ * some other restrictions. See &enum nl80211_if_combination_attrs.
+ *
+ * All together, these attributes define the concurrency of virtual
+ * interfaces that a given device supports.
+ */
+
+/**
  * enum nl80211_commands - supported nl80211 commands
  *
  * @NL80211_CMD_UNSPEC: unspecified command to catch errors
@@ -52,6 +122,8 @@
  *	%NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT,
  *	%NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
  *	and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
+ *	However, for setting the channel, see %NL80211_CMD_SET_CHANNEL
+ *	instead, the support here is for backward compatibility only.
  * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
  *	or rename notification. Has attributes %NL80211_ATTR_WIPHY and
  *	%NL80211_ATTR_WIPHY_NAME.
@@ -89,6 +161,13 @@
  * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface
  *	using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD,
  *	%NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes.
+ *	Following attributes are provided for drivers that generate full Beacon
+ *	and Probe Response frames internally: %NL80211_ATTR_SSID,
+ *	%NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE,
+ *	%NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS,
+ *	%NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY,
+ *	%NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_IE, %NL80211_ATTR_IE_PROBE_RESP,
+ *	%NL80211_ATTR_IE_ASSOC_RESP.
  * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface,
  *	parameters are like for %NL80211_CMD_SET_BEACON.
  * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
@@ -109,6 +188,10 @@
  * @NL80211_CMD_SET_MPATH:  Set mesh path attributes for mesh path to
  * 	destination %NL80211_ATTR_MAC on the interface identified by
  * 	%NL80211_ATTR_IFINDEX.
+ * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by
+ *	%NL80211_ATTR_MAC via %NL80211_ATTR_MPATH_NEXT_HOP.
+ * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by
+ *	%NL80211_ATTR_MAC.
  * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the
  *	the interface identified by %NL80211_ATTR_IFINDEX.
  * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC
@@ -130,13 +213,13 @@
  * 	%NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and
  * 	%NL80211_ATTR_REG_RULE_POWER_MAX_EIRP.
  * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain
- * 	to the the specified ISO/IEC 3166-1 alpha2 country code. The core will
+ * 	to the specified ISO/IEC 3166-1 alpha2 country code. The core will
  * 	store this as a valid request and then query userspace for it.
  *
- * @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the
+ * @NL80211_CMD_GET_MESH_CONFIG: Get mesh networking properties for the
  *	interface identified by %NL80211_ATTR_IFINDEX
  *
- * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the
+ * @NL80211_CMD_SET_MESH_CONFIG: Set mesh networking properties for the
  *      interface identified by %NL80211_ATTR_IFINDEX
  *
  * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The
@@ -155,11 +238,41 @@
  *
  * @NL80211_CMD_GET_SCAN: get scan results
  * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
+ *	%NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
+ *	probe requests at CCK rate or not.
  * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
  *	NL80211_CMD_GET_SCAN and on the "scan" multicast group)
  * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
  *	partial scan results may be available
  *
+ * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
+ *	intervals, as specified by %NL80211_ATTR_SCHED_SCAN_INTERVAL.
+ *	Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
+ *	are passed, they are used in the probe requests.  For
+ *	broadcast, a broadcast SSID must be passed (ie. an empty
+ *	string).  If no SSID is passed, no probe requests are sent and
+ *	a passive scan is performed.  %NL80211_ATTR_SCAN_FREQUENCIES,
+ *	if passed, define which channels should be scanned; if not
+ *	passed, all channels allowed for the current regulatory domain
+ *	are used.  Extra IEs can also be passed from the userspace by
+ *	using the %NL80211_ATTR_IE attribute.
+ * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan.  Returns -ENOENT
+ *	if scheduled scan is not running.
+ * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan
+ *	results available.
+ * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has
+ *	stopped.  The driver may issue this event at any time during a
+ *	scheduled scan.  One reason for stopping the scan is if the hardware
+ *	does not support starting an association or a normal scan while running
+ *	a scheduled scan.  This event is also sent when the
+ *	%NL80211_CMD_STOP_SCHED_SCAN command is received or when the interface
+ *	is brought down while a scheduled scan was running.
+ *
+ * @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation
+ *      or noise level
+ * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to
+ *	NL80211_CMD_GET_SURVEY and on the "scan" multicast group)
+ *
  * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain
  * 	has been changed and provides details of the request information
  * 	that caused the change such as who initiated the regulatory request
@@ -242,11 +355,197 @@
  * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
  *	determined by the network interface.
  *
+ * @NL80211_CMD_TESTMODE: testmode command, takes a wiphy (or ifindex) attribute
+ *	to identify the device, and the TESTDATA blob attribute to pass through
+ *	to the driver.
+ *
+ * @NL80211_CMD_CONNECT: connection request and notification; this command
+ *	requests to connect to a specified network but without separating
+ *	auth and assoc steps. For this, you need to specify the SSID in a
+ *	%NL80211_ATTR_SSID attribute, and can optionally specify the association
+ *	IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC,
+ *	%NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
+ *	%NL80211_ATTR_CONTROL_PORT_ETHERTYPE and
+ *	%NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT.
+ *	It is also sent as an event, with the BSSID and response IEs when the
+ *	connection is established or failed to be established. This can be
+ *	determined by the STATUS_CODE attribute.
+ * @NL80211_CMD_ROAM: request that the card roam (currently not implemented),
+ *	sent as an event when the card/driver roamed by itself.
+ * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify
+ *	userspace that a connection was dropped by the AP or due to other
+ *	reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and
+ *	%NL80211_ATTR_REASON_CODE attributes are used.
+ *
+ * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices
+ *	associated with this wiphy must be down and will follow.
+ *
+ * @NL80211_CMD_REMAIN_ON_CHANNEL: Request to remain awake on the specified
+ *	channel for the specified amount of time. This can be used to do
+ *	off-channel operations like transmit a Public Action frame and wait for
+ *	a response while being associated to an AP on another channel.
+ *	%NL80211_ATTR_IFINDEX is used to specify which interface (and thus
+ *	radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the
+ *	frequency for the operation and %NL80211_ATTR_WIPHY_CHANNEL_TYPE may be
+ *	optionally used to specify additional channel parameters.
+ *	%NL80211_ATTR_DURATION is used to specify the duration in milliseconds
+ *	to remain on the channel. This command is also used as an event to
+ *	notify when the requested duration starts (it may take a while for the
+ *	driver to schedule this time due to other concurrent needs for the
+ *	radio).
+ *	When called, this operation returns a cookie (%NL80211_ATTR_COOKIE)
+ *	that will be included with any events pertaining to this request;
+ *	the cookie is also used to cancel the request.
+ * @NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL: This command can be used to cancel a
+ *	pending remain-on-channel duration if the desired operation has been
+ *	completed prior to expiration of the originally requested duration.
+ *	%NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify the
+ *	radio. The %NL80211_ATTR_COOKIE attribute must be given as well to
+ *	uniquely identify the request.
+ *	This command is also used as an event to notify when a requested
+ *	remain-on-channel duration has expired.
+ *
+ * @NL80211_CMD_SET_TX_BITRATE_MASK: Set the mask of rates to be used in TX
+ *	rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface
+ *	and @NL80211_ATTR_TX_RATES the set of allowed rates.
+ *
+ * @NL80211_CMD_REGISTER_FRAME: Register for receiving certain mgmt frames
+ *	(via @NL80211_CMD_FRAME) for processing in userspace. This command
+ *	requires an interface index, a frame type attribute (optional for
+ *	backward compatibility reasons, if not given assumes action frames)
+ *	and a match attribute containing the first few bytes of the frame
+ *	that should match, e.g. a single byte for only a category match or
+ *	four bytes for vendor frames including the OUI. The registration
+ *	cannot be dropped, but is removed automatically when the netlink
+ *	socket is closed. Multiple registrations can be made.
+ * @NL80211_CMD_REGISTER_ACTION: Alias for @NL80211_CMD_REGISTER_FRAME for
+ *	backward compatibility
+ * @NL80211_CMD_FRAME: Management frame TX request and RX notification. This
+ *	command is used both as a request to transmit a management frame and
+ *	as an event indicating reception of a frame that was not processed in
+ *	kernel code, but is for us (i.e., which may need to be processed in a
+ *	user space application). %NL80211_ATTR_FRAME is used to specify the
+ *	frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and
+ *	optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on
+ *	which channel the frame is to be transmitted or was received. If this
+ *	channel is not the current channel (remain-on-channel or the
+ *	operational channel) the device will switch to the given channel and
+ *	transmit the frame, optionally waiting for a response for the time
+ *	specified using %NL80211_ATTR_DURATION. When called, this operation
+ *	returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the
+ *	TX status event pertaining to the TX request.
+ *	%NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
+ *	management frames at CCK rate or not in 2GHz band.
+ * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
+ *	command may be used with the corresponding cookie to cancel the wait
+ *	time if it is known that it is no longer necessary.
+ * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility.
+ * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame
+ *	transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies
+ *	the TX command and %NL80211_ATTR_FRAME includes the contents of the
+ *	frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged
+ *	the frame.
+ * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for
+ *	backward compatibility.
+ * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command
+ *	is used to configure connection quality monitoring notification trigger
+ *	levels.
+ * @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This
+ *	command is used as an event to indicate the that a trigger level was
+ *	reached.
+ * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ
+ *	and %NL80211_ATTR_WIPHY_CHANNEL_TYPE) the given interface (identifed
+ *	by %NL80211_ATTR_IFINDEX) shall operate on.
+ *	In case multiple channels are supported by the device, the mechanism
+ *	with which it switches channels is implementation-defined.
+ *	When a monitor interface is given, it can only switch channel while
+ *	no other interfaces are operating to avoid disturbing the operation
+ *	of any other interfaces, and other interfaces will again take
+ *	precedence when they are used.
+ *
+ * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface.
+ *
+ * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial
+ *	mesh config parameters may be given.
+ * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the
+ *	network is determined by the network interface.
+ *
+ * @NL80211_CMD_UNPROT_DEAUTHENTICATE: Unprotected deauthentication frame
+ *	notification. This event is used to indicate that an unprotected
+ *	deauthentication frame was dropped when MFP is in use.
+ * @NL80211_CMD_UNPROT_DISASSOCIATE: Unprotected disassociation frame
+ *	notification. This event is used to indicate that an unprotected
+ *	disassociation frame was dropped when MFP is in use.
+ *
+ * @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
+ *      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.
+ *
+ * @NL80211_CMD_GET_WOWLAN: get Wake-on-Wireless-LAN (WoWLAN) settings.
+ * @NL80211_CMD_SET_WOWLAN: set Wake-on-Wireless-LAN (WoWLAN) settings.
+ *	Since wireless is more complex than wired ethernet, it supports
+ *	various triggers. These triggers can be configured through this
+ *	command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For
+ *	more background information, see
+ *	http://wireless.kernel.org/en/users/Documentation/WoWLAN.
+ *
+ * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver
+ *	the necessary information for supporting GTK rekey offload. This
+ *	feature is typically used during WoWLAN. The configuration data
+ *	is contained in %NL80211_ATTR_REKEY_DATA (which is nested and
+ *	contains the data in sub-attributes). After rekeying happened,
+ *	this command may also be sent by the driver as an MLME event to
+ *	inform userspace of the new replay counter.
+ *
+ * @NL80211_CMD_PMKSA_CANDIDATE: This is used as an event to inform userspace
+ *	of PMKSA caching dandidates.
+ *
+ * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
+ * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame.
+ *
+ * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP
+ *	(or GO) interface (i.e. hostapd) to ask for unexpected frames to
+ *	implement sending deauth to stations that send unexpected class 3
+ *	frames. Also used as the event sent by the kernel when such a frame
+ *	is received.
+ *	For the event, the %NL80211_ATTR_MAC attribute carries the TA and
+ *	other attributes like the interface index are present.
+ *	If used as the command it must have an interface index and you can
+ *	only unsubscribe from the event by closing the socket. Subscription
+ *	is also for %NL80211_CMD_UNEXPECTED_4ADDR_FRAME events.
+ *
+ * @NL80211_CMD_UNEXPECTED_4ADDR_FRAME: Sent as an event indicating that the
+ *	associated station identified by %NL80211_ATTR_MAC sent a 4addr frame
+ *	and wasn't already in a 4-addr VLAN. The event will be sent similarly
+ *	to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener.
+ *
+ * @NL80211_CMD_PROBE_CLIENT: Probe an associated station on an AP interface
+ *	by sending a null data frame to it and reporting when the frame is
+ *	acknowleged. This is used to allow timing out inactive clients. Uses
+ *	%NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC. The command returns a
+ *	direct reply with an %NL80211_ATTR_COOKIE that is later used to match
+ *	up the event with the request. The event includes the same data and
+ *	has %NL80211_ATTR_ACK set if the frame was ACKed.
+ *
+ * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from
+ *	other BSSes when any interfaces are in AP mode. This helps implement
+ *	OLBC handling in hostapd. Beacons are reported in %NL80211_CMD_FRAME
+ *	messages. Note that per PHY only one application may register.
+ *
+ * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
+ *      No Acknowledgement Policy should be applied.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
 enum nl80211_commands {
-/* don't change the order or add anything inbetween, this is ABI! */
+/* don't change the order or add anything between, this is ABI! */
 	NL80211_CMD_UNSPEC,
 
 	NL80211_CMD_GET_WIPHY,		/* can dump */
@@ -284,8 +583,8 @@
 	NL80211_CMD_SET_REG,
 	NL80211_CMD_REQ_SET_REG,
 
-	NL80211_CMD_GET_MESH_PARAMS,
-	NL80211_CMD_SET_MESH_PARAMS,
+	NL80211_CMD_GET_MESH_CONFIG,
+	NL80211_CMD_SET_MESH_CONFIG,
 
 	NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */,
 
@@ -310,6 +609,77 @@
 	NL80211_CMD_JOIN_IBSS,
 	NL80211_CMD_LEAVE_IBSS,
 
+	NL80211_CMD_TESTMODE,
+
+	NL80211_CMD_CONNECT,
+	NL80211_CMD_ROAM,
+	NL80211_CMD_DISCONNECT,
+
+	NL80211_CMD_SET_WIPHY_NETNS,
+
+	NL80211_CMD_GET_SURVEY,
+	NL80211_CMD_NEW_SURVEY_RESULTS,
+
+	NL80211_CMD_SET_PMKSA,
+	NL80211_CMD_DEL_PMKSA,
+	NL80211_CMD_FLUSH_PMKSA,
+
+	NL80211_CMD_REMAIN_ON_CHANNEL,
+	NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL,
+
+	NL80211_CMD_SET_TX_BITRATE_MASK,
+
+	NL80211_CMD_REGISTER_FRAME,
+	NL80211_CMD_REGISTER_ACTION = NL80211_CMD_REGISTER_FRAME,
+	NL80211_CMD_FRAME,
+	NL80211_CMD_ACTION = NL80211_CMD_FRAME,
+	NL80211_CMD_FRAME_TX_STATUS,
+	NL80211_CMD_ACTION_TX_STATUS = NL80211_CMD_FRAME_TX_STATUS,
+
+	NL80211_CMD_SET_POWER_SAVE,
+	NL80211_CMD_GET_POWER_SAVE,
+
+	NL80211_CMD_SET_CQM,
+	NL80211_CMD_NOTIFY_CQM,
+
+	NL80211_CMD_SET_CHANNEL,
+	NL80211_CMD_SET_WDS_PEER,
+
+	NL80211_CMD_FRAME_WAIT_CANCEL,
+
+	NL80211_CMD_JOIN_MESH,
+	NL80211_CMD_LEAVE_MESH,
+
+	NL80211_CMD_UNPROT_DEAUTHENTICATE,
+	NL80211_CMD_UNPROT_DISASSOCIATE,
+
+	NL80211_CMD_NEW_PEER_CANDIDATE,
+
+	NL80211_CMD_GET_WOWLAN,
+	NL80211_CMD_SET_WOWLAN,
+
+	NL80211_CMD_START_SCHED_SCAN,
+	NL80211_CMD_STOP_SCHED_SCAN,
+	NL80211_CMD_SCHED_SCAN_RESULTS,
+	NL80211_CMD_SCHED_SCAN_STOPPED,
+
+	NL80211_CMD_SET_REKEY_OFFLOAD,
+
+	NL80211_CMD_PMKSA_CANDIDATE,
+
+	NL80211_CMD_TDLS_OPER,
+	NL80211_CMD_TDLS_MGMT,
+
+	NL80211_CMD_UNEXPECTED_FRAME,
+
+	NL80211_CMD_PROBE_CLIENT,
+
+	NL80211_CMD_REGISTER_BEACONS,
+
+	NL80211_CMD_UNEXPECTED_4ADDR_FRAME,
+
+	NL80211_CMD_SET_NOACK_MAP,
+
 	/* add new commands above here */
 
 	/* used to define NL80211_CMD_MAX below */
@@ -330,6 +700,13 @@
 #define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
 #define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
 
+#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
+
+/* source-level API compatibility */
+#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG
+#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG
+#define NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE NL80211_MESH_SETUP_IE
+
 /**
  * enum nl80211_attrs - nl80211 netlink attributes
  *
@@ -359,6 +736,8 @@
  * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length
  *	larger than or equal to this use RTS/CTS handshake); allowed range:
  *	0..65536, disable with (u32)-1; dot11RTSThreshold; u32
+ * @NL80211_ATTR_WIPHY_COVERAGE_CLASS: Coverage Class as defined by IEEE 802.11
+ *	section 7.3.2.9; dot11CoverageClass; u8
  *
  * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
  * @NL80211_ATTR_IFNAME: network interface name
@@ -398,7 +777,7 @@
  *	consisting of a nested array.
  *
  * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes).
- * @NL80211_ATTR_PLINK_ACTION: action to perform on the mesh peer link.
+ * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link.
  * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path.
  * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path
  * 	info given for %NL80211_CMD_GET_MPATH, nested attribute described at
@@ -443,16 +822,18 @@
  *
  * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
  *	a single scan request, a wiphy attribute.
+ * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS: number of SSIDs you can
+ *	scan with a single scheduled scan request, a wiphy attribute.
  * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements
  *	that can be added to a scan request
+ * @NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN: maximum length of information
+ *	elements that can be added to a scheduled scan request
+ * @NL80211_ATTR_MAX_MATCH_SETS: maximum number of sets that can be
+ *	used with @NL80211_ATTR_SCHED_SCAN_MATCH, a wiphy attribute.
  *
  * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
  * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
  *	scanning and include a zero-length SSID (wildcard) for wildcard scan
- * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the
- *	scan result list changes (BSS expired or added) so that applications
- *	can verify that they got a single, consistent snapshot (when all dump
- *	messages carried the same generation number)
  * @NL80211_ATTR_BSS: scan result BSS
  *
  * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain
@@ -510,12 +891,313 @@
  *	request, the driver will assume that the port is unauthorized until
  *	authorized by user space. Otherwise, port is marked authorized by
  *	default in station mode.
+ * @NL80211_ATTR_CONTROL_PORT_ETHERTYPE: A 16-bit value indicating the
+ *	ethertype that will be used for key negotiation. It can be
+ *	specified with the associate and connect commands. If it is not
+ *	specified, the value defaults to 0x888E (PAE, 802.1X). This
+ *	attribute is also used as a flag in the wiphy information to
+ *	indicate that protocols other than PAE are supported.
+ * @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with
+ *	%NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom
+ *	ethertype frames used for key negotiation must not be encrypted.
+ *
+ * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
+ *	We recommend using nested, driver-specific attributes within this.
+ *
+ * @NL80211_ATTR_DISCONNECTED_BY_AP: A flag indicating that the DISCONNECT
+ *	event was due to the AP disconnecting the station, and not due to
+ *	a local disconnect request.
+ * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT
+ *	event (u16)
+ * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating
+ *	that protected APs should be used. This is also used with NEW_BEACON to
+ *	indicate that the BSS is to use protection.
+ *
+ * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT, ASSOCIATE, and NEW_BEACON
+ *	to indicate which unicast key ciphers will be used with the connection
+ *	(an array of u32).
+ * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
+ *	indicate which group key cipher will be used with the connection (a
+ *	u32).
+ * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
+ *	indicate which WPA version(s) the AP we want to associate with is using
+ *	(a u32 with flags from &enum nl80211_wpa_versions).
+ * @NL80211_ATTR_AKM_SUITES: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
+ *	indicate which key management algorithm(s) to use (an array of u32).
+ *
+ * @NL80211_ATTR_REQ_IE: (Re)association request information elements as
+ *	sent out by the card, for ROAM and successful CONNECT events.
+ * @NL80211_ATTR_RESP_IE: (Re)association response information elements as
+ *	sent by peer, for ROAM and successful CONNECT events.
+ *
+ * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE
+ *	commands to specify using a reassociate frame
+ *
+ * @NL80211_ATTR_KEY: key information in a nested attribute with
+ *	%NL80211_KEY_* sub-attributes
+ * @NL80211_ATTR_KEYS: array of keys for static WEP keys for connect()
+ *	and join_ibss(), key information is in a nested attribute each
+ *	with %NL80211_KEY_* sub-attributes
+ *
+ * @NL80211_ATTR_PID: Process ID of a network namespace.
+ *
+ * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for
+ *	dumps. This number increases whenever the object list being
+ *	dumped changes, and as such userspace can verify that it has
+ *	obtained a complete and consistent snapshot by verifying that
+ *	all dump messages contain the same generation number. If it
+ *	changed then the list changed and the dump should be repeated
+ *	completely from scratch.
+ *
+ * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface
+ *
+ * @NL80211_ATTR_SURVEY_INFO: survey information about a channel, part of
+ *      the survey response for %NL80211_CMD_GET_SURVEY, nested attribute
+ *      containing info as possible, see &enum survey_info.
+ *
+ * @NL80211_ATTR_PMKID: PMK material for PMKSA caching.
+ * @NL80211_ATTR_MAX_NUM_PMKIDS: maximum number of PMKIDs a firmware can
+ *	cache, a wiphy attribute.
+ *
+ * @NL80211_ATTR_DURATION: Duration of an operation in milliseconds, u32.
+ * @NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION: Device attribute that
+ *	specifies the maximum duration that can be requested with the
+ *	remain-on-channel operation, in milliseconds, u32.
+ *
+ * @NL80211_ATTR_COOKIE: Generic 64-bit cookie to identify objects.
+ *
+ * @NL80211_ATTR_TX_RATES: Nested set of attributes
+ *	(enum nl80211_tx_rate_attributes) describing TX rates per band. The
+ *	enum nl80211_band value is used as the index (nla_type() of the nested
+ *	data. If a band is not included, it will be configured to allow all
+ *	rates based on negotiated supported rates information. This attribute
+ *	is used with %NL80211_CMD_SET_TX_BITRATE_MASK.
+ *
+ * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain
+ *	at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME.
+ * @NL80211_ATTR_FRAME_TYPE: A u16 indicating the frame type/subtype for the
+ *	@NL80211_CMD_REGISTER_FRAME command.
+ * @NL80211_ATTR_TX_FRAME_TYPES: wiphy capability attribute, which is a
+ *	nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing
+ *	information about which frame types can be transmitted with
+ *	%NL80211_CMD_FRAME.
+ * @NL80211_ATTR_RX_FRAME_TYPES: wiphy capability attribute, which is a
+ *	nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing
+ *	information about which frame types can be registered for RX.
+ *
+ * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was
+ *	acknowledged by the recipient.
+ *
+ * @NL80211_ATTR_CQM: connection quality monitor configuration in a
+ *	nested attribute with %NL80211_ATTR_CQM_* sub-attributes.
+ *
+ * @NL80211_ATTR_LOCAL_STATE_CHANGE: Flag attribute to indicate that a command
+ *	is requesting a local authentication/association state change without
+ *	invoking actual management frame exchange. This can be used with
+ *	NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE,
+ *	NL80211_CMD_DISASSOCIATE.
+ *
+ * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations
+ *	connected to this BSS.
+ *
+ * @NL80211_ATTR_WIPHY_TX_POWER_SETTING: Transmit power setting type. See
+ *      &enum nl80211_tx_power_setting for possible values.
+ * @NL80211_ATTR_WIPHY_TX_POWER_LEVEL: Transmit power level in signed mBm units.
+ *      This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING
+ *      for non-automatic settings.
+ *
+ * @NL80211_ATTR_SUPPORT_IBSS_RSN: The device supports IBSS RSN, which mostly
+ *	means support for per-station GTKs.
+ *
+ * @NL80211_ATTR_WIPHY_ANTENNA_TX: Bitmap of allowed antennas for transmitting.
+ *	This can be used to mask out antennas which are not attached or should
+ *	not be used for transmitting. If an antenna is not selected in this
+ *	bitmap the hardware is not allowed to transmit on this antenna.
+ *
+ *	Each bit represents one antenna, starting with antenna 1 at the first
+ *	bit. Depending on which antennas are selected in the bitmap, 802.11n
+ *	drivers can derive which chainmasks to use (if all antennas belonging to
+ *	a particular chain are disabled this chain should be disabled) and if
+ *	a chain has diversity antennas wether diversity should be used or not.
+ *	HT capabilities (STBC, TX Beamforming, Antenna selection) can be
+ *	derived from the available chains after applying the antenna mask.
+ *	Non-802.11n drivers can derive wether to use diversity or not.
+ *	Drivers may reject configurations or RX/TX mask combinations they cannot
+ *	support by returning -EINVAL.
+ *
+ * @NL80211_ATTR_WIPHY_ANTENNA_RX: Bitmap of allowed antennas for receiving.
+ *	This can be used to mask out antennas which are not attached or should
+ *	not be used for receiving. If an antenna is not selected in this bitmap
+ *	the hardware should not be configured to receive on this antenna.
+ *	For a more detailed description see @NL80211_ATTR_WIPHY_ANTENNA_TX.
+ *
+ * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX: Bitmap of antennas which are available
+ *	for configuration as TX antennas via the above parameters.
+ *
+ * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX: Bitmap of antennas which are available
+ *	for configuration as RX antennas via the above parameters.
+ *
+ * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS
+ *
+ * @NL80211_ATTR_OFFCHANNEL_TX_OK: For management frame TX, the frame may be
+ *	transmitted on another channel when the channel given doesn't match
+ *	the current channel. If the current channel doesn't match and this
+ *	flag isn't set, the frame will be rejected. This is also used as an
+ *	nl80211 capability flag.
+ *
+ * @NL80211_ATTR_BSS_HTOPMODE: HT operation mode (u16)
+ *
+ * @NL80211_ATTR_KEY_DEFAULT_TYPES: A nested attribute containing flags
+ *	attributes, specifying what a key should be set as default as.
+ *	See &enum nl80211_key_default_types.
+ *
+ * @NL80211_ATTR_MESH_SETUP: Optional mesh setup parameters.  These cannot be
+ *	changed once the mesh is active.
+ * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute
+ *	containing attributes from &enum nl80211_meshconf_params.
+ * @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_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy
+ *	capabilities, the supported WoWLAN triggers
+ * @NL80211_ATTR_WOWLAN_TRIGGERS: used by %NL80211_CMD_SET_WOWLAN to
+ *	indicate which WoW triggers should be enabled. This is also
+ *	used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN
+ *	triggers.
+
+ * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan
+ *	cycles, in msecs.
+
+ * @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more
+ *	sets of attributes to match during scheduled scans.  Only BSSs
+ *	that match any of the sets will be reported.  These are
+ *	pass-thru filter rules.
+ *	For a match to succeed, the BSS must match all attributes of a
+ *	set.  Since not every hardware supports matching all types of
+ *	attributes, there is no guarantee that the reported BSSs are
+ *	fully complying with the match sets and userspace needs to be
+ *	able to ignore them by itself.
+ *	Thus, the implementation is somewhat hardware-dependent, but
+ *	this is only an optimization and the userspace application
+ *	needs to handle all the non-filtered results anyway.
+ *	If the match attributes don't make sense when combined with
+ *	the values passed in @NL80211_ATTR_SCAN_SSIDS (eg. if an SSID
+ *	is included in the probe request, but the match attributes
+ *	will never let it go through), -EINVAL may be returned.
+ *	If ommited, no filtering is done.
+ *
+ * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported
+ *	interface combinations. In each nested item, it contains attributes
+ *	defined in &enum nl80211_if_combination_attrs.
+ * @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like
+ *	%NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that
+ *	are managed in software: interfaces of these types aren't subject to
+ *	any restrictions in their number or combinations.
+ *
+ * @%NL80211_ATTR_REKEY_DATA: nested attribute containing the information
+ *	necessary for GTK rekeying in the device, see &enum nl80211_rekey_data.
+ *
+ * @NL80211_ATTR_SCAN_SUPP_RATES: rates per to be advertised as supported in scan,
+ *	nested array attribute containing an entry for each band, with the entry
+ *	being a list of supported rates as defined by IEEE 802.11 7.3.2.2 but
+ *	without the length restriction (at most %NL80211_MAX_SUPP_RATES).
+ *
+ * @NL80211_ATTR_HIDDEN_SSID: indicates whether SSID is to be hidden from Beacon
+ *	and Probe Response (when response to wildcard Probe Request); see
+ *	&enum nl80211_hidden_ssid, represented as a u32
+ *
+ * @NL80211_ATTR_IE_PROBE_RESP: Information element(s) for Probe Response frame.
+ *	This is used with %NL80211_CMD_NEW_BEACON and %NL80211_CMD_SET_BEACON to
+ *	provide extra IEs (e.g., WPS/P2P IE) into Probe Response frames when the
+ *	driver (or firmware) replies to Probe Request frames.
+ * @NL80211_ATTR_IE_ASSOC_RESP: Information element(s) for (Re)Association
+ *	Response frames. This is used with %NL80211_CMD_NEW_BEACON and
+ *	%NL80211_CMD_SET_BEACON to provide extra IEs (e.g., WPS/P2P IE) into
+ *	(Re)Association Response frames when the driver (or firmware) replies to
+ *	(Re)Association Request frames.
+ *
+ * @NL80211_ATTR_STA_WME: Nested attribute containing the wme configuration
+ *	of the station, see &enum nl80211_sta_wme_attr.
+ * @NL80211_ATTR_SUPPORT_AP_UAPSD: the device supports uapsd when working
+ *	as AP.
+ *
+ * @NL80211_ATTR_ROAM_SUPPORT: Indicates whether the firmware is capable of
+ *	roaming to another AP in the same ESS if the signal lever is low.
+ *
+ * @NL80211_ATTR_PMKSA_CANDIDATE: Nested attribute containing the PMKSA caching
+ *	candidate information, see &enum nl80211_pmksa_candidate_attr.
+ *
+ * @NL80211_ATTR_TX_NO_CCK_RATE: Indicates whether to use CCK rate or not
+ *	for management frames transmission. In order to avoid p2p probe/action
+ *	frames are being transmitted at CCK rate in 2GHz band, the user space
+ *	applications use this attribute.
+ *	This attribute is used with %NL80211_CMD_TRIGGER_SCAN and
+ *	%NL80211_CMD_FRAME commands.
+ *
+ * @NL80211_ATTR_TDLS_ACTION: Low level TDLS action code (e.g. link setup
+ *	request, link setup confirm, link teardown, etc.). Values are
+ *	described in the TDLS (802.11z) specification.
+ * @NL80211_ATTR_TDLS_DIALOG_TOKEN: Non-zero token for uniquely identifying a
+ *	TDLS conversation between two devices.
+ * @NL80211_ATTR_TDLS_OPERATION: High level TDLS operation; see
+ *	&enum nl80211_tdls_operation, represented as a u8.
+ * @NL80211_ATTR_TDLS_SUPPORT: A flag indicating the device can operate
+ *	as a TDLS peer sta.
+ * @NL80211_ATTR_TDLS_EXTERNAL_SETUP: The TDLS discovery/setup and teardown
+ *	procedures should be performed by sending TDLS packets via
+ *	%NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be
+ *	used for asking the driver to perform a TDLS operation.
+ *
+ * @NL80211_ATTR_DEVICE_AP_SME: This u32 attribute may be listed for devices
+ *	that have AP support to indicate that they have the AP SME integrated
+ *	with support for the features listed in this attribute, see
+ *	&enum nl80211_ap_sme_features.
+ *
+ * @NL80211_ATTR_DONT_WAIT_FOR_ACK: Used with %NL80211_CMD_FRAME, this tells
+ *	the driver to not wait for an acknowledgement. Note that due to this,
+ *	it will also not give a status callback nor return a cookie. This is
+ *	mostly useful for probe responses to save airtime.
+ *
+ * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from
+ *	&enum nl80211_feature_flags and is advertised in wiphy information.
+ * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe
+ *
+ *	requests while operating in AP-mode.
+ *	This attribute holds a bitmap of the supported protocols for
+ *	offloading (see &enum nl80211_probe_resp_offload_support_attr).
+ *
+ * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire
+ *	probe-response frame. The DA field in the 802.11 header is zero-ed out,
+ *	to be filled by the FW.
+ * @NL80211_ATTR_DISABLE_HT:  Force HT capable interfaces to disable
+ *      this feature.  Currently, only supported in mac80211 drivers.
+ * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the
+ *      ATTR_HT_CAPABILITY to which attention should be paid.
+ *      Currently, only mac80211 NICs support this feature.
+ *      The values that may be configured are:
+ *       MCS rates, MAX-AMSDU, HT-20-40 and HT_CAP_SGI_40
+ *       AMPDU density and AMPDU factor.
+ *      All values are treated as suggestions and may be ignored
+ *      by the driver as required.  The actual values may be seen in
+ *      the station debugfs ht_caps file.
+ *
+ * @NL80211_ATTR_DFS_REGION: region for regulatory rules which this country
+ *    abides to when initiating radiation on DFS channels. A country maps
+ *    to one DFS region.
+ *
+ * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of
+ *      up to 16 TIDs.
  *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
 enum nl80211_attrs {
-/* don't change the order or add anything inbetween, this is ABI! */
+/* don't change the order or add anything between, this is ABI! */
 	NL80211_ATTR_UNSPEC,
 
 	NL80211_ATTR_WIPHY,
@@ -565,7 +1247,7 @@
 	NL80211_ATTR_REG_ALPHA2,
 	NL80211_ATTR_REG_RULES,
 
-	NL80211_ATTR_MESH_PARAMS,
+	NL80211_ATTR_MESH_CONFIG,
 
 	NL80211_ATTR_BSS_BASIC_RATES,
 
@@ -582,7 +1264,7 @@
 
 	NL80211_ATTR_SCAN_FREQUENCIES,
 	NL80211_ATTR_SCAN_SSIDS,
-	NL80211_ATTR_SCAN_GENERATION,
+	NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */
 	NL80211_ATTR_BSS,
 
 	NL80211_ATTR_REG_INITIATOR,
@@ -619,16 +1301,158 @@
 
 	NL80211_ATTR_CONTROL_PORT,
 
+	NL80211_ATTR_TESTDATA,
+
+	NL80211_ATTR_PRIVACY,
+
+	NL80211_ATTR_DISCONNECTED_BY_AP,
+	NL80211_ATTR_STATUS_CODE,
+
+	NL80211_ATTR_CIPHER_SUITES_PAIRWISE,
+	NL80211_ATTR_CIPHER_SUITE_GROUP,
+	NL80211_ATTR_WPA_VERSIONS,
+	NL80211_ATTR_AKM_SUITES,
+
+	NL80211_ATTR_REQ_IE,
+	NL80211_ATTR_RESP_IE,
+
+	NL80211_ATTR_PREV_BSSID,
+
+	NL80211_ATTR_KEY,
+	NL80211_ATTR_KEYS,
+
+	NL80211_ATTR_PID,
+
+	NL80211_ATTR_4ADDR,
+
+	NL80211_ATTR_SURVEY_INFO,
+
+	NL80211_ATTR_PMKID,
+	NL80211_ATTR_MAX_NUM_PMKIDS,
+
+	NL80211_ATTR_DURATION,
+
+	NL80211_ATTR_COOKIE,
+
+	NL80211_ATTR_WIPHY_COVERAGE_CLASS,
+
+	NL80211_ATTR_TX_RATES,
+
+	NL80211_ATTR_FRAME_MATCH,
+
+	NL80211_ATTR_ACK,
+
+	NL80211_ATTR_PS_STATE,
+
+	NL80211_ATTR_CQM,
+
+	NL80211_ATTR_LOCAL_STATE_CHANGE,
+
+	NL80211_ATTR_AP_ISOLATE,
+
+	NL80211_ATTR_WIPHY_TX_POWER_SETTING,
+	NL80211_ATTR_WIPHY_TX_POWER_LEVEL,
+
+	NL80211_ATTR_TX_FRAME_TYPES,
+	NL80211_ATTR_RX_FRAME_TYPES,
+	NL80211_ATTR_FRAME_TYPE,
+
+	NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
+	NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT,
+
+	NL80211_ATTR_SUPPORT_IBSS_RSN,
+
+	NL80211_ATTR_WIPHY_ANTENNA_TX,
+	NL80211_ATTR_WIPHY_ANTENNA_RX,
+
+	NL80211_ATTR_MCAST_RATE,
+
+	NL80211_ATTR_OFFCHANNEL_TX_OK,
+
+	NL80211_ATTR_BSS_HT_OPMODE,
+
+	NL80211_ATTR_KEY_DEFAULT_TYPES,
+
+	NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION,
+
+	NL80211_ATTR_MESH_SETUP,
+
+	NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX,
+	NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX,
+
+	NL80211_ATTR_SUPPORT_MESH_AUTH,
+	NL80211_ATTR_STA_PLINK_STATE,
+
+	NL80211_ATTR_WOWLAN_TRIGGERS,
+	NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED,
+
+	NL80211_ATTR_SCHED_SCAN_INTERVAL,
+
+	NL80211_ATTR_INTERFACE_COMBINATIONS,
+	NL80211_ATTR_SOFTWARE_IFTYPES,
+
+	NL80211_ATTR_REKEY_DATA,
+
+	NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS,
+	NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN,
+
+	NL80211_ATTR_SCAN_SUPP_RATES,
+
+	NL80211_ATTR_HIDDEN_SSID,
+
+	NL80211_ATTR_IE_PROBE_RESP,
+	NL80211_ATTR_IE_ASSOC_RESP,
+
+	NL80211_ATTR_STA_WME,
+	NL80211_ATTR_SUPPORT_AP_UAPSD,
+
+	NL80211_ATTR_ROAM_SUPPORT,
+
+	NL80211_ATTR_SCHED_SCAN_MATCH,
+	NL80211_ATTR_MAX_MATCH_SETS,
+
+	NL80211_ATTR_PMKSA_CANDIDATE,
+
+	NL80211_ATTR_TX_NO_CCK_RATE,
+
+	NL80211_ATTR_TDLS_ACTION,
+	NL80211_ATTR_TDLS_DIALOG_TOKEN,
+	NL80211_ATTR_TDLS_OPERATION,
+	NL80211_ATTR_TDLS_SUPPORT,
+	NL80211_ATTR_TDLS_EXTERNAL_SETUP,
+
+	NL80211_ATTR_DEVICE_AP_SME,
+
+	NL80211_ATTR_DONT_WAIT_FOR_ACK,
+
+	NL80211_ATTR_FEATURE_FLAGS,
+
+	NL80211_ATTR_PROBE_RESP_OFFLOAD,
+
+	NL80211_ATTR_PROBE_RESP,
+
+	NL80211_ATTR_DFS_REGION,
+
+	NL80211_ATTR_DISABLE_HT,
+	NL80211_ATTR_HT_CAPABILITY_MASK,
+
+	NL80211_ATTR_NOACK_MAP,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
 	NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
 };
 
+/* source-level API compatibility */
+#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION
+#define	NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
+
 /*
  * Allow user space programs to use #ifdef on new attributes by defining them
  * here
  */
+#define NL80211_CMD_CONNECT NL80211_CMD_CONNECT
 #define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
 #define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
 #define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
@@ -642,6 +1466,13 @@
 #define NL80211_ATTR_SSID NL80211_ATTR_SSID
 #define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE
 #define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE
+#define NL80211_ATTR_CIPHER_SUITES_PAIRWISE NL80211_ATTR_CIPHER_SUITES_PAIRWISE
+#define NL80211_ATTR_CIPHER_SUITE_GROUP NL80211_ATTR_CIPHER_SUITE_GROUP
+#define NL80211_ATTR_WPA_VERSIONS NL80211_ATTR_WPA_VERSIONS
+#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES
+#define NL80211_ATTR_KEY NL80211_ATTR_KEY
+#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
+#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
 
 #define NL80211_MAX_SUPP_RATES			32
 #define NL80211_MAX_SUPP_REG_RULES		32
@@ -650,6 +1481,9 @@
 #define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY	24
 #define NL80211_HT_CAPABILITY_LEN		26
 
+#define NL80211_MAX_NR_CIPHER_SUITES		5
+#define NL80211_MAX_NR_AKM_SUITES		2
+
 /**
  * enum nl80211_iftype - (virtual) interface types
  *
@@ -657,12 +1491,16 @@
  * @NL80211_IFTYPE_ADHOC: independent BSS member
  * @NL80211_IFTYPE_STATION: managed BSS member
  * @NL80211_IFTYPE_AP: access point
- * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
+ * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces
+ *	are a bit special in that they must always be tied to a pre-existing
+ *	AP type interface.
  * @NL80211_IFTYPE_WDS: wireless distribution interface
  * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
  * @NL80211_IFTYPE_MESH_POINT: mesh point
+ * @NL80211_IFTYPE_P2P_CLIENT: P2P client
+ * @NL80211_IFTYPE_P2P_GO: P2P group owner
  * @NL80211_IFTYPE_MAX: highest interface type number currently defined
- * @__NL80211_IFTYPE_AFTER_LAST: internal use
+ * @NUM_NL80211_IFTYPES: number of defined interface types
  *
  * These values are used with the %NL80211_ATTR_IFTYPE
  * to set the type of an interface.
@@ -677,10 +1515,12 @@
 	NL80211_IFTYPE_WDS,
 	NL80211_IFTYPE_MONITOR,
 	NL80211_IFTYPE_MESH_POINT,
+	NL80211_IFTYPE_P2P_CLIENT,
+	NL80211_IFTYPE_P2P_GO,
 
 	/* keep last */
-	__NL80211_IFTYPE_AFTER_LAST,
-	NL80211_IFTYPE_MAX = __NL80211_IFTYPE_AFTER_LAST - 1
+	NUM_NL80211_IFTYPES,
+	NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1
 };
 
 /**
@@ -689,11 +1529,20 @@
  * Station flags. When a station is added to an AP interface, it is
  * assumed to be already associated (and hence authenticated.)
  *
+ * @__NL80211_STA_FLAG_INVALID: attribute number 0 is reserved
  * @NL80211_STA_FLAG_AUTHORIZED: station is authorized (802.1X)
  * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
  *	with short barker preamble
  * @NL80211_STA_FLAG_WME: station is WME/QoS capable
  * @NL80211_STA_FLAG_MFP: station uses management frame protection
+ * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated
+ * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer -- this flag should
+ *	only be used in managed mode (even in the flags mask). Note that the
+ *	flag can't be changed, it is only valid while adding a station, and
+ *	attempts to change it will silently be ignored (rather than rejected
+ *	as errors.)
+ * @NL80211_STA_FLAG_MAX: highest station flag number currently defined
+ * @__NL80211_STA_FLAG_AFTER_LAST: internal use
  */
 enum nl80211_sta_flags {
 	__NL80211_STA_FLAG_INVALID,
@@ -701,6 +1550,8 @@
 	NL80211_STA_FLAG_SHORT_PREAMBLE,
 	NL80211_STA_FLAG_WME,
 	NL80211_STA_FLAG_MFP,
+	NL80211_STA_FLAG_AUTHENTICATED,
+	NL80211_STA_FLAG_TDLS_PEER,
 
 	/* keep last */
 	__NL80211_STA_FLAG_AFTER_LAST,
@@ -746,6 +1597,36 @@
 };
 
 /**
+ * enum nl80211_sta_bss_param - BSS information collected by STA
+ *
+ * These attribute types are used with %NL80211_STA_INFO_BSS_PARAM
+ * when getting information about the bitrate of a station.
+ *
+ * @__NL80211_STA_BSS_PARAM_INVALID: attribute number 0 is reserved
+ * @NL80211_STA_BSS_PARAM_CTS_PROT: whether CTS protection is enabled (flag)
+ * @NL80211_STA_BSS_PARAM_SHORT_PREAMBLE:  whether short preamble is enabled
+ *	(flag)
+ * @NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME:  whether short slot time is enabled
+ *	(flag)
+ * @NL80211_STA_BSS_PARAM_DTIM_PERIOD: DTIM period for beaconing (u8)
+ * @NL80211_STA_BSS_PARAM_BEACON_INTERVAL: Beacon interval (u16)
+ * @NL80211_STA_BSS_PARAM_MAX: highest sta_bss_param number currently defined
+ * @__NL80211_STA_BSS_PARAM_AFTER_LAST: internal use
+ */
+enum nl80211_sta_bss_param {
+	__NL80211_STA_BSS_PARAM_INVALID,
+	NL80211_STA_BSS_PARAM_CTS_PROT,
+	NL80211_STA_BSS_PARAM_SHORT_PREAMBLE,
+	NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME,
+	NL80211_STA_BSS_PARAM_DTIM_PERIOD,
+	NL80211_STA_BSS_PARAM_BEACON_INTERVAL,
+
+	/* keep last */
+	__NL80211_STA_BSS_PARAM_AFTER_LAST,
+	NL80211_STA_BSS_PARAM_MAX = __NL80211_STA_BSS_PARAM_AFTER_LAST - 1
+};
+
+/**
  * enum nl80211_sta_info - station information
  *
  * These attribute types are used with %NL80211_ATTR_STA_INFO
@@ -755,14 +1636,28 @@
  * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs)
  * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station)
  * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
- * @__NL80211_STA_INFO_AFTER_LAST: internal
- * @NL80211_STA_INFO_MAX: highest possible station info attribute
  * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
  * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
- * 	containing info as possible, see &enum nl80211_sta_info_txrate.
+ * 	containing info as possible, see &enum nl80211_rate_info
  * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station)
  * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this
  *	station)
+ * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station)
+ * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station)
+ * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm)
+ * @NL80211_STA_INFO_LLID: the station's mesh LLID
+ * @NL80211_STA_INFO_PLID: the station's mesh PLID
+ * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station
+ *	(see %enum nl80211_plink_state)
+ * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested
+ *	attribute, like NL80211_STA_INFO_TX_BITRATE.
+ * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute
+ *     containing info as possible, see &enum nl80211_sta_bss_param
+ * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected
+ * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update.
+ * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32)
+ * @__NL80211_STA_INFO_AFTER_LAST: internal
+ * @NL80211_STA_INFO_MAX: highest possible station info attribute
  */
 enum nl80211_sta_info {
 	__NL80211_STA_INFO_INVALID,
@@ -776,6 +1671,14 @@
 	NL80211_STA_INFO_TX_BITRATE,
 	NL80211_STA_INFO_RX_PACKETS,
 	NL80211_STA_INFO_TX_PACKETS,
+	NL80211_STA_INFO_TX_RETRIES,
+	NL80211_STA_INFO_TX_FAILED,
+	NL80211_STA_INFO_SIGNAL_AVG,
+	NL80211_STA_INFO_RX_BITRATE,
+	NL80211_STA_INFO_BSS_PARAM,
+	NL80211_STA_INFO_CONNECTED_TIME,
+	NL80211_STA_INFO_STA_FLAGS,
+	NL80211_STA_INFO_BEACON_LOSS,
 
 	/* keep last */
 	__NL80211_STA_INFO_AFTER_LAST,
@@ -787,14 +1690,14 @@
  *
  * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active
  * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running
- * @NL80211_MPATH_FLAG_DSN_VALID: the mesh path contains a valid DSN
+ * @NL80211_MPATH_FLAG_SN_VALID: the mesh path contains a valid SN
  * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set
  * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded
  */
 enum nl80211_mpath_flags {
 	NL80211_MPATH_FLAG_ACTIVE =	1<<0,
 	NL80211_MPATH_FLAG_RESOLVING =	1<<1,
-	NL80211_MPATH_FLAG_DSN_VALID =	1<<2,
+	NL80211_MPATH_FLAG_SN_VALID =	1<<2,
 	NL80211_MPATH_FLAG_FIXED =	1<<3,
 	NL80211_MPATH_FLAG_RESOLVED =	1<<4,
 };
@@ -806,19 +1709,22 @@
  * information about a mesh path.
  *
  * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved
- * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination
- * @NL80211_ATTR_MPATH_DSN: destination sequence number
- * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path
- * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now
- * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in
+ * @NL80211_MPATH_INFO_FRAME_QLEN: number of queued frames for this destination
+ * @NL80211_MPATH_INFO_SN: destination sequence number
+ * @NL80211_MPATH_INFO_METRIC: metric (cost) of this mesh path
+ * @NL80211_MPATH_INFO_EXPTIME: expiration time for the path, in msec from now
+ * @NL80211_MPATH_INFO_FLAGS: mesh path flags, enumerated in
  * 	&enum nl80211_mpath_flags;
- * @NL80211_ATTR_MPATH_DISCOVERY_TIMEOUT: total path discovery timeout, in msec
- * @NL80211_ATTR_MPATH_DISCOVERY_RETRIES: mesh path discovery retries
+ * @NL80211_MPATH_INFO_DISCOVERY_TIMEOUT: total path discovery timeout, in msec
+ * @NL80211_MPATH_INFO_DISCOVERY_RETRIES: mesh path discovery retries
+ * @NL80211_MPATH_INFO_MAX: highest mesh path information attribute number
+ *	currently defind
+ * @__NL80211_MPATH_INFO_AFTER_LAST: internal use
  */
 enum nl80211_mpath_info {
 	__NL80211_MPATH_INFO_INVALID,
 	NL80211_MPATH_INFO_FRAME_QLEN,
-	NL80211_MPATH_INFO_DSN,
+	NL80211_MPATH_INFO_SN,
 	NL80211_MPATH_INFO_METRIC,
 	NL80211_MPATH_INFO_EXPTIME,
 	NL80211_MPATH_INFO_FLAGS,
@@ -842,6 +1748,8 @@
  * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE
  * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n
  * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n
+ * @NL80211_BAND_ATTR_MAX: highest band attribute currently defined
+ * @__NL80211_BAND_ATTR_AFTER_LAST: internal use
  */
 enum nl80211_band_attr {
 	__NL80211_BAND_ATTR_INVALID,
@@ -862,6 +1770,7 @@
 
 /**
  * enum nl80211_frequency_attr - frequency attributes
+ * @__NL80211_FREQUENCY_ATTR_INVALID: attribute number 0 is reserved
  * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
  * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current
  *	regulatory domain.
@@ -873,6 +1782,9 @@
  *	on this channel in current regulatory domain.
  * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
  *	(100 * dBm).
+ * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
+ *	currently defined
+ * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
  */
 enum nl80211_frequency_attr {
 	__NL80211_FREQUENCY_ATTR_INVALID,
@@ -892,9 +1804,13 @@
 
 /**
  * enum nl80211_bitrate_attr - bitrate attributes
+ * @__NL80211_BITRATE_ATTR_INVALID: attribute number 0 is reserved
  * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps
  * @NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE: Short preamble supported
  *	in 2.4 GHz band.
+ * @NL80211_BITRATE_ATTR_MAX: highest bitrate attribute number
+ *	currently defined
+ * @__NL80211_BITRATE_ATTR_AFTER_LAST: internal use
  */
 enum nl80211_bitrate_attr {
 	__NL80211_BITRATE_ATTR_INVALID,
@@ -916,7 +1832,11 @@
  * 	wireless core it thinks its knows the regulatory domain we should be in.
  * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an
  * 	802.11 country information element with regulatory information it
- * 	thinks we should consider.
+ * 	thinks we should consider. cfg80211 only processes the country
+ *	code from the IE, and relies on the regulatory domain information
+ *	structure passed by userspace (CRDA) from our wireless-regdb.
+ *	If a channel is enabled but the country code indicates it should
+ *	be disabled we disable the channel and re-enable it upon disassociation.
  */
 enum nl80211_reg_initiator {
 	NL80211_REGDOM_SET_BY_CORE,
@@ -950,6 +1870,7 @@
 
 /**
  * enum nl80211_reg_rule_attr - regulatory rule attributes
+ * @__NL80211_REG_RULE_ATTR_INVALID: attribute number 0 is reserved
  * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional
  * 	considerations for a given frequency range. These are the
  * 	&enum nl80211_reg_rule_flags.
@@ -966,6 +1887,9 @@
  * 	If you don't have one then don't send this.
  * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for
  * 	a given frequency range. The value is in mBm (100 * dBm).
+ * @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number
+ *	currently defined
+ * @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use
  */
 enum nl80211_reg_rule_attr {
 	__NL80211_REG_RULE_ATTR_INVALID,
@@ -984,6 +1908,26 @@
 };
 
 /**
+ * enum nl80211_sched_scan_match_attr - scheduled scan match attributes
+ * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved
+ * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching,
+ * only report BSS with matching SSID.
+ * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter
+ *	attribute number currently defined
+ * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use
+ */
+enum nl80211_sched_scan_match_attr {
+	__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID,
+
+	NL80211_ATTR_SCHED_SCAN_MATCH_SSID,
+
+	/* keep last */
+	__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST,
+	NL80211_SCHED_SCAN_MATCH_ATTR_MAX =
+		__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1
+};
+
+/**
  * enum nl80211_reg_rule_flags - regulatory rule flags
  *
  * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed
@@ -1009,6 +1953,61 @@
 };
 
 /**
+ * enum nl80211_dfs_regions - regulatory DFS regions
+ *
+ * @NL80211_DFS_UNSET: Country has no DFS master region specified
+ * @NL80211_DFS_FCC_: Country follows DFS master rules from FCC
+ * @NL80211_DFS_FCC_: Country follows DFS master rules from ETSI
+ * @NL80211_DFS_JP_: Country follows DFS master rules from JP/MKK/Telec
+ */
+enum nl80211_dfs_regions {
+	NL80211_DFS_UNSET	= 0,
+	NL80211_DFS_FCC		= 1,
+	NL80211_DFS_ETSI	= 2,
+	NL80211_DFS_JP		= 3,
+};
+
+/**
+ * enum nl80211_survey_info - survey information
+ *
+ * These attribute types are used with %NL80211_ATTR_SURVEY_INFO
+ * when getting information about a survey.
+ *
+ * @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved
+ * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel
+ * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm)
+ * @NL80211_SURVEY_INFO_IN_USE: channel is currently being used
+ * @NL80211_SURVEY_INFO_CHANNEL_TIME: amount of time (in ms) that the radio
+ *	spent on this channel
+ * @NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY: amount of the time the primary
+ *	channel was sensed busy (either due to activity or energy detect)
+ * @NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: amount of time the extension
+ *	channel was sensed busy
+ * @NL80211_SURVEY_INFO_CHANNEL_TIME_RX: amount of time the radio spent
+ *	receiving data
+ * @NL80211_SURVEY_INFO_CHANNEL_TIME_TX: amount of time the radio spent
+ *	transmitting data
+ * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
+ *	currently defined
+ * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
+ */
+enum nl80211_survey_info {
+	__NL80211_SURVEY_INFO_INVALID,
+	NL80211_SURVEY_INFO_FREQUENCY,
+	NL80211_SURVEY_INFO_NOISE,
+	NL80211_SURVEY_INFO_IN_USE,
+	NL80211_SURVEY_INFO_CHANNEL_TIME,
+	NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY,
+	NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY,
+	NL80211_SURVEY_INFO_CHANNEL_TIME_RX,
+	NL80211_SURVEY_INFO_CHANNEL_TIME_TX,
+
+	/* keep last */
+	__NL80211_SURVEY_INFO_AFTER_LAST,
+	NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1
+};
+
+/**
  * enum nl80211_mntr_flags - monitor configuration flags
  *
  * Monitor configuration flags.
@@ -1041,14 +2040,15 @@
 /**
  * enum nl80211_meshconf_params - mesh configuration parameters
  *
- * Mesh configuration parameters
+ * Mesh configuration parameters. These can be changed while the mesh is
+ * active.
  *
  * @__NL80211_MESHCONF_INVALID: internal use
  *
  * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in
  * millisecond units, used by the Peer Link Open message
  *
- * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the inital confirm timeout, in
+ * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the initial confirm timeout, in
  * millisecond units, used by the peer link management to close a peer link
  *
  * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in
@@ -1088,6 +2088,22 @@
  * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs)
  * that it takes for an HWMP information element to propagate across the mesh
  *
+ * @NL80211_MESHCONF_HWMP_ROOTMODE: whether root mode is enabled or not
+ *
+ * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a
+ * source mesh point for path selection elements.
+ *
+ * @NL80211_MESHCONF_HWMP_RANN_INTERVAL:  The interval of time (in TUs) between
+ * root announcements are transmitted.
+ *
+ * @NL80211_MESHCONF_GATE_ANNOUNCEMENTS: Advertise that this mesh station has
+ * access to a broader network beyond the MBSS.  This is done via Root
+ * Announcement frames.
+ *
+ * @NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL: The minimum interval of time (in
+ * TUs) during which a mesh STA can send only one Action frame containing a
+ * PERR element.
+ *
  * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
  *
  * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
@@ -1107,6 +2123,11 @@
 	NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT,
 	NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
 	NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
+	NL80211_MESHCONF_HWMP_ROOTMODE,
+	NL80211_MESHCONF_ELEMENT_TTL,
+	NL80211_MESHCONF_HWMP_RANN_INTERVAL,
+	NL80211_MESHCONF_GATE_ANNOUNCEMENTS,
+	NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL,
 
 	/* keep last */
 	__NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -1114,6 +2135,54 @@
 };
 
 /**
+ * enum nl80211_mesh_setup_params - mesh setup parameters
+ *
+ * Mesh setup parameters.  These are used to start/join a mesh and cannot be
+ * changed while the mesh is active.
+ *
+ * @__NL80211_MESH_SETUP_INVALID: Internal use
+ *
+ * @NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL: Enable this option to use a
+ * vendor specific path selection algorithm or disable it to use the default
+ * HWMP.
+ *
+ * @NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC: Enable this option to use a
+ * vendor specific path metric or disable it to use the default Airtime
+ * metric.
+ *
+ * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a
+ * robust security network ie, or a vendor specific information element that
+ * vendors will use to identify the path selection methods and metrics in use.
+ *
+ * @NL80211_MESH_SETUP_USERSPACE_AUTH: Enable this option if an authentication
+ * daemon will be authenticating mesh candidates.
+ *
+ * @NL80211_MESH_SETUP_USERSPACE_AMPE: Enable this option if an authentication
+ * daemon will be securing peer link frames.  AMPE is a secured version of Mesh
+ * Peering Management (MPM) and is implemented with the assistance of a
+ * userspace daemon.  When this flag is set, the kernel will send peer
+ * management frames to a userspace daemon that will implement AMPE
+ * functionality (security capabilities selection, key confirmation, and key
+ * management).  When the flag is unset (default), the kernel can autonomously
+ * complete (unsecured) mesh peering without the need of a userspace daemon.
+ *
+ * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number
+ * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use
+ */
+enum nl80211_mesh_setup_params {
+	__NL80211_MESH_SETUP_INVALID,
+	NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL,
+	NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC,
+	NL80211_MESH_SETUP_IE,
+	NL80211_MESH_SETUP_USERSPACE_AUTH,
+	NL80211_MESH_SETUP_USERSPACE_AMPE,
+
+	/* keep last */
+	__NL80211_MESH_SETUP_ATTR_AFTER_LAST,
+	NL80211_MESH_SETUP_ATTR_MAX = __NL80211_MESH_SETUP_ATTR_AFTER_LAST - 1
+};
+
+/**
  * enum nl80211_txq_attr - TX queue parameter attributes
  * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
  * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*)
@@ -1158,16 +2227,26 @@
  * enum nl80211_bss - netlink attributes for a BSS
  *
  * @__NL80211_BSS_INVALID: invalid
+ * @NL80211_BSS_BSSID: BSSID of the BSS (6 octets)
  * @NL80211_BSS_FREQUENCY: frequency in MHz (u32)
  * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64)
  * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16)
  * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16)
  * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the
- *	raw information elements from the probe response/beacon (bin)
+ *	raw information elements from the probe response/beacon (bin);
+ *	if the %NL80211_BSS_BEACON_IES attribute is present, the IEs here are
+ *	from a Probe Response frame; otherwise they are from a Beacon frame.
+ *	However, if the driver does not indicate the source of the IEs, these
+ *	IEs may be from either frame subtype.
  * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon
  *	in mBm (100 * dBm) (s32)
  * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
  *	in unspecified units, scaled to 0..100 (u8)
+ * @NL80211_BSS_STATUS: status, if this BSS is "used"
+ * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms
+ * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information
+ *	elements from a Beacon frame (bin); not present if no Beacon frame has
+ *	yet been received
  * @__NL80211_BSS_AFTER_LAST: internal
  * @NL80211_BSS_MAX: highest BSS attribute
  */
@@ -1181,6 +2260,9 @@
 	NL80211_BSS_INFORMATION_ELEMENTS,
 	NL80211_BSS_SIGNAL_MBM,
 	NL80211_BSS_SIGNAL_UNSPEC,
+	NL80211_BSS_STATUS,
+	NL80211_BSS_SEEN_MS_AGO,
+	NL80211_BSS_BEACON_IES,
 
 	/* keep last */
 	__NL80211_BSS_AFTER_LAST,
@@ -1188,18 +2270,43 @@
 };
 
 /**
+ * enum nl80211_bss_status - BSS "status"
+ * @NL80211_BSS_STATUS_AUTHENTICATED: Authenticated with this BSS.
+ * @NL80211_BSS_STATUS_ASSOCIATED: Associated with this BSS.
+ * @NL80211_BSS_STATUS_IBSS_JOINED: Joined to this IBSS.
+ *
+ * The BSS status is a BSS attribute in scan dumps, which
+ * indicates the status the interface has wrt. this BSS.
+ */
+enum nl80211_bss_status {
+	NL80211_BSS_STATUS_AUTHENTICATED,
+	NL80211_BSS_STATUS_ASSOCIATED,
+	NL80211_BSS_STATUS_IBSS_JOINED,
+};
+
+/**
  * enum nl80211_auth_type - AuthenticationType
  *
  * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication
  * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only)
  * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r)
  * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP)
+ * @__NL80211_AUTHTYPE_NUM: internal
+ * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm
+ * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by
+ *	trying multiple times); this is invalid in netlink -- leave out
+ *	the attribute for this on CONNECT commands.
  */
 enum nl80211_auth_type {
 	NL80211_AUTHTYPE_OPEN_SYSTEM,
 	NL80211_AUTHTYPE_SHARED_KEY,
 	NL80211_AUTHTYPE_FT,
 	NL80211_AUTHTYPE_NETWORK_EAP,
+
+	/* keep last */
+	__NL80211_AUTHTYPE_NUM,
+	NL80211_AUTHTYPE_MAX = __NL80211_AUTHTYPE_NUM - 1,
+	NL80211_AUTHTYPE_AUTOMATIC
 };
 
 /**
@@ -1207,11 +2314,14 @@
  * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key
  * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key
  * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS)
+ * @NUM_NL80211_KEYTYPES: number of defined key types
  */
 enum nl80211_key_type {
 	NL80211_KEYTYPE_GROUP,
 	NL80211_KEYTYPE_PAIRWISE,
 	NL80211_KEYTYPE_PEERKEY,
+
+	NUM_NL80211_KEYTYPES
 };
 
 /**
@@ -1224,4 +2334,489 @@
 	NL80211_MFP_REQUIRED,
 };
 
+enum nl80211_wpa_versions {
+	NL80211_WPA_VERSION_1 = 1 << 0,
+	NL80211_WPA_VERSION_2 = 1 << 1,
+};
+
+/**
+ * enum nl80211_key_default_types - key default types
+ * @__NL80211_KEY_DEFAULT_TYPE_INVALID: invalid
+ * @NL80211_KEY_DEFAULT_TYPE_UNICAST: key should be used as default
+ *	unicast key
+ * @NL80211_KEY_DEFAULT_TYPE_MULTICAST: key should be used as default
+ *	multicast key
+ * @NUM_NL80211_KEY_DEFAULT_TYPES: number of default types
+ */
+enum nl80211_key_default_types {
+	__NL80211_KEY_DEFAULT_TYPE_INVALID,
+	NL80211_KEY_DEFAULT_TYPE_UNICAST,
+	NL80211_KEY_DEFAULT_TYPE_MULTICAST,
+
+	NUM_NL80211_KEY_DEFAULT_TYPES
+};
+
+/**
+ * enum nl80211_key_attributes - key attributes
+ * @__NL80211_KEY_INVALID: invalid
+ * @NL80211_KEY_DATA: (temporal) key data; for TKIP this consists of
+ *	16 bytes encryption key followed by 8 bytes each for TX and RX MIC
+ *	keys
+ * @NL80211_KEY_IDX: key ID (u8, 0-3)
+ * @NL80211_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11
+ *	section 7.3.2.25.1, e.g. 0x000FAC04)
+ * @NL80211_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and
+ *	CCMP keys, each six bytes in little endian
+ * @NL80211_KEY_DEFAULT: flag indicating default key
+ * @NL80211_KEY_DEFAULT_MGMT: flag indicating default management key
+ * @NL80211_KEY_TYPE: the key type from enum nl80211_key_type, if not
+ *	specified the default depends on whether a MAC address was
+ *	given with the command using the key or not (u32)
+ * @NL80211_KEY_DEFAULT_TYPES: A nested attribute containing flags
+ *	attributes, specifying what a key should be set as default as.
+ *	See &enum nl80211_key_default_types.
+ * @__NL80211_KEY_AFTER_LAST: internal
+ * @NL80211_KEY_MAX: highest key attribute
+ */
+enum nl80211_key_attributes {
+	__NL80211_KEY_INVALID,
+	NL80211_KEY_DATA,
+	NL80211_KEY_IDX,
+	NL80211_KEY_CIPHER,
+	NL80211_KEY_SEQ,
+	NL80211_KEY_DEFAULT,
+	NL80211_KEY_DEFAULT_MGMT,
+	NL80211_KEY_TYPE,
+	NL80211_KEY_DEFAULT_TYPES,
+
+	/* keep last */
+	__NL80211_KEY_AFTER_LAST,
+	NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_tx_rate_attributes - TX rate set attributes
+ * @__NL80211_TXRATE_INVALID: invalid
+ * @NL80211_TXRATE_LEGACY: Legacy (non-MCS) rates allowed for TX rate selection
+ *	in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with
+ *	1 = 500 kbps) but without the IE length restriction (at most
+ *	%NL80211_MAX_SUPP_RATES in a single array).
+ * @__NL80211_TXRATE_AFTER_LAST: internal
+ * @NL80211_TXRATE_MAX: highest TX rate attribute
+ */
+enum nl80211_tx_rate_attributes {
+	__NL80211_TXRATE_INVALID,
+	NL80211_TXRATE_LEGACY,
+
+	/* keep last */
+	__NL80211_TXRATE_AFTER_LAST,
+	NL80211_TXRATE_MAX = __NL80211_TXRATE_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_band - Frequency band
+ * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
+ * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
+ */
+enum nl80211_band {
+	NL80211_BAND_2GHZ,
+	NL80211_BAND_5GHZ,
+};
+
+enum nl80211_ps_state {
+	NL80211_PS_DISABLED,
+	NL80211_PS_ENABLED,
+};
+
+/**
+ * enum nl80211_attr_cqm - connection quality monitor attributes
+ * @__NL80211_ATTR_CQM_INVALID: invalid
+ * @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies
+ *	the threshold for the RSSI level at which an event will be sent. Zero
+ *	to disable.
+ * @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies
+ *	the minimum amount the RSSI level must change after an event before a
+ *	new event may be issued (to reduce effects of RSSI oscillation).
+ * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event
+ * @NL80211_ATTR_CQM_PKT_LOSS_EVENT: a u32 value indicating that this many
+ *	consecutive packets were not acknowledged by the peer
+ * @__NL80211_ATTR_CQM_AFTER_LAST: internal
+ * @NL80211_ATTR_CQM_MAX: highest key attribute
+ */
+enum nl80211_attr_cqm {
+	__NL80211_ATTR_CQM_INVALID,
+	NL80211_ATTR_CQM_RSSI_THOLD,
+	NL80211_ATTR_CQM_RSSI_HYST,
+	NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT,
+	NL80211_ATTR_CQM_PKT_LOSS_EVENT,
+
+	/* keep last */
+	__NL80211_ATTR_CQM_AFTER_LAST,
+	NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_cqm_rssi_threshold_event - RSSI threshold event
+ * @NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW: The RSSI level is lower than the
+ *      configured threshold
+ * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the
+ *      configured threshold
+ */
+enum nl80211_cqm_rssi_threshold_event {
+	NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW,
+	NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH,
+};
+
+
+/**
+ * enum nl80211_tx_power_setting - TX power adjustment
+ * @NL80211_TX_POWER_AUTOMATIC: automatically determine transmit power
+ * @NL80211_TX_POWER_LIMITED: limit TX power by the mBm parameter
+ * @NL80211_TX_POWER_FIXED: fix TX power to the mBm parameter
+ */
+enum nl80211_tx_power_setting {
+	NL80211_TX_POWER_AUTOMATIC,
+	NL80211_TX_POWER_LIMITED,
+	NL80211_TX_POWER_FIXED,
+};
+
+/**
+ * enum nl80211_wowlan_packet_pattern_attr - WoWLAN packet pattern attribute
+ * @__NL80211_WOWLAN_PKTPAT_INVALID: invalid number for nested attribute
+ * @NL80211_WOWLAN_PKTPAT_PATTERN: the pattern, values where the mask has
+ *	a zero bit are ignored
+ * @NL80211_WOWLAN_PKTPAT_MASK: pattern mask, must be long enough to have
+ *	a bit for each byte in the pattern. The lowest-order bit corresponds
+ *	to the first byte of the pattern, but the bytes of the pattern are
+ *	in a little-endian-like format, i.e. the 9th byte of the pattern
+ *	corresponds to the lowest-order bit in the second byte of the mask.
+ *	For example: The match 00:xx:00:00:xx:00:00:00:00:xx:xx:xx (where
+ *	xx indicates "don't care") would be represented by a pattern of
+ *	twelve zero bytes, and a mask of "0xed,0x07".
+ *	Note that the pattern matching is done as though frames were not
+ *	802.11 frames but 802.3 frames, i.e. the frame is fully unpacked
+ *	first (including SNAP header unpacking) and then matched.
+ * @NUM_NL80211_WOWLAN_PKTPAT: number of attributes
+ * @MAX_NL80211_WOWLAN_PKTPAT: max attribute number
+ */
+enum nl80211_wowlan_packet_pattern_attr {
+	__NL80211_WOWLAN_PKTPAT_INVALID,
+	NL80211_WOWLAN_PKTPAT_MASK,
+	NL80211_WOWLAN_PKTPAT_PATTERN,
+
+	NUM_NL80211_WOWLAN_PKTPAT,
+	MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1,
+};
+
+/**
+ * struct nl80211_wowlan_pattern_support - pattern support information
+ * @max_patterns: maximum number of patterns supported
+ * @min_pattern_len: minimum length of each pattern
+ * @max_pattern_len: maximum length of each pattern
+ *
+ * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when
+ * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the
+ * capability information given by the kernel to userspace.
+ */
+struct nl80211_wowlan_pattern_support {
+	__u32 max_patterns;
+	__u32 min_pattern_len;
+	__u32 max_pattern_len;
+} __attribute__((packed));
+
+/**
+ * enum nl80211_wowlan_triggers - WoWLAN trigger definitions
+ * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes
+ * @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put
+ *	the chip into a special state -- works best with chips that have
+ *	support for low-power operation already (flag)
+ * @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect
+ *	is detected is implementation-specific (flag)
+ * @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed
+ *	by 16 repetitions of MAC addr, anywhere in payload) (flag)
+ * @NL80211_WOWLAN_TRIG_PKT_PATTERN: wake up on the specified packet patterns
+ *	which are passed in an array of nested attributes, each nested attribute
+ *	defining a with attributes from &struct nl80211_wowlan_trig_pkt_pattern.
+ *	Each pattern defines a wakeup packet. The matching is done on the MSDU,
+ *	i.e. as though the packet was an 802.3 packet, so the pattern matching
+ *	is done after the packet is converted to the MSDU.
+ *
+ *	In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute
+ *	carrying a &struct nl80211_wowlan_pattern_support.
+ * @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be
+ *	used when setting, used only to indicate that GTK rekeying is supported
+ *	by the device (flag)
+ * @NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE: wake up on GTK rekey failure (if
+ *	done by the device) (flag)
+ * @NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST: wake up on EAP Identity Request
+ *	packet (flag)
+ * @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag)
+ * @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released
+ *	(on devices that have rfkill in the device) (flag)
+ * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers
+ * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number
+ */
+enum nl80211_wowlan_triggers {
+	__NL80211_WOWLAN_TRIG_INVALID,
+	NL80211_WOWLAN_TRIG_ANY,
+	NL80211_WOWLAN_TRIG_DISCONNECT,
+	NL80211_WOWLAN_TRIG_MAGIC_PKT,
+	NL80211_WOWLAN_TRIG_PKT_PATTERN,
+	NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED,
+	NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE,
+	NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST,
+	NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE,
+	NL80211_WOWLAN_TRIG_RFKILL_RELEASE,
+
+	/* keep last */
+	NUM_NL80211_WOWLAN_TRIG,
+	MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1
+};
+
+/**
+ * enum nl80211_iface_limit_attrs - limit attributes
+ * @NL80211_IFACE_LIMIT_UNSPEC: (reserved)
+ * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that
+ *	can be chosen from this set of interface types (u32)
+ * @NL80211_IFACE_LIMIT_TYPES: nested attribute containing a
+ *	flag attribute for each interface type in this set
+ * @NUM_NL80211_IFACE_LIMIT: number of attributes
+ * @MAX_NL80211_IFACE_LIMIT: highest attribute number
+ */
+enum nl80211_iface_limit_attrs {
+	NL80211_IFACE_LIMIT_UNSPEC,
+	NL80211_IFACE_LIMIT_MAX,
+	NL80211_IFACE_LIMIT_TYPES,
+
+	/* keep last */
+	NUM_NL80211_IFACE_LIMIT,
+	MAX_NL80211_IFACE_LIMIT = NUM_NL80211_IFACE_LIMIT - 1
+};
+
+/**
+ * enum nl80211_if_combination_attrs -- interface combination attributes
+ *
+ * @NL80211_IFACE_COMB_UNSPEC: (reserved)
+ * @NL80211_IFACE_COMB_LIMITS: Nested attributes containing the limits
+ *	for given interface types, see &enum nl80211_iface_limit_attrs.
+ * @NL80211_IFACE_COMB_MAXNUM: u32 attribute giving the total number of
+ *	interfaces that can be created in this group. This number doesn't
+ *	apply to interfaces purely managed in software, which are listed
+ *	in a separate attribute %NL80211_ATTR_INTERFACES_SOFTWARE.
+ * @NL80211_IFACE_COMB_STA_AP_BI_MATCH: flag attribute specifying that
+ *	beacon intervals within this group must be all the same even for
+ *	infrastructure and AP/GO combinations, i.e. the GO(s) must adopt
+ *	the infrastructure network's beacon interval.
+ * @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many
+ *	different channels may be used within this group.
+ * @NUM_NL80211_IFACE_COMB: number of attributes
+ * @MAX_NL80211_IFACE_COMB: highest attribute number
+ *
+ * Examples:
+ *	limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2
+ *	=> allows an AP and a STA that must match BIs
+ *
+ *	numbers = [ #{AP, P2P-GO} <= 8 ], channels = 1, max = 8
+ *	=> allows 8 of AP/GO
+ *
+ *	numbers = [ #{STA} <= 2 ], channels = 2, max = 2
+ *	=> allows two STAs on different channels
+ *
+ *	numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4
+ *	=> allows a STA plus three P2P interfaces
+ *
+ * The list of these four possiblities could completely be contained
+ * within the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute to indicate
+ * that any of these groups must match.
+ *
+ * "Combinations" of just a single interface will not be listed here,
+ * a single interface of any valid interface type is assumed to always
+ * be possible by itself. This means that implicitly, for each valid
+ * interface type, the following group always exists:
+ *	numbers = [ #{<type>} <= 1 ], channels = 1, max = 1
+ */
+enum nl80211_if_combination_attrs {
+	NL80211_IFACE_COMB_UNSPEC,
+	NL80211_IFACE_COMB_LIMITS,
+	NL80211_IFACE_COMB_MAXNUM,
+	NL80211_IFACE_COMB_STA_AP_BI_MATCH,
+	NL80211_IFACE_COMB_NUM_CHANNELS,
+
+	/* keep last */
+	NUM_NL80211_IFACE_COMB,
+	MAX_NL80211_IFACE_COMB = NUM_NL80211_IFACE_COMB - 1
+};
+
+
+/**
+ * enum nl80211_plink_state - state of a mesh peer link finite state machine
+ *
+ * @NL80211_PLINK_LISTEN: initial state, considered the implicit
+ *	state of non existant mesh peer links
+ * @NL80211_PLINK_OPN_SNT: mesh plink open frame has been sent to
+ *	this mesh peer
+ * @NL80211_PLINK_OPN_RCVD: mesh plink open frame has been received
+ *	from this mesh peer
+ * @NL80211_PLINK_CNF_RCVD: mesh plink confirm frame has been
+ *	received from this mesh peer
+ * @NL80211_PLINK_ESTAB: mesh peer link is established
+ * @NL80211_PLINK_HOLDING: mesh peer link is being closed or cancelled
+ * @NL80211_PLINK_BLOCKED: all frames transmitted from this mesh
+ *	plink are discarded
+ * @NUM_NL80211_PLINK_STATES: number of peer link states
+ * @MAX_NL80211_PLINK_STATES: highest numerical value of plink states
+ */
+enum nl80211_plink_state {
+	NL80211_PLINK_LISTEN,
+	NL80211_PLINK_OPN_SNT,
+	NL80211_PLINK_OPN_RCVD,
+	NL80211_PLINK_CNF_RCVD,
+	NL80211_PLINK_ESTAB,
+	NL80211_PLINK_HOLDING,
+	NL80211_PLINK_BLOCKED,
+
+	/* keep last */
+	NUM_NL80211_PLINK_STATES,
+	MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1
+};
+
+#define NL80211_KCK_LEN			16
+#define NL80211_KEK_LEN			16
+#define NL80211_REPLAY_CTR_LEN		8
+
+/**
+ * enum nl80211_rekey_data - attributes for GTK rekey offload
+ * @__NL80211_REKEY_DATA_INVALID: invalid number for nested attributes
+ * @NL80211_REKEY_DATA_KEK: key encryption key (binary)
+ * @NL80211_REKEY_DATA_KCK: key confirmation key (binary)
+ * @NL80211_REKEY_DATA_REPLAY_CTR: replay counter (binary)
+ * @NUM_NL80211_REKEY_DATA: number of rekey attributes (internal)
+ * @MAX_NL80211_REKEY_DATA: highest rekey attribute (internal)
+ */
+enum nl80211_rekey_data {
+	__NL80211_REKEY_DATA_INVALID,
+	NL80211_REKEY_DATA_KEK,
+	NL80211_REKEY_DATA_KCK,
+	NL80211_REKEY_DATA_REPLAY_CTR,
+
+	/* keep last */
+	NUM_NL80211_REKEY_DATA,
+	MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1
+};
+
+/**
+ * enum nl80211_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID
+ * @NL80211_HIDDEN_SSID_NOT_IN_USE: do not hide SSID (i.e., broadcast it in
+ *	Beacon frames)
+ * @NL80211_HIDDEN_SSID_ZERO_LEN: hide SSID by using zero-length SSID element
+ *	in Beacon frames
+ * @NL80211_HIDDEN_SSID_ZERO_CONTENTS: hide SSID by using correct length of SSID
+ *	element in Beacon frames but zero out each byte in the SSID
+ */
+enum nl80211_hidden_ssid {
+	NL80211_HIDDEN_SSID_NOT_IN_USE,
+	NL80211_HIDDEN_SSID_ZERO_LEN,
+	NL80211_HIDDEN_SSID_ZERO_CONTENTS
+};
+
+/**
+ * enum nl80211_sta_wme_attr - station WME attributes
+ * @__NL80211_STA_WME_INVALID: invalid number for nested attribute
+ * @NL80211_STA_WME_UAPSD_QUEUES: bitmap of uapsd queues. the format
+ *	is the same as the AC bitmap in the QoS info field.
+ * @NL80211_STA_WME_MAX_SP: max service period. the format is the same
+ *	as the MAX_SP field in the QoS info field (but already shifted down).
+ * @__NL80211_STA_WME_AFTER_LAST: internal
+ * @NL80211_STA_WME_MAX: highest station WME attribute
+ */
+enum nl80211_sta_wme_attr {
+	__NL80211_STA_WME_INVALID,
+	NL80211_STA_WME_UAPSD_QUEUES,
+	NL80211_STA_WME_MAX_SP,
+
+	/* keep last */
+	__NL80211_STA_WME_AFTER_LAST,
+	NL80211_STA_WME_MAX = __NL80211_STA_WME_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_pmksa_candidate_attr - attributes for PMKSA caching candidates
+ * @__NL80211_PMKSA_CANDIDATE_INVALID: invalid number for nested attributes
+ * @NL80211_PMKSA_CANDIDATE_INDEX: candidate index (u32; the smaller, the higher
+ *	priority)
+ * @NL80211_PMKSA_CANDIDATE_BSSID: candidate BSSID (6 octets)
+ * @NL80211_PMKSA_CANDIDATE_PREAUTH: RSN pre-authentication supported (flag)
+ * @NUM_NL80211_PMKSA_CANDIDATE: number of PMKSA caching candidate attributes
+ *	(internal)
+ * @MAX_NL80211_PMKSA_CANDIDATE: highest PMKSA caching candidate attribute
+ *	(internal)
+ */
+enum nl80211_pmksa_candidate_attr {
+	__NL80211_PMKSA_CANDIDATE_INVALID,
+	NL80211_PMKSA_CANDIDATE_INDEX,
+	NL80211_PMKSA_CANDIDATE_BSSID,
+	NL80211_PMKSA_CANDIDATE_PREAUTH,
+
+	/* keep last */
+	NUM_NL80211_PMKSA_CANDIDATE,
+	MAX_NL80211_PMKSA_CANDIDATE = NUM_NL80211_PMKSA_CANDIDATE - 1
+};
+
+/**
+ * enum nl80211_tdls_operation - values for %NL80211_ATTR_TDLS_OPERATION
+ * @NL80211_TDLS_DISCOVERY_REQ: Send a TDLS discovery request
+ * @NL80211_TDLS_SETUP: Setup TDLS link
+ * @NL80211_TDLS_TEARDOWN: Teardown a TDLS link which is already established
+ * @NL80211_TDLS_ENABLE_LINK: Enable TDLS link
+ * @NL80211_TDLS_DISABLE_LINK: Disable TDLS link
+ */
+enum nl80211_tdls_operation {
+	NL80211_TDLS_DISCOVERY_REQ,
+	NL80211_TDLS_SETUP,
+	NL80211_TDLS_TEARDOWN,
+	NL80211_TDLS_ENABLE_LINK,
+	NL80211_TDLS_DISABLE_LINK,
+};
+
+/*
+ * enum nl80211_ap_sme_features - device-integrated AP features
+ * Reserved for future use, no bits are defined in
+ * NL80211_ATTR_DEVICE_AP_SME yet.
+enum nl80211_ap_sme_features {
+};
+ */
+
+/**
+ * enum nl80211_feature_flags - device/driver features
+ * @NL80211_FEATURE_SK_TX_STATUS: This driver supports reflecting back
+ *	TX status to the socket error queue when requested with the
+ *	socket option.
+ * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates.
+ */
+enum nl80211_feature_flags {
+	NL80211_FEATURE_SK_TX_STATUS	= 1 << 0,
+	NL80211_FEATURE_HT_IBSS		= 1 << 1,
+};
+
+/**
+ * enum nl80211_probe_resp_offload_support_attr - optional supported
+ *	protocols for probe-response offloading by the driver/FW.
+ *	To be used with the %NL80211_ATTR_PROBE_RESP_OFFLOAD attribute.
+ *	Each enum value represents a bit in the bitmap of supported
+ *	protocols. Typically a subset of probe-requests belonging to a
+ *	supported protocol will be excluded from offload and uploaded
+ *	to the host.
+ *
+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS: Support for WPS ver. 1
+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2: Support for WPS ver. 2
+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P: Support for P2P
+ * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U: Support for 802.11u
+ */
+enum nl80211_probe_resp_offload_support_attr {
+	NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS =	1<<0,
+	NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 =	1<<1,
+	NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P =	1<<2,
+	NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U =	1<<3,
+};
+
 #endif /* __LINUX_NL80211_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/omap3isp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/omap3isp.h
new file mode 100644
index 0000000..5be9135
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/omap3isp.h
@@ -0,0 +1,644 @@
+/*
+ * omap3isp.h
+ *
+ * TI OMAP3 ISP - User-space API
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ * Copyright (C) 2009 Texas Instruments, Inc.
+ *
+ * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ *	     Sakari Ailus <sakari.ailus@iki.fi>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef OMAP3_ISP_USER_H
+#define OMAP3_ISP_USER_H
+
+#include <linux/types.h>
+
+/*
+ * Private IOCTLs
+ *
+ * VIDIOC_OMAP3ISP_CCDC_CFG: Set CCDC configuration
+ * VIDIOC_OMAP3ISP_PRV_CFG: Set preview engine configuration
+ * VIDIOC_OMAP3ISP_AEWB_CFG: Set AEWB module configuration
+ * VIDIOC_OMAP3ISP_HIST_CFG: Set histogram module configuration
+ * VIDIOC_OMAP3ISP_AF_CFG: Set auto-focus module configuration
+ * VIDIOC_OMAP3ISP_STAT_REQ: Read statistics (AEWB/AF/histogram) data
+ * VIDIOC_OMAP3ISP_STAT_EN: Enable/disable a statistics module
+ */
+
+#define VIDIOC_OMAP3ISP_CCDC_CFG \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct omap3isp_ccdc_update_config)
+#define VIDIOC_OMAP3ISP_PRV_CFG \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct omap3isp_prev_update_config)
+#define VIDIOC_OMAP3ISP_AEWB_CFG \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct omap3isp_h3a_aewb_config)
+#define VIDIOC_OMAP3ISP_HIST_CFG \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct omap3isp_hist_config)
+#define VIDIOC_OMAP3ISP_AF_CFG \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct omap3isp_h3a_af_config)
+#define VIDIOC_OMAP3ISP_STAT_REQ \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data)
+#define VIDIOC_OMAP3ISP_STAT_EN \
+	_IOWR('V', BASE_VIDIOC_PRIVATE + 7, unsigned long)
+
+/*
+ * Events
+ *
+ * V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready
+ * V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready
+ * V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready
+ */
+
+#define V4L2_EVENT_OMAP3ISP_CLASS	(V4L2_EVENT_PRIVATE_START | 0x100)
+#define V4L2_EVENT_OMAP3ISP_AEWB	(V4L2_EVENT_OMAP3ISP_CLASS | 0x1)
+#define V4L2_EVENT_OMAP3ISP_AF		(V4L2_EVENT_OMAP3ISP_CLASS | 0x2)
+#define V4L2_EVENT_OMAP3ISP_HIST	(V4L2_EVENT_OMAP3ISP_CLASS | 0x3)
+
+struct omap3isp_stat_event_status {
+	__u32 frame_number;
+	__u16 config_counter;
+	__u8 buf_err;
+};
+
+/* AE/AWB related structures and flags*/
+
+/* H3A Range Constants */
+#define OMAP3ISP_AEWB_MAX_SATURATION_LIM	1023
+#define OMAP3ISP_AEWB_MIN_WIN_H			2
+#define OMAP3ISP_AEWB_MAX_WIN_H			256
+#define OMAP3ISP_AEWB_MIN_WIN_W			6
+#define OMAP3ISP_AEWB_MAX_WIN_W			256
+#define OMAP3ISP_AEWB_MIN_WINVC			1
+#define OMAP3ISP_AEWB_MIN_WINHC			1
+#define OMAP3ISP_AEWB_MAX_WINVC			128
+#define OMAP3ISP_AEWB_MAX_WINHC			36
+#define OMAP3ISP_AEWB_MAX_WINSTART		4095
+#define OMAP3ISP_AEWB_MIN_SUB_INC		2
+#define OMAP3ISP_AEWB_MAX_SUB_INC		32
+#define OMAP3ISP_AEWB_MAX_BUF_SIZE		83600
+
+#define OMAP3ISP_AF_IIRSH_MIN			0
+#define OMAP3ISP_AF_IIRSH_MAX			4095
+#define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MIN	1
+#define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MAX	36
+#define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MIN	1
+#define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MAX	128
+#define OMAP3ISP_AF_PAXEL_INCREMENT_MIN		2
+#define OMAP3ISP_AF_PAXEL_INCREMENT_MAX		32
+#define OMAP3ISP_AF_PAXEL_HEIGHT_MIN		2
+#define OMAP3ISP_AF_PAXEL_HEIGHT_MAX		256
+#define OMAP3ISP_AF_PAXEL_WIDTH_MIN		16
+#define OMAP3ISP_AF_PAXEL_WIDTH_MAX		256
+#define OMAP3ISP_AF_PAXEL_HZSTART_MIN		1
+#define OMAP3ISP_AF_PAXEL_HZSTART_MAX		4095
+#define OMAP3ISP_AF_PAXEL_VTSTART_MIN		0
+#define OMAP3ISP_AF_PAXEL_VTSTART_MAX		4095
+#define OMAP3ISP_AF_THRESHOLD_MAX		255
+#define OMAP3ISP_AF_COEF_MAX			4095
+#define OMAP3ISP_AF_PAXEL_SIZE			48
+#define OMAP3ISP_AF_MAX_BUF_SIZE		221184
+
+/**
+ * struct omap3isp_h3a_aewb_config - AE AWB configuration reset values
+ * saturation_limit: Saturation limit.
+ * @win_height: Window Height. Range 2 - 256, even values only.
+ * @win_width: Window Width. Range 6 - 256, even values only.
+ * @ver_win_count: Vertical Window Count. Range 1 - 128.
+ * @hor_win_count: Horizontal Window Count. Range 1 - 36.
+ * @ver_win_start: Vertical Window Start. Range 0 - 4095.
+ * @hor_win_start: Horizontal Window Start. Range 0 - 4095.
+ * @blk_ver_win_start: Black Vertical Windows Start. Range 0 - 4095.
+ * @blk_win_height: Black Window Height. Range 2 - 256, even values only.
+ * @subsample_ver_inc: Subsample Vertical points increment Range 2 - 32, even
+ *                     values only.
+ * @subsample_hor_inc: Subsample Horizontal points increment Range 2 - 32, even
+ *                     values only.
+ * @alaw_enable: AEW ALAW EN flag.
+ */
+struct omap3isp_h3a_aewb_config {
+	/*
+	 * Common fields.
+	 * They should be the first ones and must be in the same order as in
+	 * ispstat_generic_config struct.
+	 */
+	__u32 buf_size;
+	__u16 config_counter;
+
+	/* Private fields */
+	__u16 saturation_limit;
+	__u16 win_height;
+	__u16 win_width;
+	__u16 ver_win_count;
+	__u16 hor_win_count;
+	__u16 ver_win_start;
+	__u16 hor_win_start;
+	__u16 blk_ver_win_start;
+	__u16 blk_win_height;
+	__u16 subsample_ver_inc;
+	__u16 subsample_hor_inc;
+	__u8 alaw_enable;
+};
+
+/**
+ * struct omap3isp_stat_data - Statistic data sent to or received from user
+ * @ts: Timestamp of returned framestats.
+ * @buf: Pointer to pass to user.
+ * @frame_number: Frame number of requested stats.
+ * @cur_frame: Current frame number being processed.
+ * @config_counter: Number of the configuration associated with the data.
+ */
+struct omap3isp_stat_data {
+	struct timeval ts;
+	void *buf;
+	__u32 buf_size;
+	__u16 frame_number;
+	__u16 cur_frame;
+	__u16 config_counter;
+};
+
+
+/* Histogram related structs */
+
+/* Flags for number of bins */
+#define OMAP3ISP_HIST_BINS_32		0
+#define OMAP3ISP_HIST_BINS_64		1
+#define OMAP3ISP_HIST_BINS_128		2
+#define OMAP3ISP_HIST_BINS_256		3
+
+/* Number of bins * 4 colors * 4-bytes word */
+#define OMAP3ISP_HIST_MEM_SIZE_BINS(n)	((1 << ((n)+5))*4*4)
+
+#define OMAP3ISP_HIST_MEM_SIZE		1024
+#define OMAP3ISP_HIST_MIN_REGIONS	1
+#define OMAP3ISP_HIST_MAX_REGIONS	4
+#define OMAP3ISP_HIST_MAX_WB_GAIN	255
+#define OMAP3ISP_HIST_MIN_WB_GAIN	0
+#define OMAP3ISP_HIST_MAX_BIT_WIDTH	14
+#define OMAP3ISP_HIST_MIN_BIT_WIDTH	8
+#define OMAP3ISP_HIST_MAX_WG		4
+#define OMAP3ISP_HIST_MAX_BUF_SIZE	4096
+
+/* Source */
+#define OMAP3ISP_HIST_SOURCE_CCDC	0
+#define OMAP3ISP_HIST_SOURCE_MEM	1
+
+/* CFA pattern */
+#define OMAP3ISP_HIST_CFA_BAYER		0
+#define OMAP3ISP_HIST_CFA_FOVEONX3	1
+
+struct omap3isp_hist_region {
+	__u16 h_start;
+	__u16 h_end;
+	__u16 v_start;
+	__u16 v_end;
+};
+
+struct omap3isp_hist_config {
+	/*
+	 * Common fields.
+	 * They should be the first ones and must be in the same order as in
+	 * ispstat_generic_config struct.
+	 */
+	__u32 buf_size;
+	__u16 config_counter;
+
+	__u8 num_acc_frames;	/* Num of image frames to be processed and
+				   accumulated for each histogram frame */
+	__u16 hist_bins;	/* number of bins: 32, 64, 128, or 256 */
+	__u8 cfa;		/* BAYER or FOVEON X3 */
+	__u8 wg[OMAP3ISP_HIST_MAX_WG];	/* White Balance Gain */
+	__u8 num_regions;	/* number of regions to be configured */
+	struct omap3isp_hist_region region[OMAP3ISP_HIST_MAX_REGIONS];
+};
+
+/* Auto Focus related structs */
+
+#define OMAP3ISP_AF_NUM_COEF		11
+
+enum omap3isp_h3a_af_fvmode {
+	OMAP3ISP_AF_MODE_SUMMED = 0,
+	OMAP3ISP_AF_MODE_PEAK = 1
+};
+
+/* Red, Green, and blue pixel location in the AF windows */
+enum omap3isp_h3a_af_rgbpos {
+	OMAP3ISP_AF_GR_GB_BAYER = 0,	/* GR and GB as Bayer pattern */
+	OMAP3ISP_AF_RG_GB_BAYER = 1,	/* RG and GB as Bayer pattern */
+	OMAP3ISP_AF_GR_BG_BAYER = 2,	/* GR and BG as Bayer pattern */
+	OMAP3ISP_AF_RG_BG_BAYER = 3,	/* RG and BG as Bayer pattern */
+	OMAP3ISP_AF_GG_RB_CUSTOM = 4,	/* GG and RB as custom pattern */
+	OMAP3ISP_AF_RB_GG_CUSTOM = 5	/* RB and GG as custom pattern */
+};
+
+/* Contains the information regarding the Horizontal Median Filter */
+struct omap3isp_h3a_af_hmf {
+	__u8 enable;	/* Status of Horizontal Median Filter */
+	__u8 threshold;	/* Threshold Value for Horizontal Median Filter */
+};
+
+/* Contains the information regarding the IIR Filters */
+struct omap3isp_h3a_af_iir {
+	__u16 h_start;			/* IIR horizontal start */
+	__u16 coeff_set0[OMAP3ISP_AF_NUM_COEF];	/* Filter coefficient, set 0 */
+	__u16 coeff_set1[OMAP3ISP_AF_NUM_COEF];	/* Filter coefficient, set 1 */
+};
+
+/* Contains the information regarding the Paxels Structure in AF Engine */
+struct omap3isp_h3a_af_paxel {
+	__u16 h_start;	/* Horizontal Start Position */
+	__u16 v_start;	/* Vertical Start Position */
+	__u8 width;	/* Width of the Paxel */
+	__u8 height;	/* Height of the Paxel */
+	__u8 h_cnt;	/* Horizontal Count */
+	__u8 v_cnt;	/* vertical Count */
+	__u8 line_inc;	/* Line Increment */
+};
+
+/* Contains the parameters required for hardware set up of AF Engine */
+struct omap3isp_h3a_af_config {
+	/*
+	 * Common fields.
+	 * They should be the first ones and must be in the same order as in
+	 * ispstat_generic_config struct.
+	 */
+	__u32 buf_size;
+	__u16 config_counter;
+
+	struct omap3isp_h3a_af_hmf hmf;		/* HMF configurations */
+	struct omap3isp_h3a_af_iir iir;		/* IIR filter configurations */
+	struct omap3isp_h3a_af_paxel paxel;	/* Paxel parameters */
+	enum omap3isp_h3a_af_rgbpos rgb_pos;	/* RGB Positions */
+	enum omap3isp_h3a_af_fvmode fvmode;	/* Accumulator mode */
+	__u8 alaw_enable;			/* AF ALAW status */
+};
+
+/* ISP CCDC structs */
+
+/* Abstraction layer CCDC configurations */
+#define OMAP3ISP_CCDC_ALAW		(1 << 0)
+#define OMAP3ISP_CCDC_LPF		(1 << 1)
+#define OMAP3ISP_CCDC_BLCLAMP		(1 << 2)
+#define OMAP3ISP_CCDC_BCOMP		(1 << 3)
+#define OMAP3ISP_CCDC_FPC		(1 << 4)
+#define OMAP3ISP_CCDC_CULL		(1 << 5)
+#define OMAP3ISP_CCDC_CONFIG_LSC	(1 << 7)
+#define OMAP3ISP_CCDC_TBL_LSC		(1 << 8)
+
+#define OMAP3ISP_RGB_MAX		3
+
+/* Enumeration constants for Alaw input width */
+enum omap3isp_alaw_ipwidth {
+	OMAP3ISP_ALAW_BIT12_3 = 0x3,
+	OMAP3ISP_ALAW_BIT11_2 = 0x4,
+	OMAP3ISP_ALAW_BIT10_1 = 0x5,
+	OMAP3ISP_ALAW_BIT9_0 = 0x6
+};
+
+/**
+ * struct omap3isp_ccdc_lsc_config - LSC configuration
+ * @offset: Table Offset of the gain table.
+ * @gain_mode_n: Vertical dimension of a paxel in LSC configuration.
+ * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration.
+ * @gain_format: Gain table format.
+ * @fmtsph: Start pixel horizontal from start of the HS sync pulse.
+ * @fmtlnh: Number of pixels in horizontal direction to use for the data
+ *          reformatter.
+ * @fmtslv: Start line from start of VS sync pulse for the data reformatter.
+ * @fmtlnv: Number of lines in vertical direction for the data reformatter.
+ * @initial_x: X position, in pixels, of the first active pixel in reference
+ *             to the first active paxel. Must be an even number.
+ * @initial_y: Y position, in pixels, of the first active pixel in reference
+ *             to the first active paxel. Must be an even number.
+ * @size: Size of LSC gain table. Filled when loaded from userspace.
+ */
+struct omap3isp_ccdc_lsc_config {
+	__u16 offset;
+	__u8 gain_mode_n;
+	__u8 gain_mode_m;
+	__u8 gain_format;
+	__u16 fmtsph;
+	__u16 fmtlnh;
+	__u16 fmtslv;
+	__u16 fmtlnv;
+	__u8 initial_x;
+	__u8 initial_y;
+	__u32 size;
+};
+
+/**
+ * struct omap3isp_ccdc_bclamp - Optical & Digital black clamp subtract
+ * @obgain: Optical black average gain.
+ * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample.
+ * @oblines: Optical Black Sample lines.
+ * @oblen: Optical Black Sample Length.
+ * @dcsubval: Digital Black Clamp subtract value.
+ */
+struct omap3isp_ccdc_bclamp {
+	__u8 obgain;
+	__u8 obstpixel;
+	__u8 oblines;
+	__u8 oblen;
+	__u16 dcsubval;
+};
+
+/**
+ * struct omap3isp_ccdc_fpc - Faulty Pixels Correction
+ * @fpnum: Number of faulty pixels to be corrected in the frame.
+ * @fpcaddr: Memory address of the FPC Table
+ */
+struct omap3isp_ccdc_fpc {
+	__u16 fpnum;
+	__u32 fpcaddr;
+};
+
+/**
+ * struct omap3isp_ccdc_blcomp - Black Level Compensation parameters
+ * @b_mg: B/Mg pixels. 2's complement. -128 to +127.
+ * @gb_g: Gb/G pixels. 2's complement. -128 to +127.
+ * @gr_cy: Gr/Cy pixels. 2's complement. -128 to +127.
+ * @r_ye: R/Ye pixels. 2's complement. -128 to +127.
+ */
+struct omap3isp_ccdc_blcomp {
+	__u8 b_mg;
+	__u8 gb_g;
+	__u8 gr_cy;
+	__u8 r_ye;
+};
+
+/**
+ * omap3isp_ccdc_culling - Culling parameters
+ * @v_pattern: Vertical culling pattern.
+ * @h_odd: Horizontal Culling pattern for odd lines.
+ * @h_even: Horizontal Culling pattern for even lines.
+ */
+struct omap3isp_ccdc_culling {
+	__u8 v_pattern;
+	__u16 h_odd;
+	__u16 h_even;
+};
+
+/**
+ * omap3isp_ccdc_update_config - CCDC configuration
+ * @update: Specifies which CCDC registers should be updated.
+ * @flag: Specifies which CCDC functions should be enabled.
+ * @alawip: Enable/Disable A-Law compression.
+ * @bclamp: Black clamp control register.
+ * @blcomp: Black level compensation value for RGrGbB Pixels. 2's complement.
+ * @fpc: Number of faulty pixels corrected in the frame, address of FPC table.
+ * @cull: Cull control register.
+ * @lsc: Pointer to LSC gain table.
+ */
+struct omap3isp_ccdc_update_config {
+	__u16 update;
+	__u16 flag;
+	enum omap3isp_alaw_ipwidth alawip;
+	struct omap3isp_ccdc_bclamp *bclamp;
+	struct omap3isp_ccdc_blcomp *blcomp;
+	struct omap3isp_ccdc_fpc *fpc;
+	struct omap3isp_ccdc_lsc_config *lsc_cfg;
+	struct omap3isp_ccdc_culling *cull;
+	__u8 *lsc;
+};
+
+/* Preview configurations */
+#define OMAP3ISP_PREV_LUMAENH		(1 << 0)
+#define OMAP3ISP_PREV_INVALAW		(1 << 1)
+#define OMAP3ISP_PREV_HRZ_MED		(1 << 2)
+#define OMAP3ISP_PREV_CFA		(1 << 3)
+#define OMAP3ISP_PREV_CHROMA_SUPP	(1 << 4)
+#define OMAP3ISP_PREV_WB		(1 << 5)
+#define OMAP3ISP_PREV_BLKADJ		(1 << 6)
+#define OMAP3ISP_PREV_RGB2RGB		(1 << 7)
+#define OMAP3ISP_PREV_COLOR_CONV	(1 << 8)
+#define OMAP3ISP_PREV_YC_LIMIT		(1 << 9)
+#define OMAP3ISP_PREV_DEFECT_COR	(1 << 10)
+#define OMAP3ISP_PREV_GAMMABYPASS	(1 << 11)
+#define OMAP3ISP_PREV_DRK_FRM_CAPTURE	(1 << 12)
+#define OMAP3ISP_PREV_DRK_FRM_SUBTRACT	(1 << 13)
+#define OMAP3ISP_PREV_LENS_SHADING	(1 << 14)
+#define OMAP3ISP_PREV_NF		(1 << 15)
+#define OMAP3ISP_PREV_GAMMA		(1 << 16)
+
+#define OMAP3ISP_PREV_NF_TBL_SIZE	64
+#define OMAP3ISP_PREV_CFA_TBL_SIZE	576
+#define OMAP3ISP_PREV_GAMMA_TBL_SIZE	1024
+#define OMAP3ISP_PREV_YENH_TBL_SIZE	128
+
+#define OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS	4
+
+/**
+ * struct omap3isp_prev_hmed - Horizontal Median Filter
+ * @odddist: Distance between consecutive pixels of same color in the odd line.
+ * @evendist: Distance between consecutive pixels of same color in the even
+ *            line.
+ * @thres: Horizontal median filter threshold.
+ */
+struct omap3isp_prev_hmed {
+	__u8 odddist;
+	__u8 evendist;
+	__u8 thres;
+};
+
+/*
+ * Enumeration for CFA Formats supported by preview
+ */
+enum omap3isp_cfa_fmt {
+	OMAP3ISP_CFAFMT_BAYER,
+	OMAP3ISP_CFAFMT_SONYVGA,
+	OMAP3ISP_CFAFMT_RGBFOVEON,
+	OMAP3ISP_CFAFMT_DNSPL,
+	OMAP3ISP_CFAFMT_HONEYCOMB,
+	OMAP3ISP_CFAFMT_RRGGBBFOVEON
+};
+
+/**
+ * struct omap3isp_prev_cfa - CFA Interpolation
+ * @format: CFA Format Enum value supported by preview.
+ * @gradthrs_vert: CFA Gradient Threshold - Vertical.
+ * @gradthrs_horz: CFA Gradient Threshold - Horizontal.
+ * @table: Pointer to the CFA table.
+ */
+struct omap3isp_prev_cfa {
+	enum omap3isp_cfa_fmt format;
+	__u8 gradthrs_vert;
+	__u8 gradthrs_horz;
+	__u32 table[OMAP3ISP_PREV_CFA_TBL_SIZE];
+};
+
+/**
+ * struct omap3isp_prev_csup - Chrominance Suppression
+ * @gain: Gain.
+ * @thres: Threshold.
+ * @hypf_en: Flag to enable/disable the High Pass Filter.
+ */
+struct omap3isp_prev_csup {
+	__u8 gain;
+	__u8 thres;
+	__u8 hypf_en;
+};
+
+/**
+ * struct omap3isp_prev_wbal - White Balance
+ * @dgain: Digital gain (U10Q8).
+ * @coef3: White balance gain - COEF 3 (U8Q5).
+ * @coef2: White balance gain - COEF 2 (U8Q5).
+ * @coef1: White balance gain - COEF 1 (U8Q5).
+ * @coef0: White balance gain - COEF 0 (U8Q5).
+ */
+struct omap3isp_prev_wbal {
+	__u16 dgain;
+	__u8 coef3;
+	__u8 coef2;
+	__u8 coef1;
+	__u8 coef0;
+};
+
+/**
+ * struct omap3isp_prev_blkadj - Black Level Adjustment
+ * @red: Black level offset adjustment for Red in 2's complement format
+ * @green: Black level offset adjustment for Green in 2's complement format
+ * @blue: Black level offset adjustment for Blue in 2's complement format
+ */
+struct omap3isp_prev_blkadj {
+	/*Black level offset adjustment for Red in 2's complement format */
+	__u8 red;
+	/*Black level offset adjustment for Green in 2's complement format */
+	__u8 green;
+	/* Black level offset adjustment for Blue in 2's complement format */
+	__u8 blue;
+};
+
+/**
+ * struct omap3isp_prev_rgbtorgb - RGB to RGB Blending
+ * @matrix: Blending values(S12Q8 format)
+ *              [RR] [GR] [BR]
+ *              [RG] [GG] [BG]
+ *              [RB] [GB] [BB]
+ * @offset: Blending offset value for R,G,B in 2's complement integer format.
+ */
+struct omap3isp_prev_rgbtorgb {
+	__u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
+	__u16 offset[OMAP3ISP_RGB_MAX];
+};
+
+/**
+ * struct omap3isp_prev_csc - Color Space Conversion from RGB-YCbYCr
+ * @matrix: Color space conversion coefficients(S10Q8)
+ *              [CSCRY]  [CSCGY]  [CSCBY]
+ *              [CSCRCB] [CSCGCB] [CSCBCB]
+ *              [CSCRCR] [CSCGCR] [CSCBCR]
+ * @offset: CSC offset values for Y offset, CB offset and CR offset respectively
+ */
+struct omap3isp_prev_csc {
+	__u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
+	__s16 offset[OMAP3ISP_RGB_MAX];
+};
+
+/**
+ * struct omap3isp_prev_yclimit - Y, C Value Limit
+ * @minC: Minimum C value
+ * @maxC: Maximum C value
+ * @minY: Minimum Y value
+ * @maxY: Maximum Y value
+ */
+struct omap3isp_prev_yclimit {
+	__u8 minC;
+	__u8 maxC;
+	__u8 minY;
+	__u8 maxY;
+};
+
+/**
+ * struct omap3isp_prev_dcor - Defect correction
+ * @couplet_mode_en: Flag to enable or disable the couplet dc Correction in NF
+ * @detect_correct: Thresholds for correction bit 0:10 detect 16:25 correct
+ */
+struct omap3isp_prev_dcor {
+	__u8 couplet_mode_en;
+	__u32 detect_correct[OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS];
+};
+
+/**
+ * struct omap3isp_prev_nf - Noise Filter
+ * @spread: Spread value to be used in Noise Filter
+ * @table: Pointer to the Noise Filter table
+ */
+struct omap3isp_prev_nf {
+	__u8 spread;
+	__u32 table[OMAP3ISP_PREV_NF_TBL_SIZE];
+};
+
+/**
+ * struct omap3isp_prev_gtables - Gamma correction tables
+ * @red: Array for red gamma table.
+ * @green: Array for green gamma table.
+ * @blue: Array for blue gamma table.
+ */
+struct omap3isp_prev_gtables {
+	__u32 red[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
+	__u32 green[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
+	__u32 blue[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
+};
+
+/**
+ * struct omap3isp_prev_luma - Luma enhancement
+ * @table: Array for luma enhancement table.
+ */
+struct omap3isp_prev_luma {
+	__u32 table[OMAP3ISP_PREV_YENH_TBL_SIZE];
+};
+
+/**
+ * struct omap3isp_prev_update_config - Preview engine configuration (user)
+ * @update: Specifies which ISP Preview registers should be updated.
+ * @flag: Specifies which ISP Preview functions should be enabled.
+ * @shading_shift: 3bit value of shift used in shading compensation.
+ * @luma: Pointer to luma enhancement structure.
+ * @hmed: Pointer to structure containing the odd and even distance.
+ *        between the pixels in the image along with the filter threshold.
+ * @cfa: Pointer to structure containing the CFA interpolation table, CFA.
+ *       format in the image, vertical and horizontal gradient threshold.
+ * @csup: Pointer to Structure for Chrominance Suppression coefficients.
+ * @wbal: Pointer to structure for White Balance.
+ * @blkadj: Pointer to structure for Black Adjustment.
+ * @rgb2rgb: Pointer to structure for RGB to RGB Blending.
+ * @csc: Pointer to structure for Color Space Conversion from RGB-YCbYCr.
+ * @yclimit: Pointer to structure for Y, C Value Limit.
+ * @dcor: Pointer to structure for defect correction.
+ * @nf: Pointer to structure for Noise Filter
+ * @gamma: Pointer to gamma structure.
+ */
+struct omap3isp_prev_update_config {
+	__u32 update;
+	__u32 flag;
+	__u32 shading_shift;
+	struct omap3isp_prev_luma *luma;
+	struct omap3isp_prev_hmed *hmed;
+	struct omap3isp_prev_cfa *cfa;
+	struct omap3isp_prev_csup *csup;
+	struct omap3isp_prev_wbal *wbal;
+	struct omap3isp_prev_blkadj *blkadj;
+	struct omap3isp_prev_rgbtorgb *rgb2rgb;
+	struct omap3isp_prev_csc *csc;
+	struct omap3isp_prev_yclimit *yclimit;
+	struct omap3isp_prev_dcor *dcor;
+	struct omap3isp_prev_nf *nf;
+	struct omap3isp_prev_gtables *gamma;
+};
+
+#endif	/* OMAP3_ISP_USER_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/omapfb.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/omapfb.h
new file mode 100644
index 0000000..133d589
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/omapfb.h
@@ -0,0 +1,222 @@
+/*
+ * File: include/linux/omapfb.h
+ *
+ * Framebuffer driver for TI OMAP boards
+ *
+ * Copyright (C) 2004 Nokia Corporation
+ * Author: Imre Deak <imre.deak@nokia.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 __LINUX_OMAPFB_H__
+#define __LINUX_OMAPFB_H__
+
+#include <linux/fb.h>
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+/* IOCTL commands. */
+
+#define OMAP_IOW(num, dtype)	_IOW('O', num, dtype)
+#define OMAP_IOR(num, dtype)	_IOR('O', num, dtype)
+#define OMAP_IOWR(num, dtype)	_IOWR('O', num, dtype)
+#define OMAP_IO(num)		_IO('O', num)
+
+#define OMAPFB_MIRROR		OMAP_IOW(31, int)
+#define OMAPFB_SYNC_GFX		OMAP_IO(37)
+#define OMAPFB_VSYNC		OMAP_IO(38)
+#define OMAPFB_SET_UPDATE_MODE	OMAP_IOW(40, int)
+#define OMAPFB_GET_CAPS		OMAP_IOR(42, struct omapfb_caps)
+#define OMAPFB_GET_UPDATE_MODE	OMAP_IOW(43, int)
+#define OMAPFB_LCD_TEST		OMAP_IOW(45, int)
+#define OMAPFB_CTRL_TEST	OMAP_IOW(46, int)
+#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
+#define OMAPFB_SET_COLOR_KEY	OMAP_IOW(50, struct omapfb_color_key)
+#define OMAPFB_GET_COLOR_KEY	OMAP_IOW(51, struct omapfb_color_key)
+#define OMAPFB_SETUP_PLANE	OMAP_IOW(52, struct omapfb_plane_info)
+#define OMAPFB_QUERY_PLANE	OMAP_IOW(53, struct omapfb_plane_info)
+#define OMAPFB_UPDATE_WINDOW	OMAP_IOW(54, struct omapfb_update_window)
+#define OMAPFB_SETUP_MEM	OMAP_IOW(55, struct omapfb_mem_info)
+#define OMAPFB_QUERY_MEM	OMAP_IOW(56, struct omapfb_mem_info)
+#define OMAPFB_WAITFORVSYNC	OMAP_IO(57)
+#define OMAPFB_MEMORY_READ	OMAP_IOR(58, struct omapfb_memory_read)
+#define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode)
+#define OMAPFB_WAITFORGO	OMAP_IO(60)
+#define OMAPFB_GET_VRAM_INFO	OMAP_IOR(61, struct omapfb_vram_info)
+#define OMAPFB_SET_TEARSYNC	OMAP_IOW(62, struct omapfb_tearsync_info)
+#define OMAPFB_GET_DISPLAY_INFO	OMAP_IOR(63, struct omapfb_display_info)
+
+#define OMAPFB_CAPS_GENERIC_MASK	0x00000fff
+#define OMAPFB_CAPS_LCDC_MASK		0x00fff000
+#define OMAPFB_CAPS_PANEL_MASK		0xff000000
+
+#define OMAPFB_CAPS_MANUAL_UPDATE	0x00001000
+#define OMAPFB_CAPS_TEARSYNC		0x00002000
+#define OMAPFB_CAPS_PLANE_RELOCATE_MEM	0x00004000
+#define OMAPFB_CAPS_PLANE_SCALE		0x00008000
+#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE	0x00010000
+#define OMAPFB_CAPS_WINDOW_SCALE	0x00020000
+#define OMAPFB_CAPS_WINDOW_OVERLAY	0x00040000
+#define OMAPFB_CAPS_WINDOW_ROTATE	0x00080000
+#define OMAPFB_CAPS_SET_BACKLIGHT	0x01000000
+
+/* Values from DSP must map to lower 16-bits */
+#define OMAPFB_FORMAT_MASK		0x00ff
+#define OMAPFB_FORMAT_FLAG_DOUBLE	0x0100
+#define OMAPFB_FORMAT_FLAG_TEARSYNC	0x0200
+#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC	0x0400
+#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY	0x0800
+#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY	0x1000
+
+#define OMAPFB_MEMTYPE_SDRAM		0
+#define OMAPFB_MEMTYPE_SRAM		1
+#define OMAPFB_MEMTYPE_MAX		1
+
+#define OMAPFB_MEM_IDX_ENABLED	0x80
+#define OMAPFB_MEM_IDX_MASK	0x7f
+
+enum omapfb_color_format {
+	OMAPFB_COLOR_RGB565 = 0,
+	OMAPFB_COLOR_YUV422,
+	OMAPFB_COLOR_YUV420,
+	OMAPFB_COLOR_CLUT_8BPP,
+	OMAPFB_COLOR_CLUT_4BPP,
+	OMAPFB_COLOR_CLUT_2BPP,
+	OMAPFB_COLOR_CLUT_1BPP,
+	OMAPFB_COLOR_RGB444,
+	OMAPFB_COLOR_YUY422,
+
+	OMAPFB_COLOR_ARGB16,
+	OMAPFB_COLOR_RGB24U,	/* RGB24, 32-bit container */
+	OMAPFB_COLOR_RGB24P,	/* RGB24, 24-bit container */
+	OMAPFB_COLOR_ARGB32,
+	OMAPFB_COLOR_RGBA32,
+	OMAPFB_COLOR_RGBX32,
+};
+
+struct omapfb_update_window {
+	__u32 x, y;
+	__u32 width, height;
+	__u32 format;
+	__u32 out_x, out_y;
+	__u32 out_width, out_height;
+	__u32 reserved[8];
+};
+
+struct omapfb_update_window_old {
+	__u32 x, y;
+	__u32 width, height;
+	__u32 format;
+};
+
+enum omapfb_plane {
+	OMAPFB_PLANE_GFX = 0,
+	OMAPFB_PLANE_VID1,
+	OMAPFB_PLANE_VID2,
+};
+
+enum omapfb_channel_out {
+	OMAPFB_CHANNEL_OUT_LCD = 0,
+	OMAPFB_CHANNEL_OUT_DIGIT,
+};
+
+struct omapfb_plane_info {
+	__u32 pos_x;
+	__u32 pos_y;
+	__u8  enabled;
+	__u8  channel_out;
+	__u8  mirror;
+	__u8  mem_idx;
+	__u32 out_width;
+	__u32 out_height;
+	__u32 reserved2[12];
+};
+
+struct omapfb_mem_info {
+	__u32 size;
+	__u8  type;
+	__u8  reserved[3];
+};
+
+struct omapfb_caps {
+	__u32 ctrl;
+	__u32 plane_color;
+	__u32 wnd_color;
+};
+
+enum omapfb_color_key_type {
+	OMAPFB_COLOR_KEY_DISABLED = 0,
+	OMAPFB_COLOR_KEY_GFX_DST,
+	OMAPFB_COLOR_KEY_VID_SRC,
+};
+
+struct omapfb_color_key {
+	__u8  channel_out;
+	__u32 background;
+	__u32 trans_key;
+	__u8  key_type;
+};
+
+enum omapfb_update_mode {
+	OMAPFB_UPDATE_DISABLED = 0,
+	OMAPFB_AUTO_UPDATE,
+	OMAPFB_MANUAL_UPDATE
+};
+
+struct omapfb_memory_read {
+	__u16 x;
+	__u16 y;
+	__u16 w;
+	__u16 h;
+	size_t buffer_size;
+	void *buffer;
+};
+
+struct omapfb_ovl_colormode {
+	__u8 overlay_idx;
+	__u8 mode_idx;
+	__u32 bits_per_pixel;
+	__u32 nonstd;
+	struct fb_bitfield red;
+	struct fb_bitfield green;
+	struct fb_bitfield blue;
+	struct fb_bitfield transp;
+};
+
+struct omapfb_vram_info {
+	__u32 total;
+	__u32 free;
+	__u32 largest_free_block;
+	__u32 reserved[5];
+};
+
+struct omapfb_tearsync_info {
+	__u8 enabled;
+	__u8 reserved1[3];
+	__u16 line;
+	__u16 reserved2;
+};
+
+struct omapfb_display_info {
+	__u16 xres;
+	__u16 yres;
+	__u32 width;	/* phys width of the display in micrometers */
+	__u32 height;	/* phys height of the display in micrometers */
+	__u32 reserved[5];
+};
+
+
+#endif /* __OMAPFB_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/oom.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/oom.h
index d7727b8..816ddd3 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/oom.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/oom.h
@@ -1,10 +1,22 @@
 #ifndef __INCLUDE_LINUX_OOM_H
 #define __INCLUDE_LINUX_OOM_H
 
-/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
+/*
+ * /proc/<pid>/oom_adj is deprecated, see
+ * Documentation/feature-removal-schedule.txt.
+ *
+ * /proc/<pid>/oom_adj set to -17 protects from the oom-killer
+ */
 #define OOM_DISABLE (-17)
 /* inclusive */
 #define OOM_ADJUST_MIN (-16)
 #define OOM_ADJUST_MAX 15
 
+/*
+ * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for
+ * pid.
+ */
+#define OOM_SCORE_ADJ_MIN	(-1000)
+#define OOM_SCORE_ADJ_MAX	1000
+
 #endif /* _INCLUDE_LINUX_OOM_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/patchkey.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/patchkey.h
index 23810dd..bb28430 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/patchkey.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/patchkey.h
@@ -20,7 +20,7 @@
 /* Endian macros. */
 #  include <endian.h>
 
-#if   defined(__BYTE_ORDER)
+#if defined(__BYTE_ORDER)
 #  if __BYTE_ORDER == __BIG_ENDIAN
 #    define _PATCHKEY(id) (0xfd00|id)
 #  elif __BYTE_ORDER == __LITTLE_ENDIAN
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pci_regs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pci_regs.h
index fcaee42..e41a10f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pci_regs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pci_regs.h
@@ -42,6 +42,7 @@
 #define  PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
 
 #define PCI_STATUS		0x06	/* 16 bits */
+#define  PCI_STATUS_INTERRUPT	0x08	/* Interrupt status */
 #define  PCI_STATUS_CAP_LIST	0x10	/* Support Capability List */
 #define  PCI_STATUS_66MHZ	0x20	/* Support 66 Mhz PCI 2.1 bus */
 #define  PCI_STATUS_UDF		0x40	/* Support User Definable Features [obsolete] */
@@ -222,7 +223,7 @@
 #define  PCI_PM_CAP_PME_CLOCK	0x0008	/* PME clock required */
 #define  PCI_PM_CAP_RESERVED    0x0010  /* Reserved field */
 #define  PCI_PM_CAP_DSI		0x0020	/* Device specific initialization */
-#define  PCI_PM_CAP_AUX_POWER	0x01C0	/* Auxilliary power support mask */
+#define  PCI_PM_CAP_AUX_POWER	0x01C0	/* Auxiliary power support mask */
 #define  PCI_PM_CAP_D1		0x0200	/* D1 power state support */
 #define  PCI_PM_CAP_D2		0x0400	/* D2 power state support */
 #define  PCI_PM_CAP_PME		0x0800	/* PME pin supported */
@@ -299,12 +300,22 @@
 #define PCI_MSI_DATA_64		12	/* 16 bits of data for 64-bit devices */
 #define PCI_MSI_MASK_64		16	/* Mask bits register for 64-bit devices */
 
-/* MSI-X registers (these are at offset PCI_MSIX_FLAGS) */
+/* 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_FLAGS_BIRMASK	(7 << 0)
+#define PCI_MSIX_TABLE		4
+#define PCI_MSIX_PBA		8
+#define  PCI_MSIX_FLAGS_BIRMASK	(7 << 0)
+
+/* MSI-X entry's format */
+#define PCI_MSIX_ENTRY_SIZE		16
+#define  PCI_MSIX_ENTRY_LOWER_ADDR	0
+#define  PCI_MSIX_ENTRY_UPPER_ADDR	4
+#define  PCI_MSIX_ENTRY_DATA		8
+#define  PCI_MSIX_ENTRY_VECTOR_CTRL	12
+#define   PCI_MSIX_ENTRY_CTRL_MASKBIT	1
 
 /* CompactPCI Hotswap Register */
 
@@ -364,6 +375,11 @@
 #define  PCI_X_STATUS_266MHZ	0x40000000	/* 266 MHz capable */
 #define  PCI_X_STATUS_533MHZ	0x80000000	/* 533 MHz capable */
 
+/* PCI Bridge Subsystem ID registers */
+
+#define PCI_SSVID_VENDOR_ID     4	/* PCI-Bridge subsystem vendor id register */
+#define PCI_SSVID_DEVICE_ID     6	/* PCI-Bridge subsystem device id register */
+
 /* PCI Express capability registers */
 
 #define PCI_EXP_FLAGS		2	/* Capabilities register */
@@ -376,7 +392,7 @@
 #define  PCI_EXP_TYPE_DOWNSTREAM 0x6	/* Downstream Port */
 #define  PCI_EXP_TYPE_PCI_BRIDGE 0x7	/* PCI/PCI-X Bridge */
 #define  PCI_EXP_TYPE_RC_END	0x9	/* Root Complex Integrated Endpoint */
-#define  PCI_EXP_TYPE_RC_EC	0x10	/* Root Complex Event Collector */
+#define  PCI_EXP_TYPE_RC_EC	0xa	/* Root Complex Event Collector */
 #define PCI_EXP_FLAGS_SLOT	0x0100	/* Slot implemented */
 #define PCI_EXP_FLAGS_IRQ	0x3e00	/* Interrupt message number */
 #define PCI_EXP_DEVCAP		4	/* Device capabilities */
@@ -419,7 +435,7 @@
 #define  PCI_EXP_LNKCAP_L0SEL	0x00007000 /* L0s Exit Latency */
 #define  PCI_EXP_LNKCAP_L1EL	0x00038000 /* L1 Exit Latency */
 #define  PCI_EXP_LNKCAP_CLKPM	0x00040000 /* L1 Clock Power Management */
-#define  PCI_EXP_LNKCAP_SDERC	0x00080000 /* Suprise Down Error Reporting Capable */
+#define  PCI_EXP_LNKCAP_SDERC	0x00080000 /* Surprise Down Error Reporting Capable */
 #define  PCI_EXP_LNKCAP_DLLLARC	0x00100000 /* Data Link Layer Link Active Reporting Capable */
 #define  PCI_EXP_LNKCAP_LBNC	0x00200000 /* Link Bandwidth Notification Capability */
 #define  PCI_EXP_LNKCAP_PN	0xff000000 /* Port Number */
@@ -436,7 +452,10 @@
 #define  PCI_EXP_LNKCTL_LABIE	0x0800	/* Lnk Autonomous Bandwidth Interrupt Enable */
 #define PCI_EXP_LNKSTA		18	/* Link Status */
 #define  PCI_EXP_LNKSTA_CLS	0x000f	/* Current Link Speed */
+#define  PCI_EXP_LNKSTA_CLS_2_5GB 0x01	/* Current Link Speed 2.5GT/s */
+#define  PCI_EXP_LNKSTA_CLS_5_0GB 0x02	/* Current Link Speed 5.0GT/s */
 #define  PCI_EXP_LNKSTA_NLW	0x03f0	/* Nogotiated Link Width */
+#define  PCI_EXP_LNKSTA_NLW_SHIFT 4	/* start of NLW mask in link status */
 #define  PCI_EXP_LNKSTA_LT	0x0800	/* Link Training */
 #define  PCI_EXP_LNKSTA_SLC	0x1000	/* Slot Clock Configuration */
 #define  PCI_EXP_LNKSTA_DLLLA	0x2000	/* Data Link Layer Link Active */
@@ -485,10 +504,22 @@
 #define  PCI_EXP_RTCTL_CRSSVE	0x10	/* CRS Software Visibility Enable */
 #define PCI_EXP_RTCAP		30	/* Root Capabilities */
 #define PCI_EXP_RTSTA		32	/* Root Status */
+#define PCI_EXP_RTSTA_PME	0x10000 /* PME status */
+#define PCI_EXP_RTSTA_PENDING	0x20000 /* PME pending */
 #define PCI_EXP_DEVCAP2		36	/* Device Capabilities 2 */
 #define  PCI_EXP_DEVCAP2_ARI	0x20	/* Alternative Routing-ID */
+#define  PCI_EXP_DEVCAP2_LTR	0x800	/* Latency tolerance reporting */
+#define  PCI_EXP_OBFF_MASK	0xc0000 /* OBFF support mechanism */
+#define  PCI_EXP_OBFF_MSG	0x40000 /* New message signaling */
+#define  PCI_EXP_OBFF_WAKE	0x80000 /* Re-use WAKE# for OBFF */
 #define PCI_EXP_DEVCTL2		40	/* Device Control 2 */
 #define  PCI_EXP_DEVCTL2_ARI	0x20	/* Alternative Routing-ID */
+#define  PCI_EXP_IDO_REQ_EN	0x100	/* ID-based ordering request enable */
+#define  PCI_EXP_IDO_CMP_EN	0x200	/* ID-based ordering completion enable */
+#define  PCI_EXP_LTR_EN		0x400	/* Latency tolerance reporting */
+#define  PCI_EXP_OBFF_MSGA_EN	0x2000	/* OBFF enable with Message type A */
+#define  PCI_EXP_OBFF_MSGB_EN	0x4000	/* OBFF enable with Message type B */
+#define  PCI_EXP_OBFF_WAKE_EN	0x6000	/* OBFF using WAKE# signaling */
 #define PCI_EXP_LNKCTL2		48	/* Link Control 2 */
 #define PCI_EXP_SLTCTL2		56	/* Slot Control 2 */
 
@@ -501,9 +532,14 @@
 #define PCI_EXT_CAP_ID_VC	2
 #define PCI_EXT_CAP_ID_DSN	3
 #define PCI_EXT_CAP_ID_PWR	4
+#define PCI_EXT_CAP_ID_VNDR	11
+#define PCI_EXT_CAP_ID_ACS	13
 #define PCI_EXT_CAP_ID_ARI	14
 #define PCI_EXT_CAP_ID_ATS	15
 #define PCI_EXT_CAP_ID_SRIOV	16
+#define PCI_EXT_CAP_ID_PRI	19
+#define PCI_EXT_CAP_ID_LTR	24
+#define PCI_EXT_CAP_ID_PASID	27
 
 /* Advanced Error Reporting */
 #define PCI_ERR_UNCOR_STATUS	4	/* Uncorrectable Error Status */
@@ -555,8 +591,7 @@
 #define PCI_ERR_ROOT_FIRST_FATAL	0x00000010	/* First Fatal */
 #define PCI_ERR_ROOT_NONFATAL_RCV	0x00000020	/* Non-Fatal Received */
 #define PCI_ERR_ROOT_FATAL_RCV		0x00000040	/* Fatal Received */
-#define PCI_ERR_ROOT_COR_SRC	52
-#define PCI_ERR_ROOT_SRC	54
+#define PCI_ERR_ROOT_ERR_SRC	52	/* Error Source Identification */
 
 /* Virtual Channel */
 #define PCI_VC_PORT_REG1	4
@@ -630,6 +665,26 @@
 #define  PCI_ATS_CTRL_STU(x)	((x) & 0x1f)	/* Smallest Translation Unit */
 #define  PCI_ATS_MIN_STU	12	/* shift of minimum STU block */
 
+/* Page Request Interface */
+#define PCI_PRI_CTRL		0x04	/* PRI control register */
+#define  PCI_PRI_CTRL_ENABLE	0x01	/* Enable */
+#define  PCI_PRI_CTRL_RESET	0x02	/* Reset */
+#define PCI_PRI_STATUS		0x06	/* PRI status register */
+#define  PCI_PRI_STATUS_RF	0x001	/* Response Failure */
+#define  PCI_PRI_STATUS_UPRGI	0x002	/* Unexpected PRG index */
+#define  PCI_PRI_STATUS_STOPPED	0x100	/* PRI Stopped */
+#define PCI_PRI_MAX_REQ		0x08	/* PRI max reqs supported */
+#define PCI_PRI_ALLOC_REQ	0x0c	/* PRI max reqs allowed */
+
+/* PASID capability */
+#define PCI_PASID_CAP		0x04    /* PASID feature register */
+#define  PCI_PASID_CAP_EXEC	0x02	/* Exec permissions Supported */
+#define  PCI_PASID_CAP_PRIV	0x04	/* Priviledge Mode Supported */
+#define PCI_PASID_CTRL		0x06    /* PASID control register */
+#define  PCI_PASID_CTRL_ENABLE	0x01	/* Enable bit */
+#define  PCI_PASID_CTRL_EXEC	0x02	/* Exec permissions Enable */
+#define  PCI_PASID_CTRL_PRIV	0x04	/* Priviledge Mode Enable */
+
 /* Single Root I/O Virtualization */
 #define PCI_SRIOV_CAP		0x04	/* SR-IOV Capabilities */
 #define  PCI_SRIOV_CAP_VFM	0x01	/* VF Migration Capable */
@@ -661,4 +716,22 @@
 #define  PCI_SRIOV_VFM_MO	0x2	/* Active.MigrateOut */
 #define  PCI_SRIOV_VFM_AV	0x3	/* Active.Available */
 
+#define PCI_LTR_MAX_SNOOP_LAT	0x4
+#define PCI_LTR_MAX_NOSNOOP_LAT	0x6
+#define  PCI_LTR_VALUE_MASK	0x000003ff
+#define  PCI_LTR_SCALE_MASK	0x00001c00
+#define  PCI_LTR_SCALE_SHIFT	10
+
+/* Access Control Service */
+#define PCI_ACS_CAP		0x04	/* ACS Capability Register */
+#define  PCI_ACS_SV		0x01	/* Source Validation */
+#define  PCI_ACS_TB		0x02	/* Translation Blocking */
+#define  PCI_ACS_RR		0x04	/* P2P Request Redirect */
+#define  PCI_ACS_CR		0x08	/* P2P Completion Redirect */
+#define  PCI_ACS_UF		0x10	/* Upstream Forwarding */
+#define  PCI_ACS_EC		0x20	/* P2P Egress Control */
+#define  PCI_ACS_DT		0x40	/* Direct Translated P2P */
+#define PCI_ACS_CTRL		0x06	/* ACS Control Register */
+#define PCI_ACS_EGRESS_CTL_V	0x08	/* ACS Egress Control Vector */
+
 #endif /* LINUX_PCI_REGS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/perf_event.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/perf_event.h
new file mode 100644
index 0000000..eb61be7
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/perf_event.h
@@ -0,0 +1,482 @@
+/*
+ * Performance events:
+ *
+ *    Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
+ *    Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar
+ *    Copyright (C) 2008-2011, Red Hat, Inc., Peter Zijlstra
+ *
+ * Data type definitions, declarations, prototypes.
+ *
+ *    Started by: Thomas Gleixner and Ingo Molnar
+ *
+ * For licencing details see kernel-base/COPYING
+ */
+#ifndef _LINUX_PERF_EVENT_H
+#define _LINUX_PERF_EVENT_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+#include <asm/byteorder.h>
+
+/*
+ * User-space ABI bits:
+ */
+
+/*
+ * attr.type
+ */
+enum perf_type_id {
+	PERF_TYPE_HARDWARE			= 0,
+	PERF_TYPE_SOFTWARE			= 1,
+	PERF_TYPE_TRACEPOINT			= 2,
+	PERF_TYPE_HW_CACHE			= 3,
+	PERF_TYPE_RAW				= 4,
+	PERF_TYPE_BREAKPOINT			= 5,
+
+	PERF_TYPE_MAX,				/* non-ABI */
+};
+
+/*
+ * Generalized performance event event_id types, used by the
+ * attr.event_id parameter of the sys_perf_event_open()
+ * syscall:
+ */
+enum perf_hw_id {
+	/*
+	 * Common hardware events, generalized by the kernel:
+	 */
+	PERF_COUNT_HW_CPU_CYCLES		= 0,
+	PERF_COUNT_HW_INSTRUCTIONS		= 1,
+	PERF_COUNT_HW_CACHE_REFERENCES		= 2,
+	PERF_COUNT_HW_CACHE_MISSES		= 3,
+	PERF_COUNT_HW_BRANCH_INSTRUCTIONS	= 4,
+	PERF_COUNT_HW_BRANCH_MISSES		= 5,
+	PERF_COUNT_HW_BUS_CYCLES		= 6,
+	PERF_COUNT_HW_STALLED_CYCLES_FRONTEND	= 7,
+	PERF_COUNT_HW_STALLED_CYCLES_BACKEND	= 8,
+	PERF_COUNT_HW_REF_CPU_CYCLES		= 9,
+
+	PERF_COUNT_HW_MAX,			/* non-ABI */
+};
+
+/*
+ * Generalized hardware cache events:
+ *
+ *       { L1-D, L1-I, LLC, ITLB, DTLB, BPU, NODE } x
+ *       { read, write, prefetch } x
+ *       { accesses, misses }
+ */
+enum perf_hw_cache_id {
+	PERF_COUNT_HW_CACHE_L1D			= 0,
+	PERF_COUNT_HW_CACHE_L1I			= 1,
+	PERF_COUNT_HW_CACHE_LL			= 2,
+	PERF_COUNT_HW_CACHE_DTLB		= 3,
+	PERF_COUNT_HW_CACHE_ITLB		= 4,
+	PERF_COUNT_HW_CACHE_BPU			= 5,
+	PERF_COUNT_HW_CACHE_NODE		= 6,
+
+	PERF_COUNT_HW_CACHE_MAX,		/* non-ABI */
+};
+
+enum perf_hw_cache_op_id {
+	PERF_COUNT_HW_CACHE_OP_READ		= 0,
+	PERF_COUNT_HW_CACHE_OP_WRITE		= 1,
+	PERF_COUNT_HW_CACHE_OP_PREFETCH		= 2,
+
+	PERF_COUNT_HW_CACHE_OP_MAX,		/* non-ABI */
+};
+
+enum perf_hw_cache_op_result_id {
+	PERF_COUNT_HW_CACHE_RESULT_ACCESS	= 0,
+	PERF_COUNT_HW_CACHE_RESULT_MISS		= 1,
+
+	PERF_COUNT_HW_CACHE_RESULT_MAX,		/* non-ABI */
+};
+
+/*
+ * Special "software" events provided by the kernel, even if the hardware
+ * does not support performance events. These events measure various
+ * physical and sw events of the kernel (and allow the profiling of them as
+ * well):
+ */
+enum perf_sw_ids {
+	PERF_COUNT_SW_CPU_CLOCK			= 0,
+	PERF_COUNT_SW_TASK_CLOCK		= 1,
+	PERF_COUNT_SW_PAGE_FAULTS		= 2,
+	PERF_COUNT_SW_CONTEXT_SWITCHES		= 3,
+	PERF_COUNT_SW_CPU_MIGRATIONS		= 4,
+	PERF_COUNT_SW_PAGE_FAULTS_MIN		= 5,
+	PERF_COUNT_SW_PAGE_FAULTS_MAJ		= 6,
+	PERF_COUNT_SW_ALIGNMENT_FAULTS		= 7,
+	PERF_COUNT_SW_EMULATION_FAULTS		= 8,
+
+	PERF_COUNT_SW_MAX,			/* non-ABI */
+};
+
+/*
+ * Bits that can be set in attr.sample_type to request information
+ * in the overflow packets.
+ */
+enum perf_event_sample_format {
+	PERF_SAMPLE_IP				= 1U << 0,
+	PERF_SAMPLE_TID				= 1U << 1,
+	PERF_SAMPLE_TIME			= 1U << 2,
+	PERF_SAMPLE_ADDR			= 1U << 3,
+	PERF_SAMPLE_READ			= 1U << 4,
+	PERF_SAMPLE_CALLCHAIN			= 1U << 5,
+	PERF_SAMPLE_ID				= 1U << 6,
+	PERF_SAMPLE_CPU				= 1U << 7,
+	PERF_SAMPLE_PERIOD			= 1U << 8,
+	PERF_SAMPLE_STREAM_ID			= 1U << 9,
+	PERF_SAMPLE_RAW				= 1U << 10,
+
+	PERF_SAMPLE_MAX = 1U << 11,		/* non-ABI */
+};
+
+/*
+ * The format of the data returned by read() on a perf event fd,
+ * as specified by attr.read_format:
+ *
+ * struct read_format {
+ *	{ u64		value;
+ *	  { u64		time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
+ *	  { u64		time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
+ *	  { u64		id;           } && PERF_FORMAT_ID
+ *	} && !PERF_FORMAT_GROUP
+ *
+ *	{ u64		nr;
+ *	  { u64		time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
+ *	  { u64		time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
+ *	  { u64		value;
+ *	    { u64	id;           } && PERF_FORMAT_ID
+ *	  }		cntr[nr];
+ *	} && PERF_FORMAT_GROUP
+ * };
+ */
+enum perf_event_read_format {
+	PERF_FORMAT_TOTAL_TIME_ENABLED		= 1U << 0,
+	PERF_FORMAT_TOTAL_TIME_RUNNING		= 1U << 1,
+	PERF_FORMAT_ID				= 1U << 2,
+	PERF_FORMAT_GROUP			= 1U << 3,
+
+	PERF_FORMAT_MAX = 1U << 4,		/* non-ABI */
+};
+
+#define PERF_ATTR_SIZE_VER0	64	/* sizeof first published struct */
+
+/*
+ * Hardware event_id to monitor via a performance monitoring event:
+ */
+struct perf_event_attr {
+
+	/*
+	 * Major type: hardware/software/tracepoint/etc.
+	 */
+	__u32			type;
+
+	/*
+	 * Size of the attr structure, for fwd/bwd compat.
+	 */
+	__u32			size;
+
+	/*
+	 * Type specific configuration information.
+	 */
+	__u64			config;
+
+	union {
+		__u64		sample_period;
+		__u64		sample_freq;
+	};
+
+	__u64			sample_type;
+	__u64			read_format;
+
+	__u64			disabled       :  1, /* off by default        */
+				inherit	       :  1, /* children inherit it   */
+				pinned	       :  1, /* must always be on PMU */
+				exclusive      :  1, /* only group on PMU     */
+				exclude_user   :  1, /* don't count user      */
+				exclude_kernel :  1, /* ditto kernel          */
+				exclude_hv     :  1, /* ditto hypervisor      */
+				exclude_idle   :  1, /* don't count when idle */
+				mmap           :  1, /* include mmap data     */
+				comm	       :  1, /* include comm data     */
+				freq           :  1, /* use freq, not period  */
+				inherit_stat   :  1, /* per task counts       */
+				enable_on_exec :  1, /* next exec enables     */
+				task           :  1, /* trace fork/exit       */
+				watermark      :  1, /* wakeup_watermark      */
+				/*
+				 * precise_ip:
+				 *
+				 *  0 - SAMPLE_IP can have arbitrary skid
+				 *  1 - SAMPLE_IP must have constant skid
+				 *  2 - SAMPLE_IP requested to have 0 skid
+				 *  3 - SAMPLE_IP must have 0 skid
+				 *
+				 *  See also PERF_RECORD_MISC_EXACT_IP
+				 */
+				precise_ip     :  2, /* skid constraint       */
+				mmap_data      :  1, /* non-exec mmap data    */
+				sample_id_all  :  1, /* sample_type all events */
+
+				exclude_host   :  1, /* don't count in host   */
+				exclude_guest  :  1, /* don't count in guest  */
+
+				__reserved_1   : 43;
+
+	union {
+		__u32		wakeup_events;	  /* wakeup every n events */
+		__u32		wakeup_watermark; /* bytes before wakeup   */
+	};
+
+	__u32			bp_type;
+	union {
+		__u64		bp_addr;
+		__u64		config1; /* extension of config */
+	};
+	union {
+		__u64		bp_len;
+		__u64		config2; /* extension of config1 */
+	};
+};
+
+/*
+ * Ioctls that can be done on a perf event fd:
+ */
+#define PERF_EVENT_IOC_ENABLE		_IO ('$', 0)
+#define PERF_EVENT_IOC_DISABLE		_IO ('$', 1)
+#define PERF_EVENT_IOC_REFRESH		_IO ('$', 2)
+#define PERF_EVENT_IOC_RESET		_IO ('$', 3)
+#define PERF_EVENT_IOC_PERIOD		_IOW('$', 4, __u64)
+#define PERF_EVENT_IOC_SET_OUTPUT	_IO ('$', 5)
+#define PERF_EVENT_IOC_SET_FILTER	_IOW('$', 6, char *)
+
+enum perf_event_ioc_flags {
+	PERF_IOC_FLAG_GROUP		= 1U << 0,
+};
+
+/*
+ * Structure of the page that can be mapped via mmap
+ */
+struct perf_event_mmap_page {
+	__u32	version;		/* version number of this structure */
+	__u32	compat_version;		/* lowest version this is compat with */
+
+	/*
+	 * Bits needed to read the hw events in user-space.
+	 *
+	 *   u32 seq;
+	 *   s64 count;
+	 *
+	 *   do {
+	 *     seq = pc->lock;
+	 *
+	 *     barrier()
+	 *     if (pc->index) {
+	 *       count = pmc_read(pc->index - 1);
+	 *       count += pc->offset;
+	 *     } else
+	 *       goto regular_read;
+	 *
+	 *     barrier();
+	 *   } while (pc->lock != seq);
+	 *
+	 * NOTE: for obvious reason this only works on self-monitoring
+	 *       processes.
+	 */
+	__u32	lock;			/* seqlock for synchronization */
+	__u32	index;			/* hardware event identifier */
+	__s64	offset;			/* add to hardware event value */
+	__u64	time_enabled;		/* time event active */
+	__u64	time_running;		/* time event on cpu */
+
+		/*
+		 * Hole for extension of the self monitor capabilities
+		 */
+
+	__u64	__reserved[123];	/* align to 1k */
+
+	/*
+	 * Control data for the mmap() data buffer.
+	 *
+	 * User-space reading the @data_head value should issue an rmb(), on
+	 * SMP capable platforms, after reading this value -- see
+	 * perf_event_wakeup().
+	 *
+	 * When the mapping is PROT_WRITE the @data_tail value should be
+	 * written by userspace to reflect the last read data. In this case
+	 * the kernel will not over-write unread data.
+	 */
+	__u64   data_head;		/* head in the data section */
+	__u64	data_tail;		/* user-space written tail */
+};
+
+#define PERF_RECORD_MISC_CPUMODE_MASK		(7 << 0)
+#define PERF_RECORD_MISC_CPUMODE_UNKNOWN	(0 << 0)
+#define PERF_RECORD_MISC_KERNEL			(1 << 0)
+#define PERF_RECORD_MISC_USER			(2 << 0)
+#define PERF_RECORD_MISC_HYPERVISOR		(3 << 0)
+#define PERF_RECORD_MISC_GUEST_KERNEL		(4 << 0)
+#define PERF_RECORD_MISC_GUEST_USER		(5 << 0)
+
+/*
+ * Indicates that the content of PERF_SAMPLE_IP points to
+ * the actual instruction that triggered the event. See also
+ * perf_event_attr::precise_ip.
+ */
+#define PERF_RECORD_MISC_EXACT_IP		(1 << 14)
+/*
+ * Reserve the last bit to indicate some extended misc field
+ */
+#define PERF_RECORD_MISC_EXT_RESERVED		(1 << 15)
+
+struct perf_event_header {
+	__u32	type;
+	__u16	misc;
+	__u16	size;
+};
+
+enum perf_event_type {
+
+	/*
+	 * If perf_event_attr.sample_id_all is set then all event types will
+	 * have the sample_type selected fields related to where/when
+	 * (identity) an event took place (TID, TIME, ID, CPU, STREAM_ID)
+	 * described in PERF_RECORD_SAMPLE below, it will be stashed just after
+	 * the perf_event_header and the fields already present for the existing
+	 * fields, i.e. at the end of the payload. That way a newer perf.data
+	 * file will be supported by older perf tools, with these new optional
+	 * fields being ignored.
+	 *
+	 * The MMAP events record the PROT_EXEC mappings so that we can
+	 * correlate userspace IPs to code. They have the following structure:
+	 *
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *
+	 *	u32				pid, tid;
+	 *	u64				addr;
+	 *	u64				len;
+	 *	u64				pgoff;
+	 *	char				filename[];
+	 * };
+	 */
+	PERF_RECORD_MMAP			= 1,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u64				id;
+	 *	u64				lost;
+	 * };
+	 */
+	PERF_RECORD_LOST			= 2,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *
+	 *	u32				pid, tid;
+	 *	char				comm[];
+	 * };
+	 */
+	PERF_RECORD_COMM			= 3,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u32				pid, ppid;
+	 *	u32				tid, ptid;
+	 *	u64				time;
+	 * };
+	 */
+	PERF_RECORD_EXIT			= 4,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u64				time;
+	 *	u64				id;
+	 *	u64				stream_id;
+	 * };
+	 */
+	PERF_RECORD_THROTTLE			= 5,
+	PERF_RECORD_UNTHROTTLE			= 6,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u32				pid, ppid;
+	 *	u32				tid, ptid;
+	 *	u64				time;
+	 * };
+	 */
+	PERF_RECORD_FORK			= 7,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u32				pid, tid;
+	 *
+	 *	struct read_format		values;
+	 * };
+	 */
+	PERF_RECORD_READ			= 8,
+
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *
+	 *	{ u64			ip;	  } && PERF_SAMPLE_IP
+	 *	{ u32			pid, tid; } && PERF_SAMPLE_TID
+	 *	{ u64			time;     } && PERF_SAMPLE_TIME
+	 *	{ u64			addr;     } && PERF_SAMPLE_ADDR
+	 *	{ u64			id;	  } && PERF_SAMPLE_ID
+	 *	{ u64			stream_id;} && PERF_SAMPLE_STREAM_ID
+	 *	{ u32			cpu, res; } && PERF_SAMPLE_CPU
+	 *	{ u64			period;   } && PERF_SAMPLE_PERIOD
+	 *
+	 *	{ struct read_format	values;	  } && PERF_SAMPLE_READ
+	 *
+	 *	{ u64			nr,
+	 *	  u64			ips[nr];  } && PERF_SAMPLE_CALLCHAIN
+	 *
+	 *	#
+	 *	# The RAW record below is opaque data wrt the ABI
+	 *	#
+	 *	# That is, the ABI doesn't make any promises wrt to
+	 *	# the stability of its content, it may vary depending
+	 *	# on event, hardware, kernel version and phase of
+	 *	# the moon.
+	 *	#
+	 *	# In other words, PERF_SAMPLE_RAW contents are not an ABI.
+	 *	#
+	 *
+	 *	{ u32			size;
+	 *	  char                  data[size];}&& PERF_SAMPLE_RAW
+	 * };
+	 */
+	PERF_RECORD_SAMPLE			= 9,
+
+	PERF_RECORD_MAX,			/* non-ABI */
+};
+
+enum perf_callchain_context {
+	PERF_CONTEXT_HV			= (__u64)-32,
+	PERF_CONTEXT_KERNEL		= (__u64)-128,
+	PERF_CONTEXT_USER		= (__u64)-512,
+
+	PERF_CONTEXT_GUEST		= (__u64)-2048,
+	PERF_CONTEXT_GUEST_KERNEL	= (__u64)-2176,
+	PERF_CONTEXT_GUEST_USER		= (__u64)-2560,
+
+	PERF_CONTEXT_MAX		= (__u64)-4095,
+};
+
+#define PERF_FLAG_FD_NO_GROUP		(1U << 0)
+#define PERF_FLAG_FD_OUTPUT		(1U << 1)
+#define PERF_FLAG_PID_CGROUP		(1U << 2) /* pid=cgroup id, per-cpu mode only */
+
+#endif /* _LINUX_PERF_EVENT_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/personality.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/personality.h
index 37478ee..9971703 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/personality.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/personality.h
@@ -8,6 +8,7 @@
  * These occupy the top three bytes.
  */
 enum {
+	UNAME26	=               0x0020000,
 	ADDR_NO_RANDOMIZE = 	0x0040000,	/* disable randomization of VA space */
 	FDPIC_FUNCPTRS =	0x0080000,	/* userspace function ptrs point to descriptors
 						 * (signal handling)
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pfkeyv2.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pfkeyv2.h
index 228b0b6..0b80c80 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pfkeyv2.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pfkeyv2.h
@@ -315,6 +315,7 @@
 #define SADB_X_EALG_AES_GCM_ICV12	19
 #define SADB_X_EALG_AES_GCM_ICV16	20
 #define SADB_X_EALG_CAMELLIACBC		22
+#define SADB_X_EALG_NULL_AES_GMAC	23
 #define SADB_EALG_MAX                   253 /* last EALG */
 /* private allocations should use 249-255 (RFC2407) */
 #define SADB_X_EALG_SERPENTCBC  252     /* draft-ietf-ipsec-ciph-aes-cbc-00 */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/phonet.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/phonet.h
index 3ad3eea..349d859 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/phonet.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/phonet.h
@@ -24,6 +24,7 @@
 #define LINUX_PHONET_H
 
 #include <linux/types.h>
+#include <linux/socket.h>
 
 /* Automatic protocol selection */
 #define PN_PROTO_TRANSPORT	0
@@ -36,8 +37,11 @@
 /* Socket options for SOL_PNPIPE level */
 #define PNPIPE_ENCAP		1
 #define PNPIPE_IFINDEX		2
+#define PNPIPE_HANDLE		3
+#define PNPIPE_INITSTATE	4
 
 #define PNADDR_ANY		0
+#define PNADDR_BROADCAST	0xFC
 #define PNPORT_RESOURCE_ROUTING	0
 
 /* Values for PNPIPE_ENCAP option */
@@ -46,6 +50,9 @@
 
 /* ioctls */
 #define SIOCPNGETOBJECT		(SIOCPROTOPRIVATE + 0)
+#define SIOCPNENABLEPIPE	(SIOCPROTOPRIVATE + 13)
+#define SIOCPNADDRESOURCE	(SIOCPROTOPRIVATE + 14)
+#define SIOCPNDELRESOURCE	(SIOCPROTOPRIVATE + 15)
 
 /* Phonet protocol header */
 struct phonethdr {
@@ -92,12 +99,15 @@
 
 /* Phonet socket address structure */
 struct sockaddr_pn {
-	sa_family_t spn_family;
+	__kernel_sa_family_t spn_family;
 	__u8 spn_obj;
 	__u8 spn_dev;
 	__u8 spn_resource;
-	__u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
-} __attribute__ ((packed));
+	__u8 spn_zero[sizeof(struct sockaddr) - sizeof(__kernel_sa_family_t) - 3];
+} __attribute__((packed));
+
+/* Well known address */
+#define PN_DEV_PC	0x10
 
 static __inline__ __u16 pn_object(__u8 addr, __u16 port)
 {
@@ -170,4 +180,6 @@
 	return spn->spn_resource;
 }
 
+/* Phonet device ioctl requests */
+
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pkt_cls.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pkt_cls.h
index 3c842ed..defbde2 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pkt_cls.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pkt_cls.h
@@ -75,8 +75,7 @@
 #define SET_TC_AT(v,n)   ((V_TC_AT(n)) | (v & ~M_TC_AT))
 
 /* Action attributes */
-enum
-{
+enum {
 	TCA_ACT_UNSPEC,
 	TCA_ACT_KIND,
 	TCA_ACT_OPTIONS,
@@ -108,8 +107,7 @@
 #define TC_ACT_JUMP		0x10000000
 
 /* Action type identifiers*/
-enum
-{
+enum {
 	TCA_ID_UNSPEC=0,
 	TCA_ID_POLICE=1,
 	/* other actions go here */
@@ -118,8 +116,7 @@
 
 #define TCA_ID_MAX __TCA_ID_MAX
 
-struct tc_police
-{
+struct tc_police {
 	__u32			index;
 	int			action;
 #define TC_POLICE_UNSPEC	TC_ACT_UNSPEC
@@ -138,15 +135,13 @@
 	__u32			capab;
 };
 
-struct tcf_t
-{
+struct tcf_t {
 	__u64   install;
 	__u64   lastuse;
 	__u64   expires;
 };
 
-struct tc_cnt
-{
+struct tc_cnt {
 	int                   refcnt; 
 	int                   bindcnt;
 };
@@ -158,8 +153,7 @@
 	int                   refcnt; \
 	int                   bindcnt
 
-enum
-{
+enum {
 	TCA_POLICE_UNSPEC,
 	TCA_POLICE_TBF,
 	TCA_POLICE_RATE,
@@ -182,8 +176,7 @@
 #define TC_U32_UNSPEC	0
 #define TC_U32_ROOT	(0xFFF00000)
 
-enum
-{
+enum {
 	TCA_U32_UNSPEC,
 	TCA_U32_CLASSID,
 	TCA_U32_HASH,
@@ -200,16 +193,14 @@
 
 #define TCA_U32_MAX (__TCA_U32_MAX - 1)
 
-struct tc_u32_key
-{
+struct tc_u32_key {
 	__be32		mask;
 	__be32		val;
 	int		off;
 	int		offmask;
 };
 
-struct tc_u32_sel
-{
+struct tc_u32_sel {
 	unsigned char		flags;
 	unsigned char		offshift;
 	unsigned char		nkeys;
@@ -223,15 +214,13 @@
 	struct tc_u32_key	keys[0];
 };
 
-struct tc_u32_mark
-{
+struct tc_u32_mark {
 	__u32		val;
 	__u32		mask;
 	__u32		success;
 };
 
-struct tc_u32_pcnt
-{
+struct tc_u32_pcnt {
 	__u64 rcnt;
 	__u64 rhit;
 	__u64 kcnts[0];
@@ -249,8 +238,7 @@
 
 /* RSVP filter */
 
-enum
-{
+enum {
 	TCA_RSVP_UNSPEC,
 	TCA_RSVP_CLASSID,
 	TCA_RSVP_DST,
@@ -263,15 +251,13 @@
 
 #define TCA_RSVP_MAX (__TCA_RSVP_MAX - 1 )
 
-struct tc_rsvp_gpi
-{
+struct tc_rsvp_gpi {
 	__u32	key;
 	__u32	mask;
 	int	offset;
 };
 
-struct tc_rsvp_pinfo
-{
+struct tc_rsvp_pinfo {
 	struct tc_rsvp_gpi dpi;
 	struct tc_rsvp_gpi spi;
 	__u8	protocol;
@@ -282,8 +268,7 @@
 
 /* ROUTE filter */
 
-enum
-{
+enum {
 	TCA_ROUTE4_UNSPEC,
 	TCA_ROUTE4_CLASSID,
 	TCA_ROUTE4_TO,
@@ -299,8 +284,7 @@
 
 /* FW filter */
 
-enum
-{
+enum {
 	TCA_FW_UNSPEC,
 	TCA_FW_CLASSID,
 	TCA_FW_POLICE,
@@ -314,8 +298,7 @@
 
 /* TC index filter */
 
-enum
-{
+enum {
 	TCA_TCINDEX_UNSPEC,
 	TCA_TCINDEX_HASH,
 	TCA_TCINDEX_MASK,
@@ -331,8 +314,7 @@
 
 /* Flow filter */
 
-enum
-{
+enum {
 	FLOW_KEY_SRC,
 	FLOW_KEY_DST,
 	FLOW_KEY_PROTO,
@@ -350,19 +332,18 @@
 	FLOW_KEY_SKUID,
 	FLOW_KEY_SKGID,
 	FLOW_KEY_VLAN_TAG,
+	FLOW_KEY_RXHASH,
 	__FLOW_KEY_MAX,
 };
 
 #define FLOW_KEY_MAX	(__FLOW_KEY_MAX - 1)
 
-enum
-{
+enum {
 	FLOW_MODE_MAP,
 	FLOW_MODE_HASH,
 };
 
-enum
-{
+enum {
 	TCA_FLOW_UNSPEC,
 	TCA_FLOW_KEYS,
 	TCA_FLOW_MODE,
@@ -383,8 +364,7 @@
 
 /* Basic filter */
 
-enum
-{
+enum {
 	TCA_BASIC_UNSPEC,
 	TCA_BASIC_CLASSID,
 	TCA_BASIC_EMATCHES,
@@ -398,8 +378,7 @@
 
 /* Cgroup classifier */
 
-enum
-{
+enum {
 	TCA_CGROUP_UNSPEC,
 	TCA_CGROUP_ACT,
 	TCA_CGROUP_POLICE,
@@ -411,14 +390,12 @@
 
 /* Extended Matches */
 
-struct tcf_ematch_tree_hdr
-{
+struct tcf_ematch_tree_hdr {
 	__u16		nmatches;
 	__u16		progid;
 };
 
-enum
-{
+enum {
 	TCA_EMATCH_TREE_UNSPEC,
 	TCA_EMATCH_TREE_HDR,
 	TCA_EMATCH_TREE_LIST,
@@ -426,8 +403,7 @@
 };
 #define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1)
 
-struct tcf_ematch_hdr
-{
+struct tcf_ematch_hdr {
 	__u16		matchid;
 	__u16		kind;
 	__u16		flags;
@@ -457,8 +433,7 @@
 #define TCF_EM_REL_MASK	3
 #define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK)
 
-enum
-{
+enum {
 	TCF_LAYER_LINK,
 	TCF_LAYER_NETWORK,
 	TCF_LAYER_TRANSPORT,
@@ -479,13 +454,11 @@
 #define        TCF_EM_VLAN		6
 #define	TCF_EM_MAX		6
 
-enum
-{
+enum {
 	TCF_EM_PROG_TC
 };
 
-enum
-{
+enum {
 	TCF_EM_OPND_EQ,
 	TCF_EM_OPND_GT,
 	TCF_EM_OPND_LT
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pkt_sched.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pkt_sched.h
index d51a2b3..b0b0e40 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pkt_sched.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pkt_sched.h
@@ -29,9 +29,8 @@
    Particular schedulers may have also their private records.
  */
 
-struct tc_stats
-{
-	__u64	bytes;			/* NUmber of enqueues bytes */
+struct tc_stats {
+	__u64	bytes;			/* Number of enqueued bytes */
 	__u32	packets;		/* Number of enqueued packets	*/
 	__u32	drops;			/* Packets dropped because of lack of resources */
 	__u32	overlimits;		/* Number of throttle events when this
@@ -42,8 +41,7 @@
 	__u32	backlog;
 };
 
-struct tc_estimator
-{
+struct tc_estimator {
 	signed char	interval;
 	unsigned char	ewma_log;
 };
@@ -75,8 +73,7 @@
 #define TC_H_ROOT	(0xFFFFFFFFU)
 #define TC_H_INGRESS    (0xFFFFFFF1U)
 
-struct tc_ratespec
-{
+struct tc_ratespec {
 	unsigned char	cell_log;
 	unsigned char	__reserved;
 	unsigned short	overhead;
@@ -109,8 +106,7 @@
 
 /* FIFO section */
 
-struct tc_fifo_qopt
-{
+struct tc_fifo_qopt {
 	__u32	limit;	/* Queue length: bytes for bfifo, packets for pfifo */
 };
 
@@ -119,8 +115,7 @@
 #define TCQ_PRIO_BANDS	16
 #define TCQ_MIN_PRIO_BANDS 2
 
-struct tc_prio_qopt
-{
+struct tc_prio_qopt {
 	int	bands;			/* Number of bands */
 	__u8	priomap[TC_PRIO_MAX+1];	/* Map: logical priority -> PRIO band */
 };
@@ -134,8 +129,7 @@
 
 /* TBF section */
 
-struct tc_tbf_qopt
-{
+struct tc_tbf_qopt {
 	struct tc_ratespec rate;
 	struct tc_ratespec peakrate;
 	__u32		limit;
@@ -143,8 +137,7 @@
 	__u32		mtu;
 };
 
-enum
-{
+enum {
 	TCA_TBF_UNSPEC,
 	TCA_TBF_PARMS,
 	TCA_TBF_RTAB,
@@ -161,8 +154,7 @@
 
 /* SFQ section */
 
-struct tc_sfq_qopt
-{
+struct tc_sfq_qopt {
 	unsigned	quantum;	/* Bytes per round allocated to flow */
 	int		perturb_period;	/* Period of hash perturbation */
 	__u32		limit;		/* Maximal packets in queue */
@@ -170,34 +162,77 @@
 	unsigned	flows;		/* Maximal number of flows  */
 };
 
-struct tc_sfq_xstats
-{
+struct tc_sfqred_stats {
+	__u32           prob_drop;      /* Early drops, below max threshold */
+	__u32           forced_drop;	/* Early drops, after max threshold */
+	__u32           prob_mark;      /* Marked packets, below max threshold */
+	__u32           forced_mark;    /* Marked packets, after max threshold */
+	__u32           prob_mark_head; /* Marked packets, below max threshold */
+	__u32           forced_mark_head;/* Marked packets, after max threshold */
+};
+
+struct tc_sfq_qopt_v1 {
+	struct tc_sfq_qopt v0;
+	unsigned int	depth;		/* max number of packets per flow */
+	unsigned int	headdrop;
+/* SFQRED parameters */
+	__u32		limit;		/* HARD maximal flow queue length (bytes) */
+	__u32		qth_min;	/* Min average length threshold (bytes) */
+	__u32		qth_max;	/* Max average length threshold (bytes) */
+	unsigned char   Wlog;		/* log(W)		*/
+	unsigned char   Plog;		/* log(P_max/(qth_max-qth_min))	*/
+	unsigned char   Scell_log;	/* cell size for idle damping */
+	unsigned char	flags;
+	__u32		max_P;		/* probability, high resolution */
+/* SFQRED stats */
+	struct tc_sfqred_stats stats;
+};
+
+
+struct tc_sfq_xstats {
 	__s32		allot;
 };
 
-/*
- *  NOTE: limit, divisor and flows are hardwired to code at the moment.
- *
- *	limit=flows=128, divisor=1024;
- *
- *	The only reason for this is efficiency, it is possible
- *	to change these parameters in compile time.
- */
-
-/* RED section */
+/* ESFQ section */
 
 enum
 {
+        /* traditional */
+	TCA_SFQ_HASH_CLASSIC,
+	TCA_SFQ_HASH_DST,
+	TCA_SFQ_HASH_SRC,
+	TCA_SFQ_HASH_FWMARK,
+	/* conntrack */
+	TCA_SFQ_HASH_CTORIGDST,
+	TCA_SFQ_HASH_CTORIGSRC,
+	TCA_SFQ_HASH_CTREPLDST,
+	TCA_SFQ_HASH_CTREPLSRC,
+	TCA_SFQ_HASH_CTNATCHG,
+};
+
+struct tc_esfq_qopt
+{
+	unsigned	quantum;	/* Bytes per round allocated to flow */
+	int		perturb_period;	/* Period of hash perturbation */
+	__u32		limit;		/* Maximal packets in queue */
+	unsigned	divisor;	/* Hash divisor  */
+	unsigned	flows;		/* Maximal number of flows  */
+	unsigned	hash_kind;	/* Hash function to use for flow identification */
+};
+
+/* RED section */
+
+enum {
 	TCA_RED_UNSPEC,
 	TCA_RED_PARMS,
 	TCA_RED_STAB,
+	TCA_RED_MAX_P,
 	__TCA_RED_MAX,
 };
 
 #define TCA_RED_MAX (__TCA_RED_MAX - 1)
 
-struct tc_red_qopt
-{
+struct tc_red_qopt {
 	__u32		limit;		/* HARD maximal queue length (bytes)	*/
 	__u32		qth_min;	/* Min average length threshold (bytes) */
 	__u32		qth_max;	/* Max average length threshold (bytes) */
@@ -205,12 +240,12 @@
 	unsigned char   Plog;		/* log(P_max/(qth_max-qth_min))	*/
 	unsigned char   Scell_log;	/* cell size for idle damping */
 	unsigned char	flags;
-#define TC_RED_ECN	1
-#define TC_RED_HARDDROP	2
+#define TC_RED_ECN		1
+#define TC_RED_HARDDROP		2
+#define TC_RED_ADAPTATIVE	4
 };
 
-struct tc_red_xstats
-{
+struct tc_red_xstats {
 	__u32           early;          /* Early drops */
 	__u32           pdrop;          /* Drops due to queue limits */
 	__u32           other;          /* Drops due to drop() calls */
@@ -221,23 +256,22 @@
 
 #define MAX_DPs 16
 
-enum
-{
+enum {
        TCA_GRED_UNSPEC,
        TCA_GRED_PARMS,
        TCA_GRED_STAB,
        TCA_GRED_DPS,
+       TCA_GRED_MAX_P,
 	   __TCA_GRED_MAX,
 };
 
 #define TCA_GRED_MAX (__TCA_GRED_MAX - 1)
 
-struct tc_gred_qopt
-{
+struct tc_gred_qopt {
 	__u32		limit;        /* HARD maximal queue length (bytes)    */
 	__u32		qth_min;      /* Min average length threshold (bytes) */
 	__u32		qth_max;      /* Max average length threshold (bytes) */
-	__u32		DP;           /* upto 2^32 DPs */
+	__u32		DP;           /* up to 2^32 DPs */
 	__u32		backlog;
 	__u32		qave;
 	__u32		forced;
@@ -253,8 +287,7 @@
 };
 
 /* gred setup */
-struct tc_gred_sopt
-{
+struct tc_gred_sopt {
 	__u32		DPs;
 	__u32		def_DP;
 	__u8		grio;
@@ -262,13 +295,42 @@
 	__u16		pad1;
 };
 
+/* CHOKe section */
+
+enum {
+	TCA_CHOKE_UNSPEC,
+	TCA_CHOKE_PARMS,
+	TCA_CHOKE_STAB,
+	TCA_CHOKE_MAX_P,
+	__TCA_CHOKE_MAX,
+};
+
+#define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1)
+
+struct tc_choke_qopt {
+	__u32		limit;		/* Hard queue length (packets)	*/
+	__u32		qth_min;	/* Min average threshold (packets) */
+	__u32		qth_max;	/* Max average threshold (packets) */
+	unsigned char   Wlog;		/* log(W)		*/
+	unsigned char   Plog;		/* log(P_max/(qth_max-qth_min))	*/
+	unsigned char   Scell_log;	/* cell size for idle damping */
+	unsigned char	flags;		/* see RED flags */
+};
+
+struct tc_choke_xstats {
+	__u32		early;          /* Early drops */
+	__u32		pdrop;          /* Drops due to queue limits */
+	__u32		other;          /* Drops due to drop() calls */
+	__u32		marked;         /* Marked packets */
+	__u32		matched;	/* Drops due to flow match */
+};
+
 /* HTB section */
 #define TC_HTB_NUMPRIO		8
 #define TC_HTB_MAXDEPTH		8
 #define TC_HTB_PROTOVER		3 /* the same as HTB and TC's major */
 
-struct tc_htb_opt
-{
+struct tc_htb_opt {
 	struct tc_ratespec 	rate;
 	struct tc_ratespec 	ceil;
 	__u32	buffer;
@@ -277,18 +339,16 @@
 	__u32	level;		/* out only */
 	__u32	prio;
 };
-struct tc_htb_glob
-{
+struct tc_htb_glob {
 	__u32 version;		/* to match HTB/TC */
     	__u32 rate2quantum;	/* bps->quantum divisor */
     	__u32 defcls;		/* default class number */
 	__u32 debug;		/* debug flags */
 
 	/* stats */
-	__u32 direct_pkts; /* count of non shapped packets */
+	__u32 direct_pkts; /* count of non shaped packets */
 };
-enum
-{
+enum {
 	TCA_HTB_UNSPEC,
 	TCA_HTB_PARMS,
 	TCA_HTB_INIT,
@@ -299,8 +359,7 @@
 
 #define TCA_HTB_MAX (__TCA_HTB_MAX - 1)
 
-struct tc_htb_xstats
-{
+struct tc_htb_xstats {
 	__u32 lends;
 	__u32 borrows;
 	__u32 giants;	/* too big packets (rate will not be accurate) */
@@ -310,28 +369,24 @@
 
 /* HFSC section */
 
-struct tc_hfsc_qopt
-{
+struct tc_hfsc_qopt {
 	__u16	defcls;		/* default class */
 };
 
-struct tc_service_curve
-{
+struct tc_service_curve {
 	__u32	m1;		/* slope of the first segment in bps */
 	__u32	d;		/* x-projection of the first segment in us */
 	__u32	m2;		/* slope of the second segment in bps */
 };
 
-struct tc_hfsc_stats
-{
+struct tc_hfsc_stats {
 	__u64	work;		/* total work done */
 	__u64	rtwork;		/* work done by real-time criteria */
 	__u32	period;		/* current period */
 	__u32	level;		/* class level in hierarchy */
 };
 
-enum
-{
+enum {
 	TCA_HFSC_UNSPEC,
 	TCA_HFSC_RSC,
 	TCA_HFSC_FSC,
@@ -348,8 +403,7 @@
 #define TC_CBQ_MAXLEVEL		8
 #define TC_CBQ_DEF_EWMA		5
 
-struct tc_cbq_lssopt
-{
+struct tc_cbq_lssopt {
 	unsigned char	change;
 	unsigned char	flags;
 #define TCF_CBQ_LSS_BOUNDED	1
@@ -368,8 +422,7 @@
 	__u32		avpkt;
 };
 
-struct tc_cbq_wrropt
-{
+struct tc_cbq_wrropt {
 	unsigned char	flags;
 	unsigned char	priority;
 	unsigned char	cpriority;
@@ -378,8 +431,7 @@
 	__u32		weight;
 };
 
-struct tc_cbq_ovl
-{
+struct tc_cbq_ovl {
 	unsigned char	strategy;
 #define	TC_CBQ_OVL_CLASSIC	0
 #define	TC_CBQ_OVL_DELAY	1
@@ -391,30 +443,26 @@
 	__u32		penalty;
 };
 
-struct tc_cbq_police
-{
+struct tc_cbq_police {
 	unsigned char	police;
 	unsigned char	__res1;
 	unsigned short	__res2;
 };
 
-struct tc_cbq_fopt
-{
+struct tc_cbq_fopt {
 	__u32		split;
 	__u32		defmap;
 	__u32		defchange;
 };
 
-struct tc_cbq_xstats
-{
+struct tc_cbq_xstats {
 	__u32		borrows;
 	__u32		overactions;
 	__s32		avgidle;
 	__s32		undertime;
 };
 
-enum
-{
+enum {
 	TCA_CBQ_UNSPEC,
 	TCA_CBQ_LSSOPT,
 	TCA_CBQ_WRROPT,
@@ -459,20 +507,20 @@
 
 /* Network emulator */
 
-enum
-{
+enum {
 	TCA_NETEM_UNSPEC,
 	TCA_NETEM_CORR,
 	TCA_NETEM_DELAY_DIST,
 	TCA_NETEM_REORDER,
 	TCA_NETEM_CORRUPT,
+	TCA_NETEM_LOSS,
+	TCA_NETEM_RATE,
 	__TCA_NETEM_MAX,
 };
 
 #define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1)
 
-struct tc_netem_qopt
-{
+struct tc_netem_qopt {
 	__u32	latency;	/* added delay (us) */
 	__u32   limit;		/* fifo limit (packets) */
 	__u32	loss;		/* random packet loss (0=none ~0=100%) */
@@ -481,31 +529,60 @@
 	__u32	jitter;		/* random jitter in latency (us) */
 };
 
-struct tc_netem_corr
-{
+struct tc_netem_corr {
 	__u32	delay_corr;	/* delay correlation */
 	__u32	loss_corr;	/* packet loss correlation */
 	__u32	dup_corr;	/* duplicate correlation  */
 };
 
-struct tc_netem_reorder
-{
+struct tc_netem_reorder {
 	__u32	probability;
 	__u32	correlation;
 };
 
-struct tc_netem_corrupt
-{
+struct tc_netem_corrupt {
 	__u32	probability;
 	__u32	correlation;
 };
 
+struct tc_netem_rate {
+	__u32	rate;	/* byte/s */
+	__s32	packet_overhead;
+	__u32	cell_size;
+	__s32	cell_overhead;
+};
+
+enum {
+	NETEM_LOSS_UNSPEC,
+	NETEM_LOSS_GI,		/* General Intuitive - 4 state model */
+	NETEM_LOSS_GE,		/* Gilbert Elliot models */
+	__NETEM_LOSS_MAX
+};
+#define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1)
+
+/* State transition probabilities for 4 state model */
+struct tc_netem_gimodel {
+	__u32	p13;
+	__u32	p31;
+	__u32	p32;
+	__u32	p14;
+	__u32	p23;
+};
+
+/* Gilbert-Elliot models */
+struct tc_netem_gemodel {
+	__u32 p;
+	__u32 r;
+	__u32 h;
+	__u32 k1;
+};
+
 #define NETEM_DIST_SCALE	8192
+#define NETEM_DIST_MAX		16384
 
 /* DRR */
 
-enum
-{
+enum {
 	TCA_DRR_UNSPEC,
 	TCA_DRR_QUANTUM,
 	__TCA_DRR_MAX
@@ -513,9 +590,154 @@
 
 #define TCA_DRR_MAX	(__TCA_DRR_MAX - 1)
 
-struct tc_drr_stats
-{
+struct tc_drr_stats {
 	__u32	deficit;
 };
 
+/* MQPRIO */
+#define TC_QOPT_BITMASK 15
+#define TC_QOPT_MAX_QUEUE 16
+
+struct tc_mqprio_qopt {
+	__u8	num_tc;
+	__u8	prio_tc_map[TC_QOPT_BITMASK + 1];
+	__u8	hw;
+	__u16	count[TC_QOPT_MAX_QUEUE];
+	__u16	offset[TC_QOPT_MAX_QUEUE];
+};
+
+/* SFB */
+
+enum {
+	TCA_SFB_UNSPEC,
+	TCA_SFB_PARMS,
+	__TCA_SFB_MAX,
+};
+
+#define TCA_SFB_MAX (__TCA_SFB_MAX - 1)
+
+/*
+ * Note: increment, decrement are Q0.16 fixed-point values.
+ */
+struct tc_sfb_qopt {
+	__u32 rehash_interval;	/* delay between hash move, in ms */
+	__u32 warmup_time;	/* double buffering warmup time in ms (warmup_time < rehash_interval) */
+	__u32 max;		/* max len of qlen_min */
+	__u32 bin_size;		/* maximum queue length per bin */
+	__u32 increment;	/* probability increment, (d1 in Blue) */
+	__u32 decrement;	/* probability decrement, (d2 in Blue) */
+	__u32 limit;		/* max SFB queue length */
+	__u32 penalty_rate;	/* inelastic flows are rate limited to 'rate' pps */
+	__u32 penalty_burst;
+};
+
+struct tc_sfb_xstats {
+	__u32 earlydrop;
+	__u32 penaltydrop;
+	__u32 bucketdrop;
+	__u32 queuedrop;
+	__u32 childdrop; /* drops in child qdisc */
+	__u32 marked;
+	__u32 maxqlen;
+	__u32 maxprob;
+	__u32 avgprob;
+};
+
+#define SFB_MAX_PROB 0xFFFF
+
+/* QFQ */
+enum {
+	TCA_QFQ_UNSPEC,
+	TCA_QFQ_WEIGHT,
+	TCA_QFQ_LMAX,
+	__TCA_QFQ_MAX
+};
+
+#define TCA_QFQ_MAX	(__TCA_QFQ_MAX - 1)
+
+struct tc_qfq_stats {
+	__u32 weight;
+	__u32 lmax;
+};
+
+/* CODEL */
+
+enum {
+	TCA_CODEL_UNSPEC,
+	TCA_CODEL_TARGET,
+	TCA_CODEL_LIMIT,
+	TCA_CODEL_INTERVAL,
+	TCA_CODEL_ECN,
+	__TCA_CODEL_MAX
+};
+
+#define TCA_CODEL_MAX	(__TCA_CODEL_MAX - 1)
+
+struct tc_codel_xstats {
+	__u32	maxpacket; /* largest packet we've seen so far */
+	__u32	count;	   /* how many drops we've done since the last time we
+			    * entered dropping state
+			    */
+	__u32	lastcount; /* count at entry to dropping state */
+	__u32	ldelay;    /* in-queue delay seen by most recently dequeued packet */
+	__s32	drop_next; /* time to drop next packet */
+	__u32	drop_overlimit; /* number of time max qdisc packet limit was hit */
+	__u32	ecn_mark;  /* number of packets we ECN marked instead of dropped */
+	__u32	dropping;  /* are we in dropping state ? */
+};
+
+/* FQ_CODEL */
+
+enum {
+	TCA_FQ_CODEL_UNSPEC,
+	TCA_FQ_CODEL_TARGET,
+	TCA_FQ_CODEL_LIMIT,
+	TCA_FQ_CODEL_INTERVAL,
+	TCA_FQ_CODEL_ECN,
+	TCA_FQ_CODEL_FLOWS,
+	TCA_FQ_CODEL_QUANTUM,
+	__TCA_FQ_CODEL_MAX
+};
+
+#define TCA_FQ_CODEL_MAX	(__TCA_FQ_CODEL_MAX - 1)
+
+enum {
+	TCA_FQ_CODEL_XSTATS_QDISC,
+	TCA_FQ_CODEL_XSTATS_CLASS,
+};
+
+struct tc_fq_codel_qd_stats {
+	__u32	maxpacket;	/* largest packet we've seen so far */
+	__u32	drop_overlimit; /* number of time max qdisc
+				 * packet limit was hit
+				 */
+	__u32	ecn_mark;	/* number of packets we ECN marked
+				 * instead of being dropped
+				 */
+	__u32	new_flow_count; /* number of time packets
+				 * created a 'new flow'
+				 */
+	__u32	new_flows_len;	/* count of flows in new list */
+	__u32	old_flows_len;	/* count of flows in old list */
+};
+
+struct tc_fq_codel_cl_stats {
+	__s32	deficit;
+	__u32	ldelay;		/* in-queue delay seen by most recently
+				 * dequeued packet
+				 */
+	__u32	count;
+	__u32	lastcount;
+	__u32	dropping;
+	__s32	drop_next;
+};
+
+struct tc_fq_codel_xstats {
+	__u32	type;
+	union {
+		struct tc_fq_codel_qd_stats qdisc_stats;
+		struct tc_fq_codel_cl_stats class_stats;
+	};
+};
+
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pktcdvd.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pktcdvd.h
index eb6805f..7c31eb7 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pktcdvd.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pktcdvd.h
@@ -30,7 +30,7 @@
 
 /*
  * use drive write caching -- we need deferred error handling to be
- * able to sucessfully recover with this option (drive will return good
+ * able to successfully recover with this option (drive will return good
  * status as soon as the cdb is validated).
  */
 #if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pmu.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pmu.h
index 5a77399..12eccb4 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pmu.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pmu.h
@@ -6,6 +6,8 @@
  * Copyright (C) 1998 Paul Mackerras.
  */
 
+#ifndef _LINUX_PMU_H
+#define _LINUX_PMU_H
 
 #define PMU_DRIVER_VERSION	2
 
@@ -133,3 +135,5 @@
 /* no param, but historically was _IOR('B', 6, 0), meaning 4 bytes */
 #define PMU_IOC_GRAB_BACKLIGHT	_IOR('B', 6, size_t) 
 
+
+#endif /* _LINUX_PMU_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pps.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pps.h
index 0194ab0..a9bb1d9 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/pps.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/pps.h
@@ -114,11 +114,18 @@
 	struct pps_ktime timeout;
 };
 
+struct pps_bind_args {
+	int tsformat;	/* format of time stamps */
+	int edge;	/* selected event type */
+	int consumer;	/* selected kernel consumer */
+};
+
 #include <linux/ioctl.h>
 
 #define PPS_GETPARAMS		_IOR('p', 0xa1, struct pps_kparams *)
 #define PPS_SETPARAMS		_IOW('p', 0xa2, struct pps_kparams *)
 #define PPS_GETCAP		_IOR('p', 0xa3, int *)
 #define PPS_FETCH		_IOWR('p', 0xa4, struct pps_fdata *)
+#define PPS_KC_BIND		_IOW('p', 0xa5, struct pps_bind_args *)
 
 #endif /* _PPS_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/prctl.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/prctl.h
index b00df4c..7ddc7f1 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/prctl.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/prctl.h
@@ -85,7 +85,33 @@
 #define PR_SET_TIMERSLACK 29
 #define PR_GET_TIMERSLACK 30
 
-#define PR_TASK_PERF_COUNTERS_DISABLE		31
-#define PR_TASK_PERF_COUNTERS_ENABLE		32
+#define PR_TASK_PERF_EVENTS_DISABLE		31
+#define PR_TASK_PERF_EVENTS_ENABLE		32
+
+/*
+ * Set early/late kill mode for hwpoison memory corruption.
+ * This influences when the process gets killed on a memory corruption.
+ */
+#define PR_MCE_KILL	33
+# define PR_MCE_KILL_CLEAR   0
+# define PR_MCE_KILL_SET     1
+
+# define PR_MCE_KILL_LATE    0
+# define PR_MCE_KILL_EARLY   1
+# define PR_MCE_KILL_DEFAULT 2
+
+#define PR_MCE_KILL_GET 34
+
+/*
+ * Tune up process memory map specifics.
+ */
+#define PR_SET_MM		35
+# define PR_SET_MM_START_CODE		1
+# define PR_SET_MM_END_CODE		2
+# define PR_SET_MM_START_DATA		3
+# define PR_SET_MM_END_DATA		4
+# define PR_SET_MM_START_STACK		5
+# define PR_SET_MM_START_BRK		6
+# define PR_SET_MM_BRK			7
 
 #endif /* _LINUX_PRCTL_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ptp_clock.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ptp_clock.h
new file mode 100644
index 0000000..94e981f
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ptp_clock.h
@@ -0,0 +1,84 @@
+/*
+ * PTP 1588 clock support - user space interface
+ *
+ * Copyright (C) 2010 OMICRON electronics GmbH
+ *
+ *  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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _PTP_CLOCK_H_
+#define _PTP_CLOCK_H_
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+/* PTP_xxx bits, for the flags field within the request structures. */
+#define PTP_ENABLE_FEATURE (1<<0)
+#define PTP_RISING_EDGE    (1<<1)
+#define PTP_FALLING_EDGE   (1<<2)
+
+/*
+ * struct ptp_clock_time - represents a time value
+ *
+ * The sign of the seconds field applies to the whole value. The
+ * nanoseconds field is always unsigned. The reserved field is
+ * included for sub-nanosecond resolution, should the demand for
+ * this ever appear.
+ *
+ */
+struct ptp_clock_time {
+	__s64 sec;  /* seconds */
+	__u32 nsec; /* nanoseconds */
+	__u32 reserved;
+};
+
+struct ptp_clock_caps {
+	int max_adj;   /* Maximum frequency adjustment in parts per billon. */
+	int n_alarm;   /* Number of programmable alarms. */
+	int n_ext_ts;  /* Number of external time stamp channels. */
+	int n_per_out; /* Number of programmable periodic signals. */
+	int pps;       /* Whether the clock supports a PPS callback. */
+	int rsv[15];   /* Reserved for future use. */
+};
+
+struct ptp_extts_request {
+	unsigned int index;  /* Which channel to configure. */
+	unsigned int flags;  /* Bit field for PTP_xxx flags. */
+	unsigned int rsv[2]; /* Reserved for future use. */
+};
+
+struct ptp_perout_request {
+	struct ptp_clock_time start;  /* Absolute start time. */
+	struct ptp_clock_time period; /* Desired period, zero means disable. */
+	unsigned int index;           /* Which channel to configure. */
+	unsigned int flags;           /* Reserved for future use. */
+	unsigned int rsv[4];          /* Reserved for future use. */
+};
+
+#define PTP_CLK_MAGIC '='
+
+#define PTP_CLOCK_GETCAPS  _IOR(PTP_CLK_MAGIC, 1, struct ptp_clock_caps)
+#define PTP_EXTTS_REQUEST  _IOW(PTP_CLK_MAGIC, 2, struct ptp_extts_request)
+#define PTP_PEROUT_REQUEST _IOW(PTP_CLK_MAGIC, 3, struct ptp_perout_request)
+#define PTP_ENABLE_PPS     _IOW(PTP_CLK_MAGIC, 4, int)
+
+struct ptp_extts_event {
+	struct ptp_clock_time t; /* Time event occured. */
+	unsigned int index;      /* Which channel produced the event. */
+	unsigned int flags;      /* Reserved for future use. */
+	unsigned int rsv[2];     /* Reserved for future use. */
+};
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ptrace.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ptrace.h
index 6e66b68..ee56237 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/ptrace.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/ptrace.h
@@ -27,6 +27,33 @@
 #define PTRACE_GETSIGINFO	0x4202
 #define PTRACE_SETSIGINFO	0x4203
 
+/*
+ * Generic ptrace interface that exports the architecture specific regsets
+ * using the corresponding NT_* types (which are also used in the core dump).
+ * Please note that the NT_PRSTATUS note type in a core dump contains a full
+ * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
+ * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
+ * other user_regset flavors, the user_regset layout and the ELF core dump note
+ * payload are exactly the same layout.
+ *
+ * This interface usage is as follows:
+ *	struct iovec iov = { buf, len};
+ *
+ *	ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);
+ *
+ * On the successful completion, iov.len will be updated by the kernel,
+ * specifying how much the kernel has written/read to/from the user's iov.buf.
+ */
+#define PTRACE_GETREGSET	0x4204
+#define PTRACE_SETREGSET	0x4205
+
+#define PTRACE_SEIZE		0x4206
+#define PTRACE_INTERRUPT	0x4207
+#define PTRACE_LISTEN		0x4208
+
+/* flags in @data for PTRACE_SEIZE */
+#define PTRACE_SEIZE_DEVEL	0x80000000 /* temp flag for development */
+
 /* options set using PTRACE_SETOPTIONS */
 #define PTRACE_O_TRACESYSGOOD	0x00000001
 #define PTRACE_O_TRACEFORK	0x00000002
@@ -45,6 +72,7 @@
 #define PTRACE_EVENT_EXEC	4
 #define PTRACE_EVENT_VFORK_DONE	5
 #define PTRACE_EVENT_EXIT	6
+#define PTRACE_EVENT_STOP	7
 
 #include <asm/ptrace.h>
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/quota.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/quota.h
index 3218a95..16fd614 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/quota.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/quota.h
@@ -73,6 +73,8 @@
 /* Quota format type IDs */
 #define	QFMT_VFS_OLD 1
 #define	QFMT_VFS_V0 2
+#define QFMT_OCFS2 3
+#define	QFMT_VFS_V1 4
 
 /* Size of block in which space limits are passed through the quota
  * interface */
@@ -166,11 +168,4 @@
 #define QUOTA_NL_A_MAX (__QUOTA_NL_A_MAX - 1)
 
 
-
-# /* nodep */ include <sys/cdefs.h>
-
-__BEGIN_DECLS
-long quotactl __P ((unsigned int, const char *, int, caddr_t));
-__END_DECLS
-
 #endif /* _QUOTA_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/raid/md_p.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/raid/md_p.h
index 6bcfd9a..3ad738b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/raid/md_p.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/raid/md_p.h
@@ -245,13 +245,19 @@
 	__u8	device_uuid[16]; /* user-space setable, ignored by kernel */
 	__u8	devflags;	/* per-device flags.  Only one defined...*/
 #define	WriteMostly1	1	/* mask for writemostly flag in above */
-	__u8	pad2[64-57];	/* set to 0 when writing */
+	/* Bad block log.  If there are any bad blocks the feature flag is set.
+	 * If offset and size are non-zero, that space is reserved and available
+	 */
+	__u8	bblog_shift;	/* shift from sectors to block size */
+	__le16	bblog_size;	/* number of sectors reserved for list */
+	__le32	bblog_offset;	/* sector offset from superblock to bblog,
+				 * signed - not unsigned */
 
 	/* array state information - 64 bytes */
-	__le64	utime;		/* 40 bits second, 24 btes microseconds */
+	__le64	utime;		/* 40 bits second, 24 bits microseconds */
 	__le64	events;		/* incremented when superblock updated */
 	__le64	resync_offset;	/* data before this offset (from data_offset) known to be in sync */
-	__le32	sb_csum;	/* checksum upto devs[max_dev] */
+	__le32	sb_csum;	/* checksum up to devs[max_dev] */
 	__le32	max_dev;	/* size of devs[] array to consider */
 	__u8	pad3[64-32];	/* set to 0 when writing */
 
@@ -270,8 +276,11 @@
 					   * must be honoured
 					   */
 #define	MD_FEATURE_RESHAPE_ACTIVE	4
-
-#define	MD_FEATURE_ALL			(1|2|4)
+#define	MD_FEATURE_BAD_BLOCKS		8 /* badblock list is not empty */
+#define	MD_FEATURE_REPLACEMENT		16 /* This device is replacing an
+					    * active device with same 'role'.
+					    * 'recovery_offset' is also set.
+					    */
+#define	MD_FEATURE_ALL			(1|2|4|8|16)
 
 #endif 
-
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/random.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/random.h
index 8f0f161..01cb442 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/random.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/random.h
@@ -1,5 +1,3 @@
-/** Copyright (c) 2013 Qualcomm Atheros, Inc. */
-
 /*
  * include/linux/random.h
  *
@@ -36,12 +34,40 @@
 /* Clear the entropy pool and associated counters.  (Superuser only.) */
 #define RNDCLEARPOOL	_IO( 'R', 0x06 )
 
+#ifdef CONFIG_FIPS_RNG
+
+/* Size of seed value - equal to AES blocksize */
+#define AES_BLOCK_SIZE_BYTES	16
+#define SEED_SIZE_BYTES			AES_BLOCK_SIZE_BYTES
+/* Size of AES key */
+#define KEY_SIZE_BYTES		16
+
+/* ioctl() structure used by FIPS 140-2 Tests */
+struct rand_fips_test {
+	unsigned char key[KEY_SIZE_BYTES];			/* Input */
+	unsigned char datetime[SEED_SIZE_BYTES];	/* Input */
+	unsigned char seed[SEED_SIZE_BYTES];		/* Input */
+	unsigned char result[SEED_SIZE_BYTES];		/* Output */
+};
+
+/* FIPS 140-2 RNG Variable Seed Test. (Superuser only.) */
+#define RNDFIPSVST	_IOWR('R', 0x10, struct rand_fips_test)
+
+/* FIPS 140-2 RNG Monte Carlo Test. (Superuser only.) */
+#define RNDFIPSMCT	_IOWR('R', 0x11, struct rand_fips_test)
+
+#endif /* #ifdef CONFIG_FIPS_RNG */
+
 struct rand_pool_info {
 	int	entropy_count;
 	int	buf_size;
 	__u32	buf[0];
 };
 
+struct rnd_state {
+	__u32 s1, s2, s3;
+};
+
 /* Exported functions */
 
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/rds.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/rds.h
new file mode 100644
index 0000000..9195095
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/rds.h
@@ -0,0 +1,285 @@
+/*
+ * Copyright (c) 2008 Oracle.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 _LINUX_RDS_H
+#define _LINUX_RDS_H
+
+#include <linux/types.h>
+
+#define RDS_IB_ABI_VERSION		0x301
+
+/*
+ * setsockopt/getsockopt for SOL_RDS
+ */
+#define RDS_CANCEL_SENT_TO      	1
+#define RDS_GET_MR			2
+#define RDS_FREE_MR			3
+/* deprecated: RDS_BARRIER 4 */
+#define RDS_RECVERR			5
+#define RDS_CONG_MONITOR		6
+#define RDS_GET_MR_FOR_DEST		7
+
+/*
+ * Control message types for SOL_RDS.
+ *
+ * CMSG_RDMA_ARGS (sendmsg)
+ *	Request a RDMA transfer to/from the specified
+ *	memory ranges.
+ *	The cmsg_data is a struct rds_rdma_args.
+ * RDS_CMSG_RDMA_DEST (recvmsg, sendmsg)
+ *	Kernel informs application about intended
+ *	source/destination of a RDMA transfer
+ * RDS_CMSG_RDMA_MAP (sendmsg)
+ *	Application asks kernel to map the given
+ *	memory range into a IB MR, and send the
+ *	R_Key along in an RDS extension header.
+ *	The cmsg_data is a struct rds_get_mr_args,
+ *	the same as for the GET_MR setsockopt.
+ * RDS_CMSG_RDMA_STATUS (recvmsg)
+ *	Returns the status of a completed RDMA operation.
+ */
+#define RDS_CMSG_RDMA_ARGS		1
+#define RDS_CMSG_RDMA_DEST		2
+#define RDS_CMSG_RDMA_MAP		3
+#define RDS_CMSG_RDMA_STATUS		4
+#define RDS_CMSG_CONG_UPDATE		5
+#define RDS_CMSG_ATOMIC_FADD		6
+#define RDS_CMSG_ATOMIC_CSWP		7
+#define RDS_CMSG_MASKED_ATOMIC_FADD	8
+#define RDS_CMSG_MASKED_ATOMIC_CSWP	9
+
+#define RDS_INFO_FIRST			10000
+#define RDS_INFO_COUNTERS		10000
+#define RDS_INFO_CONNECTIONS		10001
+/* 10002 aka RDS_INFO_FLOWS is deprecated */
+#define RDS_INFO_SEND_MESSAGES		10003
+#define RDS_INFO_RETRANS_MESSAGES       10004
+#define RDS_INFO_RECV_MESSAGES          10005
+#define RDS_INFO_SOCKETS                10006
+#define RDS_INFO_TCP_SOCKETS            10007
+#define RDS_INFO_IB_CONNECTIONS		10008
+#define RDS_INFO_CONNECTION_STATS	10009
+#define RDS_INFO_IWARP_CONNECTIONS	10010
+#define RDS_INFO_LAST			10010
+
+struct rds_info_counter {
+	uint8_t	name[32];
+	uint64_t	value;
+} __attribute__((packed));
+
+#define RDS_INFO_CONNECTION_FLAG_SENDING	0x01
+#define RDS_INFO_CONNECTION_FLAG_CONNECTING	0x02
+#define RDS_INFO_CONNECTION_FLAG_CONNECTED	0x04
+
+#define TRANSNAMSIZ	16
+
+struct rds_info_connection {
+	uint64_t	next_tx_seq;
+	uint64_t	next_rx_seq;
+	__be32		laddr;
+	__be32		faddr;
+	uint8_t	transport[TRANSNAMSIZ];		/* null term ascii */
+	uint8_t	flags;
+} __attribute__((packed));
+
+#define RDS_INFO_MESSAGE_FLAG_ACK               0x01
+#define RDS_INFO_MESSAGE_FLAG_FAST_ACK          0x02
+
+struct rds_info_message {
+	uint64_t	seq;
+	uint32_t	len;
+	__be32		laddr;
+	__be32		faddr;
+	__be16		lport;
+	__be16		fport;
+	uint8_t	flags;
+} __attribute__((packed));
+
+struct rds_info_socket {
+	uint32_t	sndbuf;
+	__be32		bound_addr;
+	__be32		connected_addr;
+	__be16		bound_port;
+	__be16		connected_port;
+	uint32_t	rcvbuf;
+	uint64_t	inum;
+} __attribute__((packed));
+
+struct rds_info_tcp_socket {
+	__be32          local_addr;
+	__be16          local_port;
+	__be32          peer_addr;
+	__be16          peer_port;
+	uint64_t       hdr_rem;
+	uint64_t       data_rem;
+	uint32_t       last_sent_nxt;
+	uint32_t       last_expected_una;
+	uint32_t       last_seen_una;
+} __attribute__((packed));
+
+#define RDS_IB_GID_LEN	16
+struct rds_info_rdma_connection {
+	__be32		src_addr;
+	__be32		dst_addr;
+	uint8_t		src_gid[RDS_IB_GID_LEN];
+	uint8_t		dst_gid[RDS_IB_GID_LEN];
+
+	uint32_t	max_send_wr;
+	uint32_t	max_recv_wr;
+	uint32_t	max_send_sge;
+	uint32_t	rdma_mr_max;
+	uint32_t	rdma_mr_size;
+};
+
+/*
+ * Congestion monitoring.
+ * Congestion control in RDS happens at the host connection
+ * level by exchanging a bitmap marking congested ports.
+ * By default, a process sleeping in poll() is always woken
+ * up when the congestion map is updated.
+ * With explicit monitoring, an application can have more
+ * fine-grained control.
+ * The application installs a 64bit mask value in the socket,
+ * where each bit corresponds to a group of ports.
+ * When a congestion update arrives, RDS checks the set of
+ * ports that are now uncongested against the list bit mask
+ * installed in the socket, and if they overlap, we queue a
+ * cong_notification on the socket.
+ *
+ * To install the congestion monitor bitmask, use RDS_CONG_MONITOR
+ * with the 64bit mask.
+ * Congestion updates are received via RDS_CMSG_CONG_UPDATE
+ * control messages.
+ *
+ * The correspondence between bits and ports is
+ *	1 << (portnum % 64)
+ */
+#define RDS_CONG_MONITOR_SIZE	64
+#define RDS_CONG_MONITOR_BIT(port)  (((unsigned int) port) % RDS_CONG_MONITOR_SIZE)
+#define RDS_CONG_MONITOR_MASK(port) (1ULL << RDS_CONG_MONITOR_BIT(port))
+
+/*
+ * RDMA related types
+ */
+
+/*
+ * This encapsulates a remote memory location.
+ * In the current implementation, it contains the R_Key
+ * of the remote memory region, and the offset into it
+ * (so that the application does not have to worry about
+ * alignment).
+ */
+typedef uint64_t	rds_rdma_cookie_t;
+
+struct rds_iovec {
+	uint64_t	addr;
+	uint64_t	bytes;
+};
+
+struct rds_get_mr_args {
+	struct rds_iovec vec;
+	uint64_t	cookie_addr;
+	uint64_t	flags;
+};
+
+struct rds_get_mr_for_dest_args {
+	struct sockaddr_storage	dest_addr;
+	struct rds_iovec 	vec;
+	uint64_t		cookie_addr;
+	uint64_t		flags;
+};
+
+struct rds_free_mr_args {
+	rds_rdma_cookie_t cookie;
+	uint64_t	flags;
+};
+
+struct rds_rdma_args {
+	rds_rdma_cookie_t cookie;
+	struct rds_iovec remote_vec;
+	uint64_t	local_vec_addr;
+	uint64_t	nr_local;
+	uint64_t	flags;
+	uint64_t	user_token;
+};
+
+struct rds_atomic_args {
+	rds_rdma_cookie_t cookie;
+	uint64_t 	local_addr;
+	uint64_t 	remote_addr;
+	union {
+		struct {
+			uint64_t	compare;
+			uint64_t	swap;
+		} cswp;
+		struct {
+			uint64_t	add;
+		} fadd;
+		struct {
+			uint64_t	compare;
+			uint64_t	swap;
+			uint64_t	compare_mask;
+			uint64_t	swap_mask;
+		} m_cswp;
+		struct {
+			uint64_t	add;
+			uint64_t	nocarry_mask;
+		} m_fadd;
+	};
+	uint64_t	flags;
+	uint64_t	user_token;
+};
+
+struct rds_rdma_notify {
+	uint64_t	user_token;
+	int32_t		status;
+};
+
+#define RDS_RDMA_SUCCESS	0
+#define RDS_RDMA_REMOTE_ERROR	1
+#define RDS_RDMA_CANCELED	2
+#define RDS_RDMA_DROPPED	3
+#define RDS_RDMA_OTHER_ERROR	4
+
+/*
+ * Common set of flags for all RDMA related structs
+ */
+#define RDS_RDMA_READWRITE	0x0001
+#define RDS_RDMA_FENCE		0x0002	/* use FENCE for immediate send */
+#define RDS_RDMA_INVALIDATE	0x0004	/* invalidate R_Key after freeing MR */
+#define RDS_RDMA_USE_ONCE	0x0008	/* free MR after use */
+#define RDS_RDMA_DONTWAIT	0x0010	/* Don't wait in SET_BARRIER */
+#define RDS_RDMA_NOTIFY_ME	0x0020	/* Notify when operation completes */
+#define RDS_RDMA_SILENT		0x0040	/* Do not interrupt remote */
+
+#endif /* IB_RDS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/resource.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/resource.h
index 7ef7a15..d56ef23 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/resource.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/resource.h
@@ -2,8 +2,7 @@
 #define _LINUX_RESOURCE_H
 
 #include <linux/time.h>
-
-struct task_struct;
+#include <linux/types.h>
 
 /*
  * Resource control/accounting header file for linux
@@ -45,6 +44,13 @@
 	unsigned long	rlim_max;
 };
 
+#define RLIM64_INFINITY		(~0ULL)
+
+struct rlimit64 {
+	__u64 rlim_cur;
+	__u64 rlim_max;
+};
+
 #define	PRIO_MIN	(-20)
 #define	PRIO_MAX	20
 
@@ -70,6 +76,5 @@
  */
 #include <asm/resource.h>
 
-int getrusage(struct task_struct *p, int who, struct rusage *ru);
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/rfkill.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/rfkill.h
index 30c1e9d..abb2c66 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/rfkill.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/rfkill.h
@@ -6,20 +6,17 @@
  * Copyright (C) 2007 Dmitry Torokhov
  * Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
  *
- * 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.
+ * 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.
  *
- * 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.
+ * 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.
  */
 
 #include <linux/types.h>
@@ -32,12 +29,14 @@
 /**
  * enum rfkill_type - type of rfkill switch.
  *
- * @RFKILL_TYPE_ALL: toggles all switches (userspace only)
+ * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type)
  * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
  * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
  * @RFKILL_TYPE_UWB: switch is on a ultra wideband device.
  * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device.
  * @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.
  * @NUM_RFKILL_TYPES: number of defined rfkill types
  */
 enum rfkill_type {
@@ -47,6 +46,8 @@
 	RFKILL_TYPE_UWB,
 	RFKILL_TYPE_WIMAX,
 	RFKILL_TYPE_WWAN,
+	RFKILL_TYPE_GPS,
+	RFKILL_TYPE_FM,
 	NUM_RFKILL_TYPES,
 };
 
@@ -80,7 +81,21 @@
 	__u8  type;
 	__u8  op;
 	__u8  soft, hard;
-} __packed;
+} __attribute__((packed));
+
+/*
+ * We are planning to be backward and forward compatible with changes
+ * to the event struct, by adding new, optional, members at the end.
+ * When reading an event (whether the kernel from userspace or vice
+ * versa) we need to accept anything that's at least as large as the
+ * version 1 event size, but might be able to accept other sizes in
+ * the future.
+ *
+ * One exception is the kernel -- we already have two event sizes in
+ * that we've made the 'hard' member optional since our only option
+ * is to ignore it anyway.
+ */
+#define RFKILL_EVENT_SIZE_V1	8
 
 /* ioctl for turning off rfkill-input (if present) */
 #define RFKILL_IOC_MAGIC	'R'
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/romfs_fs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/romfs_fs.h
index c490fbc..5f57f93 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/romfs_fs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/romfs_fs.h
@@ -1,6 +1,9 @@
 #ifndef __LINUX_ROMFS_FS_H
 #define __LINUX_ROMFS_FS_H
 
+#include <linux/types.h>
+#include <linux/fs.h>
+
 /* The basic structures of the romfs filesystem */
 
 #define ROMBSIZE BLOCK_SIZE
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/rose.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/rose.h
index c7b4b18..1fcfe95 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/rose.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/rose.h
@@ -7,6 +7,9 @@
 #ifndef	ROSE_KERNEL_H
 #define	ROSE_KERNEL_H
 
+#include <linux/socket.h>
+#include <linux/ax25.h>
+
 #define ROSE_MTU	251
 
 #define ROSE_MAX_DIGIS 6
@@ -44,7 +47,7 @@
 } rose_address;
 
 struct sockaddr_rose {
-	sa_family_t	srose_family;
+	__kernel_sa_family_t srose_family;
 	rose_address	srose_addr;
 	ax25_address	srose_call;
 	int		srose_ndigis;
@@ -52,7 +55,7 @@
 };
 
 struct full_sockaddr_rose {
-	sa_family_t	srose_family;
+	__kernel_sa_family_t srose_family;
 	rose_address	srose_addr;
 	ax25_address	srose_call;
 	unsigned int	srose_ndigis;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/route.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/route.h
index c96ff9e..11abf54 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/route.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/route.h
@@ -27,8 +27,7 @@
 
 
 /* This structure gets passed by the SIOCADDRT and SIOCDELRT calls. */
-struct rtentry 
-{
+struct rtentry {
 	unsigned long	rt_pad1;
 	struct sockaddr	rt_dst;		/* target address		*/
 	struct sockaddr	rt_gateway;	/* gateway addr (RTF_GATEWAY)	*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/rtc.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/rtc.h
index 4aae894..c06837e 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/rtc.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/rtc.h
@@ -92,10 +92,13 @@
 #define RTC_PLL_SET	_IOW('p', 0x12, struct rtc_pll_info)  /* Set PLL correction */
 
 /* interrupt flags */
-#define RTC_IRQF 0x80 /* any of the following is active */
-#define RTC_PF 0x40
-#define RTC_AF 0x20
-#define RTC_UF 0x10
+#define RTC_IRQF 0x80	/* Any of the following is active */
+#define RTC_PF 0x40	/* Periodic interrupt */
+#define RTC_AF 0x20	/* Alarm interrupt */
+#define RTC_UF 0x10	/* Update interrupt for 1Hz RTC */
+
+
+#define RTC_MAX_FREQ	8192
 
 
 #endif /* _LINUX_RTC_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/rtnetlink.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/rtnetlink.h
index 63d1c69..d5b7fdd 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/rtnetlink.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/rtnetlink.h
@@ -7,6 +7,13 @@
 #include <linux/if_addr.h>
 #include <linux/neighbour.h>
 
+/* rtnetlink families. Values up to 127 are reserved for real address
+ * families, values above 128 may be used arbitrarily.
+ */
+#define RTNL_FAMILY_IPMR		128
+#define RTNL_FAMILY_IP6MR		129
+#define RTNL_FAMILY_MAX			129
+
 /****
  *		Routing/neighbour discovery messages.
  ****/
@@ -104,7 +111,7 @@
 	RTM_NEWADDRLABEL = 72,
 #define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
 	RTM_DELADDRLABEL,
-#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
+#define RTM_DELADDRLABEL RTM_DELADDRLABEL
 	RTM_GETADDRLABEL,
 #define RTM_GETADDRLABEL RTM_GETADDRLABEL
 
@@ -127,8 +134,7 @@
    with attribute type.
  */
 
-struct rtattr
-{
+struct rtattr {
 	unsigned short	rta_len;
 	unsigned short	rta_type;
 };
@@ -154,8 +160,7 @@
  *		Definitions used in routing table administration.
  ****/
 
-struct rtmsg
-{
+struct rtmsg {
 	unsigned char		rtm_family;
 	unsigned char		rtm_dst_len;
 	unsigned char		rtm_src_len;
@@ -171,8 +176,7 @@
 
 /* rtm_type */
 
-enum
-{
+enum {
 	RTN_UNSPEC,
 	RTN_UNICAST,		/* Gateway or direct route	*/
 	RTN_LOCAL,		/* Accept locally		*/
@@ -230,8 +234,7 @@
    could be assigned a value between UNIVERSE and LINK.
 */
 
-enum rt_scope_t
-{
+enum rt_scope_t {
 	RT_SCOPE_UNIVERSE=0,
 /* User defined values  */
 	RT_SCOPE_SITE=200,
@@ -249,8 +252,7 @@
 
 /* Reserved table identifiers */
 
-enum rt_class_t
-{
+enum rt_class_t {
 	RT_TABLE_UNSPEC=0,
 /* User defined values */
 	RT_TABLE_COMPAT=252,
@@ -263,8 +265,7 @@
 
 /* Routing message attributes */
 
-enum rtattr_type_t
-{
+enum rtattr_type_t {
 	RTA_UNSPEC,
 	RTA_DST,
 	RTA_SRC,
@@ -281,6 +282,7 @@
 	RTA_SESSION, /* no longer used */
 	RTA_MP_ALGO, /* no longer used */
 	RTA_TABLE,
+	RTA_MARK,
 	__RTA_MAX
 };
 
@@ -298,8 +300,7 @@
  * and rtt for different paths from multipath.
  */
 
-struct rtnexthop
-{
+struct rtnexthop {
 	unsigned short		rtnh_len;
 	unsigned char		rtnh_flags;
 	unsigned char		rtnh_hops;
@@ -325,8 +326,7 @@
 
 /* RTM_CACHEINFO */
 
-struct rta_cacheinfo
-{
+struct rta_cacheinfo {
 	__u32	rta_clntref;
 	__u32	rta_lastuse;
 	__s32	rta_expires;
@@ -341,8 +341,7 @@
 
 /* RTM_METRICS --- array of struct rtattr with types of RTAX_* */
 
-enum
-{
+enum {
 	RTAX_UNSPEC,
 #define RTAX_UNSPEC RTAX_UNSPEC
 	RTAX_LOCK,
@@ -371,6 +370,8 @@
 #define RTAX_FEATURES RTAX_FEATURES
 	RTAX_RTO_MIN,
 #define RTAX_RTO_MIN RTAX_RTO_MIN
+	RTAX_INITRWND,
+#define RTAX_INITRWND RTAX_INITRWND
 	__RTAX_MAX
 };
 
@@ -381,8 +382,7 @@
 #define RTAX_FEATURE_TIMESTAMP	0x00000004
 #define RTAX_FEATURE_ALLFRAG	0x00000008
 
-struct rta_session
-{
+struct rta_session {
 	__u8	proto;
 	__u8	pad1;
 	__u16	pad2;
@@ -407,8 +407,7 @@
  *		General form of address family dependent message.
  ****/
 
-struct rtgenmsg
-{
+struct rtgenmsg {
 	unsigned char		rtgen_family;
 };
 
@@ -421,8 +420,7 @@
  * on network protocol.
  */
 
-struct ifinfomsg
-{
+struct ifinfomsg {
 	unsigned char	ifi_family;
 	unsigned char	__ifi_pad;
 	unsigned short	ifi_type;		/* ARPHRD_* */
@@ -435,8 +433,7 @@
  *		prefix information 
  ****/
 
-struct prefixmsg
-{
+struct prefixmsg {
 	unsigned char	prefix_family;
 	unsigned char	prefix_pad1;
 	unsigned short	prefix_pad2;
@@ -457,8 +454,7 @@
 
 #define PREFIX_MAX	(__PREFIX_MAX - 1)
 
-struct prefix_cacheinfo
-{
+struct prefix_cacheinfo {
 	__u32	preferred_time;
 	__u32	valid_time;
 };
@@ -468,8 +464,7 @@
  *		Traffic control messages.
  ****/
 
-struct tcmsg
-{
+struct tcmsg {
 	unsigned char	tcm_family;
 	unsigned char	tcm__pad1;
 	unsigned short	tcm__pad2;
@@ -479,8 +474,7 @@
 	__u32		tcm_info;
 };
 
-enum
-{
+enum {
 	TCA_UNSPEC,
 	TCA_KIND,
 	TCA_OPTIONS,
@@ -502,8 +496,7 @@
  *		Neighbor Discovery userland options
  ****/
 
-struct nduseroptmsg
-{
+struct nduseroptmsg {
 	unsigned char	nduseropt_family;
 	unsigned char	nduseropt_pad1;
 	unsigned short	nduseropt_opts_len;	/* Total length of options */
@@ -515,8 +508,7 @@
 	/* Followed by one or more ND options */
 };
 
-enum
-{
+enum {
 	NDUSEROPT_UNSPEC,
 	NDUSEROPT_SRCADDR,
 	__NDUSEROPT_MAX
@@ -591,13 +583,14 @@
 #define RTNLGRP_PHONET_IFADDR	RTNLGRP_PHONET_IFADDR
 	RTNLGRP_PHONET_ROUTE,
 #define RTNLGRP_PHONET_ROUTE	RTNLGRP_PHONET_ROUTE
+	RTNLGRP_DCB,
+#define RTNLGRP_DCB		RTNLGRP_DCB
 	__RTNLGRP_MAX
 };
 #define RTNLGRP_MAX	(__RTNLGRP_MAX - 1)
 
 /* TC action piece */
-struct tcamsg
-{
+struct tcamsg {
 	unsigned char	tca_family;
 	unsigned char	tca__pad1;
 	unsigned short	tca__pad2;
@@ -607,6 +600,9 @@
 #define TCA_ACT_TAB 1 /* attr type must be >=1 */	
 #define TCAA_MAX 1
 
+/* New extended info filters for IFLA_EXT_MASK */
+#define RTEXT_FILTER_VF		(1 << 0)
+
 /* End of information exported to user level */
 
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sched.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sched.h
index 95ec7c2..dd968cf 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sched.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sched.h
@@ -21,7 +21,8 @@
 #define CLONE_DETACHED		0x00400000	/* Unused, ignored */
 #define CLONE_UNTRACED		0x00800000	/* set if the tracing process can't force CLONE_PTRACE on this clone */
 #define CLONE_CHILD_SETTID	0x01000000	/* set the TID in the child */
-#define CLONE_STOPPED		0x02000000	/* Start in stopped state */
+/* 0x02000000 was previously the unused CLONE_STOPPED (Start in stopped state)
+   and is now available for re-use. */
 #define CLONE_NEWUTS		0x04000000	/* New utsname group? */
 #define CLONE_NEWIPC		0x08000000	/* New ipcs */
 #define CLONE_NEWUSER		0x10000000	/* New user namespace */
@@ -38,6 +39,8 @@
 #define SCHED_BATCH		3
 /* SCHED_ISO: reserved but not implemented yet */
 #define SCHED_IDLE		5
+/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
+#define SCHED_RESET_ON_FORK     0x40000000
 
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/screen_info.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/screen_info.h
index 4885982..956b4f8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/screen_info.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/screen_info.h
@@ -14,7 +14,8 @@
 	__u16 orig_video_page;	/* 0x04 */
 	__u8  orig_video_mode;	/* 0x06 */
 	__u8  orig_video_cols;	/* 0x07 */
-	__u16 unused2;		/* 0x08 */
+	__u8  flags;		/* 0x08 */
+	__u8  unused2;		/* 0x09 */
 	__u16 orig_video_ega_bx;/* 0x0a */
 	__u16 unused3;		/* 0x0c */
 	__u8  orig_video_lines;	/* 0x0e */
@@ -65,5 +66,7 @@
 
 #define VIDEO_TYPE_EFI		0x70	/* EFI graphic mode		*/
 
+#define VIDEO_FLAGS_NOCURSOR	(1 << 0) /* The video mode has no cursor set */
+
 
 #endif /* _SCREEN_INFO_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sdla.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sdla.h
index 303b4fa..414f7ec 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sdla.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sdla.h
@@ -113,7 +113,4 @@
 };
 
 
-void sdla(void *cfg_info, char *dev, struct frad_conf *conf, int quiet);
-
-
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/securebits.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/securebits.h
new file mode 100644
index 0000000..2035c62
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/securebits.h
@@ -0,0 +1,51 @@
+#ifndef _LINUX_SECUREBITS_H
+#define _LINUX_SECUREBITS_H 1
+
+/* Each securesetting is implemented using two bits. One bit specifies
+   whether the setting is on or off. The other bit specify whether the
+   setting is locked or not. A setting which is locked cannot be
+   changed from user-level. */
+#define issecure_mask(X)	(1 << (X))
+
+#define SECUREBITS_DEFAULT 0x00000000
+
+/* When set UID 0 has no special privileges. When unset, we support
+   inheritance of root-permissions and suid-root executable under
+   compatibility mode. We raise the effective and inheritable bitmasks
+   *of the executable file* if the effective uid of the new process is
+   0. If the real uid is 0, we raise the effective (legacy) bit of the
+   executable file. */
+#define SECURE_NOROOT			0
+#define SECURE_NOROOT_LOCKED		1  /* make bit-0 immutable */
+
+#define SECBIT_NOROOT		(issecure_mask(SECURE_NOROOT))
+#define SECBIT_NOROOT_LOCKED	(issecure_mask(SECURE_NOROOT_LOCKED))
+
+/* When set, setuid to/from uid 0 does not trigger capability-"fixup".
+   When unset, to provide compatiblility with old programs relying on
+   set*uid to gain/lose privilege, transitions to/from uid 0 cause
+   capabilities to be gained/lost. */
+#define SECURE_NO_SETUID_FIXUP		2
+#define SECURE_NO_SETUID_FIXUP_LOCKED	3  /* make bit-2 immutable */
+
+#define SECBIT_NO_SETUID_FIXUP	(issecure_mask(SECURE_NO_SETUID_FIXUP))
+#define SECBIT_NO_SETUID_FIXUP_LOCKED \
+			(issecure_mask(SECURE_NO_SETUID_FIXUP_LOCKED))
+
+/* When set, a process can retain its capabilities even after
+   transitioning to a non-root user (the set-uid fixup suppressed by
+   bit 2). Bit-4 is cleared when a process calls exec(); setting both
+   bit 4 and 5 will create a barrier through exec that no exec()'d
+   child can use this feature again. */
+#define SECURE_KEEP_CAPS		4
+#define SECURE_KEEP_CAPS_LOCKED		5  /* make bit-4 immutable */
+
+#define SECBIT_KEEP_CAPS	(issecure_mask(SECURE_KEEP_CAPS))
+#define SECBIT_KEEP_CAPS_LOCKED (issecure_mask(SECURE_KEEP_CAPS_LOCKED))
+
+#define SECURE_ALL_BITS		(issecure_mask(SECURE_NOROOT) | \
+				 issecure_mask(SECURE_NO_SETUID_FIXUP) | \
+				 issecure_mask(SECURE_KEEP_CAPS))
+#define SECURE_ALL_LOCKS	(SECURE_ALL_BITS << 1)
+
+#endif /* !_LINUX_SECUREBITS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial.h
index 1c04bda..c497231 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial.h
@@ -103,6 +103,7 @@
 
 /* Internal flags used only by kernel */
 #define ASYNCB_INITIALIZED	31 /* Serial port was initialized */
+#define ASYNCB_SUSPENDED	30 /* Serial port is suspended */
 #define ASYNCB_NORMAL_ACTIVE	29 /* Normal device is active */
 #define ASYNCB_BOOT_AUTOCONF	28 /* Autoconfigure port on bootup */
 #define ASYNCB_CLOSING		27 /* Serial port is closing */
@@ -114,6 +115,7 @@
 #define ASYNCB_FIRST_KERNEL	22
 
 #define ASYNC_HUP_NOTIFY	(1U << ASYNCB_HUP_NOTIFY)
+#define ASYNC_SUSPENDED		(1U << ASYNCB_SUSPENDED)
 #define ASYNC_FOURPORT		(1U << ASYNCB_FOURPORT)
 #define ASYNC_SAK		(1U << ASYNCB_SAK)
 #define ASYNC_SPLIT_TERMIOS	(1U << ASYNCB_SPLIT_TERMIOS)
@@ -130,7 +132,7 @@
 #define ASYNC_BUGGY_UART	(1U << ASYNCB_BUGGY_UART)
 #define ASYNC_AUTOPROBE		(1U << ASYNCB_AUTOPROBE)
 
-#define ASYNC_FLAGS		((1U << ASYNCB_LAST_USER) - 1)
+#define ASYNC_FLAGS		((1U << (ASYNCB_LAST_USER + 1)) - 1)
 #define ASYNC_USR_MASK		(ASYNC_SPD_HI|ASYNC_SPD_VHI| \
 		ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY)
 #define ASYNC_SPD_CUST		(ASYNC_SPD_HI|ASYNC_SPD_VHI)
@@ -186,11 +188,16 @@
 
 struct serial_rs485 {
 	__u32	flags;			/* RS485 feature flags */
-#define SER_RS485_ENABLED		(1 << 0)
-#define SER_RS485_RTS_ON_SEND		(1 << 1)
-#define SER_RS485_RTS_AFTER_SEND	(1 << 2)
-	__u32	delay_rts_before_send;	/* Milliseconds */
-	__u32	padding[6];		/* Memory is cheap, new structs
+#define SER_RS485_ENABLED		(1 << 0)	/* If enabled */
+#define SER_RS485_RTS_ON_SEND		(1 << 1)	/* Logical level for
+							   RTS pin when
+							   sending */
+#define SER_RS485_RTS_AFTER_SEND	(1 << 2)	/* Logical level for
+							   RTS pin after sent*/
+#define SER_RS485_RX_DURING_TX		(1 << 4)
+	__u32	delay_rts_before_send;	/* Delay before send (milliseconds) */
+	__u32	delay_rts_after_send;	/* Delay after send (milliseconds) */
+	__u32	padding[5];		/* Memory is cheap, new structs
 					   are a royal PITA .. */
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial_core.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial_core.h
index 88677ac..664258b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial_core.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial_core.h
@@ -20,6 +20,8 @@
 #ifndef LINUX_SERIAL_CORE_H
 #define LINUX_SERIAL_CORE_H
 
+#include <linux/serial.h>
+
 /*
  * The type definitions.  These are from Ted Ts'o's serial.h
  */
@@ -42,7 +44,10 @@
 #define PORT_RM9000	16	/* PMC-Sierra RM9xxx internal UART */
 #define PORT_OCTEON	17	/* Cavium OCTEON internal UART */
 #define PORT_AR7	18	/* Texas Instruments AR7 internal UART */
-#define PORT_MAX_8250	18	/* max port ID */
+#define PORT_U6_16550A	19	/* ST-Ericsson U6xxx internal UART */
+#define PORT_TEGRA	20	/* NVIDIA Tegra internal UART */
+#define PORT_XR17D15X	21	/* Exar XR17D15x UART */
+#define PORT_MAX_8250	21	/* max port ID */
 
 /*
  * ARM specific type numbers.  These are not currently guaranteed
@@ -92,7 +97,7 @@
 /* PPC CPM type number */
 #define PORT_CPM        58
 
-/* MPC52xx type numbers */
+/* MPC52xx (and MPC512x) type numbers */
 #define PORT_MPC52xx	59
 
 /* IBM icom */
@@ -174,5 +179,37 @@
 /* Qualcomm MSM SoCs */
 #define PORT_MSM	88
 
+/* BCM63xx family SoCs */
+#define PORT_BCM63XX	89
+
+/* Aeroflex Gaisler GRLIB APBUART */
+#define PORT_APBUART    90
+
+/* Altera UARTs */
+#define PORT_ALTERA_JTAGUART	91
+#define PORT_ALTERA_UART	92
+
+/* SH-SCI */
+#define PORT_SCIFB	93
+
+/* MAX3107 */
+#define PORT_MAX3107	94
+
+/* High Speed UART for Medfield */
+#define PORT_MFD	95
+
+/* TI OMAP-UART */
+#define PORT_OMAP	96
+
+/* VIA VT8500 SoC */
+#define PORT_VT8500	97
+
+/* Xilinx PSS UART */
+#define PORT_XUARTPS	98
+
+/* Atheros AR933X SoC */
+#define PORT_AR933X	99
+
+
 
 #endif /* LINUX_SERIAL_CORE_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial_reg.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial_reg.h
index 850db2e..8ce70d7 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial_reg.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/serial_reg.h
@@ -57,6 +57,7 @@
  * ST16C654:	 8  16  56  60		 8  16  32  56	PORT_16654
  * TI16C750:	 1  16  32  56		xx  xx  xx  xx	PORT_16750
  * TI16C752:	 8  16  56  60		 8  16  32  56
+ * Tegra:	 1   4   8  14		16   8   4   1	PORT_TEGRA
  */
 #define UART_FCR_R_TRIG_00	0x00
 #define UART_FCR_R_TRIG_01	0x40
@@ -99,6 +100,13 @@
 #define UART_LCR_WLEN7		0x02 /* Wordlength: 7 bits */
 #define UART_LCR_WLEN8		0x03 /* Wordlength: 8 bits */
 
+/*
+ * Access to some registers depends on register access / configuration
+ * mode.
+ */
+#define UART_LCR_CONF_MODE_A	UART_LCR_DLAB	/* Configutation mode A */
+#define UART_LCR_CONF_MODE_B	0xBF		/* Configutation mode B */
+
 #define UART_MCR	4	/* Out: Modem Control Register */
 #define UART_MCR_CLKSEL		0x80 /* Divide clock by 4 (TI16C752, EFR[4]=1) */
 #define UART_MCR_TCRTLR		0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */
@@ -111,6 +119,7 @@
 #define UART_MCR_DTR		0x01 /* DTR complement */
 
 #define UART_LSR	5	/* In:  Line Status Register */
+#define UART_LSR_FIFOE		0x80 /* Fifo error */
 #define UART_LSR_TEMT		0x40 /* Transmitter empty */
 #define UART_LSR_THRE		0x20 /* Transmit-hold-register empty */
 #define UART_LSR_BI		0x10 /* Break interrupt indicator */
@@ -143,6 +152,7 @@
  * LCR=0xBF (or DLAB=1 for 16C660)
  */
 #define UART_EFR	2	/* I/O: Extended Features Register */
+#define UART_XR_EFR	9	/* I/O: Extended Features Register (XR17D15x) */
 #define UART_EFR_CTS		0x80 /* CTS flow control */
 #define UART_EFR_RTS		0x40 /* RTS flow control */
 #define UART_EFR_SCD		0x20 /* Special character detect */
@@ -216,13 +226,29 @@
 
 #define UART_IIR_TOD	0x08	/* Character Timeout Indication Detected */
 
-#define UART_FCR_PXAR1	0x00	/* receive FIFO treshold = 1 */
-#define UART_FCR_PXAR8	0x40	/* receive FIFO treshold = 8 */
-#define UART_FCR_PXAR16	0x80	/* receive FIFO treshold = 16 */
-#define UART_FCR_PXAR32	0xc0	/* receive FIFO treshold = 32 */
+#define UART_FCR_PXAR1	0x00	/* receive FIFO threshold = 1 */
+#define UART_FCR_PXAR8	0x40	/* receive FIFO threshold = 8 */
+#define UART_FCR_PXAR16	0x80	/* receive FIFO threshold = 16 */
+#define UART_FCR_PXAR32	0xc0	/* receive FIFO threshold = 32 */
 
+/*
+ * Intel MID on-chip HSU (High Speed UART) defined bits
+ */
+#define UART_FCR_HSU_64_1B	0x00	/* receive FIFO treshold = 1 */
+#define UART_FCR_HSU_64_16B	0x40	/* receive FIFO treshold = 16 */
+#define UART_FCR_HSU_64_32B	0x80	/* receive FIFO treshold = 32 */
+#define UART_FCR_HSU_64_56B	0xc0	/* receive FIFO treshold = 56 */
 
+#define UART_FCR_HSU_16_1B	0x00	/* receive FIFO treshold = 1 */
+#define UART_FCR_HSU_16_4B	0x40	/* receive FIFO treshold = 4 */
+#define UART_FCR_HSU_16_8B	0x80	/* receive FIFO treshold = 8 */
+#define UART_FCR_HSU_16_14B	0xc0	/* receive FIFO treshold = 14 */
 
+#define UART_FCR_HSU_64B_FIFO	0x20	/* chose 64 bytes FIFO */
+#define UART_FCR_HSU_16B_FIFO	0x00	/* chose 16 bytes FIFO */
+
+#define UART_FCR_HALF_EMPT_TXI	0x00	/* trigger TX_EMPT IRQ for half empty */
+#define UART_FCR_FULL_EMPT_TXI	0x08	/* trigger TX_EMPT IRQ for full empty */
 
 /*
  * These register definitions are for the 16C950
@@ -325,5 +351,17 @@
 #define UART_OMAP_SYSS		0x16	/* System status register */
 #define UART_OMAP_WER		0x17	/* Wake-up enable register */
 
+/*
+ * These are the definitions for the MDR1 register
+ */
+#define UART_OMAP_MDR1_16X_MODE		0x00	/* UART 16x mode */
+#define UART_OMAP_MDR1_SIR_MODE		0x01	/* SIR mode */
+#define UART_OMAP_MDR1_16X_ABAUD_MODE	0x02	/* UART 16x auto-baud */
+#define UART_OMAP_MDR1_13X_MODE		0x03	/* UART 13x mode */
+#define UART_OMAP_MDR1_MIR_MODE		0x04	/* MIR mode */
+#define UART_OMAP_MDR1_FIR_MODE		0x05	/* FIR mode */
+#define UART_OMAP_MDR1_CIR_MODE		0x06	/* CIR mode */
+#define UART_OMAP_MDR1_DISABLE		0x07	/* Disable (default state) */
+
 #endif /* _LINUX_SERIAL_REG_H */
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/serio.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/serio.h
index b2d73ea..8f127e2 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/serio.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/serio.h
@@ -72,5 +72,9 @@
 #define SERIO_INEXIO	0x37
 #define SERIO_TOUCHIT213	0x38
 #define SERIO_W8001	0x39
+#define SERIO_DYNAPRO	0x3a
+#define SERIO_HAMPSHIRE	0x3b
+#define SERIO_PS2MULT	0x3c
+#define SERIO_TSC40	0x3d
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/signalfd.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/signalfd.h
index cd7325f..90e689a 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/signalfd.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/signalfd.h
@@ -33,6 +33,7 @@
 	__u64 ssi_utime;
 	__u64 ssi_stime;
 	__u64 ssi_addr;
+	__u16 ssi_addr_lsb;
 
 	/*
 	 * Pad strcture to 128 bytes. Remember to update the
@@ -43,10 +44,9 @@
 	 * comes out of a read(2) and we really don't want to have
 	 * a compat on read(2).
 	 */
-	__u8 __pad[48];
+	__u8 __pad[46];
 };
 
 
 
 #endif /* _LINUX_SIGNALFD_H */
-
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/smb.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/smb.h
deleted file mode 100644
index 9c94ad5..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/smb.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *  smb.h
- *
- *  Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke
- *  Copyright (C) 1997 by Volker Lendecke
- *
- */
-
-#ifndef _LINUX_SMB_H
-#define _LINUX_SMB_H
-
-#include <linux/types.h>
-#include <linux/magic.h>
-
-enum smb_protocol { 
-	SMB_PROTOCOL_NONE, 
-	SMB_PROTOCOL_CORE, 
-	SMB_PROTOCOL_COREPLUS, 
-	SMB_PROTOCOL_LANMAN1, 
-	SMB_PROTOCOL_LANMAN2, 
-	SMB_PROTOCOL_NT1 
-};
-
-enum smb_case_hndl {
-	SMB_CASE_DEFAULT,
-	SMB_CASE_LOWER,
-	SMB_CASE_UPPER
-};
-
-struct smb_dskattr {
-        __u16 total;
-        __u16 allocblocks;
-        __u16 blocksize;
-        __u16 free;
-};
-
-struct smb_conn_opt {
-
-        /* The socket */
-	unsigned int fd;
-
-	enum smb_protocol protocol;
-	enum smb_case_hndl case_handling;
-
-	/* Connection-Options */
-
-	__u32              max_xmit;
-	__u16              server_uid;
-	__u16              tid;
-
-        /* The following are LANMAN 1.0 options */
-        __u16              secmode;
-        __u16              maxmux;
-        __u16              maxvcs;
-        __u16              rawmode;
-        __u32              sesskey;
-
-	/* The following are NT LM 0.12 options */
-	__u32              maxraw;
-	__u32              capabilities;
-	__s16              serverzone;
-};
-
-#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/smb_fs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/smb_fs.h
deleted file mode 100644
index b7e9450..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/smb_fs.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *  smb_fs.h
- *
- *  Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke
- *  Copyright (C) 1997 by Volker Lendecke
- *
- */
-
-#ifndef _LINUX_SMB_FS_H
-#define _LINUX_SMB_FS_H
-
-#include <linux/smb.h>
-
-/*
- * ioctl commands
- */
-#define	SMB_IOC_GETMOUNTUID		_IOR('u', 1, __kernel_old_uid_t)
-#define SMB_IOC_NEWCONN                 _IOW('u', 2, struct smb_conn_opt)
-
-/* __kernel_uid_t can never change, so we have to use __kernel_uid32_t */
-#define	SMB_IOC_GETMOUNTUID32		_IOR('u', 3, __kernel_uid32_t)
-
-
-
-#endif /* _LINUX_SMB_FS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/smb_mount.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/smb_mount.h
deleted file mode 100644
index 82956ba..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/smb_mount.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  smb_mount.h
- *
- *  Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke
- *  Copyright (C) 1997 by Volker Lendecke
- *
- */
-
-#ifndef _LINUX_SMB_MOUNT_H
-#define _LINUX_SMB_MOUNT_H
-
-#include <linux/types.h>
-
-#define SMB_MOUNT_VERSION	6
-
-struct smb_mount_data {
-	int version;
-	__kernel_uid_t mounted_uid; /* Who may umount() this filesystem? */
-	__kernel_uid_t uid;
-	__kernel_gid_t gid;
-	__kernel_mode_t file_mode;
-	__kernel_mode_t dir_mode;
-};
-
-
-
-#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/smbno.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/smbno.h
deleted file mode 100644
index f99e02d..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/smbno.h
+++ /dev/null
@@ -1,363 +0,0 @@
-#ifndef _SMBNO_H_
-#define _SMBNO_H_
-
-/* these define the attribute byte as seen by DOS */
-#define aRONLY	(1L<<0)
-#define aHIDDEN	(1L<<1)
-#define aSYSTEM	(1L<<2)
-#define aVOLID	(1L<<3)
-#define aDIR	(1L<<4)
-#define aARCH	(1L<<5)
-
-/* error classes */
-#define SUCCESS 0  /* The request was successful. */
-#define ERRDOS 0x01 /*  Error is from the core DOS operating system set. */
-#define ERRSRV 0x02 /* Error is generated by the server network file manager.*/
-#define ERRHRD 0x03  /* Error is an hardware error. */
-#define ERRCMD 0xFF  /* Command was not in the "SMB" format. */
-
-/* SMB X/Open error codes for the ERRdos error class */
-
-#define ERRbadfunc 1            /* Invalid function (or system call) */
-#define ERRbadfile 2            /* File not found (pathname error) */
-#define ERRbadpath 3            /* Directory not found */
-#define ERRnofids 4             /* Too many open files */
-#define ERRnoaccess 5           /* Access denied */
-#define ERRbadfid 6             /* Invalid fid */
-#define ERRbadmcb 7             /* Memory control blocks destroyed */
-#define ERRnomem 8              /* Out of memory */
-#define ERRbadmem 9             /* Invalid memory block address */
-#define ERRbadenv 10            /* Invalid environment */
-#define ERRbadformat 11         /* Invalid format */
-#define ERRbadaccess 12         /* Invalid open mode */
-#define ERRbaddata 13           /* Invalid data (only from ioctl call) */
-#define ERRres 14               /* reserved */
-#define ERRbaddrive 15          /* Invalid drive */
-#define ERRremcd 16             /* Attempt to delete current directory */
-#define ERRdiffdevice 17        /* rename/move across different filesystems */
-#define ERRnofiles 18           /* no more files found in file search */
-#define ERRbadshare 32          /* Share mode on file conflict with open mode */
-#define ERRlock 33              /* Lock request conflicts with existing lock */
-#define ERRfilexists 80         /* File in operation already exists */
-#define ERRbadpipe 230          /* Named pipe invalid */
-#define ERRpipebusy 231         /* All instances of pipe are busy */
-#define ERRpipeclosing 232      /* named pipe close in progress */
-#define ERRnotconnected 233     /* No process on other end of named pipe */
-#define ERRmoredata 234         /* More data to be returned */
-
-#define ERROR_INVALID_PARAMETER	 87
-#define ERROR_DISK_FULL		112
-#define ERROR_INVALID_NAME	123
-#define ERROR_DIR_NOT_EMPTY	145
-#define ERROR_NOT_LOCKED	158
-#define ERROR_ALREADY_EXISTS	183  /* see also 80 ? */
-#define ERROR_EAS_DIDNT_FIT	275 /* Extended attributes didn't fit */
-#define ERROR_EAS_NOT_SUPPORTED	282 /* Extended attributes not supported */
-
-/* Error codes for the ERRSRV class */
-
-#define ERRerror 1              /* Non specific error code */
-#define ERRbadpw 2              /* Bad password */
-#define ERRbadtype 3            /* reserved */
-#define ERRaccess 4          /* No permissions to do the requested operation */
-#define ERRinvnid 5             /* tid invalid */
-#define ERRinvnetname 6         /* Invalid servername */
-#define ERRinvdevice 7          /* Invalid device */
-#define ERRqfull 49             /* Print queue full */
-#define ERRqtoobig 50           /* Queued item too big */
-#define ERRinvpfid 52           /* Invalid print file in smb_fid */
-#define ERRsmbcmd 64            /* Unrecognised command */
-#define ERRsrverror 65          /* smb server internal error */
-#define ERRfilespecs 67         /* fid and pathname invalid combination */
-#define ERRbadlink 68           /* reserved */
-#define ERRbadpermits 69        /* Access specified for a file is not valid */
-#define ERRbadpid 70            /* reserved */
-#define ERRsetattrmode 71       /* attribute mode invalid */
-#define ERRpaused 81            /* Message server paused */
-#define ERRmsgoff 82            /* Not receiving messages */
-#define ERRnoroom 83            /* No room for message */
-#define ERRrmuns 87             /* too many remote usernames */
-#define ERRtimeout 88           /* operation timed out */
-#define ERRnoresource  89   /* No resources currently available for request. */
-#define ERRtoomanyuids 90       /* too many userids */
-#define ERRbaduid 91            /* bad userid */
-#define ERRuseMPX 250    /* temporarily unable to use raw mode, use MPX mode */
-#define ERRuseSTD 251    /* temporarily unable to use raw mode, use std.mode */
-#define ERRcontMPX 252          /* resume MPX mode */
-#define ERRbadPW                /* reserved */
-#define ERRnosupport 0xFFFF
-
-/* Error codes for the ERRHRD class */
-
-#define ERRnowrite 19           /* read only media */
-#define ERRbadunit 20           /* Unknown device */
-#define ERRnotready 21          /* Drive not ready */
-#define ERRbadcmd 22            /* Unknown command */
-#define ERRdata 23              /* Data (CRC) error */
-#define ERRbadreq 24            /* Bad request structure length */
-#define ERRseek 25
-#define ERRbadmedia 26
-#define ERRbadsector 27
-#define ERRnopaper 28
-#define ERRwrite 29             /* write fault */
-#define ERRread 30              /* read fault */
-#define ERRgeneral 31           /* General hardware failure */
-#define ERRwrongdisk 34
-#define ERRFCBunavail 35
-#define ERRsharebufexc 36       /* share buffer exceeded */
-#define ERRdiskfull 39
-
-/*
- * Access modes when opening a file
- */
-#define SMB_ACCMASK	0x0003
-#define SMB_O_RDONLY	0x0000
-#define SMB_O_WRONLY	0x0001
-#define SMB_O_RDWR	0x0002
-
-/* offsets into message for common items */
-#define smb_com 8
-#define smb_rcls 9
-#define smb_reh 10
-#define smb_err 11
-#define smb_flg 13
-#define smb_flg2 14
-#define smb_reb 13
-#define smb_tid 28
-#define smb_pid 30
-#define smb_uid 32
-#define smb_mid 34
-#define smb_wct 36
-#define smb_vwv 37
-#define smb_vwv0 37
-#define smb_vwv1 39
-#define smb_vwv2 41
-#define smb_vwv3 43
-#define smb_vwv4 45
-#define smb_vwv5 47
-#define smb_vwv6 49
-#define smb_vwv7 51
-#define smb_vwv8 53
-#define smb_vwv9 55
-#define smb_vwv10 57
-#define smb_vwv11 59
-#define smb_vwv12 61
-#define smb_vwv13 63
-#define smb_vwv14 65
-
-/* these are the trans2 sub fields for primary requests */
-#define smb_tpscnt smb_vwv0
-#define smb_tdscnt smb_vwv1
-#define smb_mprcnt smb_vwv2
-#define smb_mdrcnt smb_vwv3
-#define smb_msrcnt smb_vwv4
-#define smb_flags smb_vwv5
-#define smb_timeout smb_vwv6
-#define smb_pscnt smb_vwv9
-#define smb_psoff smb_vwv10
-#define smb_dscnt smb_vwv11
-#define smb_dsoff smb_vwv12
-#define smb_suwcnt smb_vwv13
-#define smb_setup smb_vwv14
-#define smb_setup0 smb_setup
-#define smb_setup1 (smb_setup+2)
-#define smb_setup2 (smb_setup+4)
-
-/* these are for the secondary requests */
-#define smb_spscnt smb_vwv2
-#define smb_spsoff smb_vwv3
-#define smb_spsdisp smb_vwv4
-#define smb_sdscnt smb_vwv5
-#define smb_sdsoff smb_vwv6
-#define smb_sdsdisp smb_vwv7
-#define smb_sfid smb_vwv8
-
-/* and these for responses */
-#define smb_tprcnt smb_vwv0
-#define smb_tdrcnt smb_vwv1
-#define smb_prcnt smb_vwv3
-#define smb_proff smb_vwv4
-#define smb_prdisp smb_vwv5
-#define smb_drcnt smb_vwv6
-#define smb_droff smb_vwv7
-#define smb_drdisp smb_vwv8
-
-/* the complete */
-#define SMBmkdir      0x00   /* create directory */
-#define SMBrmdir      0x01   /* delete directory */
-#define SMBopen       0x02   /* open file */
-#define SMBcreate     0x03   /* create file */
-#define SMBclose      0x04   /* close file */
-#define SMBflush      0x05   /* flush file */
-#define SMBunlink     0x06   /* delete file */
-#define SMBmv         0x07   /* rename file */
-#define SMBgetatr     0x08   /* get file attributes */
-#define SMBsetatr     0x09   /* set file attributes */
-#define SMBread       0x0A   /* read from file */
-#define SMBwrite      0x0B   /* write to file */
-#define SMBlock       0x0C   /* lock byte range */
-#define SMBunlock     0x0D   /* unlock byte range */
-#define SMBctemp      0x0E   /* create temporary file */
-#define SMBmknew      0x0F   /* make new file */
-#define SMBchkpth     0x10   /* check directory path */
-#define SMBexit       0x11   /* process exit */
-#define SMBlseek      0x12   /* seek */
-#define SMBtcon       0x70   /* tree connect */
-#define SMBtconX      0x75   /* tree connect and X*/
-#define SMBtdis       0x71   /* tree disconnect */
-#define SMBnegprot    0x72   /* negotiate protocol */
-#define SMBdskattr    0x80   /* get disk attributes */
-#define SMBsearch     0x81   /* search directory */
-#define SMBsplopen    0xC0   /* open print spool file */
-#define SMBsplwr      0xC1   /* write to print spool file */
-#define SMBsplclose   0xC2   /* close print spool file */
-#define SMBsplretq    0xC3   /* return print queue */
-#define SMBsends      0xD0   /* send single block message */
-#define SMBsendb      0xD1   /* send broadcast message */
-#define SMBfwdname    0xD2   /* forward user name */
-#define SMBcancelf    0xD3   /* cancel forward */
-#define SMBgetmac     0xD4   /* get machine name */
-#define SMBsendstrt   0xD5   /* send start of multi-block message */
-#define SMBsendend    0xD6   /* send end of multi-block message */
-#define SMBsendtxt    0xD7   /* send text of multi-block message */
-
-/* Core+ protocol */
-#define SMBlockread	  0x13   /* Lock a range and read */
-#define SMBwriteunlock 0x14 /* Unlock a range then write */
-#define SMBreadbraw   0x1a  /* read a block of data with no smb header */
-#define SMBwritebraw  0x1d  /* write a block of data with no smb header */
-#define SMBwritec     0x20  /* secondary write request */
-#define SMBwriteclose 0x2c  /* write a file then close it */
-
-/* dos extended protocol */
-#define SMBreadBraw      0x1A   /* read block raw */
-#define SMBreadBmpx      0x1B   /* read block multiplexed */
-#define SMBreadBs        0x1C   /* read block (secondary response) */
-#define SMBwriteBraw     0x1D   /* write block raw */
-#define SMBwriteBmpx     0x1E   /* write block multiplexed */
-#define SMBwriteBs       0x1F   /* write block (secondary request) */
-#define SMBwriteC        0x20   /* write complete response */
-#define SMBsetattrE      0x22   /* set file attributes expanded */
-#define SMBgetattrE      0x23   /* get file attributes expanded */
-#define SMBlockingX      0x24   /* lock/unlock byte ranges and X */
-#define SMBtrans         0x25   /* transaction - name, bytes in/out */
-#define SMBtranss        0x26   /* transaction (secondary request/response) */
-#define SMBioctl         0x27   /* IOCTL */
-#define SMBioctls        0x28   /* IOCTL  (secondary request/response) */
-#define SMBcopy          0x29   /* copy */
-#define SMBmove          0x2A   /* move */
-#define SMBecho          0x2B   /* echo */
-#define SMBopenX         0x2D   /* open and X */
-#define SMBreadX         0x2E   /* read and X */
-#define SMBwriteX        0x2F   /* write and X */
-#define SMBsesssetupX    0x73   /* Session Set Up & X (including User Logon) */
-#define SMBtconX         0x75   /* tree connect and X */
-#define SMBffirst        0x82   /* find first */
-#define SMBfunique       0x83   /* find unique */
-#define SMBfclose        0x84   /* find close */
-#define SMBinvalid       0xFE   /* invalid command */
-
-
-/* Extended 2.0 protocol */
-#define SMBtrans2        0x32   /* TRANS2 protocol set */
-#define SMBtranss2       0x33   /* TRANS2 protocol set, secondary command */
-#define SMBfindclose     0x34   /* Terminate a TRANSACT2_FINDFIRST */
-#define SMBfindnclose    0x35   /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
-#define SMBulogoffX      0x74   /* user logoff */
-
-/* these are the TRANS2 sub commands */
-#define TRANSACT2_OPEN          0
-#define TRANSACT2_FINDFIRST     1
-#define TRANSACT2_FINDNEXT      2
-#define TRANSACT2_QFSINFO       3
-#define TRANSACT2_SETFSINFO     4
-#define TRANSACT2_QPATHINFO     5
-#define TRANSACT2_SETPATHINFO   6
-#define TRANSACT2_QFILEINFO     7
-#define TRANSACT2_SETFILEINFO   8
-#define TRANSACT2_FSCTL         9
-#define TRANSACT2_IOCTL           10
-#define TRANSACT2_FINDNOTIFYFIRST 11
-#define TRANSACT2_FINDNOTIFYNEXT  12
-#define TRANSACT2_MKDIR           13
-
-/* Information Levels -  Shared? */
-#define SMB_INFO_STANDARD		1
-#define SMB_INFO_QUERY_EA_SIZE		2
-#define SMB_INFO_QUERY_EAS_FROM_LIST	3
-#define SMB_INFO_QUERY_ALL_EAS		4
-#define SMB_INFO_IS_NAME_VALID		6
-
-/* Information Levels -  TRANSACT2_FINDFIRST */
-#define SMB_FIND_FILE_DIRECTORY_INFO		0x101
-#define SMB_FIND_FILE_FULL_DIRECTORY_INFO	0x102
-#define SMB_FIND_FILE_NAMES_INFO		0x103
-#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO	0x104
-
-/* Information Levels -  TRANSACT2_QPATHINFO */
-#define SMB_QUERY_FILE_BASIC_INFO	0x101
-#define SMB_QUERY_FILE_STANDARD_INFO	0x102
-#define SMB_QUERY_FILE_EA_INFO		0x103
-#define SMB_QUERY_FILE_NAME_INFO	0x104
-#define SMB_QUERY_FILE_ALL_INFO		0x107
-#define SMB_QUERY_FILE_ALT_NAME_INFO	0x108
-#define SMB_QUERY_FILE_STREAM_INFO	0x109
-#define SMB_QUERY_FILE_COMPRESSION_INFO	0x10b
-
-/* Information Levels - TRANSACT2_SETFILEINFO */
-#define SMB_SET_FILE_BASIC_INFO		0x101
-#define SMB_SET_FILE_DISPOSITION_INFO	0x102
-#define SMB_SET_FILE_ALLOCATION_INFO	0x103
-#define SMB_SET_FILE_END_OF_FILE_INFO	0x104
-
-/* smb_flg field flags */
-#define SMB_FLAGS_SUPPORT_LOCKREAD	0x01
-#define SMB_FLAGS_CLIENT_BUF_AVAIL	0x02
-#define SMB_FLAGS_RESERVED		0x04
-#define SMB_FLAGS_CASELESS_PATHNAMES	0x08
-#define SMB_FLAGS_CANONICAL_PATHNAMES	0x10
-#define SMB_FLAGS_REQUEST_OPLOCK	0x20
-#define SMB_FLAGS_REQUEST_BATCH_OPLOCK	0x40
-#define SMB_FLAGS_REPLY			0x80
-
-/* smb_flg2 field flags (samba-2.2.0/source/include/smb.h) */
-#define SMB_FLAGS2_LONG_PATH_COMPONENTS		0x0001
-#define SMB_FLAGS2_EXTENDED_ATTRIBUTES		0x0002
-#define SMB_FLAGS2_DFS_PATHNAMES		0x1000
-#define SMB_FLAGS2_READ_PERMIT_NO_EXECUTE	0x2000
-#define SMB_FLAGS2_32_BIT_ERROR_CODES		0x4000 
-#define SMB_FLAGS2_UNICODE_STRINGS		0x8000
-
-
-/*
- * UNIX stuff  (from samba trans2.h)
- */
-#define MIN_UNIX_INFO_LEVEL		0x200
-#define MAX_UNIX_INFO_LEVEL		0x2FF
-#define SMB_FIND_FILE_UNIX		0x202
-#define SMB_QUERY_FILE_UNIX_BASIC	0x200
-#define SMB_QUERY_FILE_UNIX_LINK	0x201
-#define SMB_QUERY_FILE_UNIX_HLINK	0x202
-#define SMB_SET_FILE_UNIX_BASIC		0x200
-#define SMB_SET_FILE_UNIX_LINK		0x201
-#define SMB_SET_FILE_UNIX_HLINK		0x203
-#define SMB_QUERY_CIFS_UNIX_INFO	0x200
-
-/* values which means "don't change it" */
-#define SMB_MODE_NO_CHANGE		0xFFFFFFFF
-#define SMB_UID_NO_CHANGE		0xFFFFFFFF
-#define SMB_GID_NO_CHANGE		0xFFFFFFFF
-#define SMB_TIME_NO_CHANGE		0xFFFFFFFFFFFFFFFFULL
-#define SMB_SIZE_NO_CHANGE		0xFFFFFFFFFFFFFFFFULL
-
-/* UNIX filetype mappings. */
-#define UNIX_TYPE_FILE		0
-#define UNIX_TYPE_DIR		1
-#define UNIX_TYPE_SYMLINK	2
-#define UNIX_TYPE_CHARDEV	3
-#define UNIX_TYPE_BLKDEV	4
-#define UNIX_TYPE_FIFO		5
-#define UNIX_TYPE_SOCKET	6
-#define UNIX_TYPE_UNKNOWN	0xFFFFFFFF
-
-#endif /* _SMBNO_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/snmp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/snmp.h
index 0f953fe..c1241c4 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/snmp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/snmp.h
@@ -100,6 +100,7 @@
 	ICMP6_MIB_INMSGS,			/* InMsgs */
 	ICMP6_MIB_INERRORS,			/* InErrors */
 	ICMP6_MIB_OUTMSGS,			/* OutMsgs */
+	ICMP6_MIB_OUTERRORS,			/* OutErrors */
 	__ICMP6_MIB_MAX
 };
 
@@ -191,7 +192,6 @@
 	LINUX_MIB_TCPPARTIALUNDO,		/* TCPPartialUndo */
 	LINUX_MIB_TCPDSACKUNDO,			/* TCPDSACKUndo */
 	LINUX_MIB_TCPLOSSUNDO,			/* TCPLossUndo */
-	LINUX_MIB_TCPLOSS,			/* TCPLoss */
 	LINUX_MIB_TCPLOSTRETRANSMIT,		/* TCPLostRetransmit */
 	LINUX_MIB_TCPRENOFAILURES,		/* TCPRenoFailures */
 	LINUX_MIB_TCPSACKFAILURES,		/* TCPSackFailures */
@@ -225,6 +225,13 @@
 	LINUX_MIB_SACKSHIFTED,
 	LINUX_MIB_SACKMERGED,
 	LINUX_MIB_SACKSHIFTFALLBACK,
+	LINUX_MIB_TCPBACKLOGDROP,
+	LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */
+	LINUX_MIB_TCPDEFERACCEPTDROP,
+	LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */
+	LINUX_MIB_TCPTIMEWAITOVERFLOW,		/* TCPTimeWaitOverflow */
+	LINUX_MIB_TCPREQQFULLDOCOOKIES,		/* TCPReqQFullDoCookies */
+	LINUX_MIB_TCPREQQFULLDROP,		/* TCPReqQFullDrop */
 	__LINUX_MIB_MAX
 };
 
@@ -257,6 +264,7 @@
 	LINUX_MIB_XFRMOUTPOLBLOCK,		/* XfrmOutPolBlock */
 	LINUX_MIB_XFRMOUTPOLDEAD,		/* XfrmOutPolDead */
 	LINUX_MIB_XFRMOUTPOLERROR,		/* XfrmOutPolError */
+	LINUX_MIB_XFRMFWDHDRERROR,		/* XfrmFwdHdrError*/
 	__LINUX_MIB_XFRMMAX
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sock_diag.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sock_diag.h
new file mode 100644
index 0000000..39e4b1c
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sock_diag.h
@@ -0,0 +1,25 @@
+#ifndef __SOCK_DIAG_H__
+#define __SOCK_DIAG_H__
+
+#include <linux/types.h>
+
+#define SOCK_DIAG_BY_FAMILY 20
+
+struct sock_diag_req {
+	__u8	sdiag_family;
+	__u8	sdiag_protocol;
+};
+
+enum {
+	SK_MEMINFO_RMEM_ALLOC,
+	SK_MEMINFO_RCVBUF,
+	SK_MEMINFO_WMEM_ALLOC,
+	SK_MEMINFO_SNDBUF,
+	SK_MEMINFO_FWD_ALLOC,
+	SK_MEMINFO_WMEM_QUEUED,
+	SK_MEMINFO_OPTMEM,
+
+	SK_MEMINFO_VARS,
+};
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/socket.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/socket.h
index dff22f9..8c1e501 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/socket.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/socket.h
@@ -8,299 +8,14 @@
 #define _K_SS_ALIGNSIZE	(__alignof__ (struct sockaddr *))
 				/* Implementation specific desired alignment */
 
+typedef unsigned short __kernel_sa_family_t;
+
 struct __kernel_sockaddr_storage {
-	unsigned short	ss_family;		/* address family */
+	__kernel_sa_family_t	ss_family;		/* address family */
 	/* Following field(s) are implementation specific */
 	char		__data[_K_SS_MAXSIZE - sizeof(unsigned short)];
 				/* space to achieve desired size, */
 				/* _SS_MAXSIZE value minus size of ss_family */
 } __attribute__ ((aligned(_K_SS_ALIGNSIZE)));	/* force desired alignment */
 
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
-
-#include <asm/socket.h>			/* arch-dependent defines	*/
-#include <linux/sockios.h>		/* the SIOCxxx I/O controls	*/
-#include <linux/uio.h>			/* iovec support		*/
-#include <linux/types.h>		/* pid_t			*/
-		/* 		*/
-
-
-typedef unsigned short	sa_family_t;
-
-/*
- *	1003.1g requires sa_family_t and that sa_data is char.
- */
- 
-struct sockaddr {
-	sa_family_t	sa_family;	/* address family, AF_xxx	*/
-	char		sa_data[14];	/* 14 bytes of protocol address	*/
-};
-
-struct linger {
-	int		l_onoff;	/* Linger active		*/
-	int		l_linger;	/* How long to linger for	*/
-};
-
-#define sockaddr_storage __kernel_sockaddr_storage
-
-/*
- *	As we do 4.4BSD message passing we use a 4.4BSD message passing
- *	system, not 4.3. Thus msg_accrights(len) are now missing. They
- *	belong in an obscure libc emulation or the bin.
- */
- 
-struct msghdr {
-	void	*	msg_name;	/* Socket name			*/
-	int		msg_namelen;	/* Length of name		*/
-	struct iovec *	msg_iov;	/* Data blocks			*/
-	__kernel_size_t	msg_iovlen;	/* Number of blocks		*/
-	void 	*	msg_control;	/* Per protocol magic (eg BSD file descriptor passing) */
-	__kernel_size_t	msg_controllen;	/* Length of cmsg list */
-	unsigned	msg_flags;
-};
-
-/*
- *	POSIX 1003.1g - ancillary data object information
- *	Ancillary data consits of a sequence of pairs of
- *	(cmsghdr, cmsg_data[])
- */
-
-struct cmsghdr {
-	__kernel_size_t	cmsg_len;	/* data byte count, including hdr */
-        int		cmsg_level;	/* originating protocol */
-        int		cmsg_type;	/* protocol-specific type */
-};
-
-/*
- *	Ancilliary data object information MACROS
- *	Table 5-14 of POSIX 1003.1g
- */
-
-#define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg))
-#define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg))
-
-#define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
-
-#define CMSG_DATA(cmsg)	((void *)((char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
-#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
-#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
-
-#define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ? \
-				  (struct cmsghdr *)(ctl) : \
-				  (struct cmsghdr *)NULL)
-#define CMSG_FIRSTHDR(msg)	__CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
-#define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && \
-			     (cmsg)->cmsg_len <= (unsigned long) \
-			     ((mhdr)->msg_controllen - \
-			      ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
-
-/*
- *	This mess will go away with glibc
- */
- 
-#if    defined(__GNUC__) 
-#define __KINLINE static __inline__
-#elif defined(__cplusplus)
-#define __KINLINE static __inline__
-#else
-#define __KINLINE static
-#endif
-
-
-/*
- *	Get the next cmsg header
- *
- *	PLEASE, do not touch this function. If you think, that it is
- *	incorrect, grep kernel sources and think about consequences
- *	before trying to improve it.
- *
- *	Now it always returns valid, not truncated ancillary object
- *	HEADER. But caller still MUST check, that cmsg->cmsg_len is
- *	inside range, given by msg->msg_controllen before using
- *	ancillary object DATA.				--ANK (980731)
- */
- 
-__KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
-					       struct cmsghdr *__cmsg)
-{
-	struct cmsghdr * __ptr;
-
-	__ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) +  CMSG_ALIGN(__cmsg->cmsg_len));
-	if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
-		return (struct cmsghdr *)0;
-
-	return __ptr;
-}
-
-__KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg)
-{
-	return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
-}
-
-/* "Socket"-level control message types: */
-
-#define	SCM_RIGHTS	0x01		/* rw: access rights (array of int) */
-#define SCM_CREDENTIALS 0x02		/* rw: struct ucred		*/
-#define SCM_SECURITY	0x03		/* rw: security label		*/
-
-struct ucred {
-	__u32	pid;
-	__u32	uid;
-	__u32	gid;
-};
-
-/* Supported address families. */
-#define AF_UNSPEC	0
-#define AF_UNIX		1	/* Unix domain sockets 		*/
-#define AF_LOCAL	1	/* POSIX name for AF_UNIX	*/
-#define AF_INET		2	/* Internet IP Protocol 	*/
-#define AF_AX25		3	/* Amateur Radio AX.25 		*/
-#define AF_IPX		4	/* Novell IPX 			*/
-#define AF_APPLETALK	5	/* AppleTalk DDP 		*/
-#define AF_NETROM	6	/* Amateur Radio NET/ROM 	*/
-#define AF_BRIDGE	7	/* Multiprotocol bridge 	*/
-#define AF_ATMPVC	8	/* ATM PVCs			*/
-#define AF_X25		9	/* Reserved for X.25 project 	*/
-#define AF_INET6	10	/* IP version 6			*/
-#define AF_ROSE		11	/* Amateur Radio X.25 PLP	*/
-#define AF_DECnet	12	/* Reserved for DECnet project	*/
-#define AF_NETBEUI	13	/* Reserved for 802.2LLC project*/
-#define AF_SECURITY	14	/* Security callback pseudo AF */
-#define AF_KEY		15      /* PF_KEY key management API */
-#define AF_NETLINK	16
-#define AF_ROUTE	AF_NETLINK /* Alias to emulate 4.4BSD */
-#define AF_PACKET	17	/* Packet family		*/
-#define AF_ASH		18	/* Ash				*/
-#define AF_ECONET	19	/* Acorn Econet			*/
-#define AF_ATMSVC	20	/* ATM SVCs			*/
-#define AF_RDS		21	/* RDS sockets 			*/
-#define AF_SNA		22	/* Linux SNA Project (nutters!) */
-#define AF_IRDA		23	/* IRDA sockets			*/
-#define AF_PPPOX	24	/* PPPoX sockets		*/
-#define AF_WANPIPE	25	/* Wanpipe API Sockets */
-#define AF_LLC		26	/* Linux LLC			*/
-#define AF_CAN		29	/* Controller Area Network      */
-#define AF_TIPC		30	/* TIPC sockets			*/
-#define AF_BLUETOOTH	31	/* Bluetooth sockets 		*/
-#define AF_IUCV		32	/* IUCV sockets			*/
-#define AF_RXRPC	33	/* RxRPC sockets 		*/
-#define AF_ISDN		34	/* mISDN sockets 		*/
-#define AF_PHONET	35	/* Phonet sockets		*/
-#define AF_IEEE802154	36	/* IEEE802154 sockets		*/
-#define AF_MAX		37	/* For now.. */
-
-/* Protocol families, same as address families. */
-#define PF_UNSPEC	AF_UNSPEC
-#define PF_UNIX		AF_UNIX
-#define PF_LOCAL	AF_LOCAL
-#define PF_INET		AF_INET
-#define PF_AX25		AF_AX25
-#define PF_IPX		AF_IPX
-#define PF_APPLETALK	AF_APPLETALK
-#define	PF_NETROM	AF_NETROM
-#define PF_BRIDGE	AF_BRIDGE
-#define PF_ATMPVC	AF_ATMPVC
-#define PF_X25		AF_X25
-#define PF_INET6	AF_INET6
-#define PF_ROSE		AF_ROSE
-#define PF_DECnet	AF_DECnet
-#define PF_NETBEUI	AF_NETBEUI
-#define PF_SECURITY	AF_SECURITY
-#define PF_KEY		AF_KEY
-#define PF_NETLINK	AF_NETLINK
-#define PF_ROUTE	AF_ROUTE
-#define PF_PACKET	AF_PACKET
-#define PF_ASH		AF_ASH
-#define PF_ECONET	AF_ECONET
-#define PF_ATMSVC	AF_ATMSVC
-#define PF_RDS		AF_RDS
-#define PF_SNA		AF_SNA
-#define PF_IRDA		AF_IRDA
-#define PF_PPPOX	AF_PPPOX
-#define PF_WANPIPE	AF_WANPIPE
-#define PF_LLC		AF_LLC
-#define PF_CAN		AF_CAN
-#define PF_TIPC		AF_TIPC
-#define PF_BLUETOOTH	AF_BLUETOOTH
-#define PF_IUCV		AF_IUCV
-#define PF_RXRPC	AF_RXRPC
-#define PF_ISDN		AF_ISDN
-#define PF_PHONET	AF_PHONET
-#define PF_IEEE802154	AF_IEEE802154
-#define PF_MAX		AF_MAX
-
-/* Maximum queue length specifiable by listen.  */
-#define SOMAXCONN	128
-
-/* Flags we can use with send/ and recv. 
-   Added those for 1003.1g not all are supported yet
- */
- 
-#define MSG_OOB		1
-#define MSG_PEEK	2
-#define MSG_DONTROUTE	4
-#define MSG_TRYHARD     4       /* Synonym for MSG_DONTROUTE for DECnet */
-#define MSG_CTRUNC	8
-#define MSG_PROBE	0x10	/* Do not send. Only probe path f.e. for MTU */
-#define MSG_TRUNC	0x20
-#define MSG_DONTWAIT	0x40	/* Nonblocking io		 */
-#define MSG_EOR         0x80	/* End of record */
-#define MSG_WAITALL	0x100	/* Wait for a full request */
-#define MSG_FIN         0x200
-#define MSG_SYN		0x400
-#define MSG_CONFIRM	0x800	/* Confirm path validity */
-#define MSG_RST		0x1000
-#define MSG_ERRQUEUE	0x2000	/* Fetch message from error queue */
-#define MSG_NOSIGNAL	0x4000	/* Do not generate SIGPIPE */
-#define MSG_MORE	0x8000	/* Sender will send more */
-
-#define MSG_EOF         MSG_FIN
-
-#define MSG_CMSG_CLOEXEC 0x40000000	/* Set close_on_exit for file
-					   descriptor received through
-					   SCM_RIGHTS */
-#if defined(CONFIG_COMPAT)
-#define MSG_CMSG_COMPAT	0x80000000	/* This message needs 32 bit fixups */
-#else
-#define MSG_CMSG_COMPAT	0		/* We never have 32 bit fixups */
-#endif
-
-
-/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
-#define SOL_IP		0
-/* #define SOL_ICMP	1	No-no-no! Due to Linux :-) we cannot use SOL_ICMP=1 */
-#define SOL_TCP		6
-#define SOL_UDP		17
-#define SOL_IPV6	41
-#define SOL_ICMPV6	58
-#define SOL_SCTP	132
-#define SOL_UDPLITE	136     /* UDP-Lite (RFC 3828) */
-#define SOL_RAW		255
-#define SOL_IPX		256
-#define SOL_AX25	257
-#define SOL_ATALK	258
-#define SOL_NETROM	259
-#define SOL_ROSE	260
-#define SOL_DECNET	261
-#define	SOL_X25		262
-#define SOL_PACKET	263
-#define SOL_ATM		264	/* ATM layer (cell level) */
-#define SOL_AAL		265	/* ATM Adaption Layer (packet level) */
-#define SOL_IRDA        266
-#define SOL_NETBEUI	267
-#define SOL_LLC		268
-#define SOL_DCCP	269
-#define SOL_NETLINK	270
-#define SOL_TIPC	271
-#define SOL_RXRPC	272
-#define SOL_PPPOL2TP	273
-#define SOL_BLUETOOTH	274
-#define SOL_PNPIPE	275
-#define SOL_RDS		276
-#define SOL_IUCV	277
-
-/* IPX options */
-#define IPX_TYPE	1
-
-#endif /* not kernel and not glibc */
 #endif /* _LINUX_SOCKET_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sockios.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sockios.h
index 241f179..7997a50 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sockios.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sockios.h
@@ -22,7 +22,7 @@
 
 /* Linux-specific socket ioctls */
 #define SIOCINQ		FIONREAD
-#define SIOCOUTQ	TIOCOUTQ
+#define SIOCOUTQ	TIOCOUTQ        /* output queue size (not sent + not acked) */
 
 /* Routing table calls. */
 #define SIOCADDRT	0x890B		/* add routing table entry	*/
@@ -83,6 +83,8 @@
 
 #define SIOCWANDEV	0x894A		/* get/set netdev parameters	*/
 
+#define SIOCOUTQNSD	0x894B		/* output queue size (not sent only) */
+
 /* ARP cache control calls. */
 		    /*  0x8950 - 0x8952  * obsolete calls, don't re-use */
 #define SIOCDARP	0x8953		/* delete ARP table entry	*/
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sonypi.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sonypi.h
index a6f2c90..285da0f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sonypi.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sonypi.h
@@ -40,6 +40,7 @@
 
 /* events the user application reading /dev/sonypi can use */
 
+#define SONYPI_EVENT_IGNORE			 0
 #define SONYPI_EVENT_JOGDIAL_DOWN		 1
 #define SONYPI_EVENT_JOGDIAL_UP			 2
 #define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED	 3
@@ -111,6 +112,8 @@
 #define SONYPI_EVENT_VOLUME_INC_PRESSED		69
 #define SONYPI_EVENT_VOLUME_DEC_PRESSED		70
 #define SONYPI_EVENT_BRIGHTNESS_PRESSED		71
+#define SONYPI_EVENT_MEDIA_PRESSED		72
+#define SONYPI_EVENT_VENDOR_PRESSED		73
 
 /* get/set brightness */
 #define SONYPI_IOCGBRT		_IOR('v', 0, __u8)
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sound.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sound.h
index fdd842e..a1d0682 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sound.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sound.h
@@ -1,3 +1,5 @@
+#ifndef _LINUX_SOUND_H
+#define _LINUX_SOUND_H
 
 /*
  * Minor numbers for the sound driver.
@@ -25,3 +27,5 @@
 #define SND_DEV_AMIDI		13	/* Like /dev/midi (obsolete) */
 #define SND_DEV_ADMMIDI		14	/* Like /dev/dmmidi (onsolete) */
 
+
+#endif /* _LINUX_SOUND_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/soundcard.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/soundcard.h
index de3f9d6..70ef496 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/soundcard.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/soundcard.h
@@ -186,7 +186,7 @@
 #include <linux/patchkey.h>
 #undef _LINUX_PATCHKEY_H_INDIRECT
 
-#if   defined(__BYTE_ORDER)
+# if defined(__BYTE_ORDER)
 #  if __BYTE_ORDER == __BIG_ENDIAN
 #    define AFMT_S16_NE AFMT_S16_BE
 #  elif __BYTE_ORDER == __LITTLE_ENDIAN
@@ -194,7 +194,7 @@
 #  else
 #    error "could not determine byte order"
 #  endif
-#endif
+# endif
 
 /*
  *	Sample loading mechanism for internal synthesizers (/dev/sequencer)
@@ -1218,7 +1218,7 @@
 #define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
 
 /*
- * Timing and syncronization macros
+ * Timing and synchronization macros
  */
 
 #define _TIMER_EVENT(ev, parm)		{_SEQ_NEEDBUF(8);\
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/spi/spidev.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/spi/spidev.h
index bf0570a..52d9ed0 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/spi/spidev.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/spi/spidev.h
@@ -66,7 +66,7 @@
  * are in a different address space (and may be of different sizes in some
  * cases, such as 32-bit i386 userspace over a 64-bit x86_64 kernel).
  * Zero-initialize the structure, including currently unused fields, to
- * accomodate potential future updates.
+ * accommodate potential future updates.
  *
  * SPI_IOC_MESSAGE gives userspace the equivalent of kernel spi_sync().
  * Pass it an array of related transfers, they'll execute together.
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/stddef.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/stddef.h
index d12ce1b..e92a5a7 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/stddef.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/stddef.h
@@ -11,4 +11,11 @@
 #endif
 
 
+#undef offsetof
+#ifdef __compiler_offsetof
+#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
+#else
+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
+
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/synclink.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/synclink.h
index b95874b..0818434 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/synclink.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/synclink.h
@@ -126,6 +126,7 @@
 #define MGSL_MODE_BISYNC	4
 #define MGSL_MODE_RAW		6
 #define MGSL_MODE_BASE_CLOCK    7
+#define MGSL_MODE_XSYNC         8
 
 #define MGSL_BUS_TYPE_ISA	1
 #define MGSL_BUS_TYPE_EISA	2
@@ -290,6 +291,10 @@
 #define MGSL_IOCSGPIO		_IOW(MGSL_MAGIC_IOC,16,struct gpio_desc)
 #define MGSL_IOCGGPIO		_IOR(MGSL_MAGIC_IOC,17,struct gpio_desc)
 #define MGSL_IOCWAITGPIO	_IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc)
+#define MGSL_IOCSXSYNC		_IO(MGSL_MAGIC_IOC, 19)
+#define MGSL_IOCGXSYNC		_IO(MGSL_MAGIC_IOC, 20)
+#define MGSL_IOCSXCTRL		_IO(MGSL_MAGIC_IOC, 21)
+#define MGSL_IOCGXCTRL		_IO(MGSL_MAGIC_IOC, 22)
 
 
 #endif /* _SYNCLINK_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sysctl.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sysctl.h
index 3e56945..a092bce 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/sysctl.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/sysctl.h
@@ -15,9 +15,6 @@
  **  The kernel will then return -ENOTDIR to any application using
  **  the old binary interface.
  **
- **  For new interfaces unless you really need a binary number
- **  please use CTL_UNNUMBERED.
- **
  ****************************************************************
  ****************************************************************
  */
@@ -29,7 +26,6 @@
 #include <linux/types.h>
 
 
-struct file;
 struct completion;
 
 #define CTL_MAXNAME 10		/* how many path components do we allow in a
@@ -51,8 +47,6 @@
 
 /* Top-level names: */
 
-/* For internal pattern-matching use only: */
-
 enum
 {
 	CTL_KERN=1,		/* General kernel info and control */
@@ -95,8 +89,8 @@
 	KERN_VERSION=4,		/* string: compile time info */
 	KERN_SECUREMASK=5,	/* struct: maximum rights mask */
 	KERN_PROF=6,		/* table: profiling information */
-	KERN_NODENAME=7,
-	KERN_DOMAINNAME=8,
+	KERN_NODENAME=7,	/* string: hostname */
+	KERN_DOMAINNAME=8,	/* string: domainname */
 
 	KERN_PANIC=15,		/* int: panic timeout */
 	KERN_REALROOTDEV=16,	/* real root device to mount after initrd */
@@ -108,8 +102,8 @@
 	KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */
 	KERN_PPC_ZEROPAGED=26,	/* turn idle page zeroing on/off on PPC */
 	KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */
-	KERN_MODPROBE=28,
-	KERN_SG_BIG_BUFF=29,
+	KERN_MODPROBE=28,	/* string: modprobe path */
+	KERN_SG_BIG_BUFF=29,	/* int: sg driver reserved buffer size */
 	KERN_ACCT=30,		/* BSD process accounting parameters */
 	KERN_PPC_L2CR=31,	/* l2cr register on PPC */
 
@@ -156,7 +150,7 @@
 	KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
 	KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
 	KERN_COMPAT_LOG=73,	/* int: print compat layer  messages */
-	KERN_MAX_LOCK_DEPTH=74,
+	KERN_MAX_LOCK_DEPTH=74, /* int: rtmutex's maximum lock depth */
 	KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
 	KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
 };
@@ -441,7 +435,7 @@
 	NET_IPV4_ROUTE_MAX_SIZE=5,
 	NET_IPV4_ROUTE_GC_MIN_INTERVAL=6,
 	NET_IPV4_ROUTE_GC_TIMEOUT=7,
-	NET_IPV4_ROUTE_GC_INTERVAL=8,
+	NET_IPV4_ROUTE_GC_INTERVAL=8, /* obsolete since 2.6.38 */
 	NET_IPV4_ROUTE_REDIRECT_LOAD=9,
 	NET_IPV4_ROUTE_REDIRECT_NUMBER=10,
 	NET_IPV4_ROUTE_REDIRECT_SILENCE=11,
@@ -487,7 +481,6 @@
 	NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
 	NET_IPV4_CONF_ARP_ACCEPT=21,
 	NET_IPV4_CONF_ARP_NOTIFY=22,
-	__NET_IPV4_CONF_MAX
 };
 
 /* /proc/sys/net/ipv4/netfilter */
@@ -603,7 +596,6 @@
 	NET_NEIGH_GC_THRESH3=16,
 	NET_NEIGH_RETRANS_TIME_MS=17,
 	NET_NEIGH_REACHABLE_TIME_MS=18,
-	__NET_NEIGH_MAX
 };
 
 /* /proc/sys/net/dccp */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/taskstats.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/taskstats.h
index 341dddb..2466e55 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/taskstats.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/taskstats.h
@@ -33,7 +33,7 @@
  */
 
 
-#define TASKSTATS_VERSION	7
+#define TASKSTATS_VERSION	8
 #define TS_COMM_LEN		32	/* should be >= TASK_COMM_LEN
 					 * in linux/sched.h */
 
@@ -188,6 +188,7 @@
 	TASKSTATS_TYPE_STATS,		/* taskstats structure */
 	TASKSTATS_TYPE_AGGR_PID,	/* contains pid + stats */
 	TASKSTATS_TYPE_AGGR_TGID,	/* contains tgid + stats */
+	TASKSTATS_TYPE_NULL,		/* contains nothing */
 	__TASKSTATS_TYPE_MAX,
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_csum.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_csum.h
new file mode 100644
index 0000000..a047c49
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_csum.h
@@ -0,0 +1,32 @@
+#ifndef __LINUX_TC_CSUM_H
+#define __LINUX_TC_CSUM_H
+
+#include <linux/types.h>
+#include <linux/pkt_cls.h>
+
+#define TCA_ACT_CSUM 16
+
+enum {
+	TCA_CSUM_UNSPEC,
+	TCA_CSUM_PARMS,
+	TCA_CSUM_TM,
+	__TCA_CSUM_MAX
+};
+#define TCA_CSUM_MAX (__TCA_CSUM_MAX - 1)
+
+enum {
+	TCA_CSUM_UPDATE_FLAG_IPV4HDR = 1,
+	TCA_CSUM_UPDATE_FLAG_ICMP    = 2,
+	TCA_CSUM_UPDATE_FLAG_IGMP    = 4,
+	TCA_CSUM_UPDATE_FLAG_TCP     = 8,
+	TCA_CSUM_UPDATE_FLAG_UDP     = 16,
+	TCA_CSUM_UPDATE_FLAG_UDPLITE = 32
+};
+
+struct tc_csum {
+	tc_gen;
+
+	__u32 update_flags;
+};
+
+#endif /* __LINUX_TC_CSUM_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_gact.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_gact.h
index e895c0a..f7bf94e 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_gact.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_gact.h
@@ -5,14 +5,12 @@
 #include <linux/pkt_cls.h>
 
 #define TCA_ACT_GACT 5
-struct tc_gact
-{
+struct tc_gact {
 	tc_gen;
 
 };
 
-struct tc_gact_p
-{
+struct tc_gact_p {
 #define PGACT_NONE              0
 #define PGACT_NETRAND           1
 #define PGACT_DETERM            2
@@ -22,8 +20,7 @@
 	int                   paction;
 };
  
-enum
-{
+enum {
 	TCA_GACT_UNSPEC,
 	TCA_GACT_TM,
 	TCA_GACT_PARMS,
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_ipt.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_ipt.h
index 4b6f7b6..a233556 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_ipt.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_ipt.h
@@ -5,8 +5,7 @@
 
 #define TCA_ACT_IPT 6
 
-enum
-{
+enum {
 	TCA_IPT_UNSPEC,
 	TCA_IPT_TABLE,
 	TCA_IPT_HOOK,
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_mirred.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_mirred.h
index 0a99ab6..7561750 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_mirred.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_mirred.h
@@ -10,15 +10,13 @@
 #define TCA_INGRESS_REDIR 3  /* packet redirect to INGRESS*/
 #define TCA_INGRESS_MIRROR 4 /* mirror packet to INGRESS */
                                                                                 
-struct tc_mirred
-{
+struct tc_mirred {
 	tc_gen;
 	int                     eaction;   /* one of IN/EGRESS_MIRROR/REDIR */
 	__u32                   ifindex;  /* ifindex of egress port */
 };
                                                                                 
-enum
-{
+enum {
 	TCA_MIRRED_UNSPEC,
 	TCA_MIRRED_TM,
 	TCA_MIRRED_PARMS,
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_nat.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_nat.h
index e7cf31e..6663aeb 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_nat.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_nat.h
@@ -6,8 +6,7 @@
 
 #define TCA_ACT_NAT 9
 
-enum
-{
+enum {
 	TCA_NAT_UNSPEC,
 	TCA_NAT_PARMS,
 	TCA_NAT_TM,
@@ -17,8 +16,7 @@
 
 #define TCA_NAT_FLAG_EGRESS 1
 
-struct tc_nat
-{
+struct tc_nat {
 	tc_gen;
 	__be32 old_addr;
 	__be32 new_addr;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_pedit.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_pedit.h
index 54ce906..716cfab 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_pedit.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_pedit.h
@@ -6,8 +6,7 @@
 
 #define TCA_ACT_PEDIT 7
 
-enum
-{
+enum {
 	TCA_PEDIT_UNSPEC,
 	TCA_PEDIT_TM,
 	TCA_PEDIT_PARMS,
@@ -15,8 +14,7 @@
 };
 #define TCA_PEDIT_MAX (__TCA_PEDIT_MAX - 1)
                                                                                 
-struct tc_pedit_key
-{
+struct tc_pedit_key {
 	__u32           mask;  /* AND */
 	__u32           val;   /*XOR */
 	__u32           off;  /*offset */
@@ -25,8 +23,7 @@
 	__u32           shift;
 };
                                                                                 
-struct tc_pedit_sel
-{
+struct tc_pedit_sel {
 	tc_gen;
 	unsigned char           nkeys;
 	unsigned char           flags;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_skbedit.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_skbedit.h
index a14e461..7a2e910 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_skbedit.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_act/tc_skbedit.h
@@ -26,6 +26,7 @@
 
 #define SKBEDIT_F_PRIORITY		0x1
 #define SKBEDIT_F_QUEUE_MAPPING		0x2
+#define SKBEDIT_F_MARK			0x4
 
 struct tc_skbedit {
 	tc_gen;
@@ -37,6 +38,7 @@
 	TCA_SKBEDIT_PARMS,
 	TCA_SKBEDIT_PRIORITY,
 	TCA_SKBEDIT_QUEUE_MAPPING,
+	TCA_SKBEDIT_MARK,
 	__TCA_SKBEDIT_MAX
 };
 #define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1)
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_cmp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_cmp.h
index 38e7f7b..f34bb1b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_cmp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_cmp.h
@@ -4,8 +4,7 @@
 #include <linux/types.h>
 #include <linux/pkt_cls.h>
 
-struct tcf_em_cmp
-{
+struct tcf_em_cmp {
 	__u32		val;
 	__u32		mask;
 	__u16		off;
@@ -15,8 +14,7 @@
 	__u8		opnd:4;
 };
 
-enum
-{
+enum {
 	TCF_EM_ALIGN_U8  = 1,
 	TCF_EM_ALIGN_U16 = 2,
 	TCF_EM_ALIGN_U32 = 4
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_meta.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_meta.h
index dcfb733..b11f8ce 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_meta.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_meta.h
@@ -4,8 +4,7 @@
 #include <linux/types.h>
 #include <linux/pkt_cls.h>
 
-enum
-{
+enum {
 	TCA_EM_META_UNSPEC,
 	TCA_EM_META_HDR,
 	TCA_EM_META_LVALUE,
@@ -14,8 +13,7 @@
 };
 #define TCA_EM_META_MAX (__TCA_EM_META_MAX - 1)
 
-struct tcf_meta_val
-{
+struct tcf_meta_val {
 	__u16			kind;
 	__u8			shift;
 	__u8			op;
@@ -26,16 +24,14 @@
 #define TCF_META_ID_MASK	0x7ff
 #define TCF_META_ID(kind)	((kind) & TCF_META_ID_MASK)
 
-enum
-{
+enum {
 	TCF_META_TYPE_VAR,
 	TCF_META_TYPE_INT,
 	__TCF_META_TYPE_MAX
 };
 #define TCF_META_TYPE_MAX (__TCF_META_TYPE_MAX - 1)
 
-enum
-{
+enum {
 	TCF_META_ID_VALUE,
 	TCF_META_ID_RANDOM,
 	TCF_META_ID_LOADAVG_0,
@@ -71,7 +67,7 @@
 	TCF_META_ID_SK_FORWARD_ALLOCS,
 	TCF_META_ID_SK_SNDBUF,
  	TCF_META_ID_SK_ALLOCS,
- 	TCF_META_ID_SK_ROUTE_CAPS,
+	__TCF_META_ID_SK_ROUTE_CAPS,	/* unimplemented but in ABI already */
  	TCF_META_ID_SK_HASH,
  	TCF_META_ID_SK_LINGERTIME,
  	TCF_META_ID_SK_ACK_BACKLOG,
@@ -83,12 +79,12 @@
  	TCF_META_ID_SK_SENDMSG_OFF,
  	TCF_META_ID_SK_WRITE_PENDING,
 	TCF_META_ID_VLAN_TAG,
+	TCF_META_ID_RXHASH,
 	__TCF_META_ID_MAX
 };
 #define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1)
 
-struct tcf_meta_hdr
-{
+struct tcf_meta_hdr {
 	struct tcf_meta_val	left;
 	struct tcf_meta_val	right;
 };
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_nbyte.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_nbyte.h
index 9ed8c2e..7172cfb 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_nbyte.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_nbyte.h
@@ -4,8 +4,7 @@
 #include <linux/types.h>
 #include <linux/pkt_cls.h>
 
-struct tcf_em_nbyte
-{
+struct tcf_em_nbyte {
 	__u16		off;
 	__u16		len:12;
 	__u8		layer:4;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_text.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_text.h
index d12a73a..5aac404 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_text.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tc_ematch/tc_em_text.h
@@ -6,8 +6,7 @@
 
 #define TC_EM_TEXT_ALGOSIZ	16
 
-struct tcf_em_text
-{
+struct tcf_em_text {
 	char		algo[TC_EM_TEXT_ALGOSIZ];
 	__u16		from_offset;
 	__u16		to_offset;
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tcp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tcp.h
index 959231d..ffe5aef 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tcp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tcp.h
@@ -54,7 +54,7 @@
 	__be16	window;
 	__sum16	check;
 	__be16	urg_ptr;
-};
+} __attribute__((packed));
 
 /*
  *	The union cast uses a gcc extension to avoid aliasing problems
@@ -81,6 +81,12 @@
 	TCP_DATA_OFFSET = __cpu_to_be32(0xF0000000)
 }; 
 
+/*
+ * TCP general constants
+ */
+#define TCP_MSS_DEFAULT		 536U	/* IPv4 (RFC1122, RFC2581) */
+#define TCP_MSS_DESIRED		1220U	/* IPv6 (tunneled), EDNS0 (RFC3226) */
+
 /* TCP socket options */
 #define TCP_NODELAY		1	/* Turn off Nagle's algorithm. */
 #define TCP_MAXSEG		2	/* Limit MSS */
@@ -96,14 +102,19 @@
 #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 */
 
+/* for TCP_INFO socket option */
 #define TCPI_OPT_TIMESTAMPS	1
 #define TCPI_OPT_SACK		2
 #define TCPI_OPT_WSCALE		4
-#define TCPI_OPT_ECN		8
+#define TCPI_OPT_ECN		8 /* ECN was negociated at TCP session init */
+#define TCPI_OPT_ECN_SEEN	16 /* we received at least one packet with ECT */
 
-enum tcp_ca_state
-{
+enum tcp_ca_state {
 	TCP_CA_Open = 0,
 #define TCPF_CA_Open	(1<<TCP_CA_Open)
 	TCP_CA_Disorder = 1,
@@ -116,8 +127,7 @@
 #define TCPF_CA_Loss	(1<<TCP_CA_Loss)
 };
 
-struct tcp_info
-{
+struct tcp_info {
 	__u8	tcpi_state;
 	__u8	tcpi_ca_state;
 	__u8	tcpi_retransmits;
@@ -170,5 +180,29 @@
 	__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	/* _LINUX_TCP_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/time.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/time.h
index 12d8c89..43f5fe5 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/time.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/time.h
@@ -57,6 +57,11 @@
 #define CLOCK_PROCESS_CPUTIME_ID	2
 #define CLOCK_THREAD_CPUTIME_ID		3
 #define CLOCK_MONOTONIC_RAW		4
+#define CLOCK_REALTIME_COARSE		5
+#define CLOCK_MONOTONIC_COARSE		6
+#define CLOCK_BOOTTIME			7
+#define CLOCK_REALTIME_ALARM		8
+#define CLOCK_BOOTTIME_ALARM		9
 
 /*
  * The IDs of various hardware clocks:
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/timex.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/timex.h
index 43789d9..d9f943c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/timex.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/timex.h
@@ -73,7 +73,7 @@
 	long tolerance;		/* clock frequency tolerance (ppm)
 				 * (read only)
 				 */
-	struct timeval time;	/* (read only) */
+	struct timeval time;	/* (read only, except for ADJ_SETOFFSET) */
 	long tick;		/* (modified) usecs between clock ticks */
 
 	long ppsfreq;           /* pps frequency (scaled ppm) (ro) */
@@ -102,6 +102,7 @@
 #define ADJ_STATUS		0x0010	/* clock status */
 #define ADJ_TIMECONST		0x0020	/* pll time constant */
 #define ADJ_TAI			0x0080	/* set TAI offset */
+#define ADJ_SETOFFSET		0x0100  /* add 'time' to current time */
 #define ADJ_MICRO		0x1000	/* select microsecond resolution */
 #define ADJ_NANO		0x2000	/* select nanosecond resolution */
 #define ADJ_TICK		0x4000	/* tick value */
@@ -109,13 +110,16 @@
 #define ADJ_OFFSET_SINGLESHOT	0x8001	/* old-fashioned adjtime */
 #define ADJ_OFFSET_SS_READ	0xa001	/* read-only adjtime */
 
-/* xntp 3.4 compatibility names */
+/* NTP userland likes the MOD_ prefix better */
 #define MOD_OFFSET	ADJ_OFFSET
 #define MOD_FREQUENCY	ADJ_FREQUENCY
 #define MOD_MAXERROR	ADJ_MAXERROR
 #define MOD_ESTERROR	ADJ_ESTERROR
 #define MOD_STATUS	ADJ_STATUS
 #define MOD_TIMECONST	ADJ_TIMECONST
+#define MOD_TAI	ADJ_TAI
+#define MOD_MICRO	ADJ_MICRO
+#define MOD_NANO	ADJ_NANO
 
 
 /*
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tipc.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tipc.h
index 3ef026d..1e2ca0f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tipc.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tipc.h
@@ -1,8 +1,8 @@
 /*
  * include/linux/tipc.h: Include file for TIPC socket interface
- * 
+ *
  * Copyright (c) 2003-2006, Ericsson AB
- * Copyright (c) 2005, Wind River Systems
+ * Copyright (c) 2005, 2010-2011, Wind River Systems
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@
 /*
  * TIPC addressing primitives
  */
- 
+
 struct tipc_portid {
 	__u32 ref;
 	__u32 node;
@@ -89,7 +89,7 @@
 #define TIPC_TOP_SRV		1	/* topology service name type */
 #define TIPC_RESERVED_TYPES	64	/* lowest user-publishable name type */
 
-/* 
+/*
  * Publication scopes when binding port names and port name sequences
  */
 
@@ -101,18 +101,18 @@
  * Limiting values for messages
  */
 
-#define TIPC_MAX_USER_MSG_SIZE	66000
+#define TIPC_MAX_USER_MSG_SIZE	66000U
 
 /*
  * Message importance levels
  */
 
-#define TIPC_LOW_IMPORTANCE		0  /* default */
+#define TIPC_LOW_IMPORTANCE		0
 #define TIPC_MEDIUM_IMPORTANCE		1
 #define TIPC_HIGH_IMPORTANCE		2
 #define TIPC_CRITICAL_IMPORTANCE	3
 
-/* 
+/*
  * Msg rejection/connection shutdown reasons
  */
 
@@ -127,22 +127,16 @@
  * TIPC topology subscription service definitions
  */
 
-#define TIPC_SUB_PORTS     	0x01  	/* filter for port availability */
-#define TIPC_SUB_SERVICE     	0x02  	/* filter for service availability */
-#define TIPC_SUB_CANCEL         0x04    /* cancel a subscription */
-#if 0
-/* The following filter options are not currently implemented */
-#define TIPC_SUB_NO_BIND_EVTS	0x04	/* filter out "publish" events */
-#define TIPC_SUB_NO_UNBIND_EVTS	0x08	/* filter out "withdraw" events */
-#define TIPC_SUB_SINGLE_EVT	0x10	/* expire after first event */
-#endif
+#define TIPC_SUB_PORTS		0x01	/* filter for port availability */
+#define TIPC_SUB_SERVICE	0x02	/* filter for service availability */
+#define TIPC_SUB_CANCEL		0x04	/* cancel a subscription */
 
-#define TIPC_WAIT_FOREVER	~0	/* timeout for permanent subscription */
+#define TIPC_WAIT_FOREVER	(~0)	/* timeout for permanent subscription */
 
 struct tipc_subscr {
 	struct tipc_name_seq seq;	/* name sequence of interest */
 	__u32 timeout;			/* subscription duration (in ms) */
-        __u32 filter;   		/* bitmask of filter options */
+	__u32 filter;			/* bitmask of filter options */
 	char usr_handle[8];		/* available for subscriber use */
 };
 
@@ -188,7 +182,7 @@
 		struct tipc_name_seq nameseq;
 		struct {
 			struct tipc_name name;
-			__u32 domain; /* 0: own zone */
+			__u32 domain;
 		} name;
 	} addr;
 };
@@ -206,8 +200,10 @@
  */
 
 #define TIPC_IMPORTANCE		127	/* Default: TIPC_LOW_IMPORTANCE */
-#define TIPC_SRC_DROPPABLE	128	/* Default: 0 (resend congested msg) */
+#define TIPC_SRC_DROPPABLE	128	/* Default: based on socket type */
 #define TIPC_DEST_DROPPABLE	129	/* Default: based on socket type */
 #define TIPC_CONN_TIMEOUT	130	/* Default: 8000 (ms)  */
+#define TIPC_NODE_RECVQ_DEPTH	131	/* Default: none (read only) */
+#define TIPC_SOCK_RECVQ_DEPTH	132	/* Default: none (read only) */
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tipc_config.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tipc_config.h
index a4b59c1..fc259ff 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tipc_config.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tipc_config.h
@@ -1,8 +1,8 @@
 /*
  * include/linux/tipc_config.h: Include file for TIPC configuration interface
- * 
+ *
  * Copyright (c) 2003-2006, Ericsson AB
- * Copyright (c) 2005-2007, Wind River Systems
+ * Copyright (c) 2005-2007, 2010-2011, Wind River Systems
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,8 @@
 #include <linux/string.h>
 #include <asm/byteorder.h>
 
+#include <arpa/inet.h> /* for ntohs etc. */
+
 /*
  * Configuration
  *
@@ -54,19 +56,19 @@
  * which specify parameters or results for the operation.
  *
  * For many operations, the request and reply messages have a fixed number
- * of TLVs (usually zero or one); however, some reply messages may return 
+ * of TLVs (usually zero or one); however, some reply messages may return
  * a variable number of TLVs.  A failed request is denoted by the presence
  * of an "error string" TLV in the reply message instead of the TLV(s) the
  * reply should contain if the request succeeds.
  */
- 
-/* 
+
+/*
  * Public commands:
  * May be issued by any process.
- * Accepted by own node, or by remote node only if remote management enabled.                       
+ * Accepted by own node, or by remote node only if remote management enabled.
  */
- 
-#define  TIPC_CMD_NOOP   	    0x0000    /* tx none, rx none */
+
+#define  TIPC_CMD_NOOP              0x0000    /* tx none, rx none */
 #define  TIPC_CMD_GET_NODES         0x0001    /* tx net_addr, rx node_info(s) */
 #define  TIPC_CMD_GET_MEDIA_NAMES   0x0002    /* tx none, rx media_name(s) */
 #define  TIPC_CMD_GET_BEARER_NAMES  0x0003    /* tx none, rx bearer_name(s) */
@@ -74,29 +76,23 @@
 #define  TIPC_CMD_SHOW_NAME_TABLE   0x0005    /* tx name_tbl_query, rx ultra_string */
 #define  TIPC_CMD_SHOW_PORTS        0x0006    /* tx none, rx ultra_string */
 #define  TIPC_CMD_SHOW_LINK_STATS   0x000B    /* tx link_name, rx ultra_string */
+#define  TIPC_CMD_SHOW_STATS        0x000F    /* tx unsigned, rx ultra_string */
 
-#if 0
-#define  TIPC_CMD_SHOW_PORT_STATS   0x0008    /* tx port_ref, rx ultra_string */
-#define  TIPC_CMD_RESET_PORT_STATS  0x0009    /* tx port_ref, rx none */
-#define  TIPC_CMD_GET_ROUTES        0x000A    /* tx ?, rx ? */
-#define  TIPC_CMD_GET_LINK_PEER     0x000D    /* tx link_name, rx ? */
-#endif
-
-/* 
+/*
  * Protected commands:
  * May only be issued by "network administration capable" process.
  * Accepted by own node, or by remote node only if remote management enabled
- * and this node is zone manager.                       
+ * and this node is zone manager.
  */
 
 #define  TIPC_CMD_GET_REMOTE_MNG    0x4003    /* tx none, rx unsigned */
 #define  TIPC_CMD_GET_MAX_PORTS     0x4004    /* tx none, rx unsigned */
 #define  TIPC_CMD_GET_MAX_PUBL      0x4005    /* tx none, rx unsigned */
 #define  TIPC_CMD_GET_MAX_SUBSCR    0x4006    /* tx none, rx unsigned */
-#define  TIPC_CMD_GET_MAX_ZONES     0x4007    /* tx none, rx unsigned */
-#define  TIPC_CMD_GET_MAX_CLUSTERS  0x4008    /* tx none, rx unsigned */
-#define  TIPC_CMD_GET_MAX_NODES     0x4009    /* tx none, rx unsigned */
-#define  TIPC_CMD_GET_MAX_SLAVES    0x400A    /* tx none, rx unsigned */
+#define  TIPC_CMD_GET_MAX_ZONES     0x4007    /* obsoleted */
+#define  TIPC_CMD_GET_MAX_CLUSTERS  0x4008    /* obsoleted */
+#define  TIPC_CMD_GET_MAX_NODES     0x4009    /* obsoleted */
+#define  TIPC_CMD_GET_MAX_SLAVES    0x400A    /* obsoleted */
 #define  TIPC_CMD_GET_NETID         0x400B    /* tx none, rx unsigned */
 
 #define  TIPC_CMD_ENABLE_BEARER     0x4101    /* tx bearer_config, rx none */
@@ -108,31 +104,21 @@
 #define  TIPC_CMD_DUMP_LOG          0x410B    /* tx none, rx ultra_string */
 #define  TIPC_CMD_RESET_LINK_STATS  0x410C    /* tx link_name, rx none */
 
-#if 0
-#define  TIPC_CMD_CREATE_LINK       0x4103    /* tx link_create, rx none */
-#define  TIPC_CMD_REMOVE_LINK       0x4104    /* tx link_name, rx none */
-#define  TIPC_CMD_BLOCK_LINK        0x4105    /* tx link_name, rx none */
-#define  TIPC_CMD_UNBLOCK_LINK      0x4106    /* tx link_name, rx none */
-#endif
-
-/* 
+/*
  * Private commands:
  * May only be issued by "network administration capable" process.
- * Accepted by own node only; cannot be used on a remote node.                       
+ * Accepted by own node only; cannot be used on a remote node.
  */
 
 #define  TIPC_CMD_SET_NODE_ADDR     0x8001    /* tx net_addr, rx none */
-#if 0
-#define  TIPC_CMD_SET_ZONE_MASTER   0x8002    /* tx none, rx none */
-#endif
 #define  TIPC_CMD_SET_REMOTE_MNG    0x8003    /* tx unsigned, rx none */
 #define  TIPC_CMD_SET_MAX_PORTS     0x8004    /* tx unsigned, rx none */
 #define  TIPC_CMD_SET_MAX_PUBL      0x8005    /* tx unsigned, rx none */
 #define  TIPC_CMD_SET_MAX_SUBSCR    0x8006    /* tx unsigned, rx none */
-#define  TIPC_CMD_SET_MAX_ZONES     0x8007    /* tx unsigned, rx none */
-#define  TIPC_CMD_SET_MAX_CLUSTERS  0x8008    /* tx unsigned, rx none */
-#define  TIPC_CMD_SET_MAX_NODES     0x8009    /* tx unsigned, rx none */
-#define  TIPC_CMD_SET_MAX_SLAVES    0x800A    /* tx unsigned, rx none */
+#define  TIPC_CMD_SET_MAX_ZONES     0x8007    /* obsoleted */
+#define  TIPC_CMD_SET_MAX_CLUSTERS  0x8008    /* obsoleted */
+#define  TIPC_CMD_SET_MAX_NODES     0x8009    /* obsoleted */
+#define  TIPC_CMD_SET_MAX_SLAVES    0x800A    /* obsoleted */
 #define  TIPC_CMD_SET_NETID         0x800B    /* tx unsigned, rx none */
 
 /*
@@ -155,20 +141,20 @@
 #define TIPC_TLV_ULTRA_STRING	5	/* char[32768] (max) */
 
 #define TIPC_TLV_ERROR_STRING	16	/* char[128] containing "error code" */
-#define TIPC_TLV_NET_ADDR   	17	/* 32-bit integer denoting <Z.C.N> */
+#define TIPC_TLV_NET_ADDR	17	/* 32-bit integer denoting <Z.C.N> */
 #define TIPC_TLV_MEDIA_NAME	18	/* char[TIPC_MAX_MEDIA_NAME] */
 #define TIPC_TLV_BEARER_NAME	19	/* char[TIPC_MAX_BEARER_NAME] */
 #define TIPC_TLV_LINK_NAME	20	/* char[TIPC_MAX_LINK_NAME] */
 #define TIPC_TLV_NODE_INFO	21	/* struct tipc_node_info */
 #define TIPC_TLV_LINK_INFO	22	/* struct tipc_link_info */
-#define TIPC_TLV_BEARER_CONFIG  23	/* struct tipc_bearer_config */
-#define TIPC_TLV_LINK_CONFIG    24	/* struct tipc_link_config */
+#define TIPC_TLV_BEARER_CONFIG	23	/* struct tipc_bearer_config */
+#define TIPC_TLV_LINK_CONFIG	24	/* struct tipc_link_config */
 #define TIPC_TLV_NAME_TBL_QUERY	25	/* struct tipc_name_table_query */
-#define TIPC_TLV_PORT_REF   	26	/* 32-bit port reference */
+#define TIPC_TLV_PORT_REF	26	/* 32-bit port reference */
 
 /*
  * Maximum sizes of TIPC bearer-related names (including terminating NUL)
- */ 
+ */
 
 #define TIPC_MAX_MEDIA_NAME	16	/* format = media */
 #define TIPC_MAX_IF_NAME	16	/* format = interface */
@@ -192,6 +178,10 @@
 #define TIPC_DEF_LINK_TOL 1500
 #define TIPC_MAX_LINK_TOL 30000
 
+#if (TIPC_MIN_LINK_TOL < 16)
+#error "TIPC_MIN_LINK_TOL is too small (abort limit may be NaN)"
+#endif
+
 /*
  * Link window limits (min, default, max), in packets
  */
@@ -214,7 +204,7 @@
 
 struct tipc_bearer_config {
 	__be32 priority;		/* Range [1,31]. Override per link  */
-	__be32 detect_scope;
+	__be32 disc_domain;		/* <Z.C.N> describing desired nodes */
 	char name[TIPC_MAX_BEARER_NAME];
 };
 
@@ -233,7 +223,7 @@
 };
 
 /*
- * The error string TLV is a null-terminated string describing the cause 
+ * The error string TLV is a null-terminated string describing the cause
  * of the request failure.  To simplify error processing (and to save space)
  * the first character of the string can be a special error code character
  * (lying by the range 0x80 to 0xFF) which represents a pre-defined reason.
@@ -246,23 +236,9 @@
 #define TIPC_CFG_NOT_SUPPORTED  "\x84"	/* request is not supported by TIPC */
 #define TIPC_CFG_INVALID_VALUE  "\x85"  /* request has invalid argument value */
 
-#if 0
-/* prototypes TLV structures for proposed commands */
-struct tipc_link_create {
-	__u32   domain;
-	struct tipc_media_addr peer_addr;
-	char bearer_name[TIPC_MAX_BEARER_NAME];
-};
-
-struct tipc_route_info {
-	__u32 dest;
-	__u32 router;
-};
-#endif
-
 /*
  * A TLV consists of a descriptor, followed by the TLV value.
- * TLV descriptor fields are stored in network byte order; 
+ * TLV descriptor fields are stored in network byte order;
  * TLV values must also be stored in network byte order (where applicable).
  * TLV descriptors must be aligned to addresses which are multiple of 4,
  * so up to 3 bytes of padding may exist at the end of the TLV value area.
@@ -298,7 +274,7 @@
 
 static __inline__ int TLV_CHECK(const void *tlv, __u16 space, __u16 exp_type)
 {
-	return TLV_OK(tlv, space) && 
+	return TLV_OK(tlv, space) &&
 		(ntohs(((struct tlv_desc *)tlv)->tlv_type) == exp_type);
 }
 
@@ -317,7 +293,7 @@
 }
 
 /*
- * A TLV list descriptor simplifies processing of messages 
+ * A TLV list descriptor simplifies processing of messages
  * containing multiple TLVs.
  */
 
@@ -326,15 +302,15 @@
 	__u32 tlv_space;		/* # bytes from curr TLV to list end */
 };
 
-static __inline__ void TLV_LIST_INIT(struct tlv_list_desc *list, 
+static __inline__ void TLV_LIST_INIT(struct tlv_list_desc *list,
 				 void *data, __u32 space)
 {
 	list->tlv_ptr = (struct tlv_desc *)data;
 	list->tlv_space = space;
 }
-	     
+
 static __inline__ int TLV_LIST_EMPTY(struct tlv_list_desc *list)
-{ 
+{
 	return (list->tlv_space == 0);
 }
 
@@ -352,7 +328,7 @@
 {
 	__u16 tlv_space = TLV_ALIGN(ntohs(list->tlv_ptr->tlv_len));
 
-        list->tlv_ptr = (struct tlv_desc *)((char *)list->tlv_ptr + tlv_space);
+	list->tlv_ptr = (struct tlv_desc *)((char *)list->tlv_ptr + tlv_space);
 	list->tlv_space -= tlv_space;
 }
 
@@ -376,15 +352,14 @@
 #define TIPC_GENL_HDRLEN	NLMSG_ALIGN(sizeof(struct tipc_genlmsghdr))
 
 /*
- * Configuration messages exchanged via TIPC sockets use the TIPC configuration 
- * message header, which is defined below.  This structure is analogous 
- * to the Netlink message header, but fields are stored in network byte order 
- * and no padding is permitted between the header and the message data 
+ * Configuration messages exchanged via TIPC sockets use the TIPC configuration
+ * message header, which is defined below.  This structure is analogous
+ * to the Netlink message header, but fields are stored in network byte order
+ * and no padding is permitted between the header and the message data
  * that follows.
  */
 
-struct tipc_cfg_msg_hdr
-{
+struct tipc_cfg_msg_hdr {
 	__be32 tcm_len;		/* Message length (including header) */
 	__be16 tcm_type;	/* Command type */
 	__be16 tcm_flags;	/* Additional flags */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/toshiba.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/toshiba.h
index 6a7c4ed..c26527f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/toshiba.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/toshiba.h
@@ -33,6 +33,5 @@
 	unsigned int edi __attribute__ ((packed));
 } SMMRegisters;
 
-int tosh_smm(SMMRegisters *regs);
 
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tty.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tty.h
index 98996ba..cfdbedc 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/tty.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/tty.h
@@ -5,4 +5,34 @@
  * 'tty.h' defines some structures used by tty_io.c and some defines.
  */
 
+#define NR_LDISCS		30
+
+/* line disciplines */
+#define N_TTY		0
+#define N_SLIP		1
+#define N_MOUSE		2
+#define N_PPP		3
+#define N_STRIP		4
+#define N_AX25		5
+#define N_X25		6	/* X.25 async */
+#define N_6PACK		7
+#define N_MASC		8	/* Reserved for Mobitex module <kaz@cafe.net> */
+#define N_R3964		9	/* Reserved for Simatic R3964 module */
+#define N_PROFIBUS_FDL	10	/* Reserved for Profibus */
+#define N_IRDA		11	/* Linux IrDa - http://irda.sourceforge.net/ */
+#define N_SMSBLOCK	12	/* SMS block mode - for talking to GSM data */
+				/* cards about SMS messages */
+#define N_HDLC		13	/* synchronous HDLC */
+#define N_SYNC_PPP	14	/* synchronous PPP */
+#define N_HCI		15	/* Bluetooth HCI UART */
+#define N_GIGASET_M101	16	/* Siemens Gigaset M101 serial DECT adapter */
+#define N_SLCAN		17	/* Serial / USB serial CAN Adaptors */
+#define N_PPS		18	/* Pulse per Second */
+#define N_V253		19	/* Codec control over voice modem */
+#define N_CAIF		20      /* CAIF protocol for talking to modems */
+#define N_GSM0710	21	/* GSM 0710 Mux */
+#define N_TI_WL		22	/* for TI's WL BT, FM, GPS combo chips */
+#define N_TRACESINK	23	/* Trace data routing for MIPI P1149.7 */
+#define N_TRACEROUTER	24	/* Trace data routing for MIPI P1149.7 */
+
 #endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/types.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/types.h
index 8b483c8..23ea78f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/types.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/types.h
@@ -34,5 +34,18 @@
 typedef __u16 __bitwise __sum16;
 typedef __u32 __bitwise __wsum;
 
+/*
+ * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
+ * common 32/64-bit compat problems.
+ * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
+ * architectures) and to 8-byte boundaries on 64-bit architectures.  The new
+ * aligned_64 type enforces 8-byte alignment so that structs containing
+ * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
+ * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
+ */
+#define __aligned_u64 __u64 __attribute__((aligned(8)))
+#define __aligned_be64 __be64 __attribute__((aligned(8)))
+#define __aligned_le64 __le64 __attribute__((aligned(8)))
+
 #endif /*  __ASSEMBLY__ */
 #endif /* _LINUX_TYPES_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/udp.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/udp.h
index 13cf21a..357a3ab 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/udp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/udp.h
@@ -24,7 +24,7 @@
 	__be16	dest;
 	__be16	len;
 	__sum16	check;
-};
+} __attribute__((packed));
 
 /* UDP socket options */
 #define UDP_CORK	1	/* Never send partially complete segments */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/uinput.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/uinput.h
index 8ffd7da..4466595 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/uinput.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/uinput.h
@@ -65,6 +65,7 @@
 #define UI_SET_FFBIT		_IOW(UINPUT_IOCTL_BASE, 107, int)
 #define UI_SET_PHYS		_IOW(UINPUT_IOCTL_BASE, 108, char*)
 #define UI_SET_SWBIT		_IOW(UINPUT_IOCTL_BASE, 109, int)
+#define UI_SET_PROPBIT		_IOW(UINPUT_IOCTL_BASE, 110, int)
 
 #define UI_BEGIN_FF_UPLOAD	_IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload)
 #define UI_END_FF_UPLOAD	_IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload)
@@ -126,11 +127,11 @@
 struct uinput_user_dev {
 	char name[UINPUT_MAX_NAME_SIZE];
 	struct input_id id;
-        int ff_effects_max;
-        int absmax[ABS_MAX + 1];
-        int absmin[ABS_MAX + 1];
-        int absfuzz[ABS_MAX + 1];
-        int absflat[ABS_MAX + 1];
+	int ff_effects_max;
+	int absmax[ABS_CNT];
+	int absmin[ABS_CNT];
+	int absfuzz[ABS_CNT];
+	int absflat[ABS_CNT];
 };
 #endif	/* __UINPUT_H_ */
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/un.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/un.h
index 45561c5..3ed3e46 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/un.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/un.h
@@ -1,10 +1,12 @@
 #ifndef _LINUX_UN_H
 #define _LINUX_UN_H
 
+#include <linux/socket.h>
+
 #define UNIX_PATH_MAX	108
 
 struct sockaddr_un {
-	sa_family_t sun_family;	/* AF_UNIX */
+	__kernel_sa_family_t sun_family; /* AF_UNIX */
 	char sun_path[UNIX_PATH_MAX];	/* pathname */
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/unix_diag.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/unix_diag.h
new file mode 100644
index 0000000..b1d2bf1
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/unix_diag.h
@@ -0,0 +1,54 @@
+#ifndef __UNIX_DIAG_H__
+#define __UNIX_DIAG_H__
+
+#include <linux/types.h>
+
+struct unix_diag_req {
+	__u8	sdiag_family;
+	__u8	sdiag_protocol;
+	__u16	pad;
+	__u32	udiag_states;
+	__u32	udiag_ino;
+	__u32	udiag_show;
+	__u32	udiag_cookie[2];
+};
+
+#define UDIAG_SHOW_NAME		0x00000001	/* show name (not path) */
+#define UDIAG_SHOW_VFS		0x00000002	/* show VFS inode info */
+#define UDIAG_SHOW_PEER		0x00000004	/* show peer socket info */
+#define UDIAG_SHOW_ICONS	0x00000008	/* show pending connections */
+#define UDIAG_SHOW_RQLEN	0x00000010	/* show skb receive queue len */
+#define UDIAG_SHOW_MEMINFO	0x00000020	/* show memory info of a socket */
+
+struct unix_diag_msg {
+	__u8	udiag_family;
+	__u8	udiag_type;
+	__u8	udiag_state;
+	__u8	pad;
+
+	__u32	udiag_ino;
+	__u32	udiag_cookie[2];
+};
+
+enum {
+	UNIX_DIAG_NAME,
+	UNIX_DIAG_VFS,
+	UNIX_DIAG_PEER,
+	UNIX_DIAG_ICONS,
+	UNIX_DIAG_RQLEN,
+	UNIX_DIAG_MEMINFO,
+
+	UNIX_DIAG_MAX,
+};
+
+struct unix_diag_vfs {
+	__u32	udiag_vfs_ino;
+	__u32	udiag_vfs_dev;
+};
+
+struct unix_diag_rqlen {
+	__u32	udiag_rqueue;
+	__u32	udiag_wqueue;
+};
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/audio.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/audio.h
index 421c53c..d754dba 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/audio.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/audio.h
@@ -13,6 +13,9 @@
  * Comments below reference relevant sections of that document:
  *
  * http://www.usb.org/developers/devclass_docs/audio10.pdf
+ *
+ * Types and defines in this file are either specific to version 1.0 of
+ * this standard or common for newer versions.
  */
 
 #ifndef __LINUX_USB_AUDIO_H
@@ -20,92 +23,149 @@
 
 #include <linux/types.h>
 
+/* bInterfaceProtocol values to denote the version of the standard used */
+#define UAC_VERSION_1			0x00
+#define UAC_VERSION_2			0x20
+
 /* A.2 Audio Interface Subclass Codes */
 #define USB_SUBCLASS_AUDIOCONTROL	0x01
 #define USB_SUBCLASS_AUDIOSTREAMING	0x02
 #define USB_SUBCLASS_MIDISTREAMING	0x03
-#define USB_SUBCLASS_VENDOR_SPEC	0xff
 
-/* A.5 Audio Class-Specific AC interface Descriptor Subtypes*/
-#define HEADER				0x01
-#define INPUT_TERMINAL			0x02
-#define OUTPUT_TERMINAL			0x03
-#define MIXER_UNIT			0x04
-#define SELECTOR_UNIT			0x05
-#define FEATURE_UNIT			0x06
-#define PROCESSING_UNIT			0x07
-#define EXTENSION_UNIT			0x08
+/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
+#define UAC_HEADER			0x01
+#define UAC_INPUT_TERMINAL		0x02
+#define UAC_OUTPUT_TERMINAL		0x03
+#define UAC_MIXER_UNIT			0x04
+#define UAC_SELECTOR_UNIT		0x05
+#define UAC_FEATURE_UNIT		0x06
+#define UAC1_PROCESSING_UNIT		0x07
+#define UAC1_EXTENSION_UNIT		0x08
 
-#define AS_GENERAL			0x01
-#define FORMAT_TYPE			0x02
-#define FORMAT_SPECIFIC			0x03
+/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
+#define UAC_AS_GENERAL			0x01
+#define UAC_FORMAT_TYPE			0x02
+#define UAC_FORMAT_SPECIFIC		0x03
 
-#define EP_GENERAL			0x01
+/* A.7 Processing Unit Process Types */
+#define UAC_PROCESS_UNDEFINED		0x00
+#define UAC_PROCESS_UP_DOWNMIX		0x01
+#define UAC_PROCESS_DOLBY_PROLOGIC	0x02
+#define UAC_PROCESS_STEREO_EXTENDER	0x03
+#define UAC_PROCESS_REVERB		0x04
+#define UAC_PROCESS_CHORUS		0x05
+#define UAC_PROCESS_DYN_RANGE_COMP	0x06
 
-#define MS_GENERAL			0x01
-#define MIDI_IN_JACK			0x02
-#define MIDI_OUT_JACK			0x03
+/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
+#define UAC_EP_GENERAL			0x01
 
-/* endpoint attributes */
-#define EP_ATTR_MASK			0x0c
-#define EP_ATTR_ASYNC			0x04
-#define EP_ATTR_ADAPTIVE		0x08
-#define EP_ATTR_SYNC			0x0c
+/* A.9 Audio Class-Specific Request Codes */
+#define UAC_SET_			0x00
+#define UAC_GET_			0x80
 
-/* cs endpoint attributes */
-#define EP_CS_ATTR_SAMPLE_RATE		0x01
-#define EP_CS_ATTR_PITCH_CONTROL	0x02
-#define EP_CS_ATTR_FILL_MAX		0x80
+#define UAC__CUR			0x1
+#define UAC__MIN			0x2
+#define UAC__MAX			0x3
+#define UAC__RES			0x4
+#define UAC__MEM			0x5
 
-/* Audio Class specific Request Codes */
-#define USB_AUDIO_SET_INTF		0x21
-#define USB_AUDIO_SET_ENDPOINT		0x22
-#define USB_AUDIO_GET_INTF		0xa1
-#define USB_AUDIO_GET_ENDPOINT		0xa2
+#define UAC_SET_CUR			(UAC_SET_ | UAC__CUR)
+#define UAC_GET_CUR			(UAC_GET_ | UAC__CUR)
+#define UAC_SET_MIN			(UAC_SET_ | UAC__MIN)
+#define UAC_GET_MIN			(UAC_GET_ | UAC__MIN)
+#define UAC_SET_MAX			(UAC_SET_ | UAC__MAX)
+#define UAC_GET_MAX			(UAC_GET_ | UAC__MAX)
+#define UAC_SET_RES			(UAC_SET_ | UAC__RES)
+#define UAC_GET_RES			(UAC_GET_ | UAC__RES)
+#define UAC_SET_MEM			(UAC_SET_ | UAC__MEM)
+#define UAC_GET_MEM			(UAC_GET_ | UAC__MEM)
 
-#define SET_	0x00
-#define GET_	0x80
+#define UAC_GET_STAT			0xff
 
-#define _CUR	0x1
-#define _MIN	0x2
-#define _MAX	0x3
-#define _RES	0x4
-#define _MEM	0x5
+/* A.10 Control Selector Codes */
 
-#define SET_CUR		(SET_ | _CUR)
-#define GET_CUR		(GET_ | _CUR)
-#define SET_MIN		(SET_ | _MIN)
-#define GET_MIN		(GET_ | _MIN)
-#define SET_MAX		(SET_ | _MAX)
-#define GET_MAX		(GET_ | _MAX)
-#define SET_RES		(SET_ | _RES)
-#define GET_RES		(GET_ | _RES)
-#define SET_MEM		(SET_ | _MEM)
-#define GET_MEM		(GET_ | _MEM)
+/* A.10.1 Terminal Control Selectors */
+#define UAC_TERM_COPY_PROTECT		0x01
 
-#define GET_STAT	0xff
+/* A.10.2 Feature Unit Control Selectors */
+#define UAC_FU_MUTE			0x01
+#define UAC_FU_VOLUME			0x02
+#define UAC_FU_BASS			0x03
+#define UAC_FU_MID			0x04
+#define UAC_FU_TREBLE			0x05
+#define UAC_FU_GRAPHIC_EQUALIZER	0x06
+#define UAC_FU_AUTOMATIC_GAIN		0x07
+#define UAC_FU_DELAY			0x08
+#define UAC_FU_BASS_BOOST		0x09
+#define UAC_FU_LOUDNESS			0x0a
 
-#define USB_AC_TERMINAL_UNDEFINED	0x100
-#define USB_AC_TERMINAL_STREAMING	0x101
-#define USB_AC_TERMINAL_VENDOR_SPEC	0x1FF
+#define UAC_CONTROL_BIT(CS)	(1 << ((CS) - 1))
+
+/* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
+#define UAC_UD_ENABLE			0x01
+#define UAC_UD_MODE_SELECT		0x02
+
+/* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
+#define UAC_DP_ENABLE			0x01
+#define UAC_DP_MODE_SELECT		0x02
+
+/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
+#define UAC_3D_ENABLE			0x01
+#define UAC_3D_SPACE			0x02
+
+/* A.10.3.4 Reverberation Processing Unit Control Selectors */
+#define UAC_REVERB_ENABLE		0x01
+#define UAC_REVERB_LEVEL		0x02
+#define UAC_REVERB_TIME			0x03
+#define UAC_REVERB_FEEDBACK		0x04
+
+/* A.10.3.5 Chorus Processing Unit Control Selectors */
+#define UAC_CHORUS_ENABLE		0x01
+#define UAC_CHORUS_LEVEL		0x02
+#define UAC_CHORUS_RATE			0x03
+#define UAC_CHORUS_DEPTH		0x04
+
+/* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
+#define UAC_DCR_ENABLE			0x01
+#define UAC_DCR_RATE			0x02
+#define UAC_DCR_MAXAMPL			0x03
+#define UAC_DCR_THRESHOLD		0x04
+#define UAC_DCR_ATTACK_TIME		0x05
+#define UAC_DCR_RELEASE_TIME		0x06
+
+/* A.10.4 Extension Unit Control Selectors */
+#define UAC_XU_ENABLE			0x01
+
+/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
+#define UAC_MS_HEADER			0x01
+#define UAC_MIDI_IN_JACK		0x02
+#define UAC_MIDI_OUT_JACK		0x03
+
+/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
+#define UAC_MS_GENERAL			0x01
+
+/* Terminals - 2.1 USB Terminal Types */
+#define UAC_TERMINAL_UNDEFINED		0x100
+#define UAC_TERMINAL_STREAMING		0x101
+#define UAC_TERMINAL_VENDOR_SPEC	0x1FF
 
 /* Terminal Control Selectors */
 /* 4.3.2  Class-Specific AC Interface Descriptor */
-struct usb_ac_header_descriptor {
+struct uac1_ac_header_descriptor {
 	__u8  bLength;			/* 8 + n */
 	__u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */
-	__u8  bDescriptorSubtype;	/* USB_MS_HEADER */
+	__u8  bDescriptorSubtype;	/* UAC_MS_HEADER */
 	__le16 bcdADC;			/* 0x0100 */
 	__le16 wTotalLength;		/* includes Unit and Terminal desc. */
 	__u8  bInCollection;		/* n */
 	__u8  baInterfaceNr[];		/* [n] */
 } __attribute__ ((packed));
 
-#define USB_DT_AC_HEADER_SIZE(n)	(8 + (n))
+#define UAC_DT_AC_HEADER_SIZE(n)	(8 + (n))
 
 /* As above, but more useful for defining your own descriptors: */
-#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) 			\
-struct usb_ac_header_descriptor_##n {				\
+#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n)			\
+struct uac1_ac_header_descriptor_##n {			\
 	__u8  bLength;						\
 	__u8  bDescriptorType;					\
 	__u8  bDescriptorSubtype;				\
@@ -116,7 +176,7 @@
 } __attribute__ ((packed))
 
 /* 4.3.2.1 Input Terminal Descriptor */
-struct usb_input_terminal_descriptor {
+struct uac_input_terminal_descriptor {
 	__u8  bLength;			/* in bytes: 12 */
 	__u8  bDescriptorType;		/* CS_INTERFACE descriptor type */
 	__u8  bDescriptorSubtype;	/* INPUT_TERMINAL descriptor subtype */
@@ -129,18 +189,23 @@
 	__u8  iTerminal;
 } __attribute__ ((packed));
 
-#define USB_DT_AC_INPUT_TERMINAL_SIZE			12
+#define UAC_DT_INPUT_TERMINAL_SIZE			12
 
-#define USB_AC_INPUT_TERMINAL_UNDEFINED			0x200
-#define USB_AC_INPUT_TERMINAL_MICROPHONE		0x201
-#define USB_AC_INPUT_TERMINAL_DESKTOP_MICROPHONE	0x202
-#define USB_AC_INPUT_TERMINAL_PERSONAL_MICROPHONE	0x203
-#define USB_AC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE	0x204
-#define USB_AC_INPUT_TERMINAL_MICROPHONE_ARRAY		0x205
-#define USB_AC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY	0x206
+/* Terminals - 2.2 Input Terminal Types */
+#define UAC_INPUT_TERMINAL_UNDEFINED			0x200
+#define UAC_INPUT_TERMINAL_MICROPHONE			0x201
+#define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE		0x202
+#define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE		0x203
+#define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE		0x204
+#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY		0x205
+#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY	0x206
+
+/* Terminals - control selectors */
+
+#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL		0x01
 
 /* 4.3.2.2 Output Terminal Descriptor */
-struct usb_output_terminal_descriptor {
+struct uac1_output_terminal_descriptor {
 	__u8  bLength;			/* in bytes: 9 */
 	__u8  bDescriptorType;		/* CS_INTERFACE descriptor type */
 	__u8  bDescriptorSubtype;	/* OUTPUT_TERMINAL descriptor subtype */
@@ -151,23 +216,24 @@
 	__u8  iTerminal;
 } __attribute__ ((packed));
 
-#define USB_DT_AC_OUTPUT_TERMINAL_SIZE				9
+#define UAC_DT_OUTPUT_TERMINAL_SIZE			9
 
-#define USB_AC_OUTPUT_TERMINAL_UNDEFINED			0x300
-#define USB_AC_OUTPUT_TERMINAL_SPEAKER				0x301
-#define USB_AC_OUTPUT_TERMINAL_HEADPHONES			0x302
-#define USB_AC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO	0x303
-#define USB_AC_OUTPUT_TERMINAL_DESKTOP_SPEAKER			0x304
-#define USB_AC_OUTPUT_TERMINAL_ROOM_SPEAKER			0x305
-#define USB_AC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER		0x306
-#define USB_AC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER		0x307
+/* Terminals - 2.3 Output Terminal Types */
+#define UAC_OUTPUT_TERMINAL_UNDEFINED			0x300
+#define UAC_OUTPUT_TERMINAL_SPEAKER			0x301
+#define UAC_OUTPUT_TERMINAL_HEADPHONES			0x302
+#define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO	0x303
+#define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER		0x304
+#define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER		0x305
+#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER	0x306
+#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER	0x307
 
 /* Set bControlSize = 2 as default setting */
-#define USB_DT_AC_FEATURE_UNIT_SIZE(ch)		(7 + ((ch) + 1) * 2)
+#define UAC_DT_FEATURE_UNIT_SIZE(ch)		(7 + ((ch) + 1) * 2)
 
 /* As above, but more useful for defining your own descriptors: */
-#define DECLARE_USB_AC_FEATURE_UNIT_DESCRIPTOR(ch) 		\
-struct usb_ac_feature_unit_descriptor_##ch {			\
+#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch)			\
+struct uac_feature_unit_descriptor_##ch {			\
 	__u8  bLength;						\
 	__u8  bDescriptorType;					\
 	__u8  bDescriptorSubtype;				\
@@ -178,8 +244,158 @@
 	__u8  iFeature;						\
 } __attribute__ ((packed))
 
+/* 4.3.2.3 Mixer Unit Descriptor */
+struct uac_mixer_unit_descriptor {
+	__u8 bLength;
+	__u8 bDescriptorType;
+	__u8 bDescriptorSubtype;
+	__u8 bUnitID;
+	__u8 bNrInPins;
+	__u8 baSourceID[];
+} __attribute__ ((packed));
+
+static __inline__ __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
+{
+	return desc->baSourceID[desc->bNrInPins];
+}
+
+static __inline__ __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
+						  int protocol)
+{
+	if (protocol == UAC_VERSION_1)
+		return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
+			desc->baSourceID[desc->bNrInPins + 1];
+	else
+		return  (desc->baSourceID[desc->bNrInPins + 4] << 24) |
+			(desc->baSourceID[desc->bNrInPins + 3] << 16) |
+			(desc->baSourceID[desc->bNrInPins + 2] << 8)  |
+			(desc->baSourceID[desc->bNrInPins + 1]);
+}
+
+static __inline__ __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
+						int protocol)
+{
+	return (protocol == UAC_VERSION_1) ?
+		desc->baSourceID[desc->bNrInPins + 3] :
+		desc->baSourceID[desc->bNrInPins + 5];
+}
+
+static __inline__ __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
+					      int protocol)
+{
+	return (protocol == UAC_VERSION_1) ?
+		&desc->baSourceID[desc->bNrInPins + 4] :
+		&desc->baSourceID[desc->bNrInPins + 6];
+}
+
+static __inline__ __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
+{
+	__u8 *raw = (__u8 *) desc;
+	return raw[desc->bLength - 1];
+}
+
+/* 4.3.2.4 Selector Unit Descriptor */
+struct uac_selector_unit_descriptor {
+	__u8 bLength;
+	__u8 bDescriptorType;
+	__u8 bDescriptorSubtype;
+	__u8 bUintID;
+	__u8 bNrInPins;
+	__u8 baSourceID[];
+} __attribute__ ((packed));
+
+static __inline__ __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
+{
+	__u8 *raw = (__u8 *) desc;
+	return raw[desc->bLength - 1];
+}
+
+/* 4.3.2.5 Feature Unit Descriptor */
+struct uac_feature_unit_descriptor {
+	__u8 bLength;
+	__u8 bDescriptorType;
+	__u8 bDescriptorSubtype;
+	__u8 bUnitID;
+	__u8 bSourceID;
+	__u8 bControlSize;
+	__u8 bmaControls[0]; /* variable length */
+} __attribute__((packed));
+
+static __inline__ __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
+{
+	__u8 *raw = (__u8 *) desc;
+	return raw[desc->bLength - 1];
+}
+
+/* 4.3.2.6 Processing Unit Descriptors */
+struct uac_processing_unit_descriptor {
+	__u8 bLength;
+	__u8 bDescriptorType;
+	__u8 bDescriptorSubtype;
+	__u8 bUnitID;
+	__u16 wProcessType;
+	__u8 bNrInPins;
+	__u8 baSourceID[];
+} __attribute__ ((packed));
+
+static __inline__ __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
+{
+	return desc->baSourceID[desc->bNrInPins];
+}
+
+static __inline__ __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
+						       int protocol)
+{
+	if (protocol == UAC_VERSION_1)
+		return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
+			desc->baSourceID[desc->bNrInPins + 1];
+	else
+		return  (desc->baSourceID[desc->bNrInPins + 4] << 24) |
+			(desc->baSourceID[desc->bNrInPins + 3] << 16) |
+			(desc->baSourceID[desc->bNrInPins + 2] << 8)  |
+			(desc->baSourceID[desc->bNrInPins + 1]);
+}
+
+static __inline__ __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
+						     int protocol)
+{
+	return (protocol == UAC_VERSION_1) ?
+		desc->baSourceID[desc->bNrInPins + 3] :
+		desc->baSourceID[desc->bNrInPins + 5];
+}
+
+static __inline__ __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
+						    int protocol)
+{
+	return (protocol == UAC_VERSION_1) ?
+		desc->baSourceID[desc->bNrInPins + 4] :
+		desc->baSourceID[desc->bNrInPins + 6];
+}
+
+static __inline__ __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
+						   int protocol)
+{
+	return (protocol == UAC_VERSION_1) ?
+		&desc->baSourceID[desc->bNrInPins + 5] :
+		&desc->baSourceID[desc->bNrInPins + 7];
+}
+
+static __inline__ __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
+						   int protocol)
+{
+	__u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
+	return desc->baSourceID[desc->bNrInPins + control_size];
+}
+
+static __inline__ __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
+						 int protocol)
+{
+	__u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
+	return &desc->baSourceID[desc->bNrInPins + control_size + 1];
+}
+
 /* 4.5.2 Class-Specific AS Interface Descriptor */
-struct usb_as_header_descriptor {
+struct uac1_as_header_descriptor {
 	__u8  bLength;			/* in bytes: 7 */
 	__u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */
 	__u8  bDescriptorSubtype;	/* AS_GENERAL */
@@ -188,16 +404,17 @@
 	__le16 wFormatTag;		/* The Audio Data Format */
 } __attribute__ ((packed));
 
-#define USB_DT_AS_HEADER_SIZE		7
+#define UAC_DT_AS_HEADER_SIZE		7
 
-#define USB_AS_AUDIO_FORMAT_TYPE_I_UNDEFINED	0x0
-#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM		0x1
-#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM8		0x2
-#define USB_AS_AUDIO_FORMAT_TYPE_I_IEEE_FLOAT	0x3
-#define USB_AS_AUDIO_FORMAT_TYPE_I_ALAW		0x4
-#define USB_AS_AUDIO_FORMAT_TYPE_I_MULAW	0x5
+/* Formats - A.1.1 Audio Data Format Type I Codes */
+#define UAC_FORMAT_TYPE_I_UNDEFINED	0x0
+#define UAC_FORMAT_TYPE_I_PCM		0x1
+#define UAC_FORMAT_TYPE_I_PCM8		0x2
+#define UAC_FORMAT_TYPE_I_IEEE_FLOAT	0x3
+#define UAC_FORMAT_TYPE_I_ALAW		0x4
+#define UAC_FORMAT_TYPE_I_MULAW		0x5
 
-struct usb_as_format_type_i_continuous_descriptor {
+struct uac_format_type_i_continuous_descriptor {
 	__u8  bLength;			/* in bytes: 8 + (ns * 3) */
 	__u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */
 	__u8  bDescriptorSubtype;	/* FORMAT_TYPE */
@@ -210,9 +427,9 @@
 	__u8  tUpperSamFreq[3];
 } __attribute__ ((packed));
 
-#define USB_AS_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE	14
+#define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE	14
 
-struct usb_as_formate_type_i_discrete_descriptor {
+struct uac_format_type_i_discrete_descriptor {
 	__u8  bLength;			/* in bytes: 8 + (ns * 3) */
 	__u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */
 	__u8  bDescriptorSubtype;	/* FORMAT_TYPE */
@@ -224,8 +441,8 @@
 	__u8  tSamFreq[][3];
 } __attribute__ ((packed));
 
-#define DECLARE_USB_AS_FORMAT_TYPE_I_DISCRETE_DESC(n) 		\
-struct usb_as_formate_type_i_discrete_descriptor_##n {		\
+#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n)		\
+struct uac_format_type_i_discrete_descriptor_##n {		\
 	__u8  bLength;						\
 	__u8  bDescriptorType;					\
 	__u8  bDescriptorSubtype;				\
@@ -237,78 +454,92 @@
 	__u8  tSamFreq[n][3];					\
 } __attribute__ ((packed))
 
-#define USB_AS_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n)	(8 + (n * 3))
+#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n)	(8 + (n * 3))
 
-#define USB_AS_FORMAT_TYPE_UNDEFINED	0x0
-#define USB_AS_FORMAT_TYPE_I		0x1
-#define USB_AS_FORMAT_TYPE_II		0x2
-#define USB_AS_FORMAT_TYPE_III		0x3
+struct uac_format_type_i_ext_descriptor {
+	__u8 bLength;
+	__u8 bDescriptorType;
+	__u8 bDescriptorSubtype;
+	__u8 bFormatType;
+	__u8 bSubslotSize;
+	__u8 bBitResolution;
+	__u8 bHeaderLength;
+	__u8 bControlSize;
+	__u8 bSideBandProtocol;
+} __attribute__((packed));
 
-#define USB_AS_ENDPOINT_ASYNC		(1 << 2)
-#define USB_AS_ENDPOINT_ADAPTIVE	(2 << 2)
-#define USB_AS_ENDPOINT_SYNC		(3 << 2)
+/* Formats - Audio Data Format Type I Codes */
 
-struct usb_as_iso_endpoint_descriptor {
+#define UAC_FORMAT_TYPE_II_MPEG	0x1001
+#define UAC_FORMAT_TYPE_II_AC3	0x1002
+
+struct uac_format_type_ii_discrete_descriptor {
+	__u8 bLength;
+	__u8 bDescriptorType;
+	__u8 bDescriptorSubtype;
+	__u8 bFormatType;
+	__le16 wMaxBitRate;
+	__le16 wSamplesPerFrame;
+	__u8 bSamFreqType;
+	__u8 tSamFreq[][3];
+} __attribute__((packed));
+
+struct uac_format_type_ii_ext_descriptor {
+	__u8 bLength;
+	__u8 bDescriptorType;
+	__u8 bDescriptorSubtype;
+	__u8 bFormatType;
+	__u16 wMaxBitRate;
+	__u16 wSamplesPerFrame;
+	__u8 bHeaderLength;
+	__u8 bSideBandProtocol;
+} __attribute__((packed));
+
+/* type III */
+#define UAC_FORMAT_TYPE_III_IEC1937_AC3	0x2001
+#define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1	0x2002
+#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT	0x2003
+#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT	0x2004
+#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS	0x2005
+#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS	0x2006
+
+/* Formats - A.2 Format Type Codes */
+#define UAC_FORMAT_TYPE_UNDEFINED	0x0
+#define UAC_FORMAT_TYPE_I		0x1
+#define UAC_FORMAT_TYPE_II		0x2
+#define UAC_FORMAT_TYPE_III		0x3
+#define UAC_EXT_FORMAT_TYPE_I		0x81
+#define UAC_EXT_FORMAT_TYPE_II		0x82
+#define UAC_EXT_FORMAT_TYPE_III		0x83
+
+struct uac_iso_endpoint_descriptor {
 	__u8  bLength;			/* in bytes: 7 */
 	__u8  bDescriptorType;		/* USB_DT_CS_ENDPOINT */
 	__u8  bDescriptorSubtype;	/* EP_GENERAL */
 	__u8  bmAttributes;
 	__u8  bLockDelayUnits;
 	__le16 wLockDelay;
-};
-#define USB_AS_ISO_ENDPOINT_DESC_SIZE	7
+} __attribute__((packed));
+#define UAC_ISO_ENDPOINT_DESC_SIZE	7
 
-#define FU_CONTROL_UNDEFINED		0x00
-#define MUTE_CONTROL			0x01
-#define VOLUME_CONTROL			0x02
-#define BASS_CONTROL			0x03
-#define MID_CONTROL			0x04
-#define TREBLE_CONTROL			0x05
-#define GRAPHIC_EQUALIZER_CONTROL	0x06
-#define AUTOMATIC_GAIN_CONTROL		0x07
-#define DELAY_CONTROL			0x08
-#define BASS_BOOST_CONTROL		0x09
-#define LOUDNESS_CONTROL		0x0a
+#define UAC_EP_CS_ATTR_SAMPLE_RATE	0x01
+#define UAC_EP_CS_ATTR_PITCH_CONTROL	0x02
+#define UAC_EP_CS_ATTR_FILL_MAX		0x80
 
-#define FU_MUTE		(1 << (MUTE_CONTROL - 1))
-#define FU_VOLUME	(1 << (VOLUME_CONTROL - 1))
-#define FU_BASS		(1 << (BASS_CONTROL - 1))
-#define FU_MID		(1 << (MID_CONTROL - 1))
-#define FU_TREBLE	(1 << (TREBLE_CONTROL - 1))
-#define FU_GRAPHIC_EQ	(1 << (GRAPHIC_EQUALIZER_CONTROL - 1))
-#define FU_AUTO_GAIN	(1 << (AUTOMATIC_GAIN_CONTROL - 1))
-#define FU_DELAY	(1 << (DELAY_CONTROL - 1))
-#define FU_BASS_BOOST	(1 << (BASS_BOOST_CONTROL - 1))
-#define FU_LOUDNESS	(1 << (LOUDNESS_CONTROL - 1))
+/* status word format (3.7.1.1) */
 
-struct usb_audio_control {
-	struct list_head list;
-	const char *name;
-	u8 type;
-	int data[5];
-	int (*set)(struct usb_audio_control *con, u8 cmd, int value);
-	int (*get)(struct usb_audio_control *con, u8 cmd);
-};
+#define UAC1_STATUS_TYPE_ORIG_MASK		0x0f
+#define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF	0x0
+#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF	0x1
+#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP	0x2
 
-static __inline__ int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value)
-{
-	con->data[cmd] = value;
+#define UAC1_STATUS_TYPE_IRQ_PENDING		(1 << 7)
+#define UAC1_STATUS_TYPE_MEM_CHANGED		(1 << 6)
 
-	return 0;
-}
+struct uac1_status_word {
+	__u8 bStatusType;
+	__u8 bOriginator;
+} __attribute__((packed));
 
-static __inline__ int generic_get_cmd(struct usb_audio_control *con, u8 cmd)
-{
-	return con->data[cmd];
-}
-
-struct usb_audio_control_selector {
-	struct list_head list;
-	struct list_head control;
-	u8 id;
-	const char *name;
-	u8 type;
-	struct usb_descriptor_header *desc;
-};
 
 #endif /* __LINUX_USB_AUDIO_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/cdc.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/cdc.h
index c24124a..81a9279 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/cdc.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/cdc.h
@@ -18,6 +18,7 @@
 #define USB_CDC_SUBCLASS_MDLM			0x0a
 #define USB_CDC_SUBCLASS_OBEX			0x0b
 #define USB_CDC_SUBCLASS_EEM			0x0c
+#define USB_CDC_SUBCLASS_NCM			0x0d
 
 #define USB_CDC_PROTO_NONE			0
 
@@ -31,6 +32,8 @@
 
 #define USB_CDC_PROTO_EEM			7
 
+#define USB_CDC_NCM_PROTO_NTB			1
+
 /*-------------------------------------------------------------------------*/
 
 /*
@@ -49,6 +52,7 @@
 #define USB_CDC_MDLM_DETAIL_TYPE	0x13	/* mdlm_detail_desc */
 #define USB_CDC_DMM_TYPE		0x14
 #define USB_CDC_OBEX_TYPE		0x15
+#define USB_CDC_NCM_TYPE		0x1a
 
 /* "Header Functional Descriptor" from CDC spec  5.2.3.1 */
 struct usb_cdc_header_desc {
@@ -85,7 +89,7 @@
 
 #define USB_CDC_COMM_FEATURE	0x01
 #define USB_CDC_CAP_LINE	0x02
-#define USB_CDC_CAP_BRK	0x04
+#define USB_CDC_CAP_BRK		0x04
 #define USB_CDC_CAP_NOTIFY	0x08
 
 /* "Union Functional Descriptor" from CDC spec 5.2.3.8 */
@@ -174,6 +178,15 @@
 	__le16	bcdVersion;
 } __attribute__ ((packed));
 
+/* "NCM Control Model Functional Descriptor" */
+struct usb_cdc_ncm_desc {
+	__u8	bLength;
+	__u8	bDescriptorType;
+	__u8	bDescriptorSubType;
+
+	__le16	bcdNcmVersion;
+	__u8	bmNetworkCapabilities;
+} __attribute__ ((packed));
 /*-------------------------------------------------------------------------*/
 
 /*
@@ -197,6 +210,17 @@
 #define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER	0x42
 #define USB_CDC_SET_ETHERNET_PACKET_FILTER	0x43
 #define USB_CDC_GET_ETHERNET_STATISTIC		0x44
+#define USB_CDC_GET_NTB_PARAMETERS		0x80
+#define USB_CDC_GET_NET_ADDRESS			0x81
+#define USB_CDC_SET_NET_ADDRESS			0x82
+#define USB_CDC_GET_NTB_FORMAT			0x83
+#define USB_CDC_SET_NTB_FORMAT			0x84
+#define USB_CDC_GET_NTB_INPUT_SIZE		0x85
+#define USB_CDC_SET_NTB_INPUT_SIZE		0x86
+#define USB_CDC_GET_MAX_DATAGRAM_SIZE		0x87
+#define USB_CDC_SET_MAX_DATAGRAM_SIZE		0x88
+#define USB_CDC_GET_CRC_MODE			0x89
+#define USB_CDC_SET_CRC_MODE			0x8a
 
 /* Line Coding Structure from CDC spec 6.2.13 */
 struct usb_cdc_line_coding {
@@ -247,4 +271,142 @@
 	__le16	wLength;
 } __attribute__ ((packed));
 
+struct usb_cdc_speed_change {
+	__le32	DLBitRRate;	/* contains the downlink bit rate (IN pipe) */
+	__le32	ULBitRate;	/* contains the uplink bit rate (OUT pipe) */
+} __attribute__ ((packed));
+
+/*-------------------------------------------------------------------------*/
+
+/*
+ * Class Specific structures and constants
+ *
+ * CDC NCM NTB parameters structure, CDC NCM subclass 6.2.1
+ *
+ */
+
+struct usb_cdc_ncm_ntb_parameters {
+	__le16	wLength;
+	__le16	bmNtbFormatsSupported;
+	__le32	dwNtbInMaxSize;
+	__le16	wNdpInDivisor;
+	__le16	wNdpInPayloadRemainder;
+	__le16	wNdpInAlignment;
+	__le16	wPadding1;
+	__le32	dwNtbOutMaxSize;
+	__le16	wNdpOutDivisor;
+	__le16	wNdpOutPayloadRemainder;
+	__le16	wNdpOutAlignment;
+	__le16	wNtbOutMaxDatagrams;
+} __attribute__ ((packed));
+
+/*
+ * CDC NCM transfer headers, CDC NCM subclass 3.2
+ */
+
+#define USB_CDC_NCM_NTH16_SIGN		0x484D434E /* NCMH */
+#define USB_CDC_NCM_NTH32_SIGN		0x686D636E /* ncmh */
+
+struct usb_cdc_ncm_nth16 {
+	__le32	dwSignature;
+	__le16	wHeaderLength;
+	__le16	wSequence;
+	__le16	wBlockLength;
+	__le16	wNdpIndex;
+} __attribute__ ((packed));
+
+struct usb_cdc_ncm_nth32 {
+	__le32	dwSignature;
+	__le16	wHeaderLength;
+	__le16	wSequence;
+	__le32	dwBlockLength;
+	__le32	dwNdpIndex;
+} __attribute__ ((packed));
+
+/*
+ * CDC NCM datagram pointers, CDC NCM subclass 3.3
+ */
+
+#define USB_CDC_NCM_NDP16_CRC_SIGN	0x314D434E /* NCM1 */
+#define USB_CDC_NCM_NDP16_NOCRC_SIGN	0x304D434E /* NCM0 */
+#define USB_CDC_NCM_NDP32_CRC_SIGN	0x316D636E /* ncm1 */
+#define USB_CDC_NCM_NDP32_NOCRC_SIGN	0x306D636E /* ncm0 */
+
+/* 16-bit NCM Datagram Pointer Entry */
+struct usb_cdc_ncm_dpe16 {
+	__le16	wDatagramIndex;
+	__le16	wDatagramLength;
+} __attribute__((__packed__));
+
+/* 16-bit NCM Datagram Pointer Table */
+struct usb_cdc_ncm_ndp16 {
+	__le32	dwSignature;
+	__le16	wLength;
+	__le16	wNextNdpIndex;
+	struct	usb_cdc_ncm_dpe16 dpe16[0];
+} __attribute__ ((packed));
+
+/* 32-bit NCM Datagram Pointer Entry */
+struct usb_cdc_ncm_dpe32 {
+	__le32	dwDatagramIndex;
+	__le32	dwDatagramLength;
+} __attribute__((__packed__));
+
+/* 32-bit NCM Datagram Pointer Table */
+struct usb_cdc_ncm_ndp32 {
+	__le32	dwSignature;
+	__le16	wLength;
+	__le16	wReserved6;
+	__le32	dwNextNdpIndex;
+	__le32	dwReserved12;
+	struct	usb_cdc_ncm_dpe32 dpe32[0];
+} __attribute__ ((packed));
+
+/* CDC NCM subclass 3.2.1 and 3.2.2 */
+#define USB_CDC_NCM_NDP16_INDEX_MIN			0x000C
+#define USB_CDC_NCM_NDP32_INDEX_MIN			0x0010
+
+/* CDC NCM subclass 3.3.3 Datagram Formatting */
+#define USB_CDC_NCM_DATAGRAM_FORMAT_CRC			0x30
+#define USB_CDC_NCM_DATAGRAM_FORMAT_NOCRC		0X31
+
+/* CDC NCM subclass 4.2 NCM Communications Interface Protocol Code */
+#define USB_CDC_NCM_PROTO_CODE_NO_ENCAP_COMMANDS	0x00
+#define USB_CDC_NCM_PROTO_CODE_EXTERN_PROTO		0xFE
+
+/* CDC NCM subclass 5.2.1 NCM Functional Descriptor, bmNetworkCapabilities */
+#define USB_CDC_NCM_NCAP_ETH_FILTER			(1 << 0)
+#define USB_CDC_NCM_NCAP_NET_ADDRESS			(1 << 1)
+#define USB_CDC_NCM_NCAP_ENCAP_COMMAND			(1 << 2)
+#define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE		(1 << 3)
+#define USB_CDC_NCM_NCAP_CRC_MODE			(1 << 4)
+#define	USB_CDC_NCM_NCAP_NTB_INPUT_SIZE			(1 << 5)
+
+/* CDC NCM subclass Table 6-3: NTB Parameter Structure */
+#define USB_CDC_NCM_NTB16_SUPPORTED			(1 << 0)
+#define USB_CDC_NCM_NTB32_SUPPORTED			(1 << 1)
+
+/* CDC NCM subclass Table 6-3: NTB Parameter Structure */
+#define USB_CDC_NCM_NDP_ALIGN_MIN_SIZE			0x04
+#define USB_CDC_NCM_NTB_MAX_LENGTH			0x1C
+
+/* CDC NCM subclass 6.2.5 SetNtbFormat */
+#define USB_CDC_NCM_NTB16_FORMAT			0x00
+#define USB_CDC_NCM_NTB32_FORMAT			0x01
+
+/* CDC NCM subclass 6.2.7 SetNtbInputSize */
+#define USB_CDC_NCM_NTB_MIN_IN_SIZE			2048
+#define USB_CDC_NCM_NTB_MIN_OUT_SIZE			2048
+
+/* NTB Input Size Structure */
+struct usb_cdc_ncm_ndp_input_size {
+	__le32	dwNtbInMaxSize;
+	__le16	wNtbInMaxDatagrams;
+	__le16	wReserved;
+} __attribute__ ((packed));
+
+/* CDC NCM subclass 6.2.11 SetCrcMode */
+#define USB_CDC_NCM_CRC_NOT_APPENDED			0x00
+#define USB_CDC_NCM_CRC_APPENDED			0x01
+
 #endif /* __LINUX_USB_CDC_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/ch11.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/ch11.h
new file mode 100644
index 0000000..0b83acd
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/ch11.h
@@ -0,0 +1,259 @@
+/*
+ * This file holds Hub protocol constants and data structures that are
+ * defined in chapter 11 (Hub Specification) of the USB 2.0 specification.
+ *
+ * It is used/shared between the USB core, the HCDs and couple of other USB
+ * drivers.
+ */
+
+#ifndef __LINUX_CH11_H
+#define __LINUX_CH11_H
+
+#include <linux/types.h>	/* __u8 etc */
+
+/*
+ * Hub request types
+ */
+
+#define USB_RT_HUB	(USB_TYPE_CLASS | USB_RECIP_DEVICE)
+#define USB_RT_PORT	(USB_TYPE_CLASS | USB_RECIP_OTHER)
+
+/*
+ * Hub class requests
+ * See USB 2.0 spec Table 11-16
+ */
+#define HUB_CLEAR_TT_BUFFER	8
+#define HUB_RESET_TT		9
+#define HUB_GET_TT_STATE	10
+#define HUB_STOP_TT		11
+
+/*
+ * Hub class additional requests defined by USB 3.0 spec
+ * See USB 3.0 spec Table 10-6
+ */
+#define HUB_SET_DEPTH		12
+#define HUB_GET_PORT_ERR_COUNT	13
+
+/*
+ * Hub Class feature numbers
+ * See USB 2.0 spec Table 11-17
+ */
+#define C_HUB_LOCAL_POWER	0
+#define C_HUB_OVER_CURRENT	1
+
+/*
+ * Port feature numbers
+ * See USB 2.0 spec Table 11-17
+ */
+#define USB_PORT_FEAT_CONNECTION	0
+#define USB_PORT_FEAT_ENABLE		1
+#define USB_PORT_FEAT_SUSPEND		2	/* L2 suspend */
+#define USB_PORT_FEAT_OVER_CURRENT	3
+#define USB_PORT_FEAT_RESET		4
+#define USB_PORT_FEAT_L1		5	/* L1 suspend */
+#define USB_PORT_FEAT_POWER		8
+#define USB_PORT_FEAT_LOWSPEED		9	/* Should never be used */
+#define USB_PORT_FEAT_C_CONNECTION	16
+#define USB_PORT_FEAT_C_ENABLE		17
+#define USB_PORT_FEAT_C_SUSPEND		18
+#define USB_PORT_FEAT_C_OVER_CURRENT	19
+#define USB_PORT_FEAT_C_RESET		20
+#define USB_PORT_FEAT_TEST              21
+#define USB_PORT_FEAT_INDICATOR         22
+#define USB_PORT_FEAT_C_PORT_L1         23
+
+/*
+ * Port feature selectors added by USB 3.0 spec.
+ * See USB 3.0 spec Table 10-7
+ */
+#define USB_PORT_FEAT_LINK_STATE		5
+#define USB_PORT_FEAT_U1_TIMEOUT		23
+#define USB_PORT_FEAT_U2_TIMEOUT		24
+#define USB_PORT_FEAT_C_PORT_LINK_STATE		25
+#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR	26
+#define USB_PORT_FEAT_REMOTE_WAKE_MASK		27
+#define USB_PORT_FEAT_BH_PORT_RESET		28
+#define USB_PORT_FEAT_C_BH_PORT_RESET		29
+#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT	30
+
+/*
+ * Hub Status and Hub Change results
+ * See USB 2.0 spec Table 11-19 and Table 11-20
+ */
+struct usb_port_status {
+	__le16 wPortStatus;
+	__le16 wPortChange;
+} __attribute__ ((packed));
+
+/*
+ * wPortStatus bit field
+ * See USB 2.0 spec Table 11-21
+ */
+#define USB_PORT_STAT_CONNECTION	0x0001
+#define USB_PORT_STAT_ENABLE		0x0002
+#define USB_PORT_STAT_SUSPEND		0x0004
+#define USB_PORT_STAT_OVERCURRENT	0x0008
+#define USB_PORT_STAT_RESET		0x0010
+#define USB_PORT_STAT_L1		0x0020
+/* bits 6 to 7 are reserved */
+#define USB_PORT_STAT_POWER		0x0100
+#define USB_PORT_STAT_LOW_SPEED		0x0200
+#define USB_PORT_STAT_HIGH_SPEED        0x0400
+#define USB_PORT_STAT_TEST              0x0800
+#define USB_PORT_STAT_INDICATOR         0x1000
+/* bits 13 to 15 are reserved */
+
+/*
+ * Additions to wPortStatus bit field from USB 3.0
+ * See USB 3.0 spec Table 10-10
+ */
+#define USB_PORT_STAT_LINK_STATE	0x01e0
+#define USB_SS_PORT_STAT_POWER		0x0200
+#define USB_SS_PORT_STAT_SPEED		0x1c00
+#define USB_PORT_STAT_SPEED_5GBPS	0x0000
+/* Valid only if port is enabled */
+/* Bits that are the same from USB 2.0 */
+#define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION |	    \
+				USB_PORT_STAT_ENABLE |	    \
+				USB_PORT_STAT_OVERCURRENT | \
+				USB_PORT_STAT_RESET)
+
+/*
+ * Definitions for PORT_LINK_STATE values
+ * (bits 5-8) in wPortStatus
+ */
+#define USB_SS_PORT_LS_U0		0x0000
+#define USB_SS_PORT_LS_U1		0x0020
+#define USB_SS_PORT_LS_U2		0x0040
+#define USB_SS_PORT_LS_U3		0x0060
+#define USB_SS_PORT_LS_SS_DISABLED	0x0080
+#define USB_SS_PORT_LS_RX_DETECT	0x00a0
+#define USB_SS_PORT_LS_SS_INACTIVE	0x00c0
+#define USB_SS_PORT_LS_POLLING		0x00e0
+#define USB_SS_PORT_LS_RECOVERY		0x0100
+#define USB_SS_PORT_LS_HOT_RESET	0x0120
+#define USB_SS_PORT_LS_COMP_MOD		0x0140
+#define USB_SS_PORT_LS_LOOPBACK		0x0160
+
+/*
+ * wPortChange bit field
+ * See USB 2.0 spec Table 11-22 and USB 2.0 LPM ECN Table-4.10
+ * Bits 0 to 5 shown, bits 6 to 15 are reserved
+ */
+#define USB_PORT_STAT_C_CONNECTION	0x0001
+#define USB_PORT_STAT_C_ENABLE		0x0002
+#define USB_PORT_STAT_C_SUSPEND		0x0004
+#define USB_PORT_STAT_C_OVERCURRENT	0x0008
+#define USB_PORT_STAT_C_RESET		0x0010
+#define USB_PORT_STAT_C_L1		0x0020
+/*
+ * USB 3.0 wPortChange bit fields
+ * See USB 3.0 spec Table 10-11
+ */
+#define USB_PORT_STAT_C_BH_RESET	0x0020
+#define USB_PORT_STAT_C_LINK_STATE	0x0040
+#define USB_PORT_STAT_C_CONFIG_ERROR	0x0080
+
+/*
+ * wHubCharacteristics (masks)
+ * See USB 2.0 spec Table 11-13, offset 3
+ */
+#define HUB_CHAR_LPSM		0x0003 /* Logical Power Switching Mode mask */
+#define HUB_CHAR_COMMON_LPSM	0x0000 /* All ports power control at once */
+#define HUB_CHAR_INDV_PORT_LPSM	0x0001 /* per-port power control */
+#define HUB_CHAR_NO_LPSM	0x0002 /* no power switching */
+
+#define HUB_CHAR_COMPOUND	0x0004 /* hub is part of a compound device */
+
+#define HUB_CHAR_OCPM		0x0018 /* Over-Current Protection Mode mask */
+#define HUB_CHAR_COMMON_OCPM	0x0000 /* All ports Over-Current reporting */
+#define HUB_CHAR_INDV_PORT_OCPM	0x0008 /* per-port Over-current reporting */
+#define HUB_CHAR_NO_OCPM	0x0010 /* No Over-current Protection support */
+
+#define HUB_CHAR_TTTT		0x0060 /* TT Think Time mask */
+#define HUB_CHAR_PORTIND	0x0080 /* per-port indicators (LEDs) */
+
+struct usb_hub_status {
+	__le16 wHubStatus;
+	__le16 wHubChange;
+} __attribute__ ((packed));
+
+/*
+ * Hub Status & Hub Change bit masks
+ * See USB 2.0 spec Table 11-19 and Table 11-20
+ * Bits 0 and 1 for wHubStatus and wHubChange
+ * Bits 2 to 15 are reserved for both
+ */
+#define HUB_STATUS_LOCAL_POWER	0x0001
+#define HUB_STATUS_OVERCURRENT	0x0002
+#define HUB_CHANGE_LOCAL_POWER	0x0001
+#define HUB_CHANGE_OVERCURRENT	0x0002
+
+
+/*
+ * Hub descriptor
+ * See USB 2.0 spec Table 11-13
+ */
+
+#define USB_DT_HUB			(USB_TYPE_CLASS | 0x09)
+#define USB_DT_SS_HUB			(USB_TYPE_CLASS | 0x0a)
+#define USB_DT_HUB_NONVAR_SIZE		7
+#define USB_DT_SS_HUB_SIZE              12
+
+/*
+ * Hub Device descriptor
+ * USB Hub class device protocols
+ */
+
+#define USB_HUB_PR_FS		0 /* Full speed hub */
+#define USB_HUB_PR_HS_NO_TT	0 /* Hi-speed hub without TT */
+#define USB_HUB_PR_HS_SINGLE_TT	1 /* Hi-speed hub with single TT */
+#define USB_HUB_PR_HS_MULTI_TT	2 /* Hi-speed hub with multiple TT */
+#define USB_HUB_PR_SS		3 /* Super speed hub */
+
+struct usb_hub_descriptor {
+	__u8  bDescLength;
+	__u8  bDescriptorType;
+	__u8  bNbrPorts;
+	__le16 wHubCharacteristics;
+	__u8  bPwrOn2PwrGood;
+	__u8  bHubContrCurrent;
+
+	/* 2.0 and 3.0 hubs differ here */
+	union {
+		struct {
+			/* add 1 bit for hub status change; round to bytes */
+			__u8  DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
+			__u8  PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
+		}  __attribute__ ((packed)) hs;
+
+		struct {
+			__u8 bHubHdrDecLat;
+			__u16 wHubDelay;
+			__u16 DeviceRemovable;
+		}  __attribute__ ((packed)) ss;
+	} u;
+} __attribute__ ((packed));
+
+/* port indicator status selectors, tables 11-7 and 11-25 */
+#define HUB_LED_AUTO	0
+#define HUB_LED_AMBER	1
+#define HUB_LED_GREEN	2
+#define HUB_LED_OFF	3
+
+enum hub_led_mode {
+	INDICATOR_AUTO = 0,
+	INDICATOR_CYCLE,
+	/* software blinks for attention:  software, hardware, reserved */
+	INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
+	INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
+	INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
+} __attribute__ ((packed));
+
+/* Transaction Translator Think Times, in bits */
+#define HUB_TTTT_8_BITS		0x00
+#define HUB_TTTT_16_BITS	0x20
+#define HUB_TTTT_24_BITS	0x40
+#define HUB_TTTT_32_BITS	0x60
+
+#endif /* __LINUX_CH11_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/ch9.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/ch9.h
index 5d8b520..467bd4e 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/ch9.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/ch9.h
@@ -34,6 +34,7 @@
 #define __LINUX_USB_CH9_H
 
 #include <linux/types.h>	/* __u8 etc */
+#include <asm/byteorder.h>	/* le16_to_cpu */
 
 /*-------------------------------------------------------------------------*/
 
@@ -123,8 +124,38 @@
 #define USB_DEVICE_A_ALT_HNP_SUPPORT	5	/* (otg) other RH port does */
 #define USB_DEVICE_DEBUG_MODE		6	/* (special devices only) */
 
+/*
+ * Test Mode Selectors
+ * See USB 2.0 spec Table 9-7
+ */
+#define	TEST_J		1
+#define	TEST_K		2
+#define	TEST_SE0_NAK	3
+#define	TEST_PACKET	4
+#define	TEST_FORCE_EN	5
+
+/*
+ * New Feature Selectors as added by USB 3.0
+ * See USB 3.0 spec Table 9-6
+ */
+#define USB_DEVICE_U1_ENABLE	48	/* dev may initiate U1 transition */
+#define USB_DEVICE_U2_ENABLE	49	/* dev may initiate U2 transition */
+#define USB_DEVICE_LTM_ENABLE	50	/* dev may send LTM */
+#define USB_INTRF_FUNC_SUSPEND	0	/* function suspend */
+
+#define USB_INTR_FUNC_SUSPEND_OPT_MASK	0xFF00
+/*
+ * Suspend Options, Table 9-7 USB 3.0 spec
+ */
+#define USB_INTRF_FUNC_SUSPEND_LP	(1 << (8 + 0))
+#define USB_INTRF_FUNC_SUSPEND_RW	(1 << (8 + 1))
+
 #define USB_ENDPOINT_HALT		0	/* IN/OUT will STALL */
 
+/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
+#define USB_DEV_STAT_U1_ENABLED		2	/* transition into U1 state */
+#define USB_DEV_STAT_U2_ENABLED		3	/* transition into U2 state */
+#define USB_DEV_STAT_LTM_ENABLED	4	/* Latency tolerance messages */
 
 /**
  * struct usb_ctrlrequest - SETUP data for a USB device control request
@@ -191,6 +222,8 @@
 #define USB_DT_WIRE_ADAPTER		0x21
 #define USB_DT_RPIPE			0x22
 #define USB_DT_CS_RADIO_CONTROL		0x23
+/* From the T10 UAS specification */
+#define USB_DT_PIPE_USAGE		0x24
 /* From the USB 3.0 spec */
 #define	USB_DT_SS_ENDPOINT_COMP		0x30
 
@@ -258,6 +291,8 @@
 #define USB_CLASS_APP_SPEC		0xfe
 #define USB_CLASS_VENDOR_SPEC		0xff
 
+#define USB_SUBCLASS_VENDOR_SPEC	0xff
+
 /*-------------------------------------------------------------------------*/
 
 /* USB_DT_CONFIG: Configuration descriptor information.
@@ -355,6 +390,17 @@
 #define USB_ENDPOINT_XFER_INT		3
 #define USB_ENDPOINT_MAX_ADJUSTABLE	0x80
 
+#define USB_ENDPOINT_SYNCTYPE		0x0c
+#define USB_ENDPOINT_SYNC_NONE		(0 << 2)
+#define USB_ENDPOINT_SYNC_ASYNC		(1 << 2)
+#define USB_ENDPOINT_SYNC_ADAPTIVE	(2 << 2)
+#define USB_ENDPOINT_SYNC_SYNC		(3 << 2)
+
+#define USB_ENDPOINT_USAGE_MASK		0x30
+#define USB_ENDPOINT_USAGE_DATA		0x00
+#define USB_ENDPOINT_USAGE_FEEDBACK	0x10
+#define USB_ENDPOINT_USAGE_IMPLICIT_FB	0x20	/* Implicit feedback Data endpoint */
+
 /*-------------------------------------------------------------------------*/
 
 /**
@@ -467,7 +513,7 @@
 static __inline__ int usb_endpoint_is_bulk_in(
 				const struct usb_endpoint_descriptor *epd)
 {
-	return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
+	return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
 }
 
 /**
@@ -480,7 +526,7 @@
 static __inline__ int usb_endpoint_is_bulk_out(
 				const struct usb_endpoint_descriptor *epd)
 {
-	return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
+	return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
 }
 
 /**
@@ -493,7 +539,7 @@
 static __inline__ int usb_endpoint_is_int_in(
 				const struct usb_endpoint_descriptor *epd)
 {
-	return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
+	return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
 }
 
 /**
@@ -506,7 +552,7 @@
 static __inline__ int usb_endpoint_is_int_out(
 				const struct usb_endpoint_descriptor *epd)
 {
-	return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
+	return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
 }
 
 /**
@@ -519,7 +565,7 @@
 static __inline__ int usb_endpoint_is_isoc_in(
 				const struct usb_endpoint_descriptor *epd)
 {
-	return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
+	return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
 }
 
 /**
@@ -532,7 +578,18 @@
 static __inline__ int usb_endpoint_is_isoc_out(
 				const struct usb_endpoint_descriptor *epd)
 {
-	return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
+	return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
+}
+
+/**
+ * usb_endpoint_maxp - get endpoint's max packet size
+ * @epd: endpoint to be checked
+ *
+ * Returns @epd's max packet
+ */
+static __inline__ int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
+{
+	return __le16_to_cpu(epd->wMaxPacketSize);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -544,11 +601,33 @@
 
 	__u8  bMaxBurst;
 	__u8  bmAttributes;
-	__u16 wBytesPerInterval;
+	__le16 wBytesPerInterval;
 } __attribute__ ((packed));
 
 #define USB_DT_SS_EP_COMP_SIZE		6
 
+/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
+static __inline__ int
+usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
+{
+	int		max_streams;
+
+	if (!comp)
+		return 0;
+
+	max_streams = comp->bmAttributes & 0x1f;
+
+	if (!max_streams)
+		return 0;
+
+	max_streams = 1 << max_streams;
+
+	return max_streams;
+}
+
+/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
+#define USB_SS_MULT(p)			(1 + ((p) & 0x3))
+
 /*-------------------------------------------------------------------------*/
 
 /* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
@@ -663,6 +742,7 @@
 	__u8  bNumDeviceCaps;
 } __attribute__((packed));
 
+#define USB_DT_BOS_SIZE		5
 /*-------------------------------------------------------------------------*/
 
 /* USB_DT_DEVICE_CAPABILITY:  grouped with BOS */
@@ -700,16 +780,56 @@
 	__u8  bReserved;
 } __attribute__((packed));
 
+/* USB 2.0 Extension descriptor */
 #define	USB_CAP_TYPE_EXT		2
 
 struct usb_ext_cap_descriptor {		/* Link Power Management */
 	__u8  bLength;
 	__u8  bDescriptorType;
 	__u8  bDevCapabilityType;
-	__u8  bmAttributes;
+	__le32 bmAttributes;
 #define USB_LPM_SUPPORT			(1 << 1)	/* supports LPM */
 } __attribute__((packed));
 
+#define USB_DT_USB_EXT_CAP_SIZE	7
+
+/*
+ * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB
+ * specific device level capabilities
+ */
+#define		USB_SS_CAP_TYPE		3
+struct usb_ss_cap_descriptor {		/* Link Power Management */
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDevCapabilityType;
+	__u8  bmAttributes;
+#define USB_LTM_SUPPORT			(1 << 1) /* supports LTM */
+	__le16 wSpeedSupported;
+#define USB_LOW_SPEED_OPERATION		(1)	 /* Low speed operation */
+#define USB_FULL_SPEED_OPERATION	(1 << 1) /* Full speed operation */
+#define USB_HIGH_SPEED_OPERATION	(1 << 2) /* High speed operation */
+#define USB_5GBPS_OPERATION		(1 << 3) /* Operation at 5Gbps */
+	__u8  bFunctionalitySupport;
+	__u8  bU1devExitLat;
+	__le16 bU2DevExitLat;
+} __attribute__((packed));
+
+#define USB_DT_USB_SS_CAP_SIZE	10
+
+/*
+ * Container ID Capability descriptor: Defines the instance unique ID used to
+ * identify the instance across all operating modes
+ */
+#define	CONTAINER_ID_TYPE	4
+struct usb_ss_container_id_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDevCapabilityType;
+	__u8  bReserved;
+	__u8  ContainerID[16]; /* 128-bit number */
+} __attribute__((packed));
+
+#define USB_DT_USB_SS_CONTN_ID_SIZE	20
 /*-------------------------------------------------------------------------*/
 
 /* USB_DT_WIRELESS_ENDPOINT_COMP:  companion descriptor associated with
@@ -767,10 +887,11 @@
 	USB_SPEED_UNKNOWN = 0,			/* enumerating */
 	USB_SPEED_LOW, USB_SPEED_FULL,		/* usb 1.1 */
 	USB_SPEED_HIGH,				/* usb 2.0 */
-	USB_SPEED_VARIABLE,			/* wireless (usb 2.5) */
+	USB_SPEED_WIRELESS,			/* wireless (usb 2.5) */
 	USB_SPEED_SUPER,			/* usb 3.0 */
 };
 
+
 enum usb_device_state {
 	/* NOTATTACHED isn't in the USB spec, and this state acts
 	 * the same as ATTACHED ... but it's clearer this way.
@@ -796,4 +917,14 @@
 	 */
 };
 
+/*-------------------------------------------------------------------------*/
+
+/*
+ * As per USB compliance update, a device that is actively drawing
+ * more than 100mA from USB must report itself as bus-powered in
+ * the GetStatus(DEVICE) call.
+ * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34
+ */
+#define USB_SELF_POWER_VBUS_MAX_DRAW		100
+
 #endif /* __LINUX_USB_CH9_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/functionfs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/functionfs.h
new file mode 100644
index 0000000..53a3f30
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/functionfs.h
@@ -0,0 +1,167 @@
+#ifndef __LINUX_FUNCTIONFS_H__
+#define __LINUX_FUNCTIONFS_H__ 1
+
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+#include <linux/usb/ch9.h>
+
+
+enum {
+	FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
+	FUNCTIONFS_STRINGS_MAGIC     = 2
+};
+
+
+
+/* Descriptor of an non-audio endpoint */
+struct usb_endpoint_descriptor_no_audio {
+	__u8  bLength;
+	__u8  bDescriptorType;
+
+	__u8  bEndpointAddress;
+	__u8  bmAttributes;
+	__le16 wMaxPacketSize;
+	__u8  bInterval;
+} __attribute__((packed));
+
+
+/*
+ * All numbers must be in little endian order.
+ */
+
+struct usb_functionfs_descs_head {
+	__le32 magic;
+	__le32 length;
+	__le32 fs_count;
+	__le32 hs_count;
+} __attribute__((packed));
+
+/*
+ * Descriptors format:
+ *
+ * | off | name      | type         | description                          |
+ * |-----+-----------+--------------+--------------------------------------|
+ * |   0 | magic     | LE32         | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC |
+ * |   4 | length    | LE32         | length of the whole data chunk       |
+ * |   8 | fs_count  | LE32         | number of full-speed descriptors     |
+ * |  12 | hs_count  | LE32         | number of high-speed descriptors     |
+ * |  16 | fs_descrs | Descriptor[] | list of full-speed descriptors       |
+ * |     | hs_descrs | Descriptor[] | list of high-speed descriptors       |
+ *
+ * descs are just valid USB descriptors and have the following format:
+ *
+ * | off | name            | type | description              |
+ * |-----+-----------------+------+--------------------------|
+ * |   0 | bLength         | U8   | length of the descriptor |
+ * |   1 | bDescriptorType | U8   | descriptor type          |
+ * |   2 | payload         |      | descriptor's payload     |
+ */
+
+struct usb_functionfs_strings_head {
+	__le32 magic;
+	__le32 length;
+	__le32 str_count;
+	__le32 lang_count;
+} __attribute__((packed));
+
+/*
+ * Strings format:
+ *
+ * | off | name       | type                  | description                |
+ * |-----+------------+-----------------------+----------------------------|
+ * |   0 | magic      | LE32                  | FUNCTIONFS_STRINGS_MAGIC   |
+ * |   4 | length     | LE32                  | length of the data chunk   |
+ * |   8 | str_count  | LE32                  | number of strings          |
+ * |  12 | lang_count | LE32                  | number of languages        |
+ * |  16 | stringtab  | StringTab[lang_count] | table of strings per lang  |
+ *
+ * For each language there is one stringtab entry (ie. there are lang_count
+ * stringtab entires).  Each StringTab has following format:
+ *
+ * | off | name    | type              | description                        |
+ * |-----+---------+-------------------+------------------------------------|
+ * |   0 | lang    | LE16              | language code                      |
+ * |   2 | strings | String[str_count] | array of strings in given language |
+ *
+ * For each string there is one strings entry (ie. there are str_count
+ * string entries).  Each String is a NUL terminated string encoded in
+ * UTF-8.
+ */
+
+
+
+/*
+ * Events are delivered on the ep0 file descriptor, when the user mode driver
+ * reads from this file descriptor after writing the descriptors.  Don't
+ * stop polling this descriptor.
+ */
+
+enum usb_functionfs_event_type {
+	FUNCTIONFS_BIND,
+	FUNCTIONFS_UNBIND,
+
+	FUNCTIONFS_ENABLE,
+	FUNCTIONFS_DISABLE,
+
+	FUNCTIONFS_SETUP,
+
+	FUNCTIONFS_SUSPEND,
+	FUNCTIONFS_RESUME
+};
+
+/* NOTE:  this structure must stay the same size and layout on
+ * both 32-bit and 64-bit kernels.
+ */
+struct usb_functionfs_event {
+	union {
+		/* SETUP: packet; DATA phase i/o precedes next event
+		 *(setup.bmRequestType & USB_DIR_IN) flags direction */
+		struct usb_ctrlrequest	setup;
+	} __attribute__((packed)) u;
+
+	/* enum usb_functionfs_event_type */
+	__u8				type;
+	__u8				_pad[3];
+} __attribute__((packed));
+
+
+/* Endpoint ioctls */
+/* The same as in gadgetfs */
+
+/* IN transfers may be reported to the gadget driver as complete
+ *	when the fifo is loaded, before the host reads the data;
+ * OUT transfers may be reported to the host's "client" driver as
+ *	complete when they're sitting in the FIFO unread.
+ * THIS returns how many bytes are "unclaimed" in the endpoint fifo
+ * (needed for precise fault handling, when the hardware allows it)
+ */
+#define	FUNCTIONFS_FIFO_STATUS	_IO('g', 1)
+
+/* discards any unclaimed data in the fifo. */
+#define	FUNCTIONFS_FIFO_FLUSH	_IO('g', 2)
+
+/* resets endpoint halt+toggle; used to implement set_interface.
+ * some hardware (like pxa2xx) can't support this.
+ */
+#define	FUNCTIONFS_CLEAR_HALT	_IO('g', 3)
+
+/* Specific for functionfs */
+
+/*
+ * Returns reverse mapping of an interface.  Called on EP0.  If there
+ * is no such interface returns -EDOM.  If function is not active
+ * returns -ENODEV.
+ */
+#define	FUNCTIONFS_INTERFACE_REVMAP	_IO('g', 128)
+
+/*
+ * Returns real bEndpointAddress of an endpoint.  If function is not
+ * active returns -ENODEV.
+ */
+#define	FUNCTIONFS_ENDPOINT_REVMAP	_IO('g', 129)
+
+
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/gadgetfs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/gadgetfs.h
index 612102e..0bb12e0 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/gadgetfs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/gadgetfs.h
@@ -19,7 +19,7 @@
 #define __LINUX_USB_GADGETFS_H
 
 #include <linux/types.h>
-#include <asm/ioctl.h>
+#include <linux/ioctl.h>
 
 #include <linux/usb/ch9.h>
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/midi.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/midi.h
index 1d10408..c8c52e3 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/midi.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/midi.h
@@ -70,7 +70,7 @@
 	__u8  bJackID;
 	__u8  bNrInputPins;		/* p */
 	struct usb_midi_source_pin pins[]; /* [p] */
-	/*__u8  iJack;  -- ommitted due to variable-sized pins[] */
+	/*__u8  iJack;  -- omitted due to variable-sized pins[] */
 } __attribute__ ((packed));
 
 #define USB_DT_MIDI_OUT_SIZE(p)	(7 + 2 * (p))
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/video.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/video.h
new file mode 100644
index 0000000..3b3b95e
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/video.h
@@ -0,0 +1,568 @@
+/*
+ * USB Video Class definitions.
+ *
+ * Copyright (C) 2009 Laurent Pinchart <laurent.pinchart@skynet.be>
+ *
+ * This file holds USB constants and structures defined by the USB Device
+ * Class Definition for Video Devices. Unless otherwise stated, comments
+ * below reference relevant sections of the USB Video Class 1.1 specification
+ * available at
+ *
+ * http://www.usb.org/developers/devclass_docs/USB_Video_Class_1_1.zip
+ */
+
+#ifndef __LINUX_USB_VIDEO_H
+#define __LINUX_USB_VIDEO_H
+
+#include <linux/types.h>
+
+/* --------------------------------------------------------------------------
+ * UVC constants
+ */
+
+/* A.2. Video Interface Subclass Codes */
+#define UVC_SC_UNDEFINED				0x00
+#define UVC_SC_VIDEOCONTROL				0x01
+#define UVC_SC_VIDEOSTREAMING				0x02
+#define UVC_SC_VIDEO_INTERFACE_COLLECTION		0x03
+
+/* A.3. Video Interface Protocol Codes */
+#define UVC_PC_PROTOCOL_UNDEFINED			0x00
+
+/* A.5. Video Class-Specific VC Interface Descriptor Subtypes */
+#define UVC_VC_DESCRIPTOR_UNDEFINED			0x00
+#define UVC_VC_HEADER					0x01
+#define UVC_VC_INPUT_TERMINAL				0x02
+#define UVC_VC_OUTPUT_TERMINAL				0x03
+#define UVC_VC_SELECTOR_UNIT				0x04
+#define UVC_VC_PROCESSING_UNIT				0x05
+#define UVC_VC_EXTENSION_UNIT				0x06
+
+/* A.6. Video Class-Specific VS Interface Descriptor Subtypes */
+#define UVC_VS_UNDEFINED				0x00
+#define UVC_VS_INPUT_HEADER				0x01
+#define UVC_VS_OUTPUT_HEADER				0x02
+#define UVC_VS_STILL_IMAGE_FRAME			0x03
+#define UVC_VS_FORMAT_UNCOMPRESSED			0x04
+#define UVC_VS_FRAME_UNCOMPRESSED			0x05
+#define UVC_VS_FORMAT_MJPEG				0x06
+#define UVC_VS_FRAME_MJPEG				0x07
+#define UVC_VS_FORMAT_MPEG2TS				0x0a
+#define UVC_VS_FORMAT_DV				0x0c
+#define UVC_VS_COLORFORMAT				0x0d
+#define UVC_VS_FORMAT_FRAME_BASED			0x10
+#define UVC_VS_FRAME_FRAME_BASED			0x11
+#define UVC_VS_FORMAT_STREAM_BASED			0x12
+
+/* A.7. Video Class-Specific Endpoint Descriptor Subtypes */
+#define UVC_EP_UNDEFINED				0x00
+#define UVC_EP_GENERAL					0x01
+#define UVC_EP_ENDPOINT					0x02
+#define UVC_EP_INTERRUPT				0x03
+
+/* A.8. Video Class-Specific Request Codes */
+#define UVC_RC_UNDEFINED				0x00
+#define UVC_SET_CUR					0x01
+#define UVC_GET_CUR					0x81
+#define UVC_GET_MIN					0x82
+#define UVC_GET_MAX					0x83
+#define UVC_GET_RES					0x84
+#define UVC_GET_LEN					0x85
+#define UVC_GET_INFO					0x86
+#define UVC_GET_DEF					0x87
+
+/* A.9.1. VideoControl Interface Control Selectors */
+#define UVC_VC_CONTROL_UNDEFINED			0x00
+#define UVC_VC_VIDEO_POWER_MODE_CONTROL			0x01
+#define UVC_VC_REQUEST_ERROR_CODE_CONTROL		0x02
+
+/* A.9.2. Terminal Control Selectors */
+#define UVC_TE_CONTROL_UNDEFINED			0x00
+
+/* A.9.3. Selector Unit Control Selectors */
+#define UVC_SU_CONTROL_UNDEFINED			0x00
+#define UVC_SU_INPUT_SELECT_CONTROL			0x01
+
+/* A.9.4. Camera Terminal Control Selectors */
+#define UVC_CT_CONTROL_UNDEFINED			0x00
+#define UVC_CT_SCANNING_MODE_CONTROL			0x01
+#define UVC_CT_AE_MODE_CONTROL				0x02
+#define UVC_CT_AE_PRIORITY_CONTROL			0x03
+#define UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL		0x04
+#define UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL		0x05
+#define UVC_CT_FOCUS_ABSOLUTE_CONTROL			0x06
+#define UVC_CT_FOCUS_RELATIVE_CONTROL			0x07
+#define UVC_CT_FOCUS_AUTO_CONTROL			0x08
+#define UVC_CT_IRIS_ABSOLUTE_CONTROL			0x09
+#define UVC_CT_IRIS_RELATIVE_CONTROL			0x0a
+#define UVC_CT_ZOOM_ABSOLUTE_CONTROL			0x0b
+#define UVC_CT_ZOOM_RELATIVE_CONTROL			0x0c
+#define UVC_CT_PANTILT_ABSOLUTE_CONTROL			0x0d
+#define UVC_CT_PANTILT_RELATIVE_CONTROL			0x0e
+#define UVC_CT_ROLL_ABSOLUTE_CONTROL			0x0f
+#define UVC_CT_ROLL_RELATIVE_CONTROL			0x10
+#define UVC_CT_PRIVACY_CONTROL				0x11
+
+/* A.9.5. Processing Unit Control Selectors */
+#define UVC_PU_CONTROL_UNDEFINED			0x00
+#define UVC_PU_BACKLIGHT_COMPENSATION_CONTROL		0x01
+#define UVC_PU_BRIGHTNESS_CONTROL			0x02
+#define UVC_PU_CONTRAST_CONTROL				0x03
+#define UVC_PU_GAIN_CONTROL				0x04
+#define UVC_PU_POWER_LINE_FREQUENCY_CONTROL		0x05
+#define UVC_PU_HUE_CONTROL				0x06
+#define UVC_PU_SATURATION_CONTROL			0x07
+#define UVC_PU_SHARPNESS_CONTROL			0x08
+#define UVC_PU_GAMMA_CONTROL				0x09
+#define UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL	0x0a
+#define UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL	0x0b
+#define UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL		0x0c
+#define UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL	0x0d
+#define UVC_PU_DIGITAL_MULTIPLIER_CONTROL		0x0e
+#define UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL		0x0f
+#define UVC_PU_HUE_AUTO_CONTROL				0x10
+#define UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL		0x11
+#define UVC_PU_ANALOG_LOCK_STATUS_CONTROL		0x12
+
+/* A.9.7. VideoStreaming Interface Control Selectors */
+#define UVC_VS_CONTROL_UNDEFINED			0x00
+#define UVC_VS_PROBE_CONTROL				0x01
+#define UVC_VS_COMMIT_CONTROL				0x02
+#define UVC_VS_STILL_PROBE_CONTROL			0x03
+#define UVC_VS_STILL_COMMIT_CONTROL			0x04
+#define UVC_VS_STILL_IMAGE_TRIGGER_CONTROL		0x05
+#define UVC_VS_STREAM_ERROR_CODE_CONTROL		0x06
+#define UVC_VS_GENERATE_KEY_FRAME_CONTROL		0x07
+#define UVC_VS_UPDATE_FRAME_SEGMENT_CONTROL		0x08
+#define UVC_VS_SYNC_DELAY_CONTROL			0x09
+
+/* B.1. USB Terminal Types */
+#define UVC_TT_VENDOR_SPECIFIC				0x0100
+#define UVC_TT_STREAMING				0x0101
+
+/* B.2. Input Terminal Types */
+#define UVC_ITT_VENDOR_SPECIFIC				0x0200
+#define UVC_ITT_CAMERA					0x0201
+#define UVC_ITT_MEDIA_TRANSPORT_INPUT			0x0202
+
+/* B.3. Output Terminal Types */
+#define UVC_OTT_VENDOR_SPECIFIC				0x0300
+#define UVC_OTT_DISPLAY					0x0301
+#define UVC_OTT_MEDIA_TRANSPORT_OUTPUT			0x0302
+
+/* B.4. External Terminal Types */
+#define UVC_EXTERNAL_VENDOR_SPECIFIC			0x0400
+#define UVC_COMPOSITE_CONNECTOR				0x0401
+#define UVC_SVIDEO_CONNECTOR				0x0402
+#define UVC_COMPONENT_CONNECTOR				0x0403
+
+/* 2.4.2.2. Status Packet Type */
+#define UVC_STATUS_TYPE_CONTROL				1
+#define UVC_STATUS_TYPE_STREAMING			2
+
+/* 2.4.3.3. Payload Header Information */
+#define UVC_STREAM_EOH					(1 << 7)
+#define UVC_STREAM_ERR					(1 << 6)
+#define UVC_STREAM_STI					(1 << 5)
+#define UVC_STREAM_RES					(1 << 4)
+#define UVC_STREAM_SCR					(1 << 3)
+#define UVC_STREAM_PTS					(1 << 2)
+#define UVC_STREAM_EOF					(1 << 1)
+#define UVC_STREAM_FID					(1 << 0)
+
+/* 4.1.2. Control Capabilities */
+#define UVC_CONTROL_CAP_GET				(1 << 0)
+#define UVC_CONTROL_CAP_SET				(1 << 1)
+#define UVC_CONTROL_CAP_DISABLED			(1 << 2)
+#define UVC_CONTROL_CAP_AUTOUPDATE			(1 << 3)
+#define UVC_CONTROL_CAP_ASYNCHRONOUS			(1 << 4)
+
+/* ------------------------------------------------------------------------
+ * UVC structures
+ */
+
+/* All UVC descriptors have these 3 fields at the beginning */
+struct uvc_descriptor_header {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+} __attribute__((packed));
+
+/* 3.7.2. Video Control Interface Header Descriptor */
+struct uvc_header_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u16 bcdUVC;
+	__u16 wTotalLength;
+	__u32 dwClockFrequency;
+	__u8  bInCollection;
+	__u8  baInterfaceNr[];
+} __attribute__((__packed__));
+
+#define UVC_DT_HEADER_SIZE(n)				(12+(n))
+
+#define UVC_HEADER_DESCRIPTOR(n) \
+	uvc_header_descriptor_##n
+
+#define DECLARE_UVC_HEADER_DESCRIPTOR(n)		\
+struct UVC_HEADER_DESCRIPTOR(n) {			\
+	__u8  bLength;					\
+	__u8  bDescriptorType;				\
+	__u8  bDescriptorSubType;			\
+	__u16 bcdUVC;					\
+	__u16 wTotalLength;				\
+	__u32 dwClockFrequency;				\
+	__u8  bInCollection;				\
+	__u8  baInterfaceNr[n];				\
+} __attribute__ ((packed))
+
+/* 3.7.2.1. Input Terminal Descriptor */
+struct uvc_input_terminal_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bTerminalID;
+	__u16 wTerminalType;
+	__u8  bAssocTerminal;
+	__u8  iTerminal;
+} __attribute__((__packed__));
+
+#define UVC_DT_INPUT_TERMINAL_SIZE			8
+
+/* 3.7.2.2. Output Terminal Descriptor */
+struct uvc_output_terminal_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bTerminalID;
+	__u16 wTerminalType;
+	__u8  bAssocTerminal;
+	__u8  bSourceID;
+	__u8  iTerminal;
+} __attribute__((__packed__));
+
+#define UVC_DT_OUTPUT_TERMINAL_SIZE			9
+
+/* 3.7.2.3. Camera Terminal Descriptor */
+struct uvc_camera_terminal_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bTerminalID;
+	__u16 wTerminalType;
+	__u8  bAssocTerminal;
+	__u8  iTerminal;
+	__u16 wObjectiveFocalLengthMin;
+	__u16 wObjectiveFocalLengthMax;
+	__u16 wOcularFocalLength;
+	__u8  bControlSize;
+	__u8  bmControls[3];
+} __attribute__((__packed__));
+
+#define UVC_DT_CAMERA_TERMINAL_SIZE(n)			(15+(n))
+
+/* 3.7.2.4. Selector Unit Descriptor */
+struct uvc_selector_unit_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bUnitID;
+	__u8  bNrInPins;
+	__u8  baSourceID[0];
+	__u8  iSelector;
+} __attribute__((__packed__));
+
+#define UVC_DT_SELECTOR_UNIT_SIZE(n)			(6+(n))
+
+#define UVC_SELECTOR_UNIT_DESCRIPTOR(n)	\
+	uvc_selector_unit_descriptor_##n
+
+#define DECLARE_UVC_SELECTOR_UNIT_DESCRIPTOR(n)	\
+struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) {		\
+	__u8  bLength;					\
+	__u8  bDescriptorType;				\
+	__u8  bDescriptorSubType;			\
+	__u8  bUnitID;					\
+	__u8  bNrInPins;				\
+	__u8  baSourceID[n];				\
+	__u8  iSelector;				\
+} __attribute__ ((packed))
+
+/* 3.7.2.5. Processing Unit Descriptor */
+struct uvc_processing_unit_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bUnitID;
+	__u8  bSourceID;
+	__u16 wMaxMultiplier;
+	__u8  bControlSize;
+	__u8  bmControls[2];
+	__u8  iProcessing;
+} __attribute__((__packed__));
+
+#define UVC_DT_PROCESSING_UNIT_SIZE(n)			(9+(n))
+
+/* 3.7.2.6. Extension Unit Descriptor */
+struct uvc_extension_unit_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bUnitID;
+	__u8  guidExtensionCode[16];
+	__u8  bNumControls;
+	__u8  bNrInPins;
+	__u8  baSourceID[0];
+	__u8  bControlSize;
+	__u8  bmControls[0];
+	__u8  iExtension;
+} __attribute__((__packed__));
+
+#define UVC_DT_EXTENSION_UNIT_SIZE(p, n)		(24+(p)+(n))
+
+#define UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) \
+	uvc_extension_unit_descriptor_##p_##n
+
+#define DECLARE_UVC_EXTENSION_UNIT_DESCRIPTOR(p, n)	\
+struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) {		\
+	__u8  bLength;					\
+	__u8  bDescriptorType;				\
+	__u8  bDescriptorSubType;			\
+	__u8  bUnitID;					\
+	__u8  guidExtensionCode[16];			\
+	__u8  bNumControls;				\
+	__u8  bNrInPins;				\
+	__u8  baSourceID[p];				\
+	__u8  bControlSize;				\
+	__u8  bmControls[n];				\
+	__u8  iExtension;				\
+} __attribute__ ((packed))
+
+/* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */
+struct uvc_control_endpoint_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u16 wMaxTransferSize;
+} __attribute__((__packed__));
+
+#define UVC_DT_CONTROL_ENDPOINT_SIZE			5
+
+/* 3.9.2.1. Input Header Descriptor */
+struct uvc_input_header_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bNumFormats;
+	__u16 wTotalLength;
+	__u8  bEndpointAddress;
+	__u8  bmInfo;
+	__u8  bTerminalLink;
+	__u8  bStillCaptureMethod;
+	__u8  bTriggerSupport;
+	__u8  bTriggerUsage;
+	__u8  bControlSize;
+	__u8  bmaControls[];
+} __attribute__((__packed__));
+
+#define UVC_DT_INPUT_HEADER_SIZE(n, p)			(13+(n*p))
+
+#define UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
+	uvc_input_header_descriptor_##n_##p
+
+#define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p)	\
+struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) {		\
+	__u8  bLength;					\
+	__u8  bDescriptorType;				\
+	__u8  bDescriptorSubType;			\
+	__u8  bNumFormats;				\
+	__u16 wTotalLength;				\
+	__u8  bEndpointAddress;				\
+	__u8  bmInfo;					\
+	__u8  bTerminalLink;				\
+	__u8  bStillCaptureMethod;			\
+	__u8  bTriggerSupport;				\
+	__u8  bTriggerUsage;				\
+	__u8  bControlSize;				\
+	__u8  bmaControls[p][n];			\
+} __attribute__ ((packed))
+
+/* 3.9.2.2. Output Header Descriptor */
+struct uvc_output_header_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bNumFormats;
+	__u16 wTotalLength;
+	__u8  bEndpointAddress;
+	__u8  bTerminalLink;
+	__u8  bControlSize;
+	__u8  bmaControls[];
+} __attribute__((__packed__));
+
+#define UVC_DT_OUTPUT_HEADER_SIZE(n, p)			(9+(n*p))
+
+#define UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
+	uvc_output_header_descriptor_##n_##p
+
+#define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p)	\
+struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) {		\
+	__u8  bLength;					\
+	__u8  bDescriptorType;				\
+	__u8  bDescriptorSubType;			\
+	__u8  bNumFormats;				\
+	__u16 wTotalLength;				\
+	__u8  bEndpointAddress;				\
+	__u8  bTerminalLink;				\
+	__u8  bControlSize;				\
+	__u8  bmaControls[p][n];			\
+} __attribute__ ((packed))
+
+/* 3.9.2.6. Color matching descriptor */
+struct uvc_color_matching_descriptor {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bColorPrimaries;
+	__u8  bTransferCharacteristics;
+	__u8  bMatrixCoefficients;
+} __attribute__((__packed__));
+
+#define UVC_DT_COLOR_MATCHING_SIZE			6
+
+/* 4.3.1.1. Video Probe and Commit Controls */
+struct uvc_streaming_control {
+	__u16 bmHint;
+	__u8  bFormatIndex;
+	__u8  bFrameIndex;
+	__u32 dwFrameInterval;
+	__u16 wKeyFrameRate;
+	__u16 wPFrameRate;
+	__u16 wCompQuality;
+	__u16 wCompWindowSize;
+	__u16 wDelay;
+	__u32 dwMaxVideoFrameSize;
+	__u32 dwMaxPayloadTransferSize;
+	__u32 dwClockFrequency;
+	__u8  bmFramingInfo;
+	__u8  bPreferedVersion;
+	__u8  bMinVersion;
+	__u8  bMaxVersion;
+} __attribute__((__packed__));
+
+/* Uncompressed Payload - 3.1.1. Uncompressed Video Format Descriptor */
+struct uvc_format_uncompressed {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bFormatIndex;
+	__u8  bNumFrameDescriptors;
+	__u8  guidFormat[16];
+	__u8  bBitsPerPixel;
+	__u8  bDefaultFrameIndex;
+	__u8  bAspectRatioX;
+	__u8  bAspectRatioY;
+	__u8  bmInterfaceFlags;
+	__u8  bCopyProtect;
+} __attribute__((__packed__));
+
+#define UVC_DT_FORMAT_UNCOMPRESSED_SIZE			27
+
+/* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */
+struct uvc_frame_uncompressed {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bFrameIndex;
+	__u8  bmCapabilities;
+	__u16 wWidth;
+	__u16 wHeight;
+	__u32 dwMinBitRate;
+	__u32 dwMaxBitRate;
+	__u32 dwMaxVideoFrameBufferSize;
+	__u32 dwDefaultFrameInterval;
+	__u8  bFrameIntervalType;
+	__u32 dwFrameInterval[];
+} __attribute__((__packed__));
+
+#define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n)		(26+4*(n))
+
+#define UVC_FRAME_UNCOMPRESSED(n) \
+	uvc_frame_uncompressed_##n
+
+#define DECLARE_UVC_FRAME_UNCOMPRESSED(n)		\
+struct UVC_FRAME_UNCOMPRESSED(n) {			\
+	__u8  bLength;					\
+	__u8  bDescriptorType;				\
+	__u8  bDescriptorSubType;			\
+	__u8  bFrameIndex;				\
+	__u8  bmCapabilities;				\
+	__u16 wWidth;					\
+	__u16 wHeight;					\
+	__u32 dwMinBitRate;				\
+	__u32 dwMaxBitRate;				\
+	__u32 dwMaxVideoFrameBufferSize;		\
+	__u32 dwDefaultFrameInterval;			\
+	__u8  bFrameIntervalType;			\
+	__u32 dwFrameInterval[n];			\
+} __attribute__ ((packed))
+
+/* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */
+struct uvc_format_mjpeg {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bFormatIndex;
+	__u8  bNumFrameDescriptors;
+	__u8  bmFlags;
+	__u8  bDefaultFrameIndex;
+	__u8  bAspectRatioX;
+	__u8  bAspectRatioY;
+	__u8  bmInterfaceFlags;
+	__u8  bCopyProtect;
+} __attribute__((__packed__));
+
+#define UVC_DT_FORMAT_MJPEG_SIZE			11
+
+/* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */
+struct uvc_frame_mjpeg {
+	__u8  bLength;
+	__u8  bDescriptorType;
+	__u8  bDescriptorSubType;
+	__u8  bFrameIndex;
+	__u8  bmCapabilities;
+	__u16 wWidth;
+	__u16 wHeight;
+	__u32 dwMinBitRate;
+	__u32 dwMaxBitRate;
+	__u32 dwMaxVideoFrameBufferSize;
+	__u32 dwDefaultFrameInterval;
+	__u8  bFrameIntervalType;
+	__u32 dwFrameInterval[];
+} __attribute__((__packed__));
+
+#define UVC_DT_FRAME_MJPEG_SIZE(n)			(26+4*(n))
+
+#define UVC_FRAME_MJPEG(n) \
+	uvc_frame_mjpeg_##n
+
+#define DECLARE_UVC_FRAME_MJPEG(n)			\
+struct UVC_FRAME_MJPEG(n) {				\
+	__u8  bLength;					\
+	__u8  bDescriptorType;				\
+	__u8  bDescriptorSubType;			\
+	__u8  bFrameIndex;				\
+	__u8  bmCapabilities;				\
+	__u16 wWidth;					\
+	__u16 wHeight;					\
+	__u32 dwMinBitRate;				\
+	__u32 dwMaxBitRate;				\
+	__u32 dwMaxVideoFrameBufferSize;		\
+	__u32 dwDefaultFrameInterval;			\
+	__u8  bFrameIntervalType;			\
+	__u32 dwFrameInterval[n];			\
+} __attribute__ ((packed))
+
+#endif /* __LINUX_USB_VIDEO_H */
+
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/vstusb.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/vstusb.h
deleted file mode 100644
index c44e16c..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usb/vstusb.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*****************************************************************************
- *  File: drivers/usb/misc/vstusb.h
- *
- *  Purpose: Support for the bulk USB Vernier Spectrophotometers
- *
- *  Author:     EQware Engineering, Inc.
- *              Oregon City, OR, USA 97045
- *
- *  Copyright:  2007, 2008
- *              Vernier Software & Technology
- *              Beaverton, OR, USA 97005
- *
- *  Web:        www.vernier.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.
- *
- *****************************************************************************/
-/*****************************************************************************
- *
- *  The vstusb module is a standard usb 'client' driver running on top of the
- *  standard usb host controller stack.
- *
- *  In general, vstusb supports standard bulk usb pipes.  It supports multiple
- *  devices and multiple pipes per device.
- *
- *  The vstusb driver supports two interfaces:
- *  1 - ioctl SEND_PIPE/RECV_PIPE - a general bulk write/read msg
- *  	interface to any pipe with timeout support;
- *  2 - standard read/write with ioctl config - offers standard read/write
- *  	interface with ioctl configured pipes and timeouts.
- *
- *  Both interfaces can be signal from other process and will abort its i/o
- *  operation.
- *
- *  A timeout of 0 means NO timeout.  The user can still terminate the read via
- *  signal.
- *
- *  If using multiple threads with this driver, the user should ensure that
- *  any reads, writes, or ioctls are complete before closing the device.
- *  Changing read/write timeouts or pipes takes effect on next read/write.
- *
- *****************************************************************************/
-
-struct vstusb_args {
-	union {
-		/* this struct is used for IOCTL_VSTUSB_SEND_PIPE,	*
-		 * IOCTL_VSTUSB_RECV_PIPE, and read()/write() fops	*/
-		struct {
-			void *buffer;
-			size_t          count;
-			unsigned int    timeout_ms;
-			int             pipe;
-		};
-
-		/* this one is used for IOCTL_VSTUSB_CONFIG_RW  	*/
-		struct {
-			int rd_pipe;
-			int rd_timeout_ms;
-			int wr_pipe;
-			int wr_timeout_ms;
-		};
-	};
-};
-
-#define VST_IOC_MAGIC 'L'
-#define VST_IOC_FIRST 0x20
-#define IOCTL_VSTUSB_SEND_PIPE	_IO(VST_IOC_MAGIC, VST_IOC_FIRST)
-#define IOCTL_VSTUSB_RECV_PIPE	_IO(VST_IOC_MAGIC, VST_IOC_FIRST + 1)
-#define IOCTL_VSTUSB_CONFIG_RW	_IO(VST_IOC_MAGIC, VST_IOC_FIRST + 2)
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usbdevice_fs.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usbdevice_fs.h
index 6411839..3c5ec05 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/usbdevice_fs.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/usbdevice_fs.h
@@ -77,6 +77,7 @@
 
 #define USBDEVFS_URB_SHORT_NOT_OK	0x01
 #define USBDEVFS_URB_ISO_ASAP		0x02
+#define USBDEVFS_URB_BULK_CONTINUATION	0x04
 #define USBDEVFS_URB_NO_FSBR		0x20
 #define USBDEVFS_URB_ZERO_PACKET	0x40
 #define USBDEVFS_URB_NO_INTERRUPT	0x80
@@ -126,7 +127,9 @@
 
 
 #define USBDEVFS_CONTROL           _IOWR('U', 0, struct usbdevfs_ctrltransfer)
+#define USBDEVFS_CONTROL32           _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
 #define USBDEVFS_BULK              _IOWR('U', 2, struct usbdevfs_bulktransfer)
+#define USBDEVFS_BULK32              _IOWR('U', 2, struct usbdevfs_bulktransfer32)
 #define USBDEVFS_RESETEP           _IOR('U', 3, unsigned int)
 #define USBDEVFS_SETINTERFACE      _IOR('U', 4, struct usbdevfs_setinterface)
 #define USBDEVFS_SETCONFIGURATION  _IOR('U', 5, unsigned int)
@@ -139,6 +142,7 @@
 #define USBDEVFS_REAPURBNDELAY     _IOW('U', 13, void *)
 #define USBDEVFS_REAPURBNDELAY32   _IOW('U', 13, __u32)
 #define USBDEVFS_DISCSIGNAL        _IOR('U', 14, struct usbdevfs_disconnectsignal)
+#define USBDEVFS_DISCSIGNAL32      _IOR('U', 14, struct usbdevfs_disconnectsignal32)
 #define USBDEVFS_CLAIMINTERFACE    _IOR('U', 15, unsigned int)
 #define USBDEVFS_RELEASEINTERFACE  _IOR('U', 16, unsigned int)
 #define USBDEVFS_CONNECTINFO       _IOW('U', 17, struct usbdevfs_connectinfo)
@@ -149,4 +153,6 @@
 #define USBDEVFS_CLEAR_HALT        _IOR('U', 21, unsigned int)
 #define USBDEVFS_DISCONNECT        _IO('U', 22)
 #define USBDEVFS_CONNECT           _IO('U', 23)
+#define USBDEVFS_CLAIM_PORT        _IOR('U', 24, unsigned int)
+#define USBDEVFS_RELEASE_PORT      _IOR('U', 25, unsigned int)
 #endif /* _LINUX_USBDEVICE_FS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/uvcvideo.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/uvcvideo.h
new file mode 100644
index 0000000..c6aacfc
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/uvcvideo.h
@@ -0,0 +1,69 @@
+#ifndef __LINUX_UVCVIDEO_H_
+#define __LINUX_UVCVIDEO_H_
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+/*
+ * Dynamic controls
+ */
+
+/* Data types for UVC control data */
+#define UVC_CTRL_DATA_TYPE_RAW		0
+#define UVC_CTRL_DATA_TYPE_SIGNED	1
+#define UVC_CTRL_DATA_TYPE_UNSIGNED	2
+#define UVC_CTRL_DATA_TYPE_BOOLEAN	3
+#define UVC_CTRL_DATA_TYPE_ENUM		4
+#define UVC_CTRL_DATA_TYPE_BITMASK	5
+
+/* Control flags */
+#define UVC_CTRL_FLAG_SET_CUR		(1 << 0)
+#define UVC_CTRL_FLAG_GET_CUR		(1 << 1)
+#define UVC_CTRL_FLAG_GET_MIN		(1 << 2)
+#define UVC_CTRL_FLAG_GET_MAX		(1 << 3)
+#define UVC_CTRL_FLAG_GET_RES		(1 << 4)
+#define UVC_CTRL_FLAG_GET_DEF		(1 << 5)
+/* Control should be saved at suspend and restored at resume. */
+#define UVC_CTRL_FLAG_RESTORE		(1 << 6)
+/* Control can be updated by the camera. */
+#define UVC_CTRL_FLAG_AUTO_UPDATE	(1 << 7)
+
+#define UVC_CTRL_FLAG_GET_RANGE \
+	(UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \
+	 UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \
+	 UVC_CTRL_FLAG_GET_DEF)
+
+struct uvc_menu_info {
+	__u32 value;
+	__u8 name[32];
+};
+
+struct uvc_xu_control_mapping {
+	__u32 id;
+	__u8 name[32];
+	__u8 entity[16];
+	__u8 selector;
+
+	__u8 size;
+	__u8 offset;
+	__u32 v4l2_type;
+	__u32 data_type;
+
+	struct uvc_menu_info *menu_info;
+	__u32 menu_count;
+
+	__u32 reserved[4];
+};
+
+struct uvc_xu_control_query {
+	__u8 unit;
+	__u8 selector;
+	__u8 query;
+	__u16 size;
+	__u8 *data;
+};
+
+#define UVCIOC_CTRL_MAP		_IOWR('u', 0x20, struct uvc_xu_control_mapping)
+#define UVCIOC_CTRL_QUERY	_IOWR('u', 0x21, struct uvc_xu_control_query)
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/v4l2-mediabus.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/v4l2-mediabus.h
new file mode 100644
index 0000000..5ea7f75
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/v4l2-mediabus.h
@@ -0,0 +1,114 @@
+/*
+ * Media Bus API header
+ *
+ * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
+ *
+ * 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_V4L2_MEDIABUS_H
+#define __LINUX_V4L2_MEDIABUS_H
+
+#include <linux/types.h>
+#include <linux/videodev2.h>
+
+/*
+ * These pixel codes uniquely identify data formats on the media bus. Mostly
+ * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
+ * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
+ * data format is fixed. Additionally, "2X8" means that one pixel is transferred
+ * in two 8-bit samples, "BE" or "LE" specify in which order those samples are
+ * transferred over the bus: "LE" means that the least significant bits are
+ * transferred first, "BE" means that the most significant bits are transferred
+ * first, and "PADHI" and "PADLO" define which bits - low or high, in the
+ * incomplete high byte, are filled with padding bits.
+ *
+ * The pixel codes are grouped by type, bus_width, bits per component, samples
+ * per pixel and order of subsamples. Numerical values are sorted using generic
+ * numerical sort order (8 thus comes before 10).
+ *
+ * As their value can't change when a new pixel code is inserted in the
+ * enumeration, the pixel codes are explicitly given a numerical value. The next
+ * free values for each category are listed below, update them when inserting
+ * new pixel codes.
+ */
+enum v4l2_mbus_pixelcode {
+	V4L2_MBUS_FMT_FIXED = 0x0001,
+
+	/* RGB - next is 0x1009 */
+	V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
+	V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
+	V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
+	V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004,
+	V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005,
+	V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
+	V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
+	V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
+
+	/* YUV (including grey) - next is 0x2014 */
+	V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
+	V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
+	V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
+	V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004,
+	V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005,
+	V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006,
+	V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007,
+	V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
+	V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
+	V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
+	V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
+	V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
+	V4L2_MBUS_FMT_Y12_1X12 = 0x2013,
+	V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f,
+	V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
+	V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
+	V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
+	V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
+	V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
+
+	/* Bayer - next is 0x3015 */
+	V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
+	V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013,
+	V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
+	V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014,
+	V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b,
+	V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c,
+	V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
+	V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d,
+	V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
+	V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
+	V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
+	V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
+	V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
+	V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e,
+	V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a,
+	V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f,
+	V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
+	V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010,
+	V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011,
+	V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012,
+
+	/* JPEG compressed formats - next is 0x4002 */
+	V4L2_MBUS_FMT_JPEG_1X8 = 0x4001,
+};
+
+/**
+ * struct v4l2_mbus_framefmt - frame format on the media bus
+ * @width:	frame width
+ * @height:	frame height
+ * @code:	data format code (from enum v4l2_mbus_pixelcode)
+ * @field:	used interlacing type (from enum v4l2_field)
+ * @colorspace:	colorspace of the data (from enum v4l2_colorspace)
+ */
+struct v4l2_mbus_framefmt {
+	__u32			width;
+	__u32			height;
+	__u32			code;
+	__u32			field;
+	__u32			colorspace;
+	__u32			reserved[7];
+};
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/v4l2-subdev.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/v4l2-subdev.h
new file mode 100644
index 0000000..ed29cbb
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/v4l2-subdev.h
@@ -0,0 +1,141 @@
+/*
+ * V4L2 subdev userspace API
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ *	     Sakari Ailus <sakari.ailus@iki.fi>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __LINUX_V4L2_SUBDEV_H
+#define __LINUX_V4L2_SUBDEV_H
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+#include <linux/v4l2-mediabus.h>
+
+/**
+ * enum v4l2_subdev_format_whence - Media bus format type
+ * @V4L2_SUBDEV_FORMAT_TRY: try format, for negotiation only
+ * @V4L2_SUBDEV_FORMAT_ACTIVE: active format, applied to the device
+ */
+enum v4l2_subdev_format_whence {
+	V4L2_SUBDEV_FORMAT_TRY = 0,
+	V4L2_SUBDEV_FORMAT_ACTIVE = 1,
+};
+
+/**
+ * struct v4l2_subdev_format - Pad-level media bus format
+ * @which: format type (from enum v4l2_subdev_format_whence)
+ * @pad: pad number, as reported by the media API
+ * @format: media bus format (format code and frame size)
+ */
+struct v4l2_subdev_format {
+	__u32 which;
+	__u32 pad;
+	struct v4l2_mbus_framefmt format;
+	__u32 reserved[8];
+};
+
+/**
+ * struct v4l2_subdev_crop - Pad-level crop settings
+ * @which: format type (from enum v4l2_subdev_format_whence)
+ * @pad: pad number, as reported by the media API
+ * @rect: pad crop rectangle boundaries
+ */
+struct v4l2_subdev_crop {
+	__u32 which;
+	__u32 pad;
+	struct v4l2_rect rect;
+	__u32 reserved[8];
+};
+
+/**
+ * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
+ * @pad: pad number, as reported by the media API
+ * @index: format index during enumeration
+ * @code: format code (from enum v4l2_mbus_pixelcode)
+ */
+struct v4l2_subdev_mbus_code_enum {
+	__u32 pad;
+	__u32 index;
+	__u32 code;
+	__u32 reserved[9];
+};
+
+/**
+ * struct v4l2_subdev_frame_size_enum - Media bus format enumeration
+ * @pad: pad number, as reported by the media API
+ * @index: format index during enumeration
+ * @code: format code (from enum v4l2_mbus_pixelcode)
+ */
+struct v4l2_subdev_frame_size_enum {
+	__u32 index;
+	__u32 pad;
+	__u32 code;
+	__u32 min_width;
+	__u32 max_width;
+	__u32 min_height;
+	__u32 max_height;
+	__u32 reserved[9];
+};
+
+/**
+ * struct v4l2_subdev_frame_interval - Pad-level frame rate
+ * @pad: pad number, as reported by the media API
+ * @interval: frame interval in seconds
+ */
+struct v4l2_subdev_frame_interval {
+	__u32 pad;
+	struct v4l2_fract interval;
+	__u32 reserved[9];
+};
+
+/**
+ * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration
+ * @pad: pad number, as reported by the media API
+ * @index: frame interval index during enumeration
+ * @code: format code (from enum v4l2_mbus_pixelcode)
+ * @width: frame width in pixels
+ * @height: frame height in pixels
+ * @interval: frame interval in seconds
+ */
+struct v4l2_subdev_frame_interval_enum {
+	__u32 index;
+	__u32 pad;
+	__u32 code;
+	__u32 width;
+	__u32 height;
+	struct v4l2_fract interval;
+	__u32 reserved[9];
+};
+
+#define VIDIOC_SUBDEV_G_FMT	_IOWR('V',  4, struct v4l2_subdev_format)
+#define VIDIOC_SUBDEV_S_FMT	_IOWR('V',  5, struct v4l2_subdev_format)
+#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
+			_IOWR('V', 21, struct v4l2_subdev_frame_interval)
+#define VIDIOC_SUBDEV_S_FRAME_INTERVAL \
+			_IOWR('V', 22, struct v4l2_subdev_frame_interval)
+#define VIDIOC_SUBDEV_ENUM_MBUS_CODE \
+			_IOWR('V',  2, struct v4l2_subdev_mbus_code_enum)
+#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
+			_IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
+#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
+			_IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
+#define VIDIOC_SUBDEV_G_CROP	_IOWR('V', 59, struct v4l2_subdev_crop)
+#define VIDIOC_SUBDEV_S_CROP	_IOWR('V', 60, struct v4l2_subdev_crop)
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/version.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/version.h
index 09ec365..79457ff 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/version.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/version.h
@@ -1,2 +1,2 @@
-#define LINUX_VERSION_CODE 132639
+#define LINUX_VERSION_CODE 197384
 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/vhost.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/vhost.h
new file mode 100644
index 0000000..165a484
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/vhost.h
@@ -0,0 +1,130 @@
+#ifndef _LINUX_VHOST_H
+#define _LINUX_VHOST_H
+/* Userspace interface for in-kernel virtio accelerators. */
+
+/* vhost is used to reduce the number of system calls involved in virtio.
+ *
+ * Existing virtio net code is used in the guest without modification.
+ *
+ * This header includes interface used by userspace hypervisor for
+ * device configuration.
+ */
+
+#include <linux/types.h>
+
+#include <linux/ioctl.h>
+#include <linux/virtio_config.h>
+#include <linux/virtio_ring.h>
+
+struct vhost_vring_state {
+	unsigned int index;
+	unsigned int num;
+};
+
+struct vhost_vring_file {
+	unsigned int index;
+	int fd; /* Pass -1 to unbind from file. */
+
+};
+
+struct vhost_vring_addr {
+	unsigned int index;
+	/* Option flags. */
+	unsigned int flags;
+	/* Flag values: */
+	/* Whether log address is valid. If set enables logging. */
+#define VHOST_VRING_F_LOG 0
+
+	/* Start of array of descriptors (virtually contiguous) */
+	__u64 desc_user_addr;
+	/* Used structure address. Must be 32 bit aligned */
+	__u64 used_user_addr;
+	/* Available structure address. Must be 16 bit aligned */
+	__u64 avail_user_addr;
+	/* Logging support. */
+	/* Log writes to used structure, at offset calculated from specified
+	 * address. Address must be 32 bit aligned. */
+	__u64 log_guest_addr;
+};
+
+struct vhost_memory_region {
+	__u64 guest_phys_addr;
+	__u64 memory_size; /* bytes */
+	__u64 userspace_addr;
+	__u64 flags_padding; /* No flags are currently specified. */
+};
+
+/* All region addresses and sizes must be 4K aligned. */
+#define VHOST_PAGE_SIZE 0x1000
+
+struct vhost_memory {
+	__u32 nregions;
+	__u32 padding;
+	struct vhost_memory_region regions[0];
+};
+
+/* ioctls */
+
+#define VHOST_VIRTIO 0xAF
+
+/* Features bitmask for forward compatibility.  Transport bits are used for
+ * vhost specific features. */
+#define VHOST_GET_FEATURES	_IOR(VHOST_VIRTIO, 0x00, __u64)
+#define VHOST_SET_FEATURES	_IOW(VHOST_VIRTIO, 0x00, __u64)
+
+/* Set current process as the (exclusive) owner of this file descriptor.  This
+ * must be called before any other vhost command.  Further calls to
+ * VHOST_OWNER_SET fail until VHOST_OWNER_RESET is called. */
+#define VHOST_SET_OWNER _IO(VHOST_VIRTIO, 0x01)
+/* Give up ownership, and reset the device to default values.
+ * Allows subsequent call to VHOST_OWNER_SET to succeed. */
+#define VHOST_RESET_OWNER _IO(VHOST_VIRTIO, 0x02)
+
+/* Set up/modify memory layout */
+#define VHOST_SET_MEM_TABLE	_IOW(VHOST_VIRTIO, 0x03, struct vhost_memory)
+
+/* Write logging setup. */
+/* Memory writes can optionally be logged by setting bit at an offset
+ * (calculated from the physical address) from specified log base.
+ * The bit is set using an atomic 32 bit operation. */
+/* Set base address for logging. */
+#define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64)
+/* Specify an eventfd file descriptor to signal on log write. */
+#define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int)
+
+/* Ring setup. */
+/* Set number of descriptors in ring. This parameter can not
+ * be modified while ring is running (bound to a device). */
+#define VHOST_SET_VRING_NUM _IOW(VHOST_VIRTIO, 0x10, struct vhost_vring_state)
+/* Set addresses for the ring. */
+#define VHOST_SET_VRING_ADDR _IOW(VHOST_VIRTIO, 0x11, struct vhost_vring_addr)
+/* Base value where queue looks for available descriptors */
+#define VHOST_SET_VRING_BASE _IOW(VHOST_VIRTIO, 0x12, struct vhost_vring_state)
+/* Get accessor: reads index, writes value in num */
+#define VHOST_GET_VRING_BASE _IOWR(VHOST_VIRTIO, 0x12, struct vhost_vring_state)
+
+/* The following ioctls use eventfd file descriptors to signal and poll
+ * for events. */
+
+/* Set eventfd to poll for added buffers */
+#define VHOST_SET_VRING_KICK _IOW(VHOST_VIRTIO, 0x20, struct vhost_vring_file)
+/* Set eventfd to signal when buffers have beed used */
+#define VHOST_SET_VRING_CALL _IOW(VHOST_VIRTIO, 0x21, struct vhost_vring_file)
+/* Set eventfd to signal an error */
+#define VHOST_SET_VRING_ERR _IOW(VHOST_VIRTIO, 0x22, struct vhost_vring_file)
+
+/* VHOST_NET specific defines */
+
+/* Attach virtio net ring to a raw socket, or tap device.
+ * The socket must be already bound to an ethernet device, this device will be
+ * used for transmit.  Pass fd -1 to unbind from the socket and the transmit
+ * device.  This can be used to stop the ring (e.g. for migration). */
+#define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
+
+/* Feature bits */
+/* Log all write descriptors. Can be changed while device is active. */
+#define VHOST_F_LOG_ALL 26
+/* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */
+#define VHOST_NET_F_VIRTIO_NET_HDR 27
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/videodev.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/videodev.h
deleted file mode 100644
index c51a5f9..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/videodev.h
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- *	Video for Linux version 1 - OBSOLETE
- *
- *	Header file for v4l1 drivers and applications, for
- *	Linux kernels 2.2.x or 2.4.x.
- *
- *	Provides header for legacy drivers and applications
- *
- *	See http://linuxtv.org for more info
- *
- */
-#ifndef __LINUX_VIDEODEV_H
-#define __LINUX_VIDEODEV_H
-
-#include <linux/types.h>
-#include <linux/ioctl.h>
-#include <linux/videodev2.h>
-
-
-#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 */
-
-struct video_capability
-{
-	char name[32];
-	int type;
-	int channels;	/* Num channels */
-	int audios;	/* Num audio devices */
-	int maxwidth;	/* Supported width */
-	int maxheight;	/* And height */
-	int minwidth;	/* Supported width */
-	int minheight;	/* And height */
-};
-
-
-struct video_channel
-{
-	int channel;
-	char name[32];
-	int tuners;
-	__u32  flags;
-#define VIDEO_VC_TUNER		1	/* Channel has a tuner */
-#define VIDEO_VC_AUDIO		2	/* Channel has audio */
-	__u16  type;
-#define VIDEO_TYPE_TV		1
-#define VIDEO_TYPE_CAMERA	2
-	__u16 norm;			/* Norm set by channel */
-};
-
-struct video_tuner
-{
-	int tuner;
-	char name[32];
-	unsigned long rangelow, rangehigh;	/* Tuner range */
-	__u32 flags;
-#define VIDEO_TUNER_PAL		1
-#define VIDEO_TUNER_NTSC	2
-#define VIDEO_TUNER_SECAM	4
-#define VIDEO_TUNER_LOW		8	/* Uses KHz not MHz */
-#define VIDEO_TUNER_NORM	16	/* Tuner can set norm */
-#define VIDEO_TUNER_STEREO_ON	128	/* Tuner is seeing stereo */
-#define VIDEO_TUNER_RDS_ON      256     /* Tuner is seeing an RDS datastream */
-#define VIDEO_TUNER_MBS_ON      512     /* Tuner is seeing an MBS datastream */
-	__u16 mode;			/* PAL/NTSC/SECAM/OTHER */
-#define VIDEO_MODE_PAL		0
-#define VIDEO_MODE_NTSC		1
-#define VIDEO_MODE_SECAM	2
-#define VIDEO_MODE_AUTO		3
-	__u16 signal;			/* Signal strength 16bit scale */
-};
-
-struct video_picture
-{
-	__u16	brightness;
-	__u16	hue;
-	__u16	colour;
-	__u16	contrast;
-	__u16	whiteness;	/* Black and white only */
-	__u16	depth;		/* Capture depth */
-	__u16   palette;	/* Palette in use */
-#define VIDEO_PALETTE_GREY	1	/* Linear greyscale */
-#define VIDEO_PALETTE_HI240	2	/* High 240 cube (BT848) */
-#define VIDEO_PALETTE_RGB565	3	/* 565 16 bit RGB */
-#define VIDEO_PALETTE_RGB24	4	/* 24bit RGB */
-#define VIDEO_PALETTE_RGB32	5	/* 32bit RGB */
-#define VIDEO_PALETTE_RGB555	6	/* 555 15bit RGB */
-#define VIDEO_PALETTE_YUV422	7	/* YUV422 capture */
-#define VIDEO_PALETTE_YUYV	8
-#define VIDEO_PALETTE_UYVY	9	/* The great thing about standards is ... */
-#define VIDEO_PALETTE_YUV420	10
-#define VIDEO_PALETTE_YUV411	11	/* YUV411 capture */
-#define VIDEO_PALETTE_RAW	12	/* RAW capture (BT848) */
-#define VIDEO_PALETTE_YUV422P	13	/* YUV 4:2:2 Planar */
-#define VIDEO_PALETTE_YUV411P	14	/* YUV 4:1:1 Planar */
-#define VIDEO_PALETTE_YUV420P	15	/* YUV 4:2:0 Planar */
-#define VIDEO_PALETTE_YUV410P	16	/* YUV 4:1:0 Planar */
-#define VIDEO_PALETTE_PLANAR	13	/* start of planar entries */
-#define VIDEO_PALETTE_COMPONENT 7	/* start of component entries */
-};
-
-struct video_audio
-{
-	int	audio;		/* Audio channel */
-	__u16	volume;		/* If settable */
-	__u16	bass, treble;
-	__u32	flags;
-#define VIDEO_AUDIO_MUTE	1
-#define VIDEO_AUDIO_MUTABLE	2
-#define VIDEO_AUDIO_VOLUME	4
-#define VIDEO_AUDIO_BASS	8
-#define VIDEO_AUDIO_TREBLE	16
-#define VIDEO_AUDIO_BALANCE	32
-	char    name[16];
-#define VIDEO_SOUND_MONO	1
-#define VIDEO_SOUND_STEREO	2
-#define VIDEO_SOUND_LANG1	4
-#define VIDEO_SOUND_LANG2	8
-	__u16   mode;
-	__u16	balance;	/* Stereo balance */
-	__u16	step;		/* Step actual volume uses */
-};
-
-struct video_clip
-{
-	__s32	x,y;
-	__s32	width, height;
-	struct	video_clip *next;	/* For user use/driver use only */
-};
-
-struct video_window
-{
-	__u32	x,y;			/* Position of window */
-	__u32	width,height;		/* Its size */
-	__u32	chromakey;
-	__u32	flags;
-	struct	video_clip *clips;	/* Set only */
-	int	clipcount;
-#define VIDEO_WINDOW_INTERLACE	1
-#define VIDEO_WINDOW_CHROMAKEY	16	/* Overlay by chromakey */
-#define VIDEO_CLIP_BITMAP	-1
-/* bitmap is 1024x625, a '1' bit represents a clipped pixel */
-#define VIDEO_CLIPMAP_SIZE	(128 * 625)
-};
-
-struct video_capture
-{
-	__u32 	x,y;			/* Offsets into image */
-	__u32	width, height;		/* Area to capture */
-	__u16	decimation;		/* Decimation divider */
-	__u16	flags;			/* Flags for capture */
-#define VIDEO_CAPTURE_ODD		0	/* Temporal */
-#define VIDEO_CAPTURE_EVEN		1
-};
-
-struct video_buffer
-{
-	void	*base;
-	int	height,width;
-	int	depth;
-	int	bytesperline;
-};
-
-struct video_mmap
-{
-	unsigned	int frame;		/* Frame (0 - n) for double buffer */
-	int		height,width;
-	unsigned	int format;		/* should be VIDEO_PALETTE_* */
-};
-
-struct video_key
-{
-	__u8	key[8];
-	__u32	flags;
-};
-
-struct video_mbuf
-{
-	int	size;		/* Total memory to map */
-	int	frames;		/* Frames */
-	int	offsets[VIDEO_MAX_FRAME];
-};
-
-#define 	VIDEO_NO_UNIT	(-1)
-
-struct video_unit
-{
-	int 	video;		/* Video minor */
-	int	vbi;		/* VBI minor */
-	int	radio;		/* Radio minor */
-	int	audio;		/* Audio minor */
-	int	teletext;	/* Teletext minor */
-};
-
-struct vbi_format {
-	__u32	sampling_rate;	/* in Hz */
-	__u32	samples_per_line;
-	__u32	sample_format;	/* VIDEO_PALETTE_RAW only (1 byte) */
-	__s32	start[2];	/* starting line for each frame */
-	__u32	count[2];	/* count of lines for each frame */
-	__u32	flags;
-#define	VBI_UNSYNC	1	/* can distingues between top/bottom field */
-#define	VBI_INTERLACED	2	/* lines are interlaced */
-};
-
-/* video_info is biased towards hardware mpeg encode/decode */
-/* but it could apply generically to any hardware compressor/decompressor */
-struct video_info
-{
-	__u32	frame_count;	/* frames output since decode/encode began */
-	__u32	h_size;		/* current unscaled horizontal size */
-	__u32	v_size;		/* current unscaled veritcal size */
-	__u32	smpte_timecode;	/* current SMPTE timecode (for current GOP) */
-	__u32	picture_type;	/* current picture type */
-	__u32	temporal_reference;	/* current temporal reference */
-	__u8	user_data[256];	/* user data last found in compressed stream */
-	/* user_data[0] contains user data flags, user_data[1] has count */
-};
-
-/* generic structure for setting playback modes */
-struct video_play_mode
-{
-	int	mode;
-	int	p1;
-	int	p2;
-};
-
-/* for loading microcode / fpga programming */
-struct video_code
-{
-	char	loadwhat[16];	/* name or tag of file being passed */
-	int	datasize;
-	__u8	*data;
-};
-
-#define VIDIOCGCAP		_IOR('v',1,struct video_capability)	/* Get capabilities */
-#define VIDIOCGCHAN		_IOWR('v',2,struct video_channel)	/* Get channel info (sources) */
-#define VIDIOCSCHAN		_IOW('v',3,struct video_channel)	/* Set channel 	*/
-#define VIDIOCGTUNER		_IOWR('v',4,struct video_tuner)		/* Get tuner abilities */
-#define VIDIOCSTUNER		_IOW('v',5,struct video_tuner)		/* Tune the tuner for the current channel */
-#define VIDIOCGPICT		_IOR('v',6,struct video_picture)	/* Get picture properties */
-#define VIDIOCSPICT		_IOW('v',7,struct video_picture)	/* Set picture properties */
-#define VIDIOCCAPTURE		_IOW('v',8,int)				/* Start, end capture */
-#define VIDIOCGWIN		_IOR('v',9, struct video_window)	/* Get the video overlay window */
-#define VIDIOCSWIN		_IOW('v',10, struct video_window)	/* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
-#define VIDIOCGFBUF		_IOR('v',11, struct video_buffer)	/* Get frame buffer */
-#define VIDIOCSFBUF		_IOW('v',12, struct video_buffer)	/* Set frame buffer - root only */
-#define VIDIOCKEY		_IOR('v',13, struct video_key)		/* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
-#define VIDIOCGFREQ		_IOR('v',14, unsigned long)		/* Set tuner */
-#define VIDIOCSFREQ		_IOW('v',15, unsigned long)		/* Set tuner */
-#define VIDIOCGAUDIO		_IOR('v',16, struct video_audio)	/* Get audio info */
-#define VIDIOCSAUDIO		_IOW('v',17, struct video_audio)	/* Audio source, mute etc */
-#define VIDIOCSYNC		_IOW('v',18, int)			/* Sync with mmap grabbing */
-#define VIDIOCMCAPTURE		_IOW('v',19, struct video_mmap)		/* Grab frames */
-#define VIDIOCGMBUF		_IOR('v',20, struct video_mbuf)		/* Memory map buffer info */
-#define VIDIOCGUNIT		_IOR('v',21, struct video_unit)		/* Get attached units */
-#define VIDIOCGCAPTURE		_IOR('v',22, struct video_capture)	/* Get subcapture */
-#define VIDIOCSCAPTURE		_IOW('v',23, struct video_capture)	/* Set subcapture */
-#define VIDIOCSPLAYMODE		_IOW('v',24, struct video_play_mode)	/* Set output video mode/feature */
-#define VIDIOCSWRITEMODE	_IOW('v',25, int)			/* Set write mode */
-#define VIDIOCGPLAYINFO		_IOR('v',26, struct video_info)		/* Get current playback info from hardware */
-#define VIDIOCSMICROCODE	_IOW('v',27, struct video_code)		/* Load microcode into hardware */
-#define	VIDIOCGVBIFMT		_IOR('v',28, struct vbi_format)		/* Get VBI information */
-#define	VIDIOCSVBIFMT		_IOW('v',29, struct vbi_format)		/* Set VBI information */
-
-
-#define BASE_VIDIOCPRIVATE	192		/* 192-255 are private */
-
-/* VIDIOCSWRITEMODE */
-#define VID_WRITE_MPEG_AUD		0
-#define VID_WRITE_MPEG_VID		1
-#define VID_WRITE_OSD			2
-#define VID_WRITE_TTX			3
-#define VID_WRITE_CC			4
-#define VID_WRITE_MJPEG			5
-
-/* VIDIOCSPLAYMODE */
-#define VID_PLAY_VID_OUT_MODE		0
-	/* p1: = VIDEO_MODE_PAL, VIDEO_MODE_NTSC, etc ... */
-#define VID_PLAY_GENLOCK		1
-	/* p1: 0 = OFF, 1 = ON */
-	/* p2: GENLOCK FINE DELAY value */
-#define VID_PLAY_NORMAL			2
-#define VID_PLAY_PAUSE			3
-#define VID_PLAY_SINGLE_FRAME		4
-#define VID_PLAY_FAST_FORWARD		5
-#define VID_PLAY_SLOW_MOTION		6
-#define VID_PLAY_IMMEDIATE_NORMAL	7
-#define VID_PLAY_SWITCH_CHANNELS	8
-#define VID_PLAY_FREEZE_FRAME		9
-#define VID_PLAY_STILL_MODE		10
-#define VID_PLAY_MASTER_MODE		11
-	/* p1: see below */
-#define		VID_PLAY_MASTER_NONE	1
-#define		VID_PLAY_MASTER_VIDEO	2
-#define		VID_PLAY_MASTER_AUDIO	3
-#define VID_PLAY_ACTIVE_SCANLINES	12
-	/* p1 = first active; p2 = last active */
-#define VID_PLAY_RESET			13
-#define VID_PLAY_END_MARK		14
-
-
-#endif /* __LINUX_VIDEODEV_H */
-
-/*
- * Local variables:
- * c-basic-offset: 8
- * End:
- */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/videodev2.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/videodev2.h
index 1e0c066..4165e47 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/videodev2.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/videodev2.h
@@ -66,6 +66,7 @@
  * Moved from videodev.h
  */
 #define VIDEO_MAX_FRAME               32
+#define VIDEO_MAX_PLANES               8
 
 
 /* These defines are V4L1 specific and should not be used with the V4L2 API!
@@ -151,17 +152,22 @@
 	/* Experimental */
 	V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
 #endif
+	V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
+	V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE  = 10,
 	V4L2_BUF_TYPE_PRIVATE              = 0x80,
 };
 
-enum v4l2_ctrl_type {
-	V4L2_CTRL_TYPE_INTEGER	     = 1,
-	V4L2_CTRL_TYPE_BOOLEAN	     = 2,
-	V4L2_CTRL_TYPE_MENU	     = 3,
-	V4L2_CTRL_TYPE_BUTTON	     = 4,
-	V4L2_CTRL_TYPE_INTEGER64     = 5,
-	V4L2_CTRL_TYPE_CTRL_CLASS    = 6,
-};
+#define V4L2_TYPE_IS_MULTIPLANAR(type)			\
+	((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE	\
+	 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
+
+#define V4L2_TYPE_IS_OUTPUT(type)				\
+	((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT			\
+	 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE		\
+	 || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY		\
+	 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY	\
+	 || (type) == V4L2_BUF_TYPE_VBI_OUTPUT			\
+	 || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT)
 
 enum v4l2_tuner_type {
 	V4L2_TUNER_RADIO	     = 1,
@@ -246,10 +252,17 @@
 #define V4L2_CAP_RDS_CAPTURE		0x00000100  /* RDS data capture */
 #define V4L2_CAP_VIDEO_OUTPUT_OVERLAY	0x00000200  /* Can do video output overlay */
 #define V4L2_CAP_HW_FREQ_SEEK		0x00000400  /* Can do hardware frequency seek  */
+#define V4L2_CAP_RDS_OUTPUT		0x00000800  /* Is an RDS encoder */
+
+/* Is a video capture device that supports multiplanar formats */
+#define V4L2_CAP_VIDEO_CAPTURE_MPLANE	0x00001000
+/* Is a video output device that supports multiplanar formats */
+#define V4L2_CAP_VIDEO_OUTPUT_MPLANE	0x00002000
 
 #define V4L2_CAP_TUNER			0x00010000  /* has a tuner */
 #define V4L2_CAP_AUDIO			0x00020000  /* has audio support */
 #define V4L2_CAP_RADIO			0x00040000  /* is a radio device */
+#define V4L2_CAP_MODULATOR		0x00080000  /* has a modulator */
 
 #define V4L2_CAP_READWRITE              0x01000000  /* read/write systemcalls */
 #define V4L2_CAP_ASYNCIO                0x02000000  /* async I/O */
@@ -269,23 +282,41 @@
 	__u32			priv;		/* private data, depends on pixelformat */
 };
 
-/*      Pixel format         FOURCC                        depth  Description  */
+/*      Pixel format         FOURCC                          depth  Description  */
+
+/* RGB formats */
 #define V4L2_PIX_FMT_RGB332  v4l2_fourcc('R', 'G', 'B', '1') /*  8  RGB-3-3-2     */
 #define V4L2_PIX_FMT_RGB444  v4l2_fourcc('R', '4', '4', '4') /* 16  xxxxrrrr ggggbbbb */
 #define V4L2_PIX_FMT_RGB555  v4l2_fourcc('R', 'G', 'B', 'O') /* 16  RGB-5-5-5     */
 #define V4L2_PIX_FMT_RGB565  v4l2_fourcc('R', 'G', 'B', 'P') /* 16  RGB-5-6-5     */
 #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16  RGB-5-5-5 BE  */
 #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16  RGB-5-6-5 BE  */
+#define V4L2_PIX_FMT_BGR666  v4l2_fourcc('B', 'G', 'R', 'H') /* 18  BGR-6-6-6	  */
 #define V4L2_PIX_FMT_BGR24   v4l2_fourcc('B', 'G', 'R', '3') /* 24  BGR-8-8-8     */
 #define V4L2_PIX_FMT_RGB24   v4l2_fourcc('R', 'G', 'B', '3') /* 24  RGB-8-8-8     */
 #define V4L2_PIX_FMT_BGR32   v4l2_fourcc('B', 'G', 'R', '4') /* 32  BGR-8-8-8-8   */
 #define V4L2_PIX_FMT_RGB32   v4l2_fourcc('R', 'G', 'B', '4') /* 32  RGB-8-8-8-8   */
+
+/* Grey formats */
 #define V4L2_PIX_FMT_GREY    v4l2_fourcc('G', 'R', 'E', 'Y') /*  8  Greyscale     */
+#define V4L2_PIX_FMT_Y4      v4l2_fourcc('Y', '0', '4', ' ') /*  4  Greyscale     */
+#define V4L2_PIX_FMT_Y6      v4l2_fourcc('Y', '0', '6', ' ') /*  6  Greyscale     */
+#define V4L2_PIX_FMT_Y10     v4l2_fourcc('Y', '1', '0', ' ') /* 10  Greyscale     */
+#define V4L2_PIX_FMT_Y12     v4l2_fourcc('Y', '1', '2', ' ') /* 12  Greyscale     */
 #define V4L2_PIX_FMT_Y16     v4l2_fourcc('Y', '1', '6', ' ') /* 16  Greyscale     */
+
+/* Grey bit-packed formats */
+#define V4L2_PIX_FMT_Y10BPACK    v4l2_fourcc('Y', '1', '0', 'B') /* 10  Greyscale bit-packed */
+
+/* Palette formats */
 #define V4L2_PIX_FMT_PAL8    v4l2_fourcc('P', 'A', 'L', '8') /*  8  8-bit palette */
+
+/* Luminance+Chrominance formats */
 #define V4L2_PIX_FMT_YVU410  v4l2_fourcc('Y', 'V', 'U', '9') /*  9  YVU 4:1:0     */
 #define V4L2_PIX_FMT_YVU420  v4l2_fourcc('Y', 'V', '1', '2') /* 12  YVU 4:2:0     */
 #define V4L2_PIX_FMT_YUYV    v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16  YUV 4:2:2     */
+#define V4L2_PIX_FMT_YYUV    v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16  YUV 4:2:2     */
+#define V4L2_PIX_FMT_YVYU    v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
 #define V4L2_PIX_FMT_UYVY    v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16  YUV 4:2:2     */
 #define V4L2_PIX_FMT_VYUY    v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16  YUV 4:2:2     */
 #define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16  YVU422 planar */
@@ -295,41 +326,65 @@
 #define V4L2_PIX_FMT_YUV555  v4l2_fourcc('Y', 'U', 'V', 'O') /* 16  YUV-5-5-5     */
 #define V4L2_PIX_FMT_YUV565  v4l2_fourcc('Y', 'U', 'V', 'P') /* 16  YUV-5-6-5     */
 #define V4L2_PIX_FMT_YUV32   v4l2_fourcc('Y', 'U', 'V', '4') /* 32  YUV-8-8-8-8   */
+#define V4L2_PIX_FMT_YUV410  v4l2_fourcc('Y', 'U', 'V', '9') /*  9  YUV 4:1:0     */
+#define V4L2_PIX_FMT_YUV420  v4l2_fourcc('Y', 'U', '1', '2') /* 12  YUV 4:2:0     */
+#define V4L2_PIX_FMT_HI240   v4l2_fourcc('H', 'I', '2', '4') /*  8  8-bit color   */
+#define V4L2_PIX_FMT_HM12    v4l2_fourcc('H', 'M', '1', '2') /*  8  YUV 4:2:0 16x16 macroblocks */
+#define V4L2_PIX_FMT_M420    v4l2_fourcc('M', '4', '2', '0') /* 12  YUV 4:2:0 2 lines y, 1 line uv interleaved */
 
 /* two planes -- one Y, one Cr + Cb interleaved  */
 #define V4L2_PIX_FMT_NV12    v4l2_fourcc('N', 'V', '1', '2') /* 12  Y/CbCr 4:2:0  */
 #define V4L2_PIX_FMT_NV21    v4l2_fourcc('N', 'V', '2', '1') /* 12  Y/CrCb 4:2:0  */
 #define V4L2_PIX_FMT_NV16    v4l2_fourcc('N', 'V', '1', '6') /* 16  Y/CbCr 4:2:2  */
 #define V4L2_PIX_FMT_NV61    v4l2_fourcc('N', 'V', '6', '1') /* 16  Y/CrCb 4:2:2  */
+#define V4L2_PIX_FMT_NV24    v4l2_fourcc('N', 'V', '2', '4') /* 24  Y/CbCr 4:4:4  */
+#define V4L2_PIX_FMT_NV42    v4l2_fourcc('N', 'V', '4', '2') /* 24  Y/CrCb 4:4:4  */
 
-/*  The following formats are not defined in the V4L2 specification */
-#define V4L2_PIX_FMT_YUV410  v4l2_fourcc('Y', 'U', 'V', '9') /*  9  YUV 4:1:0     */
-#define V4L2_PIX_FMT_YUV420  v4l2_fourcc('Y', 'U', '1', '2') /* 12  YUV 4:2:0     */
-#define V4L2_PIX_FMT_YYUV    v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16  YUV 4:2:2     */
-#define V4L2_PIX_FMT_HI240   v4l2_fourcc('H', 'I', '2', '4') /*  8  8-bit color   */
-#define V4L2_PIX_FMT_HM12    v4l2_fourcc('H', 'M', '1', '2') /*  8  YUV 4:2:0 16x16 macroblocks */
+/* two non contiguous planes - one Y, one Cr + Cb interleaved  */
+#define V4L2_PIX_FMT_NV12M   v4l2_fourcc('N', 'M', '1', '2') /* 12  Y/CbCr 4:2:0  */
+#define V4L2_PIX_FMT_NV12MT  v4l2_fourcc('T', 'M', '1', '2') /* 12  Y/CbCr 4:2:0 64x32 macroblocks */
 
-/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
+/* three non contiguous planes - Y, Cb, Cr */
+#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12  YUV420 planar */
+
+/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
 #define V4L2_PIX_FMT_SBGGR8  v4l2_fourcc('B', 'A', '8', '1') /*  8  BGBG.. GRGR.. */
 #define V4L2_PIX_FMT_SGBRG8  v4l2_fourcc('G', 'B', 'R', 'G') /*  8  GBGB.. RGRG.. */
 #define V4L2_PIX_FMT_SGRBG8  v4l2_fourcc('G', 'R', 'B', 'G') /*  8  GRGR.. BGBG.. */
-
-/*
- * 10bit raw bayer, expanded to 16 bits
- * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
- */
-#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0')
-/* 10bit raw bayer DPCM compressed to 8 bits */
+#define V4L2_PIX_FMT_SRGGB8  v4l2_fourcc('R', 'G', 'G', 'B') /*  8  RGRG.. GBGB.. */
+#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10  BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10  GBGB.. RGRG.. */
+#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10  GRGR.. BGBG.. */
+#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10  RGRG.. GBGB.. */
+#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12  BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12  GBGB.. RGRG.. */
+#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12  GRGR.. BGBG.. */
+#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12  RGRG.. GBGB.. */
+	/* 10bit raw bayer DPCM compressed to 8 bits */
 #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
+	/*
+	 * 10bit raw bayer, expanded to 16 bits
+	 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
+	 */
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. GRGR.. */
 
 /* compressed formats */
 #define V4L2_PIX_FMT_MJPEG    v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG   */
 #define V4L2_PIX_FMT_JPEG     v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG     */
 #define V4L2_PIX_FMT_DV       v4l2_fourcc('d', 'v', 's', 'd') /* 1394          */
-#define V4L2_PIX_FMT_MPEG     v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4    */
+#define V4L2_PIX_FMT_MPEG     v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */
+#define V4L2_PIX_FMT_H264     v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */
+#define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */
+#define V4L2_PIX_FMT_H263     v4l2_fourcc('H', '2', '6', '3') /* H263          */
+#define V4L2_PIX_FMT_MPEG1    v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES     */
+#define V4L2_PIX_FMT_MPEG2    v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES     */
+#define V4L2_PIX_FMT_MPEG4    v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 ES     */
+#define V4L2_PIX_FMT_XVID     v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid           */
+#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
+#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
 
 /*  Vendor-specific formats   */
+#define V4L2_PIX_FMT_CPIA1    v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
 #define V4L2_PIX_FMT_WNVA     v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
 #define V4L2_PIX_FMT_SN9C10X  v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
 #define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */
@@ -342,11 +397,18 @@
 #define V4L2_PIX_FMT_SPCA561  v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
 #define V4L2_PIX_FMT_PAC207   v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
 #define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
+#define V4L2_PIX_FMT_JL2005BCD v4l2_fourcc('J', 'L', '2', '0') /* compressed RGGB bayer */
+#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
 #define V4L2_PIX_FMT_SQ905C   v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
 #define V4L2_PIX_FMT_PJPG     v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
-#define V4L2_PIX_FMT_YVYU     v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
 #define V4L2_PIX_FMT_OV511    v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
 #define V4L2_PIX_FMT_OV518    v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
+#define V4L2_PIX_FMT_STV0680  v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
+#define V4L2_PIX_FMT_TM6000   v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
+#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
+#define V4L2_PIX_FMT_KONICA420  v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
+#define V4L2_PIX_FMT_JPGL	v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
+#define V4L2_PIX_FMT_SE401      v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
 
 /*
  *	F O R M A T   E N U M E R A T I O N
@@ -361,6 +423,7 @@
 };
 
 #define V4L2_FMT_FLAG_COMPRESSED 0x0001
+#define V4L2_FMT_FLAG_EMULATED   0x0002
 
 #if 1
 	/* Experimental Frame Size and frame rate enumeration */
@@ -475,7 +538,7 @@
 				 * you do, leave them untouched.
 				 * Inluding less markers will make the
 				 * resulting code smaller, but there will
-				 * be fewer aplications which can read it.
+				 * be fewer applications which can read it.
 				 * The presence of the APP and COM marker
 				 * is influenced by APP_len and COM_len
 				 * ONLY, not by this property! */
@@ -498,6 +561,62 @@
 	__u32			reserved[2];
 };
 
+/**
+ * struct v4l2_plane - plane info for multi-planar buffers
+ * @bytesused:		number of bytes occupied by data in the plane (payload)
+ * @length:		size of this plane (NOT the payload) in bytes
+ * @mem_offset:		when memory in the associated struct v4l2_buffer is
+ *			V4L2_MEMORY_MMAP, equals the offset from the start of
+ *			the device memory for this plane (or is a "cookie" that
+ *			should be passed to mmap() called on the video node)
+ * @userptr:		when memory is V4L2_MEMORY_USERPTR, a userspace pointer
+ *			pointing to this plane
+ * @data_offset:	offset in the plane to the start of data; usually 0,
+ *			unless there is a header in front of the data
+ *
+ * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer
+ * with two planes can have one plane for Y, and another for interleaved CbCr
+ * components. Each plane can reside in a separate memory buffer, or even in
+ * a completely separate memory node (e.g. in embedded devices).
+ */
+struct v4l2_plane {
+	__u32			bytesused;
+	__u32			length;
+	union {
+		__u32		mem_offset;
+		unsigned long	userptr;
+	} m;
+	__u32			data_offset;
+	__u32			reserved[11];
+};
+
+/**
+ * struct v4l2_buffer - video buffer info
+ * @index:	id number of the buffer
+ * @type:	buffer type (type == *_MPLANE for multiplanar buffers)
+ * @bytesused:	number of bytes occupied by data in the buffer (payload);
+ *		unused (set to 0) for multiplanar buffers
+ * @flags:	buffer informational flags
+ * @field:	field order of the image in the buffer
+ * @timestamp:	frame timestamp
+ * @timecode:	frame timecode
+ * @sequence:	sequence count of this frame
+ * @memory:	the method, in which the actual video data is passed
+ * @offset:	for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
+ *		offset from the start of the device memory for this plane,
+ *		(or a "cookie" that should be passed to mmap() as offset)
+ * @userptr:	for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
+ *		a userspace pointer pointing to this buffer
+ * @planes:	for multiplanar buffers; userspace pointer to the array of plane
+ *		info structs for this buffer
+ * @length:	size in bytes of the buffer (NOT its payload) for single-plane
+ *		buffers (when type != *_MPLANE); number of elements in the
+ *		planes array for multi-plane buffers
+ * @input:	input number from which the video data has has been captured
+ *
+ * Contains data exchanged by application and driver using one of the Streaming
+ * I/O methods.
+ */
 struct v4l2_buffer {
 	__u32			index;
 	enum v4l2_buf_type      type;
@@ -513,6 +632,7 @@
 	union {
 		__u32           offset;
 		unsigned long   userptr;
+		struct v4l2_plane *planes;
 	} m;
 	__u32			length;
 	__u32			input;
@@ -526,8 +646,14 @@
 #define V4L2_BUF_FLAG_KEYFRAME	0x0008	/* Image is a keyframe (I-frame) */
 #define V4L2_BUF_FLAG_PFRAME	0x0010	/* Image is a P-frame */
 #define V4L2_BUF_FLAG_BFRAME	0x0020	/* Image is a B-frame */
+/* Buffer is ready, but the data contained within is corrupted. */
+#define V4L2_BUF_FLAG_ERROR	0x0040
 #define V4L2_BUF_FLAG_TIMECODE	0x0100	/* timecode field is valid */
 #define V4L2_BUF_FLAG_INPUT     0x0200  /* input field is valid */
+#define V4L2_BUF_FLAG_PREPARED	0x0400	/* Buffer is prepared for queuing */
+/* Cache handling flags */
+#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE	0x0800
+#define V4L2_BUF_FLAG_NO_CACHE_CLEAN		0x1000
 
 /*
  *	O V E R L A Y   P R E V I E W
@@ -548,6 +674,7 @@
 #define V4L2_FBUF_CAP_LOCAL_ALPHA	0x0010
 #define V4L2_FBUF_CAP_GLOBAL_ALPHA	0x0020
 #define V4L2_FBUF_CAP_LOCAL_INV_ALPHA	0x0040
+#define V4L2_FBUF_CAP_SRC_CHROMAKEY	0x0080
 /*  Flags for the 'flags' field. */
 #define V4L2_FBUF_FLAG_PRIMARY		0x0001
 #define V4L2_FBUF_FLAG_OVERLAY		0x0002
@@ -555,6 +682,7 @@
 #define V4L2_FBUF_FLAG_LOCAL_ALPHA	0x0008
 #define V4L2_FBUF_FLAG_GLOBAL_ALPHA	0x0010
 #define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA	0x0020
+#define V4L2_FBUF_FLAG_SRC_CHROMAKEY	0x0040
 
 struct v4l2_clip {
 	struct v4l2_rect        c;
@@ -611,6 +739,48 @@
 	struct v4l2_rect        c;
 };
 
+/* Hints for adjustments of selection rectangle */
+#define V4L2_SEL_FLAG_GE	0x00000001
+#define V4L2_SEL_FLAG_LE	0x00000002
+
+/* Selection targets */
+
+/* current cropping area */
+#define V4L2_SEL_TGT_CROP_ACTIVE	0
+/* default cropping area */
+#define V4L2_SEL_TGT_CROP_DEFAULT	1
+/* cropping bounds */
+#define V4L2_SEL_TGT_CROP_BOUNDS	2
+/* current composing area */
+#define V4L2_SEL_TGT_COMPOSE_ACTIVE	256
+/* default composing area */
+#define V4L2_SEL_TGT_COMPOSE_DEFAULT	257
+/* composing bounds */
+#define V4L2_SEL_TGT_COMPOSE_BOUNDS	258
+/* current composing area plus all padding pixels */
+#define V4L2_SEL_TGT_COMPOSE_PADDED	259
+
+/**
+ * struct v4l2_selection - selection info
+ * @type:	buffer type (do not use *_MPLANE types)
+ * @target:	selection target, used to choose one of possible rectangles
+ * @flags:	constraints flags
+ * @r:		coordinates of selection window
+ * @reserved:	for future use, rounds structure size to 64 bytes, set to zero
+ *
+ * Hardware may use multiple helper window to process a video stream.
+ * The structure is used to exchange this selection areas between
+ * an application and a driver.
+ */
+struct v4l2_selection {
+	__u32			type;
+	__u32			target;
+	__u32                   flags;
+	struct v4l2_rect        r;
+	__u32                   reserved[9];
+};
+
+
 /*
  *      A N A L O G   V I D E O   S T A N D A R D
  */
@@ -632,10 +802,10 @@
 #define V4L2_STD_PAL_Nc         ((v4l2_std_id)0x00000400)
 #define V4L2_STD_PAL_60         ((v4l2_std_id)0x00000800)
 
-#define V4L2_STD_NTSC_M         ((v4l2_std_id)0x00001000)
-#define V4L2_STD_NTSC_M_JP      ((v4l2_std_id)0x00002000)
+#define V4L2_STD_NTSC_M         ((v4l2_std_id)0x00001000)	/* BTSC */
+#define V4L2_STD_NTSC_M_JP      ((v4l2_std_id)0x00002000)	/* EIA-J */
 #define V4L2_STD_NTSC_443       ((v4l2_std_id)0x00004000)
-#define V4L2_STD_NTSC_M_KR      ((v4l2_std_id)0x00008000)
+#define V4L2_STD_NTSC_M_KR      ((v4l2_std_id)0x00008000)	/* FM A2 */
 
 #define V4L2_STD_SECAM_B        ((v4l2_std_id)0x00010000)
 #define V4L2_STD_SECAM_D        ((v4l2_std_id)0x00020000)
@@ -659,47 +829,86 @@
    v4l2-common.c should be fixed.
  */
 
-/* some merged standards */
-#define V4L2_STD_MN	(V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
-#define V4L2_STD_B	(V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
-#define V4L2_STD_GH	(V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
-#define V4L2_STD_DK	(V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
+/*
+ * Some macros to merge video standards in order to make live easier for the
+ * drivers and V4L2 applications
+ */
 
-/* some common needed stuff */
-#define V4L2_STD_PAL_BG		(V4L2_STD_PAL_B		|\
-				 V4L2_STD_PAL_B1	|\
-				 V4L2_STD_PAL_G)
-#define V4L2_STD_PAL_DK		(V4L2_STD_PAL_D		|\
-				 V4L2_STD_PAL_D1	|\
-				 V4L2_STD_PAL_K)
-#define V4L2_STD_PAL		(V4L2_STD_PAL_BG	|\
-				 V4L2_STD_PAL_DK	|\
-				 V4L2_STD_PAL_H		|\
-				 V4L2_STD_PAL_I)
+/*
+ * "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is
+ * Missing here.
+ */
 #define V4L2_STD_NTSC           (V4L2_STD_NTSC_M	|\
 				 V4L2_STD_NTSC_M_JP     |\
 				 V4L2_STD_NTSC_M_KR)
+/* Secam macros */
 #define V4L2_STD_SECAM_DK      	(V4L2_STD_SECAM_D	|\
 				 V4L2_STD_SECAM_K	|\
 				 V4L2_STD_SECAM_K1)
+/* All Secam Standards */
 #define V4L2_STD_SECAM		(V4L2_STD_SECAM_B	|\
 				 V4L2_STD_SECAM_G	|\
 				 V4L2_STD_SECAM_H	|\
 				 V4L2_STD_SECAM_DK	|\
 				 V4L2_STD_SECAM_L       |\
 				 V4L2_STD_SECAM_LC)
+/* PAL macros */
+#define V4L2_STD_PAL_BG		(V4L2_STD_PAL_B		|\
+				 V4L2_STD_PAL_B1	|\
+				 V4L2_STD_PAL_G)
+#define V4L2_STD_PAL_DK		(V4L2_STD_PAL_D		|\
+				 V4L2_STD_PAL_D1	|\
+				 V4L2_STD_PAL_K)
+/*
+ * "Common" PAL - This macro is there to be compatible with the old
+ * V4L1 concept of "PAL": /BGDKHI.
+ * Several PAL standards are mising here: /M, /N and /Nc
+ */
+#define V4L2_STD_PAL		(V4L2_STD_PAL_BG	|\
+				 V4L2_STD_PAL_DK	|\
+				 V4L2_STD_PAL_H		|\
+				 V4L2_STD_PAL_I)
+/* Chroma "agnostic" standards */
+#define V4L2_STD_B		(V4L2_STD_PAL_B		|\
+				 V4L2_STD_PAL_B1	|\
+				 V4L2_STD_SECAM_B)
+#define V4L2_STD_G		(V4L2_STD_PAL_G		|\
+				 V4L2_STD_SECAM_G)
+#define V4L2_STD_H		(V4L2_STD_PAL_H		|\
+				 V4L2_STD_SECAM_H)
+#define V4L2_STD_L		(V4L2_STD_SECAM_L	|\
+				 V4L2_STD_SECAM_LC)
+#define V4L2_STD_GH		(V4L2_STD_G		|\
+				 V4L2_STD_H)
+#define V4L2_STD_DK		(V4L2_STD_PAL_DK	|\
+				 V4L2_STD_SECAM_DK)
+#define V4L2_STD_BG		(V4L2_STD_B		|\
+				 V4L2_STD_G)
+#define V4L2_STD_MN		(V4L2_STD_PAL_M		|\
+				 V4L2_STD_PAL_N		|\
+				 V4L2_STD_PAL_Nc	|\
+				 V4L2_STD_NTSC)
 
+/* Standards where MTS/BTSC stereo could be found */
+#define V4L2_STD_MTS		(V4L2_STD_NTSC_M	|\
+				 V4L2_STD_PAL_M		|\
+				 V4L2_STD_PAL_N		|\
+				 V4L2_STD_PAL_Nc)
+
+/* Standards for Countries with 60Hz Line frequency */
 #define V4L2_STD_525_60		(V4L2_STD_PAL_M		|\
 				 V4L2_STD_PAL_60	|\
 				 V4L2_STD_NTSC		|\
 				 V4L2_STD_NTSC_443)
+/* Standards for Countries with 50Hz Line frequency */
 #define V4L2_STD_625_50		(V4L2_STD_PAL		|\
 				 V4L2_STD_PAL_N		|\
 				 V4L2_STD_PAL_Nc	|\
 				 V4L2_STD_SECAM)
+
 #define V4L2_STD_ATSC           (V4L2_STD_ATSC_8_VSB    |\
 				 V4L2_STD_ATSC_16_VSB)
-
+/* Macros with none and all analog standards */
 #define V4L2_STD_UNKNOWN        0
 #define V4L2_STD_ALL            (V4L2_STD_525_60	|\
 				 V4L2_STD_625_50)
@@ -714,6 +923,99 @@
 };
 
 /*
+ *	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
+ */
+
+/* BT.656/BT.1120 timing data */
+struct v4l2_bt_timings {
+	__u32	width;		/* width in pixels */
+	__u32	height;		/* height in lines */
+	__u32	interlaced;	/* Interlaced or progressive */
+	__u32	polarities;	/* Positive or negative polarity */
+	__u64	pixelclock;	/* Pixel clock in HZ. Ex. 74.25MHz->74250000 */
+	__u32	hfrontporch;	/* Horizpontal front porch in pixels */
+	__u32	hsync;		/* Horizontal Sync length in pixels */
+	__u32	hbackporch;	/* Horizontal back porch in pixels */
+	__u32	vfrontporch;	/* Vertical front porch in pixels */
+	__u32	vsync;		/* Vertical Sync length in lines */
+	__u32	vbackporch;	/* Vertical back porch in lines */
+	__u32	il_vfrontporch;	/* Vertical front porch for bottom field of
+				 * interlaced field formats
+				 */
+	__u32	il_vsync;	/* Vertical sync length for bottom field of
+				 * interlaced field formats
+				 */
+	__u32	il_vbackporch;	/* Vertical back porch for bottom field of
+				 * interlaced field formats
+				 */
+	__u32	reserved[16];
+} __attribute__ ((packed));
+
+/* Interlaced or progressive format */
+#define	V4L2_DV_PROGRESSIVE	0
+#define	V4L2_DV_INTERLACED	1
+
+/* Polarities. If bit is not set, it is assumed to be negative polarity */
+#define V4L2_DV_VSYNC_POS_POL	0x00000001
+#define V4L2_DV_HSYNC_POS_POL	0x00000002
+
+
+/* DV timings */
+struct v4l2_dv_timings {
+	__u32 type;
+	union {
+		struct v4l2_bt_timings	bt;
+		__u32	reserved[32];
+	};
+} __attribute__ ((packed));
+
+/* Values for the type field */
+#define V4L2_DV_BT_656_1120	0	/* BT.656/1120 timing type */
+
+/*
  *	V I D E O   I N P U T S
  */
 struct v4l2_input {
@@ -724,7 +1026,8 @@
 	__u32        tuner;             /*  Associated tuner */
 	v4l2_std_id  std;
 	__u32	     status;
-	__u32	     reserved[4];
+	__u32	     capabilities;
+	__u32	     reserved[3];
 };
 
 /*  Values for the 'type' field */
@@ -755,6 +1058,11 @@
 #define V4L2_IN_ST_NO_ACCESS   0x02000000  /* Conditional access denied */
 #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_CUSTOM_TIMINGS	0x00000002 /* Supports S_DV_TIMINGS */
+#define V4L2_IN_CAP_STD			0x00000004 /* Supports S_STD */
+
 /*
  *	V I D E O   O U T P U T S
  */
@@ -765,13 +1073,19 @@
 	__u32	     audioset;		/*  Associated audios (bitfield) */
 	__u32	     modulator;         /*  Associated modulator */
 	v4l2_std_id  std;
-	__u32	     reserved[4];
+	__u32	     capabilities;
+	__u32	     reserved[3];
 };
 /*  Values for the 'type' field */
 #define V4L2_OUTPUT_TYPE_MODULATOR		1
 #define V4L2_OUTPUT_TYPE_ANALOG			2
 #define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY	3
 
+/* capabilities flags */
+#define V4L2_OUT_CAP_PRESETS		0x00000001 /* Supports S_DV_PRESET */
+#define V4L2_OUT_CAP_CUSTOM_TIMINGS	0x00000002 /* Supports S_DV_TIMINGS */
+#define V4L2_OUT_CAP_STD		0x00000004 /* Supports S_STD */
+
 /*
  *	C O N T R O L S
  */
@@ -782,11 +1096,12 @@
 
 struct v4l2_ext_control {
 	__u32 id;
-	__u32 reserved2[2];
+	__u32 size;
+	__u32 reserved2[1];
 	union {
 		__s32 value;
 		__s64 value64;
-		void *reserved;
+		char *string;
 	};
 } __attribute__ ((packed));
 
@@ -802,11 +1117,24 @@
 #define V4L2_CTRL_CLASS_USER 0x00980000	/* Old-style 'user' controls */
 #define V4L2_CTRL_CLASS_MPEG 0x00990000	/* MPEG-compression controls */
 #define V4L2_CTRL_CLASS_CAMERA 0x009a0000	/* Camera class controls */
+#define V4L2_CTRL_CLASS_FM_TX 0x009b0000	/* FM Modulator control class */
+#define V4L2_CTRL_CLASS_FLASH 0x009c0000	/* Camera flash controls */
 
 #define V4L2_CTRL_ID_MASK      	  (0x0fffffff)
 #define V4L2_CTRL_ID2CLASS(id)    ((id) & 0x0fff0000UL)
 #define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
 
+enum v4l2_ctrl_type {
+	V4L2_CTRL_TYPE_INTEGER	     = 1,
+	V4L2_CTRL_TYPE_BOOLEAN	     = 2,
+	V4L2_CTRL_TYPE_MENU	     = 3,
+	V4L2_CTRL_TYPE_BUTTON	     = 4,
+	V4L2_CTRL_TYPE_INTEGER64     = 5,
+	V4L2_CTRL_TYPE_CTRL_CLASS    = 6,
+	V4L2_CTRL_TYPE_STRING        = 7,
+	V4L2_CTRL_TYPE_BITMASK       = 8,
+};
+
 /*  Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
 struct v4l2_queryctrl {
 	__u32		     id;
@@ -836,11 +1164,13 @@
 #define V4L2_CTRL_FLAG_INACTIVE 	0x0010
 #define V4L2_CTRL_FLAG_SLIDER 		0x0020
 #define V4L2_CTRL_FLAG_WRITE_ONLY 	0x0040
+#define V4L2_CTRL_FLAG_VOLATILE		0x0080
 
 /*  Query flag, to be ORed with the control ID */
 #define V4L2_CTRL_FLAG_NEXT_CTRL	0x80000000
 
 /*  User-class control IDs defined by V4L2 */
+#define V4L2_CID_MAX_CTRLS		1024
 #define V4L2_CID_BASE			(V4L2_CTRL_CLASS_USER | 0x900)
 #define V4L2_CID_USER_BASE 		V4L2_CID_BASE
 /*  IDs reserved for driver specific controls */
@@ -879,6 +1209,7 @@
 	V4L2_CID_POWER_LINE_FREQUENCY_DISABLED	= 0,
 	V4L2_CID_POWER_LINE_FREQUENCY_50HZ	= 1,
 	V4L2_CID_POWER_LINE_FREQUENCY_60HZ	= 2,
+	V4L2_CID_POWER_LINE_FREQUENCY_AUTO	= 3,
 };
 #define V4L2_CID_HUE_AUTO			(V4L2_CID_BASE+25)
 #define V4L2_CID_WHITE_BALANCE_TEMPERATURE	(V4L2_CID_BASE+26)
@@ -891,17 +1222,38 @@
 	V4L2_COLORFX_NONE	= 0,
 	V4L2_COLORFX_BW		= 1,
 	V4L2_COLORFX_SEPIA	= 2,
+	V4L2_COLORFX_NEGATIVE = 3,
+	V4L2_COLORFX_EMBOSS = 4,
+	V4L2_COLORFX_SKETCH = 5,
+	V4L2_COLORFX_SKY_BLUE = 6,
+	V4L2_COLORFX_GRASS_GREEN = 7,
+	V4L2_COLORFX_SKIN_WHITEN = 8,
+	V4L2_COLORFX_VIVID = 9,
 };
 #define V4L2_CID_AUTOBRIGHTNESS			(V4L2_CID_BASE+32)
+#define V4L2_CID_BAND_STOP_FILTER		(V4L2_CID_BASE+33)
+
+#define V4L2_CID_ROTATE				(V4L2_CID_BASE+34)
+#define V4L2_CID_BG_COLOR			(V4L2_CID_BASE+35)
+
+#define V4L2_CID_CHROMA_GAIN                    (V4L2_CID_BASE+36)
+
+#define V4L2_CID_ILLUMINATORS_1			(V4L2_CID_BASE+37)
+#define V4L2_CID_ILLUMINATORS_2			(V4L2_CID_BASE+38)
+
+#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE	(V4L2_CID_BASE+39)
+#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT		(V4L2_CID_BASE+40)
+
+#define V4L2_CID_ALPHA_COMPONENT		(V4L2_CID_BASE+41)
 
 /* last CID + 1 */
-#define V4L2_CID_LASTP1                         (V4L2_CID_BASE+33)
+#define V4L2_CID_LASTP1                         (V4L2_CID_BASE+42)
 
 /*  MPEG-class control IDs defined by V4L2 */
 #define V4L2_CID_MPEG_BASE 			(V4L2_CTRL_CLASS_MPEG | 0x900)
 #define V4L2_CID_MPEG_CLASS 			(V4L2_CTRL_CLASS_MPEG | 1)
 
-/*  MPEG streams */
+/*  MPEG streams, specific to multiplexed streams */
 #define V4L2_CID_MPEG_STREAM_TYPE 		(V4L2_CID_MPEG_BASE+0)
 enum v4l2_mpeg_stream_type {
 	V4L2_MPEG_STREAM_TYPE_MPEG2_PS   = 0, /* MPEG-2 program stream */
@@ -923,7 +1275,7 @@
 	V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1,  /* VBI in private packets, IVTV format */
 };
 
-/*  MPEG audio */
+/*  MPEG audio controls specific to multiplexed streams  */
 #define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ 	(V4L2_CID_MPEG_BASE+100)
 enum v4l2_mpeg_audio_sampling_freq {
 	V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
@@ -1039,7 +1391,7 @@
 	V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
 };
 
-/*  MPEG video */
+/*  MPEG video controls specific to multiplexed streams */
 #define V4L2_CID_MPEG_VIDEO_ENCODING 		(V4L2_CID_MPEG_BASE+200)
 enum v4l2_mpeg_video_encoding {
 	V4L2_MPEG_VIDEO_ENCODING_MPEG_1     = 0,
@@ -1067,6 +1419,141 @@
 #define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
 #define V4L2_CID_MPEG_VIDEO_MUTE 		(V4L2_CID_MPEG_BASE+210)
 #define V4L2_CID_MPEG_VIDEO_MUTE_YUV 		(V4L2_CID_MPEG_BASE+211)
+#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE		(V4L2_CID_MPEG_BASE+212)
+#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER	(V4L2_CID_MPEG_BASE+213)
+#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB		(V4L2_CID_MPEG_BASE+214)
+#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE			(V4L2_CID_MPEG_BASE+215)
+#define V4L2_CID_MPEG_VIDEO_HEADER_MODE				(V4L2_CID_MPEG_BASE+216)
+enum v4l2_mpeg_video_header_mode {
+	V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE			= 0,
+	V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME	= 1,
+
+};
+#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC			(V4L2_CID_MPEG_BASE+217)
+#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE		(V4L2_CID_MPEG_BASE+218)
+#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES	(V4L2_CID_MPEG_BASE+219)
+#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB		(V4L2_CID_MPEG_BASE+220)
+#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE		(V4L2_CID_MPEG_BASE+221)
+enum v4l2_mpeg_video_multi_slice_mode {
+	V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE		= 0,
+	V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB		= 1,
+	V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES	= 2,
+};
+#define V4L2_CID_MPEG_VIDEO_VBV_SIZE			(V4L2_CID_MPEG_BASE+222)
+#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)
+#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP		(V4L2_CID_MPEG_BASE+302)
+#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP			(V4L2_CID_MPEG_BASE+303)
+#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP			(V4L2_CID_MPEG_BASE+304)
+#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP		(V4L2_CID_MPEG_BASE+350)
+#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP		(V4L2_CID_MPEG_BASE+351)
+#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP		(V4L2_CID_MPEG_BASE+352)
+#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP			(V4L2_CID_MPEG_BASE+353)
+#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP			(V4L2_CID_MPEG_BASE+354)
+#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM		(V4L2_CID_MPEG_BASE+355)
+#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE		(V4L2_CID_MPEG_BASE+356)
+#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE		(V4L2_CID_MPEG_BASE+357)
+enum v4l2_mpeg_video_h264_entropy_mode {
+	V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC	= 0,
+	V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC	= 1,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD		(V4L2_CID_MPEG_BASE+358)
+#define V4L2_CID_MPEG_VIDEO_H264_LEVEL			(V4L2_CID_MPEG_BASE+359)
+enum v4l2_mpeg_video_h264_level {
+	V4L2_MPEG_VIDEO_H264_LEVEL_1_0	= 0,
+	V4L2_MPEG_VIDEO_H264_LEVEL_1B	= 1,
+	V4L2_MPEG_VIDEO_H264_LEVEL_1_1	= 2,
+	V4L2_MPEG_VIDEO_H264_LEVEL_1_2	= 3,
+	V4L2_MPEG_VIDEO_H264_LEVEL_1_3	= 4,
+	V4L2_MPEG_VIDEO_H264_LEVEL_2_0	= 5,
+	V4L2_MPEG_VIDEO_H264_LEVEL_2_1	= 6,
+	V4L2_MPEG_VIDEO_H264_LEVEL_2_2	= 7,
+	V4L2_MPEG_VIDEO_H264_LEVEL_3_0	= 8,
+	V4L2_MPEG_VIDEO_H264_LEVEL_3_1	= 9,
+	V4L2_MPEG_VIDEO_H264_LEVEL_3_2	= 10,
+	V4L2_MPEG_VIDEO_H264_LEVEL_4_0	= 11,
+	V4L2_MPEG_VIDEO_H264_LEVEL_4_1	= 12,
+	V4L2_MPEG_VIDEO_H264_LEVEL_4_2	= 13,
+	V4L2_MPEG_VIDEO_H264_LEVEL_5_0	= 14,
+	V4L2_MPEG_VIDEO_H264_LEVEL_5_1	= 15,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA	(V4L2_CID_MPEG_BASE+360)
+#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA	(V4L2_CID_MPEG_BASE+361)
+#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE	(V4L2_CID_MPEG_BASE+362)
+enum v4l2_mpeg_video_h264_loop_filter_mode {
+	V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED				= 0,
+	V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED				= 1,
+	V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY	= 2,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_PROFILE		(V4L2_CID_MPEG_BASE+363)
+enum v4l2_mpeg_video_h264_profile {
+	V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE			= 0,
+	V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE	= 1,
+	V4L2_MPEG_VIDEO_H264_PROFILE_MAIN			= 2,
+	V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED			= 3,
+	V4L2_MPEG_VIDEO_H264_PROFILE_HIGH			= 4,
+	V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10			= 5,
+	V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422			= 6,
+	V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE	= 7,
+	V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA		= 8,
+	V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA		= 9,
+	V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA		= 10,
+	V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA		= 11,
+	V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE		= 12,
+	V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH		= 13,
+	V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA	= 14,
+	V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH		= 15,
+	V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH		= 16,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT	(V4L2_CID_MPEG_BASE+364)
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH	(V4L2_CID_MPEG_BASE+365)
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE		(V4L2_CID_MPEG_BASE+366)
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC		(V4L2_CID_MPEG_BASE+367)
+enum v4l2_mpeg_video_h264_vui_sar_idc {
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED	= 0,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1		= 1,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11		= 2,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11		= 3,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11		= 4,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33		= 5,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11		= 6,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11		= 7,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11		= 8,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33		= 9,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11		= 10,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11		= 11,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33		= 12,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99		= 13,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3		= 14,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2		= 15,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1		= 16,
+	V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED	= 17,
+};
+#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP	(V4L2_CID_MPEG_BASE+400)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP	(V4L2_CID_MPEG_BASE+401)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP	(V4L2_CID_MPEG_BASE+402)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP	(V4L2_CID_MPEG_BASE+403)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP	(V4L2_CID_MPEG_BASE+404)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL		(V4L2_CID_MPEG_BASE+405)
+enum v4l2_mpeg_video_mpeg4_level {
+	V4L2_MPEG_VIDEO_MPEG4_LEVEL_0	= 0,
+	V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B	= 1,
+	V4L2_MPEG_VIDEO_MPEG4_LEVEL_1	= 2,
+	V4L2_MPEG_VIDEO_MPEG4_LEVEL_2	= 3,
+	V4L2_MPEG_VIDEO_MPEG4_LEVEL_3	= 4,
+	V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B	= 5,
+	V4L2_MPEG_VIDEO_MPEG4_LEVEL_4	= 6,
+	V4L2_MPEG_VIDEO_MPEG4_LEVEL_5	= 7,
+};
+#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE	(V4L2_CID_MPEG_BASE+406)
+enum v4l2_mpeg_video_mpeg4_profile {
+	V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE				= 0,
+	V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE			= 1,
+	V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE				= 2,
+	V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE			= 3,
+	V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY	= 4,
+};
+#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL		(V4L2_CID_MPEG_BASE+407)
 
 /*  MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
 #define V4L2_CID_MPEG_CX2341X_BASE 				(V4L2_CTRL_CLASS_MPEG | 0x1000)
@@ -1109,6 +1596,33 @@
 #define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP 	(V4L2_CID_MPEG_CX2341X_BASE+10)
 #define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS 	(V4L2_CID_MPEG_CX2341X_BASE+11)
 
+/*  MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */
+#define V4L2_CID_MPEG_MFC51_BASE				(V4L2_CTRL_CLASS_MPEG | 0x1100)
+
+#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY		(V4L2_CID_MPEG_MFC51_BASE+0)
+#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE	(V4L2_CID_MPEG_MFC51_BASE+1)
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE			(V4L2_CID_MPEG_MFC51_BASE+2)
+enum v4l2_mpeg_mfc51_video_frame_skip_mode {
+	V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED		= 0,
+	V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT	= 1,
+	V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT		= 2,
+};
+#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE			(V4L2_CID_MPEG_MFC51_BASE+3)
+enum v4l2_mpeg_mfc51_video_force_frame_type {
+	V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED		= 0,
+	V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME		= 1,
+	V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED	= 2,
+};
+#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING				(V4L2_CID_MPEG_MFC51_BASE+4)
+#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV				(V4L2_CID_MPEG_MFC51_BASE+5)
+#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT			(V4L2_CID_MPEG_MFC51_BASE+6)
+#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF			(V4L2_CID_MPEG_MFC51_BASE+7)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY		(V4L2_CID_MPEG_MFC51_BASE+50)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK			(V4L2_CID_MPEG_MFC51_BASE+51)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH		(V4L2_CID_MPEG_MFC51_BASE+52)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC		(V4L2_CID_MPEG_MFC51_BASE+53)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P		(V4L2_CID_MPEG_MFC51_BASE+54)
+
 /*  Camera class control IDs */
 #define V4L2_CID_CAMERA_CLASS_BASE 	(V4L2_CTRL_CLASS_CAMERA | 0x900)
 #define V4L2_CID_CAMERA_CLASS 		(V4L2_CTRL_CLASS_CAMERA | 1)
@@ -1141,6 +1655,79 @@
 
 #define V4L2_CID_PRIVACY			(V4L2_CID_CAMERA_CLASS_BASE+16)
 
+#define V4L2_CID_IRIS_ABSOLUTE			(V4L2_CID_CAMERA_CLASS_BASE+17)
+#define V4L2_CID_IRIS_RELATIVE			(V4L2_CID_CAMERA_CLASS_BASE+18)
+
+/* FM Modulator class control IDs */
+#define V4L2_CID_FM_TX_CLASS_BASE		(V4L2_CTRL_CLASS_FM_TX | 0x900)
+#define V4L2_CID_FM_TX_CLASS			(V4L2_CTRL_CLASS_FM_TX | 1)
+
+#define V4L2_CID_RDS_TX_DEVIATION		(V4L2_CID_FM_TX_CLASS_BASE + 1)
+#define V4L2_CID_RDS_TX_PI			(V4L2_CID_FM_TX_CLASS_BASE + 2)
+#define V4L2_CID_RDS_TX_PTY			(V4L2_CID_FM_TX_CLASS_BASE + 3)
+#define V4L2_CID_RDS_TX_PS_NAME			(V4L2_CID_FM_TX_CLASS_BASE + 5)
+#define V4L2_CID_RDS_TX_RADIO_TEXT		(V4L2_CID_FM_TX_CLASS_BASE + 6)
+
+#define V4L2_CID_AUDIO_LIMITER_ENABLED		(V4L2_CID_FM_TX_CLASS_BASE + 64)
+#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME	(V4L2_CID_FM_TX_CLASS_BASE + 65)
+#define V4L2_CID_AUDIO_LIMITER_DEVIATION	(V4L2_CID_FM_TX_CLASS_BASE + 66)
+
+#define V4L2_CID_AUDIO_COMPRESSION_ENABLED	(V4L2_CID_FM_TX_CLASS_BASE + 80)
+#define V4L2_CID_AUDIO_COMPRESSION_GAIN		(V4L2_CID_FM_TX_CLASS_BASE + 81)
+#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD	(V4L2_CID_FM_TX_CLASS_BASE + 82)
+#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME	(V4L2_CID_FM_TX_CLASS_BASE + 83)
+#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME	(V4L2_CID_FM_TX_CLASS_BASE + 84)
+
+#define V4L2_CID_PILOT_TONE_ENABLED		(V4L2_CID_FM_TX_CLASS_BASE + 96)
+#define V4L2_CID_PILOT_TONE_DEVIATION		(V4L2_CID_FM_TX_CLASS_BASE + 97)
+#define V4L2_CID_PILOT_TONE_FREQUENCY		(V4L2_CID_FM_TX_CLASS_BASE + 98)
+
+#define V4L2_CID_TUNE_PREEMPHASIS		(V4L2_CID_FM_TX_CLASS_BASE + 112)
+enum v4l2_preemphasis {
+	V4L2_PREEMPHASIS_DISABLED	= 0,
+	V4L2_PREEMPHASIS_50_uS		= 1,
+	V4L2_PREEMPHASIS_75_uS		= 2,
+};
+#define V4L2_CID_TUNE_POWER_LEVEL		(V4L2_CID_FM_TX_CLASS_BASE + 113)
+#define V4L2_CID_TUNE_ANTENNA_CAPACITOR		(V4L2_CID_FM_TX_CLASS_BASE + 114)
+
+/* Flash and privacy (indicator) light controls */
+#define V4L2_CID_FLASH_CLASS_BASE		(V4L2_CTRL_CLASS_FLASH | 0x900)
+#define V4L2_CID_FLASH_CLASS			(V4L2_CTRL_CLASS_FLASH | 1)
+
+#define V4L2_CID_FLASH_LED_MODE			(V4L2_CID_FLASH_CLASS_BASE + 1)
+enum v4l2_flash_led_mode {
+	V4L2_FLASH_LED_MODE_NONE,
+	V4L2_FLASH_LED_MODE_FLASH,
+	V4L2_FLASH_LED_MODE_TORCH,
+};
+
+#define V4L2_CID_FLASH_STROBE_SOURCE		(V4L2_CID_FLASH_CLASS_BASE + 2)
+enum v4l2_flash_strobe_source {
+	V4L2_FLASH_STROBE_SOURCE_SOFTWARE,
+	V4L2_FLASH_STROBE_SOURCE_EXTERNAL,
+};
+
+#define V4L2_CID_FLASH_STROBE			(V4L2_CID_FLASH_CLASS_BASE + 3)
+#define V4L2_CID_FLASH_STROBE_STOP		(V4L2_CID_FLASH_CLASS_BASE + 4)
+#define V4L2_CID_FLASH_STROBE_STATUS		(V4L2_CID_FLASH_CLASS_BASE + 5)
+
+#define V4L2_CID_FLASH_TIMEOUT			(V4L2_CID_FLASH_CLASS_BASE + 6)
+#define V4L2_CID_FLASH_INTENSITY		(V4L2_CID_FLASH_CLASS_BASE + 7)
+#define V4L2_CID_FLASH_TORCH_INTENSITY		(V4L2_CID_FLASH_CLASS_BASE + 8)
+#define V4L2_CID_FLASH_INDICATOR_INTENSITY	(V4L2_CID_FLASH_CLASS_BASE + 9)
+
+#define V4L2_CID_FLASH_FAULT			(V4L2_CID_FLASH_CLASS_BASE + 10)
+#define V4L2_FLASH_FAULT_OVER_VOLTAGE		(1 << 0)
+#define V4L2_FLASH_FAULT_TIMEOUT		(1 << 1)
+#define V4L2_FLASH_FAULT_OVER_TEMPERATURE	(1 << 2)
+#define V4L2_FLASH_FAULT_SHORT_CIRCUIT		(1 << 3)
+#define V4L2_FLASH_FAULT_OVER_CURRENT		(1 << 4)
+#define V4L2_FLASH_FAULT_INDICATOR		(1 << 5)
+
+#define V4L2_CID_FLASH_CHARGE			(V4L2_CID_FLASH_CLASS_BASE + 11)
+#define V4L2_CID_FLASH_READY			(V4L2_CID_FLASH_CLASS_BASE + 12)
+
 /*
  *	T U N I N G
  */
@@ -1175,6 +1762,9 @@
 #define V4L2_TUNER_CAP_LANG2		0x0020
 #define V4L2_TUNER_CAP_SAP		0x0020
 #define V4L2_TUNER_CAP_LANG1		0x0040
+#define V4L2_TUNER_CAP_RDS		0x0080
+#define V4L2_TUNER_CAP_RDS_BLOCK_IO	0x0100
+#define V4L2_TUNER_CAP_RDS_CONTROLS	0x0200
 
 /*  Flags for the 'rxsubchans' field */
 #define V4L2_TUNER_SUB_MONO		0x0001
@@ -1182,6 +1772,7 @@
 #define V4L2_TUNER_SUB_LANG2		0x0004
 #define V4L2_TUNER_SUB_SAP		0x0004
 #define V4L2_TUNER_SUB_LANG1		0x0008
+#define V4L2_TUNER_SUB_RDS		0x0010
 
 /*  Values for the 'audmode' field */
 #define V4L2_TUNER_MODE_MONO		0x0000
@@ -1203,10 +1794,32 @@
 	enum v4l2_tuner_type  type;
 	__u32		      seek_upward;
 	__u32		      wrap_around;
-	__u32		      reserved[8];
+	__u32		      spacing;
+	__u32		      reserved[7];
 };
 
 /*
+ *	R D S
+ */
+
+struct v4l2_rds_data {
+	__u8 	lsb;
+	__u8 	msb;
+	__u8 	block;
+} __attribute__ ((packed));
+
+#define V4L2_RDS_BLOCK_MSK 	 0x7
+#define V4L2_RDS_BLOCK_A 	 0
+#define V4L2_RDS_BLOCK_B 	 1
+#define V4L2_RDS_BLOCK_C 	 2
+#define V4L2_RDS_BLOCK_D 	 3
+#define V4L2_RDS_BLOCK_C_ALT 	 4
+#define V4L2_RDS_BLOCK_INVALID 	 7
+
+#define V4L2_RDS_BLOCK_CORRECTED 0x40
+#define V4L2_RDS_BLOCK_ERROR 	 0x80
+
+/*
  *	A U D I O
  */
 struct v4l2_audio {
@@ -1404,12 +2017,56 @@
  *	A G G R E G A T E   S T R U C T U R E S
  */
 
-/*	Stream data format
+/**
+ * struct v4l2_plane_pix_format - additional, per-plane format definition
+ * @sizeimage:		maximum size in bytes required for data, for which
+ *			this plane will be used
+ * @bytesperline:	distance in bytes between the leftmost pixels in two
+ *			adjacent lines
+ */
+struct v4l2_plane_pix_format {
+	__u32		sizeimage;
+	__u16		bytesperline;
+	__u16		reserved[7];
+} __attribute__ ((packed));
+
+/**
+ * struct v4l2_pix_format_mplane - multiplanar format definition
+ * @width:		image width in pixels
+ * @height:		image height in pixels
+ * @pixelformat:	little endian four character code (fourcc)
+ * @field:		field order (for interlaced video)
+ * @colorspace:		supplemental to pixelformat
+ * @plane_fmt:		per-plane information
+ * @num_planes:		number of planes for this format
+ */
+struct v4l2_pix_format_mplane {
+	__u32				width;
+	__u32				height;
+	__u32				pixelformat;
+	enum v4l2_field			field;
+	enum v4l2_colorspace		colorspace;
+
+	struct v4l2_plane_pix_format	plane_fmt[VIDEO_MAX_PLANES];
+	__u8				num_planes;
+	__u8				reserved[11];
+} __attribute__ ((packed));
+
+/**
+ * struct v4l2_format - stream data format
+ * @type:	type of the data stream
+ * @pix:	definition of an image format
+ * @pix_mp:	definition of a multiplanar image format
+ * @win:	definition of an overlaid image
+ * @vbi:	raw VBI capture or output parameters
+ * @sliced:	sliced VBI capture or output parameters
+ * @raw_data:	placeholder for future extensions and custom formats
  */
 struct v4l2_format {
 	enum v4l2_buf_type type;
 	union {
 		struct v4l2_pix_format		pix;     /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
+		struct v4l2_pix_format_mplane	pix_mp;  /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
 		struct v4l2_window		win;     /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
 		struct v4l2_vbi_format		vbi;     /* V4L2_BUF_TYPE_VBI_CAPTURE */
 		struct v4l2_sliced_vbi_format	sliced;  /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
@@ -1417,7 +2074,6 @@
 	} fmt;
 };
 
-
 /*	Stream type-dependent parameters
  */
 struct v4l2_streamparm {
@@ -1430,6 +2086,70 @@
 };
 
 /*
+ *	E V E N T S
+ */
+
+#define V4L2_EVENT_ALL				0
+#define V4L2_EVENT_VSYNC			1
+#define V4L2_EVENT_EOS				2
+#define V4L2_EVENT_CTRL				3
+#define V4L2_EVENT_FRAME_SYNC			4
+#define V4L2_EVENT_PRIVATE_START		0x08000000
+
+/* Payload for V4L2_EVENT_VSYNC */
+struct v4l2_event_vsync {
+	/* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
+	__u8 field;
+} __attribute__ ((packed));
+
+/* Payload for V4L2_EVENT_CTRL */
+#define V4L2_EVENT_CTRL_CH_VALUE		(1 << 0)
+#define V4L2_EVENT_CTRL_CH_FLAGS		(1 << 1)
+
+struct v4l2_event_ctrl {
+	__u32 changes;
+	__u32 type;
+	union {
+		__s32 value;
+		__s64 value64;
+	};
+	__u32 flags;
+	__s32 minimum;
+	__s32 maximum;
+	__s32 step;
+	__s32 default_value;
+};
+
+struct v4l2_event_frame_sync {
+	__u32 frame_sequence;
+};
+
+struct v4l2_event {
+	__u32				type;
+	union {
+		struct v4l2_event_vsync		vsync;
+		struct v4l2_event_ctrl		ctrl;
+		struct v4l2_event_frame_sync	frame_sync;
+		__u8				data[64];
+	} u;
+	__u32				pending;
+	__u32				sequence;
+	struct timespec			timestamp;
+	__u32				id;
+	__u32				reserved[8];
+};
+
+#define V4L2_EVENT_SUB_FL_SEND_INITIAL		(1 << 0)
+#define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK	(1 << 1)
+
+struct v4l2_event_subscription {
+	__u32				type;
+	__u32				id;
+	__u32				flags;
+	__u32				reserved[5];
+};
+
+/*
  *	A D V A N C E D   D E B U G G I N G
  *
  *	NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
@@ -1465,6 +2185,23 @@
 	__u32 revision;    /* chip revision, chip specific */
 } __attribute__ ((packed));
 
+/**
+ * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument
+ * @index:	on return, index of the first created buffer
+ * @count:	entry: number of requested buffers,
+ *		return: number of created buffers
+ * @memory:	buffer memory type
+ * @format:	frame format, for which buffers are requested
+ * @reserved:	future extensions
+ */
+struct v4l2_create_buffers {
+	__u32			index;
+	__u32			count;
+	enum v4l2_memory        memory;
+	struct v4l2_format	format;
+	__u32			reserved[8];
+};
+
 /*
  *	I O C T L   C O D E S   F O R   V I D E O   D E V I C E S
  *
@@ -1545,19 +2282,28 @@
 #endif
 
 #define VIDIOC_S_HW_FREQ_SEEK	 _IOW('V', 82, struct v4l2_hw_freq_seek)
+#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)
+#define	VIDIOC_SUBSCRIBE_EVENT	 _IOW('V', 90, struct v4l2_event_subscription)
+#define	VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
+
+/* Experimental, the below two ioctls may change over the next couple of kernel
+   versions */
+#define VIDIOC_CREATE_BUFS	_IOWR('V', 92, struct v4l2_create_buffers)
+#define VIDIOC_PREPARE_BUF	_IOWR('V', 93, struct v4l2_buffer)
+
+/* Experimental selection API */
+#define VIDIOC_G_SELECTION	_IOWR('V', 94, struct v4l2_selection)
+#define VIDIOC_S_SELECTION	_IOWR('V', 95, struct v4l2_selection)
+
 /* Reminder: when adding new ioctls please add support for them to
    drivers/media/video/v4l2-compat-ioctl32.c as well! */
 
-#ifdef __OLD_VIDIOC_
-/* for compatibility, will go away some day */
-#define VIDIOC_OVERLAY_OLD     	_IOWR('V', 14, int)
-#define VIDIOC_S_PARM_OLD      	 _IOW('V', 22, struct v4l2_streamparm)
-#define VIDIOC_S_CTRL_OLD      	 _IOW('V', 28, struct v4l2_control)
-#define VIDIOC_G_AUDIO_OLD     	_IOWR('V', 33, struct v4l2_audio)
-#define VIDIOC_G_AUDOUT_OLD    	_IOWR('V', 49, struct v4l2_audioout)
-#define VIDIOC_CROPCAP_OLD     	 _IOR('V', 58, struct v4l2_cropcap)
-#endif
-
 #define BASE_VIDIOC_PRIVATE	192		/* 192-255 are private */
 
 #endif /* __LINUX_VIDEODEV2_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/videotext.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/videotext.h
deleted file mode 100644
index 6afaaf1..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/videotext.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifndef _VTX_H
-#define _VTX_H
-
-/*
- * Teletext (=Videotext) hardware decoders using interface /dev/vtx
- * Do not confuse with drivers using /dev/vbi which decode videotext by software
- *
- * Videotext IOCTLs changed in order to use _IO() macros defined in <linux/ioctl.h>,
- * unused tuner IOCTLs cleaned up by
- * Michael Geng <linux@MichaelGeng.de>
- *
- * Copyright (c) 1994-97 Martin Buck  <martin-2.buck@student.uni-ulm.de>
- * Read COPYING for more information
- *
- */
-
-
-/*
- *	Videotext ioctls
- */
-#define VTXIOCGETINFO	_IOR  (0x81,  1, vtx_info_t)
-#define VTXIOCCLRPAGE	_IOW  (0x81,  2, vtx_pagereq_t)
-#define VTXIOCCLRFOUND	_IOW  (0x81,  3, vtx_pagereq_t)
-#define VTXIOCPAGEREQ	_IOW  (0x81,  4, vtx_pagereq_t)
-#define VTXIOCGETSTAT	_IOW  (0x81,  5, vtx_pagereq_t)
-#define VTXIOCGETPAGE	_IOW  (0x81,  6, vtx_pagereq_t)
-#define VTXIOCSTOPDAU	_IOW  (0x81,  7, vtx_pagereq_t)
-#define VTXIOCPUTPAGE	_IO   (0x81,  8)
-#define VTXIOCSETDISP	_IO   (0x81,  9)
-#define VTXIOCPUTSTAT	_IO   (0x81, 10)
-#define VTXIOCCLRCACHE	_IO   (0x81, 11)
-#define VTXIOCSETVIRT	_IOW  (0x81, 12, long)
-
-/* for compatibility, will go away some day */
-#define VTXIOCGETINFO_OLD  0x7101  /* get version of driver & capabilities of vtx-chipset */
-#define VTXIOCCLRPAGE_OLD  0x7102  /* clear page-buffer */
-#define VTXIOCCLRFOUND_OLD 0x7103  /* clear bits indicating that page was found */
-#define VTXIOCPAGEREQ_OLD  0x7104  /* search for page */
-#define VTXIOCGETSTAT_OLD  0x7105  /* get status of page-buffer */
-#define VTXIOCGETPAGE_OLD  0x7106  /* get contents of page-buffer */
-#define VTXIOCSTOPDAU_OLD  0x7107  /* stop data acquisition unit */
-#define VTXIOCPUTPAGE_OLD  0x7108  /* display page on TV-screen */
-#define VTXIOCSETDISP_OLD  0x7109  /* set TV-mode */
-#define VTXIOCPUTSTAT_OLD  0x710a  /* set status of TV-output-buffer */
-#define VTXIOCCLRCACHE_OLD 0x710b  /* clear cache on VTX-interface (if avail.) */
-#define VTXIOCSETVIRT_OLD  0x710c  /* turn on virtual mode (this disables TV-display) */
-
-/*
- *	Definitions for VTXIOCGETINFO
- */
-
-#define SAA5243 0
-#define SAA5246 1
-#define SAA5249 2
-#define SAA5248 3
-#define XSTV5346 4
-
-typedef struct {
-	int version_major, version_minor;	/* version of driver; if version_major changes, driver */
-						/* is not backward compatible!!! CHECK THIS!!! */
-	int numpages;				/* number of page-buffers of vtx-chipset */
-	int cct_type;				/* type of vtx-chipset (SAA5243, SAA5246, SAA5248 or
-						 * SAA5249) */
-}
-vtx_info_t;
-
-
-/*
- *	Definitions for VTXIOC{CLRPAGE,CLRFOUND,PAGEREQ,GETSTAT,GETPAGE,STOPDAU,PUTPAGE,SETDISP}
- */
-
-#define MIN_UNIT   (1<<0)
-#define MIN_TEN    (1<<1)
-#define HR_UNIT    (1<<2)
-#define HR_TEN     (1<<3)
-#define PG_UNIT    (1<<4)
-#define PG_TEN     (1<<5)
-#define PG_HUND    (1<<6)
-#define PGMASK_MAX (1<<7)
-#define PGMASK_PAGE (PG_HUND | PG_TEN | PG_UNIT)
-#define PGMASK_HOUR (HR_TEN | HR_UNIT)
-#define PGMASK_MINUTE (MIN_TEN | MIN_UNIT)
-
-typedef struct
-{
-	int page;	/* number of requested page (hexadecimal) */
-	int hour;	/* requested hour (hexadecimal) */
-	int minute;	/* requested minute (hexadecimal) */
-	int pagemask;	/* mask defining which values of the above are set */
-	int pgbuf;	/* buffer where page will be stored */
-	int start;	/* start of requested part of page */
-	int end;	/* end of requested part of page */
-	void *buffer;	/* pointer to beginning of destination buffer */
-}
-vtx_pagereq_t;
-
-
-/*
- *	Definitions for VTXIOC{GETSTAT,PUTSTAT}
- */
-
-#define VTX_PAGESIZE (40 * 24)
-#define VTX_VIRTUALSIZE (40 * 49)
-
-typedef struct
-{
-	int pagenum;			/* number of page (hexadecimal) */
-	int hour;			/* hour (hexadecimal) */
-	int minute;			/* minute (hexadecimal) */
-	int charset;			/* national charset */
-	unsigned delete : 1;		/* delete page (C4) */
-	unsigned headline : 1;		/* insert headline (C5) */
-	unsigned subtitle : 1;		/* insert subtitle (C6) */
-	unsigned supp_header : 1;	/* suppress header (C7) */
-	unsigned update : 1;		/* update page (C8) */
-	unsigned inter_seq : 1;		/* interrupted sequence (C9) */
-	unsigned dis_disp : 1;		/* disable/suppress display (C10) */
-	unsigned serial : 1;		/* serial mode (C11) */
-	unsigned notfound : 1;		/* /FOUND */
-	unsigned pblf : 1;		/* PBLF */
-	unsigned hamming : 1;		/* hamming-error occurred */
-}
-vtx_pageinfo_t;
-
-#endif /* _VTX_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_9p.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_9p.h
index b3c4a60..277c4ad 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_9p.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_9p.h
@@ -1,12 +1,44 @@
 #ifndef _LINUX_VIRTIO_9P_H
 #define _LINUX_VIRTIO_9P_H
 /* This header is BSD licensed so anyone can use the definitions to implement
- * compatible drivers/servers. */
+ * compatible drivers/servers.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of IBM nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE. */
+#include <linux/types.h>
+#include <linux/virtio_ids.h>
 #include <linux/virtio_config.h>
 
-/* The ID for virtio console */
-#define VIRTIO_ID_9P	9
-/* Maximum number of virtio channels per partition (1 for now) */
-#define MAX_9P_CHAN	1
+/* The feature bitmap for virtio 9P */
+
+/* The mount point is specified in a config variable */
+#define VIRTIO_9P_MOUNT_TAG 0
+
+struct virtio_9p_config {
+	/* length of the tag name */
+	__u16 tag_len;
+	/* non-NULL terminated tag name */
+	__u8 tag[0];
+} __attribute__((packed));
 
 #endif /* _LINUX_VIRTIO_9P_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_balloon.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_balloon.h
index 8726ff7..652dc8b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_balloon.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_balloon.h
@@ -1,14 +1,36 @@
 #ifndef _LINUX_VIRTIO_BALLOON_H
 #define _LINUX_VIRTIO_BALLOON_H
 /* This header is BSD licensed so anyone can use the definitions to implement
- * compatible drivers/servers. */
+ * compatible drivers/servers.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of IBM nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE. */
+#include <linux/virtio_ids.h>
 #include <linux/virtio_config.h>
 
-/* The ID for virtio_balloon */
-#define VIRTIO_ID_BALLOON	5
-
 /* The feature bitmap for virtio balloon */
 #define VIRTIO_BALLOON_F_MUST_TELL_HOST	0 /* Tell before reclaiming pages */
+#define VIRTIO_BALLOON_F_STATS_VQ	1 /* Memory Stats virtqueue */
 
 /* Size of a PFN in the balloon interface. */
 #define VIRTIO_BALLOON_PFN_SHIFT 12
@@ -20,4 +42,18 @@
 	/* Number of pages we've actually got in balloon. */
 	__le32 actual;
 };
+
+#define VIRTIO_BALLOON_S_SWAP_IN  0   /* Amount of memory swapped in */
+#define VIRTIO_BALLOON_S_SWAP_OUT 1   /* Amount of memory swapped out */
+#define VIRTIO_BALLOON_S_MAJFLT   2   /* Number of major faults */
+#define VIRTIO_BALLOON_S_MINFLT   3   /* Number of minor faults */
+#define VIRTIO_BALLOON_S_MEMFREE  4   /* Total amount of free memory */
+#define VIRTIO_BALLOON_S_MEMTOT   5   /* Total amount of memory */
+#define VIRTIO_BALLOON_S_NR       6
+
+struct virtio_balloon_stat {
+	u16 tag;
+	u64 val;
+} __attribute__((packed));
+
 #endif /* _LINUX_VIRTIO_BALLOON_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_blk.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_blk.h
index 8dab9f2..e0edb40 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_blk.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_blk.h
@@ -1,13 +1,34 @@
 #ifndef _LINUX_VIRTIO_BLK_H
 #define _LINUX_VIRTIO_BLK_H
 /* This header is BSD licensed so anyone can use the definitions to implement
- * compatible drivers/servers. */
+ * compatible drivers/servers.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of IBM nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE. */
 #include <linux/types.h>
+#include <linux/virtio_ids.h>
 #include <linux/virtio_config.h>
 
-/* The ID for virtio_block */
-#define VIRTIO_ID_BLOCK	2
-
 /* Feature bits */
 #define VIRTIO_BLK_F_BARRIER	0	/* Does host support barriers? */
 #define VIRTIO_BLK_F_SIZE_MAX	1	/* Indicates maximum segment size */
@@ -16,9 +37,10 @@
 #define VIRTIO_BLK_F_RO		5	/* Disk is read-only */
 #define VIRTIO_BLK_F_BLK_SIZE	6	/* Block size of disk is available*/
 #define VIRTIO_BLK_F_SCSI	7	/* Supports scsi command passthru */
-#define VIRTIO_BLK_F_IDENTIFY	8	/* ATA IDENTIFY supported */
+#define VIRTIO_BLK_F_FLUSH	9	/* Cache flush command support */
+#define VIRTIO_BLK_F_TOPOLOGY	10	/* Topology information is available */
 
-#define VIRTIO_BLK_ID_BYTES	(sizeof(__u16[256]))	/* IDENTIFY DATA */
+#define VIRTIO_BLK_ID_BYTES	20	/* ID string length */
 
 struct virtio_blk_config {
 	/* The capacity (in 512-byte sectors). */
@@ -33,11 +55,33 @@
 		__u8 heads;
 		__u8 sectors;
 	} geometry;
+
 	/* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
 	__u32 blk_size;
-	__u8 identify[VIRTIO_BLK_ID_BYTES];
+
+	/* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY  */
+	/* exponent for physical block per logical block. */
+	__u8 physical_block_exp;
+	/* alignment offset in logical blocks. */
+	__u8 alignment_offset;
+	/* minimum I/O size without performance penalty in logical blocks. */
+	__u16 min_io_size;
+	/* optimal sustained I/O size in logical blocks. */
+	__u32 opt_io_size;
+
 } __attribute__((packed));
 
+/*
+ * Command types
+ *
+ * Usage is a bit tricky as some bits are used as flags and some are not.
+ *
+ * Rules:
+ *   VIRTIO_BLK_T_OUT may be combined with VIRTIO_BLK_T_SCSI_CMD or
+ *   VIRTIO_BLK_T_BARRIER.  VIRTIO_BLK_T_FLUSH is a command of its own
+ *   and may not be combined with any of the other flags.
+ */
+
 /* These two define direction. */
 #define VIRTIO_BLK_T_IN		0
 #define VIRTIO_BLK_T_OUT	1
@@ -45,6 +89,12 @@
 /* This bit says it's a scsi command, not an actual read or write. */
 #define VIRTIO_BLK_T_SCSI_CMD	2
 
+/* Cache flush command */
+#define VIRTIO_BLK_T_FLUSH	4
+
+/* Get device ID command */
+#define VIRTIO_BLK_T_GET_ID    8
+
 /* Barrier before this op. */
 #define VIRTIO_BLK_T_BARRIER	0x80000000
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_config.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_config.h
index 26f45f1..4f51d8f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_config.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_config.h
@@ -1,7 +1,30 @@
 #ifndef _LINUX_VIRTIO_CONFIG_H
 #define _LINUX_VIRTIO_CONFIG_H
 /* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
- * anyone can use the definitions to implement compatible drivers/servers. */
+ * anyone can use the definitions to implement compatible drivers/servers.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of IBM nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE. */
 
 /* Virtio devices use a standardized configuration space to define their
  * features and pass configuration information, but each implementation can
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_console.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_console.h
index 06d638d..5454e2e 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_console.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_console.h
@@ -1,23 +1,74 @@
 #ifndef _LINUX_VIRTIO_CONSOLE_H
 #define _LINUX_VIRTIO_CONSOLE_H
 #include <linux/types.h>
+#include <linux/virtio_ids.h>
 #include <linux/virtio_config.h>
-/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
- * anyone can use the definitions to implement compatible drivers/servers. */
-
-/* The ID for virtio console */
-#define VIRTIO_ID_CONSOLE	3
+/*
+ * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
+ * anyone can use the definitions to implement compatible drivers/servers:
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of IBM nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Copyright (C) Red Hat, Inc., 2009, 2010, 2011
+ * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011
+ */
 
 /* Feature bits */
 #define VIRTIO_CONSOLE_F_SIZE	0	/* Does host provide console size? */
+#define VIRTIO_CONSOLE_F_MULTIPORT 1	/* Does host provide multiple ports? */
+
+#define VIRTIO_CONSOLE_BAD_ID		(~(u32)0)
 
 struct virtio_console_config {
 	/* colums of the screens */
 	__u16 cols;
 	/* rows of the screens */
 	__u16 rows;
+	/* max. number of ports this device can hold */
+	__u32 max_nr_ports;
 } __attribute__((packed));
 
+/*
+ * A message that's passed between the Host and the Guest for a
+ * particular port.
+ */
+struct virtio_console_control {
+	__u32 id;		/* Port number */
+	__u16 event;		/* The kind of control event (see below) */
+	__u16 value;		/* Extra information for the key */
+};
+
+/* Some events for control messages */
+#define VIRTIO_CONSOLE_DEVICE_READY	0
+#define VIRTIO_CONSOLE_PORT_ADD		1
+#define VIRTIO_CONSOLE_PORT_REMOVE	2
+#define VIRTIO_CONSOLE_PORT_READY	3
+#define VIRTIO_CONSOLE_CONSOLE_PORT	4
+#define VIRTIO_CONSOLE_RESIZE		5
+#define VIRTIO_CONSOLE_PORT_OPEN	6
+#define VIRTIO_CONSOLE_PORT_NAME	7
 
 
 #endif /* _LINUX_VIRTIO_CONSOLE_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_ids.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_ids.h
new file mode 100644
index 0000000..85bb0bb
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_ids.h
@@ -0,0 +1,39 @@
+#ifndef _LINUX_VIRTIO_IDS_H
+#define _LINUX_VIRTIO_IDS_H
+/*
+ * Virtio IDs
+ *
+ * This header is BSD licensed so anyone can use the definitions to implement
+ * compatible drivers/servers.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of IBM nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE. */
+
+#define VIRTIO_ID_NET		1 /* virtio net */
+#define VIRTIO_ID_BLOCK		2 /* virtio block */
+#define VIRTIO_ID_CONSOLE	3 /* virtio console */
+#define VIRTIO_ID_RNG		4 /* virtio ring */
+#define VIRTIO_ID_BALLOON	5 /* virtio balloon */
+#define VIRTIO_ID_9P		9 /* 9p virtio console */
+
+#endif /* _LINUX_VIRTIO_IDS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_net.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_net.h
index d8dd539..970d5a2 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_net.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_net.h
@@ -1,14 +1,35 @@
 #ifndef _LINUX_VIRTIO_NET_H
 #define _LINUX_VIRTIO_NET_H
 /* This header is BSD licensed so anyone can use the definitions to implement
- * compatible drivers/servers. */
+ * compatible drivers/servers.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of IBM nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE. */
 #include <linux/types.h>
+#include <linux/virtio_ids.h>
 #include <linux/virtio_config.h>
 #include <linux/if_ether.h>
 
-/* The ID for virtio_net */
-#define VIRTIO_ID_NET	1
-
 /* The feature bitmap for virtio net */
 #define VIRTIO_NET_F_CSUM	0	/* Host handles pkts w/ partial csum */
 #define VIRTIO_NET_F_GUEST_CSUM	1	/* Guest handles pkts w/ partial csum */
@@ -42,6 +63,7 @@
  * specify GSO or CSUM features, you can simply ignore the header. */
 struct virtio_net_hdr {
 #define VIRTIO_NET_HDR_F_NEEDS_CSUM	1	// Use csum_start, csum_offset
+#define VIRTIO_NET_HDR_F_DATA_VALID	2	// Csum is valid
 	__u8 flags;
 #define VIRTIO_NET_HDR_GSO_NONE		0	// Not a GSO frame
 #define VIRTIO_NET_HDR_GSO_TCPV4	1	// GSO frame, IPv4 TCP (TSO)
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_pci.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_pci.h
index 9a3d7c4..ea66f3f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_pci.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_pci.h
@@ -11,6 +11,29 @@
  *
  * This header is BSD licensed so anyone can use the definitions to implement
  * compatible drivers/servers.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of IBM nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #ifndef _LINUX_VIRTIO_PCI_H
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_ring.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_ring.h
index 541dc42..1b333e2 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_ring.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_ring.h
@@ -7,6 +7,29 @@
  * This header is BSD licensed so anyone can use the definitions to implement
  * compatible drivers/servers.
  *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of IBM nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
  * Copyright Rusty Russell IBM Corporation 2007. */
 #include <linux/types.h>
 
@@ -29,6 +52,12 @@
 /* We support indirect buffer descriptors */
 #define VIRTIO_RING_F_INDIRECT_DESC	28
 
+/* The Guest publishes the used index for which it expects an interrupt
+ * at the end of the avail ring. Host should ignore the avail->flags field. */
+/* The Host publishes the avail index for which it expects a kick
+ * at the end of the used ring. Guest should ignore the used->flags field. */
+#define VIRTIO_RING_F_EVENT_IDX		29
+
 /* Virtio ring descriptors: 16 bytes.  These can chain together via "next". */
 struct vring_desc {
 	/* Address (guest-physical). */
@@ -83,6 +112,7 @@
  *	__u16 avail_flags;
  *	__u16 avail_idx;
  *	__u16 available[num];
+ *	__u16 used_event_idx;
  *
  *	// Padding to the next align boundary.
  *	char pad[];
@@ -91,23 +121,43 @@
  *	__u16 used_flags;
  *	__u16 used_idx;
  *	struct vring_used_elem used[num];
+ *	__u16 avail_event_idx;
  * };
  */
+/* We publish the used event index at the end of the available ring, and vice
+ * versa. They are at the end for backwards compatibility. */
+#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num])
+#define vring_avail_event(vr) (*(__u16 *)&(vr)->used->ring[(vr)->num])
+
 static __inline__ void vring_init(struct vring *vr, unsigned int num, void *p,
 			      unsigned long align)
 {
 	vr->num = num;
 	vr->desc = p;
 	vr->avail = p + num*sizeof(struct vring_desc);
-	vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + align-1)
-			    & ~(align - 1));
+	vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(__u16)
+		+ align-1) & ~(align - 1));
 }
 
 static __inline__ unsigned vring_size(unsigned int num, unsigned long align)
 {
-	return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
+	return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (3 + num)
 		 + align - 1) & ~(align - 1))
-		+ sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num;
+		+ sizeof(__u16) * 3 + sizeof(struct vring_used_elem) * num;
+}
+
+/* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */
+/* Assuming a given event_idx value from the other size, if
+ * we have just incremented index from old to new_idx,
+ * should we trigger an event? */
+static __inline__ int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old)
+{
+	/* Note: Xen has similar logic for notification hold-off
+	 * in include/xen/interface/io/ring.h with req_event and req_prod
+	 * corresponding to event_idx + 1 and new_idx respectively.
+	 * Note also that req_event and req_prod in Xen start at 1,
+	 * event indexes in virtio start at 0. */
+	return (__u16)(new_idx - event_idx - 1) < (__u16)(new_idx - old);
 }
 
 #endif /* _LINUX_VIRTIO_RING_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_rng.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_rng.h
index 1a85dab..c4d5de8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_rng.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/virtio_rng.h
@@ -2,9 +2,7 @@
 #define _LINUX_VIRTIO_RNG_H
 /* This header is BSD licensed so anyone can use the definitions to implement
  * compatible drivers/servers. */
+#include <linux/virtio_ids.h>
 #include <linux/virtio_config.h>
 
-/* The ID for virtio_rng */
-#define VIRTIO_ID_RNG	4
-
 #endif /* _LINUX_VIRTIO_RNG_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/vt.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/vt.h
index bbf9f8e..f108f05 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/vt.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/vt.h
@@ -63,4 +63,28 @@
 #define VT_UNLOCKSWITCH 0x560C  /* allow vt switching */
 #define VT_GETHIFONTMASK 0x560D  /* return hi font mask */
 
+struct vt_event {
+	unsigned int event;
+#define VT_EVENT_SWITCH		0x0001	/* Console switch */
+#define VT_EVENT_BLANK		0x0002	/* Screen blank */
+#define VT_EVENT_UNBLANK	0x0004	/* Screen unblank */
+#define VT_EVENT_RESIZE		0x0008	/* Resize display */
+#define VT_MAX_EVENT		0x000F
+	unsigned int oldev;		/* Old console */
+	unsigned int newev;		/* New console (if changing) */
+	unsigned int pad[4];		/* Padding for expansion */
+};
+
+#define VT_WAITEVENT	0x560E	/* Wait for an event */
+
+struct vt_setactivate {
+	unsigned int console;
+	struct vt_mode mode;
+};
+
+#define VT_SETACTIVATE	0x560F	/* Activate and set the mode of a console */
+
+
+#define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
+
 #endif /* _LINUX_VT_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/wanrouter.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/wanrouter.h
index 45615ab..f26b2a8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/wanrouter.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/wanrouter.h
@@ -309,7 +309,7 @@
 #define WANOPT_EVEN	2
 
 /* CHDLC Protocol Options */
-/* DF Commmented out for now.
+/* DF Commented out for now.
 
 #define WANOPT_CHDLC_NO_DCD		IGNORE_DCD_FOR_LINK_STAT
 #define WANOPT_CHDLC_NO_CTS		IGNORE_CTS_FOR_LINK_STAT
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/wimax.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/wimax.h
index 4fdcc56..9f6b77a 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/wimax.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/wimax.h
@@ -114,7 +114,7 @@
 	WIMAX_GNL_RESET_IFIDX = 1,
 };
 
-/* Atributes for wimax_state_get() */
+/* Attributes for wimax_state_get() */
 enum {
 	WIMAX_GNL_STGET_IFIDX = 1,
 };
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/wimax/i2400m.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/wimax/i2400m.h
index 433693e..62d3561 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/wimax/i2400m.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/wimax/i2400m.h
@@ -138,7 +138,7 @@
 	__le32 module_id;
 	__le32 module_vendor;
 	__le32 date;		/* BCD YYYMMDD */
-	__le32 size;
+	__le32 size;            /* in dwords */
 	__le32 key_size;	/* in dwords */
 	__le32 modulus_size;	/* in dwords */
 	__le32 exponent_size;	/* in dwords */
@@ -168,16 +168,6 @@
 };
 
 
-/* Constants for bcf->module_id */
-enum i2400m_bcf_mod_id {
-	/* Firmware file carries its own pokes -- pokes are a set of
-	 * magical values that have to be written in certain memory
-	 * addresses to get the device up and ready for firmware
-	 * download when it is in non-signed boot mode. */
-	I2400M_BCF_MOD_ID_POKES = 0x000000001,
-};
-
-
 /**
  * i2400m_bootrom_header - Header for a boot-mode command
  *
@@ -276,6 +266,7 @@
 	I2400M_WARM_RESET_BARKER = 0x50f750f7,
 	I2400M_NBOOT_BARKER = 0xdeadbeef,
 	I2400M_SBOOT_BARKER = 0x0ff1c1a1,
+	I2400M_SBOOT_BARKER_6050 = 0x80000001,
 	I2400M_ACK_BARKER = 0xfeedbabe,
 	I2400M_D2H_MSG_BARKER = 0xbeefbabe,
 };
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/wireless.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/wireless.h
index fc1fec0..2c6426b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/wireless.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/wireless.h
@@ -346,6 +346,8 @@
 #define SIOCIWFIRST	0x8B00
 #define SIOCIWLAST	SIOCIWLASTPRIV		/* 0x8BFF */
 #define IW_IOCTL_IDX(cmd)	((cmd) - SIOCIWFIRST)
+#define IW_HANDLER(id, func)			\
+	[IW_IOCTL_IDX(id)] = func
 
 /* Odd : get (world access), even : set (root access) */
 #define IW_IS_SET(cmd)	(!((cmd) & 0x1))
@@ -648,7 +650,7 @@
  * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
 #define IW_EVENT_CAPA_BASE(cmd)		((cmd >= SIOCIWFIRSTPRIV) ? \
 					 (cmd - SIOCIWFIRSTPRIV + 0x60) : \
-					 (cmd - SIOCSIWCOMMIT))
+					 (cmd - SIOCIWFIRST))
 #define IW_EVENT_CAPA_INDEX(cmd)	(IW_EVENT_CAPA_BASE(cmd) >> 5)
 #define IW_EVENT_CAPA_MASK(cmd)		(1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
 /* Event capability constants - event autogenerated by the kernel
@@ -1121,6 +1123,6 @@
 #define IW_EV_PARAM_PK_LEN	(IW_EV_LCP_PK_LEN + sizeof(struct iw_param))
 #define IW_EV_ADDR_PK_LEN	(IW_EV_LCP_PK_LEN + sizeof(struct sockaddr))
 #define IW_EV_QUAL_PK_LEN	(IW_EV_LCP_PK_LEN + sizeof(struct iw_quality))
-#define IW_EV_POINT_PK_LEN	(IW_EV_LCP_LEN + 4)
+#define IW_EV_POINT_PK_LEN	(IW_EV_LCP_PK_LEN + 4)
 
 #endif	/* _LINUX_WIRELESS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/x25.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/x25.h
index d035e4e..810cce6 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/x25.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/x25.h
@@ -12,6 +12,7 @@
 #define	X25_KERNEL_H
 
 #include <linux/types.h>
+#include <linux/socket.h>
 
 #define	SIOCX25GSUBSCRIP	(SIOCPROTOPRIVATE + 0)
 #define	SIOCX25SSUBSCRIP	(SIOCPROTOPRIVATE + 1)
@@ -25,6 +26,7 @@
 #define SIOCX25SENDCALLACCPT    (SIOCPROTOPRIVATE + 9)
 #define SIOCX25GDTEFACILITIES (SIOCPROTOPRIVATE + 10)
 #define SIOCX25SDTEFACILITIES (SIOCPROTOPRIVATE + 11)
+#define SIOCX25SCAUSEDIAG	(SIOCPROTOPRIVATE + 12)
 
 /*
  *	Values for {get,set}sockopt.
@@ -56,7 +58,7 @@
  *	Linux X.25 Address structure, used for bind, and connect mostly.
  */
 struct sockaddr_x25 {
-	sa_family_t	   sx25_family;		/* Must be AF_X25 */
+	__kernel_sa_family_t sx25_family;	/* Must be AF_X25 */
 	struct x25_address sx25_addr;		/* X.121 Address */
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/xattr.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/xattr.h
index 82ca33c..ac62537 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/xattr.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/xattr.h
@@ -13,5 +13,49 @@
 #define XATTR_CREATE	0x1	/* set value, fail if attr already exists */
 #define XATTR_REPLACE	0x2	/* set value, fail if attr does not exist */
 
+/* Namespaces */
+#define XATTR_OS2_PREFIX "os2."
+#define XATTR_OS2_PREFIX_LEN (sizeof (XATTR_OS2_PREFIX) - 1)
+
+#define XATTR_SECURITY_PREFIX	"security."
+#define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1)
+
+#define XATTR_SYSTEM_PREFIX "system."
+#define XATTR_SYSTEM_PREFIX_LEN (sizeof (XATTR_SYSTEM_PREFIX) - 1)
+
+#define XATTR_TRUSTED_PREFIX "trusted."
+#define XATTR_TRUSTED_PREFIX_LEN (sizeof (XATTR_TRUSTED_PREFIX) - 1)
+
+#define XATTR_USER_PREFIX "user."
+#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1)
+
+/* Security namespace */
+#define XATTR_EVM_SUFFIX "evm"
+#define XATTR_NAME_EVM XATTR_SECURITY_PREFIX XATTR_EVM_SUFFIX
+
+#define XATTR_SELINUX_SUFFIX "selinux"
+#define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX
+
+#define XATTR_SMACK_SUFFIX "SMACK64"
+#define XATTR_SMACK_IPIN "SMACK64IPIN"
+#define XATTR_SMACK_IPOUT "SMACK64IPOUT"
+#define XATTR_SMACK_EXEC "SMACK64EXEC"
+#define XATTR_SMACK_TRANSMUTE "SMACK64TRANSMUTE"
+#define XATTR_SMACK_MMAP "SMACK64MMAP"
+#define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX
+#define XATTR_NAME_SMACKIPIN	XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN
+#define XATTR_NAME_SMACKIPOUT	XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT
+#define XATTR_NAME_SMACKEXEC	XATTR_SECURITY_PREFIX XATTR_SMACK_EXEC
+#define XATTR_NAME_SMACKTRANSMUTE XATTR_SECURITY_PREFIX XATTR_SMACK_TRANSMUTE
+#define XATTR_NAME_SMACKMMAP XATTR_SECURITY_PREFIX XATTR_SMACK_MMAP
+
+#define XATTR_CAPS_SUFFIX "capability"
+#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
+
+#define XATTR_POSIX_ACL_ACCESS  "posix_acl_access"
+#define XATTR_NAME_POSIX_ACL_ACCESS XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_ACCESS
+#define XATTR_POSIX_ACL_DEFAULT  "posix_acl_default"
+#define XATTR_NAME_POSIX_ACL_DEFAULT XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_DEFAULT
+
 
 #endif	/* _LINUX_XATTR_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/linux/xfrm.h b/mips-qca-linux-uclibc/sysroot/usr/include/linux/xfrm.h
index a59bc4a..0aa3805 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/linux/xfrm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/linux/xfrm.h
@@ -10,8 +10,7 @@
 /* Structure to encapsulate addresses. I do not want to use
  * "standard" structure. My apologies.
  */
-typedef union
-{
+typedef union {
 	__be32		a4;
 	__be32		a6[4];
 } xfrm_address_t;
@@ -20,8 +19,7 @@
  * the state by (spi,daddr,ah/esp) or to store information about
  * spi, protocol and tunnel address on output.
  */
-struct xfrm_id
-{
+struct xfrm_id {
 	xfrm_address_t	daddr;
 	__be32		spi;
 	__u8		proto;
@@ -45,8 +43,7 @@
 
 /* Selector, used as selector both on policy rules (SPD) and SAs. */
 
-struct xfrm_selector
-{
+struct xfrm_selector {
 	xfrm_address_t	daddr;
 	xfrm_address_t	saddr;
 	__be16	dport;
@@ -63,8 +60,7 @@
 
 #define XFRM_INF (~(__u64)0)
 
-struct xfrm_lifetime_cfg
-{
+struct xfrm_lifetime_cfg {
 	__u64	soft_byte_limit;
 	__u64	hard_byte_limit;
 	__u64	soft_packet_limit;
@@ -75,27 +71,42 @@
 	__u64	hard_use_expires_seconds;
 };
 
-struct xfrm_lifetime_cur
-{
+struct xfrm_lifetime_cur {
 	__u64	bytes;
 	__u64	packets;
 	__u64	add_time;
 	__u64	use_time;
 };
 
-struct xfrm_replay_state
-{
+struct xfrm_replay_state {
 	__u32	oseq;
 	__u32	seq;
 	__u32	bitmap;
 };
 
+struct xfrm_replay_state_esn {
+	unsigned int	bmp_len;
+	__u32		oseq;
+	__u32		seq;
+	__u32		oseq_hi;
+	__u32		seq_hi;
+	__u32		replay_window;
+	__u32		bmp[0];
+};
+
 struct xfrm_algo {
 	char		alg_name[64];
 	unsigned int	alg_key_len;    /* in bits */
 	char		alg_key[0];
 };
 
+struct xfrm_algo_auth {
+	char		alg_name[64];
+	unsigned int	alg_key_len;    /* in bits */
+	unsigned int	alg_trunc_len;  /* in bits */
+	char		alg_key[0];
+};
+
 struct xfrm_algo_aead {
 	char		alg_name[64];
 	unsigned int	alg_key_len;	/* in bits */
@@ -109,16 +120,14 @@
 	__u32	integrity_failed;
 };
 
-enum
-{
+enum {
 	XFRM_POLICY_TYPE_MAIN	= 0,
 	XFRM_POLICY_TYPE_SUB	= 1,
 	XFRM_POLICY_TYPE_MAX	= 2,
 	XFRM_POLICY_TYPE_ANY	= 255
 };
 
-enum
-{
+enum {
 	XFRM_POLICY_IN	= 0,
 	XFRM_POLICY_OUT	= 1,
 	XFRM_POLICY_FWD	= 2,
@@ -126,8 +135,7 @@
 	XFRM_POLICY_MAX	= 3
 };
 
-enum
-{
+enum {
 	XFRM_SHARE_ANY,		/* No limitations */
 	XFRM_SHARE_SESSION,	/* For this session only */
 	XFRM_SHARE_USER,	/* For this user only */
@@ -269,8 +277,8 @@
 	XFRMA_ALG_COMP,		/* struct xfrm_algo */
 	XFRMA_ENCAP,		/* struct xfrm_algo + struct xfrm_encap_tmpl */
 	XFRMA_TMPL,		/* 1 or more struct xfrm_user_tmpl */
-	XFRMA_SA,
-	XFRMA_POLICY,
+	XFRMA_SA,		/* struct xfrm_usersa_info  */
+	XFRMA_POLICY,		/*struct xfrm_userpolicy_info */
 	XFRMA_SEC_CTX,		/* struct xfrm_sec_ctx */
 	XFRMA_LTIME_VAL,
 	XFRMA_REPLAY_VAL,
@@ -278,16 +286,25 @@
 	XFRMA_ETIMER_THRESH,
 	XFRMA_SRCADDR,		/* xfrm_address_t */
 	XFRMA_COADDR,		/* xfrm_address_t */
-	XFRMA_LASTUSED,
+	XFRMA_LASTUSED,		/* unsigned long  */
 	XFRMA_POLICY_TYPE,	/* struct xfrm_userpolicy_type */
 	XFRMA_MIGRATE,
 	XFRMA_ALG_AEAD,		/* struct xfrm_algo_aead */
 	XFRMA_KMADDRESS,        /* struct xfrm_user_kmaddress */
+	XFRMA_ALG_AUTH_TRUNC,	/* struct xfrm_algo_auth */
+	XFRMA_MARK,		/* struct xfrm_mark */
+	XFRMA_TFCPAD,		/* __u32 */
+	XFRMA_REPLAY_ESN_VAL,	/* struct xfrm_replay_esn */
 	__XFRMA_MAX
 
 #define XFRMA_MAX (__XFRMA_MAX - 1)
 };
 
+struct xfrm_mark {
+	__u32           v; /* value */
+	__u32           m; /* mask */
+};
+
 enum xfrm_sadattr_type_t {
 	XFRMA_SAD_UNSPEC,
 	XFRMA_SAD_CNT,
@@ -344,6 +361,8 @@
 #define XFRM_STATE_WILDRECV	8
 #define XFRM_STATE_ICMP		16
 #define XFRM_STATE_AF_UNSPEC	32
+#define XFRM_STATE_ALIGN4	64
+#define XFRM_STATE_ESN		128
 };
 
 struct xfrm_usersa_id {
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/mtd/mtd-abi.h b/mips-qca-linux-uclibc/sysroot/usr/include/mtd/mtd-abi.h
index c6954ed..53233a8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/mtd/mtd-abi.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/mtd/mtd-abi.h
@@ -1,5 +1,20 @@
 /*
- * Portions of MTD ABI definition which are shared by kernel and user space
+ * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org> et al.
+ *
+ * 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
  */
 
 #ifndef __MTD_ABI_H__
@@ -30,6 +45,51 @@
 	__u64 usr_ptr;
 };
 
+/**
+ * MTD operation modes
+ *
+ * @MTD_OPS_PLACE_OOB:	OOB data are placed at the given offset (default)
+ * @MTD_OPS_AUTO_OOB:	OOB data are automatically placed at the free areas
+ *			which are defined by the internal ecclayout
+ * @MTD_OPS_RAW:	data are transferred as-is, with no error correction;
+ *			this mode implies %MTD_OPS_PLACE_OOB
+ *
+ * These modes can be passed to ioctl(MEMWRITE) and are also used internally.
+ * See notes on "MTD file modes" for discussion on %MTD_OPS_RAW vs.
+ * %MTD_FILE_MODE_RAW.
+ */
+enum {
+	MTD_OPS_PLACE_OOB = 0,
+	MTD_OPS_AUTO_OOB = 1,
+	MTD_OPS_RAW = 2,
+};
+
+/**
+ * struct mtd_write_req - data structure for requesting a write operation
+ *
+ * @start:	start address
+ * @len:	length of data buffer
+ * @ooblen:	length of OOB buffer
+ * @usr_data:	user-provided data buffer
+ * @usr_oob:	user-provided OOB buffer
+ * @mode:	MTD mode (see "MTD operation modes")
+ * @padding:	reserved, must be set to 0
+ *
+ * This structure supports ioctl(MEMWRITE) operations, allowing data and/or OOB
+ * writes in various modes. To write to OOB-only, set @usr_data == NULL, and to
+ * write data-only, set @usr_oob == NULL. However, setting both @usr_data and
+ * @usr_oob to NULL is not allowed.
+ */
+struct mtd_write_req {
+	__u64 start;
+	__u64 len;
+	__u64 ooblen;
+	__u64 usr_data;
+	__u64 usr_oob;
+	__u8 mode;
+	__u8 padding[7];
+};
+
 #define MTD_ABSENT		0
 #define MTD_RAM			1
 #define MTD_ROM			2
@@ -37,19 +97,20 @@
 #define MTD_NANDFLASH		4
 #define MTD_DATAFLASH		6
 #define MTD_UBIVOLUME		7
+#define MTD_MLCNANDFLASH	8
 
 #define MTD_WRITEABLE		0x400	/* Device is writeable */
 #define MTD_BIT_WRITEABLE	0x800	/* Single bits can be flipped */
 #define MTD_NO_ERASE		0x1000	/* No erase necessary */
 #define MTD_POWERUP_LOCK	0x2000	/* Always locked after reset */
 
-// Some common devices / combinations of capabilities
+/* Some common devices / combinations of capabilities */
 #define MTD_CAP_ROM		0
 #define MTD_CAP_RAM		(MTD_WRITEABLE | MTD_BIT_WRITEABLE | MTD_NO_ERASE)
 #define MTD_CAP_NORFLASH	(MTD_WRITEABLE | MTD_BIT_WRITEABLE)
 #define MTD_CAP_NANDFLASH	(MTD_WRITEABLE)
 
-/* ECC byte placement */
+/* Obsolete ECC byte placement modes (used with obsolete MEMGETOOBSEL) */
 #define MTD_NANDECC_OFF		0	// Switch off ECC (Not recommended)
 #define MTD_NANDECC_PLACE	1	// Use the given placement in the structure (YAFFS1 legacy mode)
 #define MTD_NANDECC_AUTOPLACE	2	// Use the default placement scheme
@@ -64,21 +125,18 @@
 struct mtd_info_user {
 	__u8 type;
 	__u32 flags;
-	__u32 size;	 // Total size of the MTD
+	__u32 size;	/* Total size of the MTD */
 	__u32 erasesize;
 	__u32 writesize;
-	__u32 oobsize;   // Amount of OOB data per block (e.g. 16)
-	/* The below two fields are obsolete and broken, do not use them
-	 * (TODO: remove at some point) */
-	__u32 ecctype;
-	__u32 eccsize;
+	__u32 oobsize;	/* Amount of OOB data per block (e.g. 16) */
+	__u64 padding;	/* Old obsolete field; do not use */
 };
 
 struct region_info_user {
 	__u32 offset;		/* At which this region starts,
-					 * from the beginning of the MTD */
-	__u32 erasesize;		/* For this region */
-	__u32 numblocks;		/* Number of blocks in this region */
+				 * from the beginning of the MTD */
+	__u32 erasesize;	/* For this region */
+	__u32 numblocks;	/* Number of blocks in this region */
 	__u32 regionindex;
 };
 
@@ -88,28 +146,63 @@
 	__u32 locked;
 };
 
+/*
+ * Note, the following ioctl existed in the past and was removed:
+ * #define MEMSETOOBSEL           _IOW('M', 9, struct nand_oobinfo)
+ * Try to avoid adding a new ioctl with the same ioctl number.
+ */
+
+/* Get basic MTD characteristics info (better to use sysfs) */
 #define MEMGETINFO		_IOR('M', 1, struct mtd_info_user)
+/* Erase segment of MTD */
 #define MEMERASE		_IOW('M', 2, struct erase_info_user)
+/* Write out-of-band data from MTD */
 #define MEMWRITEOOB		_IOWR('M', 3, struct mtd_oob_buf)
+/* Read out-of-band data from MTD */
 #define MEMREADOOB		_IOWR('M', 4, struct mtd_oob_buf)
+/* Lock a chip (for MTD that supports it) */
 #define MEMLOCK			_IOW('M', 5, struct erase_info_user)
+/* Unlock a chip (for MTD that supports it) */
 #define MEMUNLOCK		_IOW('M', 6, struct erase_info_user)
+/* Get the number of different erase regions */
 #define MEMGETREGIONCOUNT	_IOR('M', 7, int)
+/* Get information about the erase region for a specific index */
 #define MEMGETREGIONINFO	_IOWR('M', 8, struct region_info_user)
-#define MEMSETOOBSEL		_IOW('M', 9, struct nand_oobinfo)
+/* Get info about OOB modes (e.g., RAW, PLACE, AUTO) - legacy interface */
 #define MEMGETOOBSEL		_IOR('M', 10, struct nand_oobinfo)
+/* Check if an eraseblock is bad */
 #define MEMGETBADBLOCK		_IOW('M', 11, __kernel_loff_t)
+/* Mark an eraseblock as bad */
 #define MEMSETBADBLOCK		_IOW('M', 12, __kernel_loff_t)
+/* Set OTP (One-Time Programmable) mode (factory vs. user) */
 #define OTPSELECT		_IOR('M', 13, int)
+/* Get number of OTP (One-Time Programmable) regions */
 #define OTPGETREGIONCOUNT	_IOW('M', 14, int)
+/* Get all OTP (One-Time Programmable) info about MTD */
 #define OTPGETREGIONINFO	_IOW('M', 15, struct otp_info)
+/* Lock a given range of user data (must be in mode %MTD_FILE_MODE_OTP_USER) */
 #define OTPLOCK			_IOR('M', 16, struct otp_info)
-#define ECCGETLAYOUT		_IOR('M', 17, struct nand_ecclayout)
+/* Get ECC layout (deprecated) */
+#define ECCGETLAYOUT		_IOR('M', 17, struct nand_ecclayout_user)
+/* Get statistics about corrected/uncorrected errors */
 #define ECCGETSTATS		_IOR('M', 18, struct mtd_ecc_stats)
+/* Set MTD mode on a per-file-descriptor basis (see "MTD file modes") */
 #define MTDFILEMODE		_IO('M', 19)
+/* Erase segment of MTD (supports 64-bit address) */
 #define MEMERASE64		_IOW('M', 20, struct erase_info_user64)
+/* Write data to OOB (64-bit version) */
 #define MEMWRITEOOB64		_IOWR('M', 21, struct mtd_oob_buf64)
+/* Read data from OOB (64-bit version) */
 #define MEMREADOOB64		_IOWR('M', 22, struct mtd_oob_buf64)
+/* Check if chip is locked (for MTD that supports it) */
+#define MEMISLOCKED		_IOR('M', 23, struct erase_info_user)
+/*
+ * Most generic write interface; can write in-band and/or out-of-band in various
+ * modes (see "struct mtd_write_req"). This ioctl is not supported for flashes
+ * without OOB, e.g., NOR flash.
+ */
+#define MEMWRITE		_IOWR('M', 24, struct mtd_write_req)
+#define MTDREFRESH		_IO('M', 50)
 
 /*
  * Obsolete legacy interface. Keep it in order not to break userspace
@@ -128,13 +221,18 @@
 };
 
 #define MTD_MAX_OOBFREE_ENTRIES	8
+#define MTD_MAX_ECCPOS_ENTRIES	64
 /*
- * ECC layout control structure. Exported to userspace for
- * diagnosis and to allow creation of raw images
+ * OBSOLETE: ECC layout control structure. Exported to user-space via ioctl
+ * ECCGETLAYOUT for backwards compatbility and should not be mistaken as a
+ * complete set of ECC information. The ioctl truncates the larger internal
+ * structure to retain binary compatibility with the static declaration of the
+ * ioctl. Note that the "MTD_MAX_..._ENTRIES" macros represent the max size of
+ * the user struct, not the MAX size of the internal struct nand_ecclayout.
  */
-struct nand_ecclayout {
+struct nand_ecclayout_user {
 	__u32 eccbytes;
-	__u32 eccpos[64];
+	__u32 eccpos[MTD_MAX_ECCPOS_ENTRIES];
 	__u32 oobavail;
 	struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES];
 };
@@ -155,13 +253,27 @@
 };
 
 /*
- * Read/write file modes for access to MTD
+ * MTD file modes - for read/write access to MTD
+ *
+ * @MTD_FILE_MODE_NORMAL:	OTP disabled, ECC enabled
+ * @MTD_FILE_MODE_OTP_FACTORY:	OTP enabled in factory mode
+ * @MTD_FILE_MODE_OTP_USER:	OTP enabled in user mode
+ * @MTD_FILE_MODE_RAW:		OTP disabled, ECC disabled
+ *
+ * These modes can be set via ioctl(MTDFILEMODE). The mode mode will be retained
+ * separately for each open file descriptor.
+ *
+ * Note: %MTD_FILE_MODE_RAW provides the same functionality as %MTD_OPS_RAW -
+ * raw access to the flash, without error correction or autoplacement schemes.
+ * Wherever possible, the MTD_OPS_* mode will override the MTD_FILE_MODE_* mode
+ * (e.g., when using ioctl(MEMWRITE)), but in some cases, the MTD_FILE_MODE is
+ * used out of necessity (e.g., `write()', ioctl(MEMWRITEOOB64)).
  */
 enum mtd_file_modes {
-	MTD_MODE_NORMAL = MTD_OTP_OFF,
-	MTD_MODE_OTP_FACTORY = MTD_OTP_FACTORY,
-	MTD_MODE_OTP_USER = MTD_OTP_USER,
-	MTD_MODE_RAW,
+	MTD_FILE_MODE_NORMAL = MTD_OTP_OFF,
+	MTD_FILE_MODE_OTP_FACTORY = MTD_OTP_FACTORY,
+	MTD_FILE_MODE_OTP_USER = MTD_OTP_USER,
+	MTD_FILE_MODE_RAW,
 };
 
 #endif /* __MTD_ABI_H__ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/mtd/mtd-user.h b/mips-qca-linux-uclibc/sysroot/usr/include/mtd/mtd-user.h
index 170ceca..83327c8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/mtd/mtd-user.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/mtd/mtd-user.h
@@ -1,5 +1,20 @@
 /*
- * MTD ABI header for use by user space only.
+ * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
+ *
+ * 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
  */
 
 #ifndef __MTD_USER_H__
@@ -14,6 +29,6 @@
 typedef struct erase_info_user erase_info_t;
 typedef struct region_info_user region_info_t;
 typedef struct nand_oobinfo nand_oobinfo_t;
-typedef struct nand_ecclayout nand_ecclayout_t;
+typedef struct nand_ecclayout_user nand_ecclayout_t;
 
 #endif /* __MTD_USER_H__ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/mtd/nftl-user.h b/mips-qca-linux-uclibc/sysroot/usr/include/mtd/nftl-user.h
index 98e9e57..bdeabd8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/mtd/nftl-user.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/mtd/nftl-user.h
@@ -1,5 +1,19 @@
 /*
- * Parts of NFTL headers shared with userspace
+ * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
+ *
+ * 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 St, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/mtd/ubi-user.h b/mips-qca-linux-uclibc/sysroot/usr/include/mtd/ubi-user.h
index 466a832..cce1993 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/mtd/ubi-user.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/mtd/ubi-user.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) International Business Machines Corp., 2006
+ * Copyright © International Business Machines Corp., 2006
  *
  * 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
@@ -131,7 +131,7 @@
  * ~~~~~~~~~~~~~~~~~~~~~~~~~
  *
  * To set an UBI volume property the %UBI_IOCSETPROP ioctl command should be
- * used. A pointer to a &struct ubi_set_prop_req object is expected to be
+ * used. A pointer to a &struct ubi_set_vol_prop_req object is expected to be
  * passed. The object describes which property should be set, and to which value
  * it should be set.
  */
@@ -186,7 +186,8 @@
 /* Check if LEB is mapped command */
 #define UBI_IOCEBISMAP _IOR(UBI_VOL_IOC_MAGIC, 5, __s32)
 /* Set an UBI volume property */
-#define UBI_IOCSETPROP _IOW(UBI_VOL_IOC_MAGIC, 6, struct ubi_set_prop_req)
+#define UBI_IOCSETVOLPROP _IOW(UBI_VOL_IOC_MAGIC, 6, \
+			       struct ubi_set_vol_prop_req)
 
 /* Maximum MTD device name length supported by UBI */
 #define MAX_UBI_MTD_NAME_LEN 127
@@ -223,13 +224,14 @@
 };
 
 /*
- * UBI set property ioctl constants
+ * UBI set volume property ioctl constants.
  *
- * @UBI_PROP_DIRECT_WRITE: allow / disallow user to directly write and
- *                         erase individual eraseblocks on dynamic volumes
+ * @UBI_VOL_PROP_DIRECT_WRITE: allow (any non-zero value) or disallow (value 0)
+ *                             user to directly write and erase individual
+ *                             eraseblocks on dynamic volumes
  */
 enum {
-       UBI_PROP_DIRECT_WRITE = 1,
+	UBI_VOL_PROP_DIRECT_WRITE = 1,
 };
 
 /**
@@ -308,7 +310,7 @@
 	__s16 name_len;
 	__s8 padding2[4];
 	char name[UBI_MAX_VOLUME_NAME + 1];
-} __attribute__ ((packed));
+} __attribute__((packed));
 
 /**
  * struct ubi_rsvol_req - a data structure used in volume re-size requests.
@@ -324,7 +326,7 @@
 struct ubi_rsvol_req {
 	__s64 bytes;
 	__s32 vol_id;
-} __attribute__ ((packed));
+} __attribute__((packed));
 
 /**
  * struct ubi_rnvol_req - volumes re-name request.
@@ -366,7 +368,7 @@
 		__s8  padding2[2];
 		char    name[UBI_MAX_VOLUME_NAME + 1];
 	} ents[UBI_MAX_RNVOL];
-} __attribute__ ((packed));
+} __attribute__((packed));
 
 /**
  * struct ubi_leb_change_req - a data structure used in atomic LEB change
@@ -381,7 +383,7 @@
 	__s32 bytes;
 	__s8  dtype;
 	__s8  padding[7];
-} __attribute__ ((packed));
+} __attribute__((packed));
 
 /**
  * struct ubi_map_req - a data structure used in map LEB requests.
@@ -393,20 +395,20 @@
 	__s32 lnum;
 	__s8  dtype;
 	__s8  padding[3];
-} __attribute__ ((packed));
+} __attribute__((packed));
 
 
 /**
- * struct ubi_set_prop_req - a data structure used to set an ubi volume
- *                           property.
- * @property: property to set (%UBI_PROP_DIRECT_WRITE)
+ * struct ubi_set_vol_prop_req - a data structure used to set an UBI volume
+ *                               property.
+ * @property: property to set (%UBI_VOL_PROP_DIRECT_WRITE)
  * @padding: reserved for future, not used, has to be zeroed
  * @value: value to set
  */
-struct ubi_set_prop_req {
-       __u8  property;
-       __u8  padding[7];
-       __u64 value;
-}  __attribute__ ((packed));
+struct ubi_set_vol_prop_req {
+	__u8  property;
+	__u8  padding[7];
+	__u64 value;
+}  __attribute__((packed));
 
 #endif /* __UBI_USER_H__ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/net/switch.h b/mips-qca-linux-uclibc/sysroot/usr/include/net/switch.h
new file mode 100644
index 0000000..d24f954
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/net/switch.h
@@ -0,0 +1,108 @@
+/*
+ * switch.h: Switch configuration API
+ *
+ * Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org>
+ *
+ * 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.
+ */
+
+#ifndef __LINUX_SWITCH_H
+#define __LINUX_SWITCH_H
+
+#include <linux/types.h>
+#include <linux/netdevice.h>
+#include <linux/netlink.h>
+#include <linux/genetlink.h>
+#include <netlink/netlink.h>
+#include <netlink/genl/genl.h>
+#include <netlink/genl/ctrl.h>
+
+/* main attributes */
+enum {
+	SWITCH_ATTR_UNSPEC,
+	/* global */
+	SWITCH_ATTR_TYPE,
+	/* device */
+	SWITCH_ATTR_ID,
+	SWITCH_ATTR_DEV_NAME,
+	SWITCH_ATTR_ALIAS,
+	SWITCH_ATTR_NAME,
+	SWITCH_ATTR_VLANS,
+	SWITCH_ATTR_PORTS,
+	SWITCH_ATTR_CPU_PORT,
+	/* attributes */
+	SWITCH_ATTR_OP_ID,
+	SWITCH_ATTR_OP_TYPE,
+	SWITCH_ATTR_OP_NAME,
+	SWITCH_ATTR_OP_PORT,
+	SWITCH_ATTR_OP_VLAN,
+	SWITCH_ATTR_OP_REG,
+	SWITCH_ATTR_OP_VALUE_INT,
+	SWITCH_ATTR_OP_VALUE_STR,
+	SWITCH_ATTR_OP_VALUE_PORTS,
+	SWITCH_ATTR_OP_VALUE_EXT,
+	SWITCH_ATTR_OP_DESCRIPTION,
+	/* port lists */
+	SWITCH_ATTR_PORT,
+	/* switch_ext attribute */
+	SWITCH_ATTR_EXT,
+	SWITCH_ATTR_MAX
+};
+
+/* commands */
+enum {
+	SWITCH_CMD_UNSPEC,
+	SWITCH_CMD_GET_SWITCH,
+	SWITCH_CMD_NEW_ATTR,
+	SWITCH_CMD_LIST_GLOBAL,
+	SWITCH_CMD_GET_GLOBAL,
+	SWITCH_CMD_SET_GLOBAL,
+	SWITCH_CMD_LIST_PORT,
+	SWITCH_CMD_GET_PORT,
+	SWITCH_CMD_SET_PORT,
+	SWITCH_CMD_LIST_VLAN,
+	SWITCH_CMD_GET_VLAN,
+	SWITCH_CMD_SET_VLAN,
+	SWITCH_CMD_LIST_REG,
+	SWITCH_CMD_GET_REG,
+	SWITCH_CMD_SET_REG,
+};
+
+/* data types */
+enum switch_val_type {
+	SWITCH_TYPE_UNSPEC,
+	SWITCH_TYPE_INT,
+	SWITCH_TYPE_STRING,
+	SWITCH_TYPE_PORTS,
+	SWITCH_TYPE_EXT,
+	SWITCH_TYPE_NOVAL,
+};
+
+/* port nested attributes */
+enum {
+	SWITCH_PORT_UNSPEC,
+	SWITCH_PORT_ID,
+	SWITCH_PORT_FLAG_TAGGED,
+	SWITCH_PORT_ATTR_MAX
+};
+
+/* switch_ext nested attributes */
+enum {
+	SWITCH_EXT_UNSPEC,
+	SWITCH_EXT_NAME,
+	SWITCH_EXT_VALUE,
+	SWITCH_EXT_ATTR_MAX
+};
+
+#define SWITCH_ATTR_DEFAULTS_OFFSET	0x1000
+
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/rdma/ib_user_cm.h b/mips-qca-linux-uclibc/sysroot/usr/include/rdma/ib_user_cm.h
new file mode 100644
index 0000000..f79014a
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/rdma/ib_user_cm.h
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 2005 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Intel Corporation.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 IB_USER_CM_H
+#define IB_USER_CM_H
+
+#include <linux/types.h>
+#include <rdma/ib_user_sa.h>
+
+#define IB_USER_CM_ABI_VERSION 5
+
+enum {
+	IB_USER_CM_CMD_CREATE_ID,
+	IB_USER_CM_CMD_DESTROY_ID,
+	IB_USER_CM_CMD_ATTR_ID,
+
+	IB_USER_CM_CMD_LISTEN,
+	IB_USER_CM_CMD_NOTIFY,
+
+	IB_USER_CM_CMD_SEND_REQ,
+	IB_USER_CM_CMD_SEND_REP,
+	IB_USER_CM_CMD_SEND_RTU,
+	IB_USER_CM_CMD_SEND_DREQ,
+	IB_USER_CM_CMD_SEND_DREP,
+	IB_USER_CM_CMD_SEND_REJ,
+	IB_USER_CM_CMD_SEND_MRA,
+	IB_USER_CM_CMD_SEND_LAP,
+	IB_USER_CM_CMD_SEND_APR,
+	IB_USER_CM_CMD_SEND_SIDR_REQ,
+	IB_USER_CM_CMD_SEND_SIDR_REP,
+
+	IB_USER_CM_CMD_EVENT,
+	IB_USER_CM_CMD_INIT_QP_ATTR,
+};
+/*
+ * command ABI structures.
+ */
+struct ib_ucm_cmd_hdr {
+	__u32 cmd;
+	__u16 in;
+	__u16 out;
+};
+
+struct ib_ucm_create_id {
+	__u64 uid;
+	__u64 response;
+};
+
+struct ib_ucm_create_id_resp {
+	__u32 id;
+};
+
+struct ib_ucm_destroy_id {
+	__u64 response;
+	__u32 id;
+	__u32 reserved;
+};
+
+struct ib_ucm_destroy_id_resp {
+	__u32 events_reported;
+};
+
+struct ib_ucm_attr_id {
+	__u64 response;
+	__u32 id;
+	__u32 reserved;
+};
+
+struct ib_ucm_attr_id_resp {
+	__be64 service_id;
+	__be64 service_mask;
+	__be32 local_id;
+	__be32 remote_id;
+};
+
+struct ib_ucm_init_qp_attr {
+	__u64 response;
+	__u32 id;
+	__u32 qp_state;
+};
+
+struct ib_ucm_listen {
+	__be64 service_id;
+	__be64 service_mask;
+	__u32 id;
+	__u32 reserved;
+};
+
+struct ib_ucm_notify {
+	__u32 id;
+	__u32 event;
+};
+
+struct ib_ucm_private_data {
+	__u64 data;
+	__u32 id;
+	__u8  len;
+	__u8  reserved[3];
+};
+
+struct ib_ucm_req {
+	__u32 id;
+	__u32 qpn;
+	__u32 qp_type;
+	__u32 psn;
+	__be64 sid;
+	__u64 data;
+	__u64 primary_path;
+	__u64 alternate_path;
+	__u8  len;
+	__u8  peer_to_peer;
+	__u8  responder_resources;
+	__u8  initiator_depth;
+	__u8  remote_cm_response_timeout;
+	__u8  flow_control;
+	__u8  local_cm_response_timeout;
+	__u8  retry_count;
+	__u8  rnr_retry_count;
+	__u8  max_cm_retries;
+	__u8  srq;
+	__u8  reserved[5];
+};
+
+struct ib_ucm_rep {
+	__u64 uid;
+	__u64 data;
+	__u32 id;
+	__u32 qpn;
+	__u32 psn;
+	__u8  len;
+	__u8  responder_resources;
+	__u8  initiator_depth;
+	__u8  target_ack_delay;
+	__u8  failover_accepted;
+	__u8  flow_control;
+	__u8  rnr_retry_count;
+	__u8  srq;
+	__u8  reserved[4];
+};
+
+struct ib_ucm_info {
+	__u32 id;
+	__u32 status;
+	__u64 info;
+	__u64 data;
+	__u8  info_len;
+	__u8  data_len;
+	__u8  reserved[6];
+};
+
+struct ib_ucm_mra {
+	__u64 data;
+	__u32 id;
+	__u8  len;
+	__u8  timeout;
+	__u8  reserved[2];
+};
+
+struct ib_ucm_lap {
+	__u64 path;
+	__u64 data;
+	__u32 id;
+	__u8  len;
+	__u8  reserved[3];
+};
+
+struct ib_ucm_sidr_req {
+	__u32 id;
+	__u32 timeout;
+	__be64 sid;
+	__u64 data;
+	__u64 path;
+	__u16 reserved_pkey;
+	__u8  len;
+	__u8  max_cm_retries;
+	__u8  reserved[4];
+};
+
+struct ib_ucm_sidr_rep {
+	__u32 id;
+	__u32 qpn;
+	__u32 qkey;
+	__u32 status;
+	__u64 info;
+	__u64 data;
+	__u8  info_len;
+	__u8  data_len;
+	__u8  reserved[6];
+};
+/*
+ * event notification ABI structures.
+ */
+struct ib_ucm_event_get {
+	__u64 response;
+	__u64 data;
+	__u64 info;
+	__u8  data_len;
+	__u8  info_len;
+	__u8  reserved[6];
+};
+
+struct ib_ucm_req_event_resp {
+	struct ib_user_path_rec primary_path;
+	struct ib_user_path_rec alternate_path;
+	__be64                 remote_ca_guid;
+	__u32                  remote_qkey;
+	__u32                  remote_qpn;
+	__u32                  qp_type;
+	__u32                  starting_psn;
+	__u8  responder_resources;
+	__u8  initiator_depth;
+	__u8  local_cm_response_timeout;
+	__u8  flow_control;
+	__u8  remote_cm_response_timeout;
+	__u8  retry_count;
+	__u8  rnr_retry_count;
+	__u8  srq;
+	__u8  port;
+	__u8  reserved[7];
+};
+
+struct ib_ucm_rep_event_resp {
+	__be64 remote_ca_guid;
+	__u32 remote_qkey;
+	__u32 remote_qpn;
+	__u32 starting_psn;
+	__u8  responder_resources;
+	__u8  initiator_depth;
+	__u8  target_ack_delay;
+	__u8  failover_accepted;
+	__u8  flow_control;
+	__u8  rnr_retry_count;
+	__u8  srq;
+	__u8  reserved[5];
+};
+
+struct ib_ucm_rej_event_resp {
+	__u32 reason;
+	/* ari in ib_ucm_event_get info field. */
+};
+
+struct ib_ucm_mra_event_resp {
+	__u8  timeout;
+	__u8  reserved[3];
+};
+
+struct ib_ucm_lap_event_resp {
+	struct ib_user_path_rec path;
+};
+
+struct ib_ucm_apr_event_resp {
+	__u32 status;
+	/* apr info in ib_ucm_event_get info field. */
+};
+
+struct ib_ucm_sidr_req_event_resp {
+	__u16 pkey;
+	__u8  port;
+	__u8  reserved;
+};
+
+struct ib_ucm_sidr_rep_event_resp {
+	__u32 status;
+	__u32 qkey;
+	__u32 qpn;
+	/* info in ib_ucm_event_get info field. */
+};
+
+#define IB_UCM_PRES_DATA      0x01
+#define IB_UCM_PRES_INFO      0x02
+#define IB_UCM_PRES_PRIMARY   0x04
+#define IB_UCM_PRES_ALTERNATE 0x08
+
+struct ib_ucm_event_resp {
+	__u64 uid;
+	__u32 id;
+	__u32 event;
+	__u32 present;
+	__u32 reserved;
+	union {
+		struct ib_ucm_req_event_resp req_resp;
+		struct ib_ucm_rep_event_resp rep_resp;
+		struct ib_ucm_rej_event_resp rej_resp;
+		struct ib_ucm_mra_event_resp mra_resp;
+		struct ib_ucm_lap_event_resp lap_resp;
+		struct ib_ucm_apr_event_resp apr_resp;
+
+		struct ib_ucm_sidr_req_event_resp sidr_req_resp;
+		struct ib_ucm_sidr_rep_event_resp sidr_rep_resp;
+
+		__u32                             send_status;
+	} u;
+};
+
+#endif /* IB_USER_CM_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/rdma/ib_user_sa.h b/mips-qca-linux-uclibc/sysroot/usr/include/rdma/ib_user_sa.h
new file mode 100644
index 0000000..cfc7c9b
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/rdma/ib_user_sa.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2005 Intel Corporation.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 IB_USER_SA_H
+#define IB_USER_SA_H
+
+#include <linux/types.h>
+
+enum {
+	IB_PATH_GMP		= 1,
+	IB_PATH_PRIMARY		= (1<<1),
+	IB_PATH_ALTERNATE	= (1<<2),
+	IB_PATH_OUTBOUND	= (1<<3),
+	IB_PATH_INBOUND		= (1<<4),
+	IB_PATH_INBOUND_REVERSE = (1<<5),
+	IB_PATH_BIDIRECTIONAL	= IB_PATH_OUTBOUND | IB_PATH_INBOUND_REVERSE
+};
+
+struct ib_path_rec_data {
+	__u32	flags;
+	__u32	reserved;
+	__u32	path_rec[16];
+};
+
+struct ib_user_path_rec {
+	__u8	dgid[16];
+	__u8	sgid[16];
+	__be16	dlid;
+	__be16	slid;
+	__u32	raw_traffic;
+	__be32	flow_label;
+	__u32	reversible;
+	__u32	mtu;
+	__be16	pkey;
+	__u8	hop_limit;
+	__u8	traffic_class;
+	__u8	numb_path;
+	__u8	sl;
+	__u8	mtu_selector;
+	__u8	rate_selector;
+	__u8	rate;
+	__u8	packet_life_time_selector;
+	__u8	packet_life_time;
+	__u8	preference;
+};
+
+#endif /* IB_USER_SA_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/rdma/ib_user_verbs.h b/mips-qca-linux-uclibc/sysroot/usr/include/rdma/ib_user_verbs.h
new file mode 100644
index 0000000..81aba3a
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/rdma/ib_user_verbs.h
@@ -0,0 +1,734 @@
+/*
+ * Copyright (c) 2005 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005, 2006 Cisco Systems.  All rights reserved.
+ * Copyright (c) 2005 PathScale, Inc.  All rights reserved.
+ * Copyright (c) 2006 Mellanox Technologies.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 IB_USER_VERBS_H
+#define IB_USER_VERBS_H
+
+#include <linux/types.h>
+
+/*
+ * Increment this value if any changes that break userspace ABI
+ * compatibility are made.
+ */
+#define IB_USER_VERBS_ABI_VERSION	6
+
+enum {
+	IB_USER_VERBS_CMD_GET_CONTEXT,
+	IB_USER_VERBS_CMD_QUERY_DEVICE,
+	IB_USER_VERBS_CMD_QUERY_PORT,
+	IB_USER_VERBS_CMD_ALLOC_PD,
+	IB_USER_VERBS_CMD_DEALLOC_PD,
+	IB_USER_VERBS_CMD_CREATE_AH,
+	IB_USER_VERBS_CMD_MODIFY_AH,
+	IB_USER_VERBS_CMD_QUERY_AH,
+	IB_USER_VERBS_CMD_DESTROY_AH,
+	IB_USER_VERBS_CMD_REG_MR,
+	IB_USER_VERBS_CMD_REG_SMR,
+	IB_USER_VERBS_CMD_REREG_MR,
+	IB_USER_VERBS_CMD_QUERY_MR,
+	IB_USER_VERBS_CMD_DEREG_MR,
+	IB_USER_VERBS_CMD_ALLOC_MW,
+	IB_USER_VERBS_CMD_BIND_MW,
+	IB_USER_VERBS_CMD_DEALLOC_MW,
+	IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL,
+	IB_USER_VERBS_CMD_CREATE_CQ,
+	IB_USER_VERBS_CMD_RESIZE_CQ,
+	IB_USER_VERBS_CMD_DESTROY_CQ,
+	IB_USER_VERBS_CMD_POLL_CQ,
+	IB_USER_VERBS_CMD_PEEK_CQ,
+	IB_USER_VERBS_CMD_REQ_NOTIFY_CQ,
+	IB_USER_VERBS_CMD_CREATE_QP,
+	IB_USER_VERBS_CMD_QUERY_QP,
+	IB_USER_VERBS_CMD_MODIFY_QP,
+	IB_USER_VERBS_CMD_DESTROY_QP,
+	IB_USER_VERBS_CMD_POST_SEND,
+	IB_USER_VERBS_CMD_POST_RECV,
+	IB_USER_VERBS_CMD_ATTACH_MCAST,
+	IB_USER_VERBS_CMD_DETACH_MCAST,
+	IB_USER_VERBS_CMD_CREATE_SRQ,
+	IB_USER_VERBS_CMD_MODIFY_SRQ,
+	IB_USER_VERBS_CMD_QUERY_SRQ,
+	IB_USER_VERBS_CMD_DESTROY_SRQ,
+	IB_USER_VERBS_CMD_POST_SRQ_RECV,
+	IB_USER_VERBS_CMD_OPEN_XRCD,
+	IB_USER_VERBS_CMD_CLOSE_XRCD,
+	IB_USER_VERBS_CMD_CREATE_XSRQ,
+	IB_USER_VERBS_CMD_OPEN_QP
+};
+
+/*
+ * Make sure that all structs defined in this file remain laid out so
+ * that they pack the same way on 32-bit and 64-bit architectures (to
+ * avoid incompatibility between 32-bit userspace and 64-bit kernels).
+ * Specifically:
+ *  - Do not use pointer types -- pass pointers in __u64 instead.
+ *  - Make sure that any structure larger than 4 bytes is padded to a
+ *    multiple of 8 bytes.  Otherwise the structure size will be
+ *    different between 32-bit and 64-bit architectures.
+ */
+
+struct ib_uverbs_async_event_desc {
+	__u64 element;
+	__u32 event_type;	/* enum ib_event_type */
+	__u32 reserved;
+};
+
+struct ib_uverbs_comp_event_desc {
+	__u64 cq_handle;
+};
+
+/*
+ * All commands from userspace should start with a __u32 command field
+ * followed by __u16 in_words and out_words fields (which give the
+ * length of the command block and response buffer if any in 32-bit
+ * words).  The kernel driver will read these fields first and read
+ * the rest of the command struct based on these value.
+ */
+
+struct ib_uverbs_cmd_hdr {
+	__u32 command;
+	__u16 in_words;
+	__u16 out_words;
+};
+
+struct ib_uverbs_get_context {
+	__u64 response;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_get_context_resp {
+	__u32 async_fd;
+	__u32 num_comp_vectors;
+};
+
+struct ib_uverbs_query_device {
+	__u64 response;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_query_device_resp {
+	__u64 fw_ver;
+	__be64 node_guid;
+	__be64 sys_image_guid;
+	__u64 max_mr_size;
+	__u64 page_size_cap;
+	__u32 vendor_id;
+	__u32 vendor_part_id;
+	__u32 hw_ver;
+	__u32 max_qp;
+	__u32 max_qp_wr;
+	__u32 device_cap_flags;
+	__u32 max_sge;
+	__u32 max_sge_rd;
+	__u32 max_cq;
+	__u32 max_cqe;
+	__u32 max_mr;
+	__u32 max_pd;
+	__u32 max_qp_rd_atom;
+	__u32 max_ee_rd_atom;
+	__u32 max_res_rd_atom;
+	__u32 max_qp_init_rd_atom;
+	__u32 max_ee_init_rd_atom;
+	__u32 atomic_cap;
+	__u32 max_ee;
+	__u32 max_rdd;
+	__u32 max_mw;
+	__u32 max_raw_ipv6_qp;
+	__u32 max_raw_ethy_qp;
+	__u32 max_mcast_grp;
+	__u32 max_mcast_qp_attach;
+	__u32 max_total_mcast_qp_attach;
+	__u32 max_ah;
+	__u32 max_fmr;
+	__u32 max_map_per_fmr;
+	__u32 max_srq;
+	__u32 max_srq_wr;
+	__u32 max_srq_sge;
+	__u16 max_pkeys;
+	__u8  local_ca_ack_delay;
+	__u8  phys_port_cnt;
+	__u8  reserved[4];
+};
+
+struct ib_uverbs_query_port {
+	__u64 response;
+	__u8  port_num;
+	__u8  reserved[7];
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_query_port_resp {
+	__u32 port_cap_flags;
+	__u32 max_msg_sz;
+	__u32 bad_pkey_cntr;
+	__u32 qkey_viol_cntr;
+	__u32 gid_tbl_len;
+	__u16 pkey_tbl_len;
+	__u16 lid;
+	__u16 sm_lid;
+	__u8  state;
+	__u8  max_mtu;
+	__u8  active_mtu;
+	__u8  lmc;
+	__u8  max_vl_num;
+	__u8  sm_sl;
+	__u8  subnet_timeout;
+	__u8  init_type_reply;
+	__u8  active_width;
+	__u8  active_speed;
+	__u8  phys_state;
+	__u8  link_layer;
+	__u8  reserved[2];
+};
+
+struct ib_uverbs_alloc_pd {
+	__u64 response;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_alloc_pd_resp {
+	__u32 pd_handle;
+};
+
+struct ib_uverbs_dealloc_pd {
+	__u32 pd_handle;
+};
+
+struct ib_uverbs_open_xrcd {
+	__u64 response;
+	__u32 fd;
+	__u32 oflags;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_open_xrcd_resp {
+	__u32 xrcd_handle;
+};
+
+struct ib_uverbs_close_xrcd {
+	__u32 xrcd_handle;
+};
+
+struct ib_uverbs_reg_mr {
+	__u64 response;
+	__u64 start;
+	__u64 length;
+	__u64 hca_va;
+	__u32 pd_handle;
+	__u32 access_flags;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_reg_mr_resp {
+	__u32 mr_handle;
+	__u32 lkey;
+	__u32 rkey;
+};
+
+struct ib_uverbs_dereg_mr {
+	__u32 mr_handle;
+};
+
+struct ib_uverbs_create_comp_channel {
+	__u64 response;
+};
+
+struct ib_uverbs_create_comp_channel_resp {
+	__u32 fd;
+};
+
+struct ib_uverbs_create_cq {
+	__u64 response;
+	__u64 user_handle;
+	__u32 cqe;
+	__u32 comp_vector;
+	__s32 comp_channel;
+	__u32 reserved;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_create_cq_resp {
+	__u32 cq_handle;
+	__u32 cqe;
+};
+
+struct ib_uverbs_resize_cq {
+	__u64 response;
+	__u32 cq_handle;
+	__u32 cqe;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_resize_cq_resp {
+	__u32 cqe;
+	__u32 reserved;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_poll_cq {
+	__u64 response;
+	__u32 cq_handle;
+	__u32 ne;
+};
+
+struct ib_uverbs_wc {
+	__u64 wr_id;
+	__u32 status;
+	__u32 opcode;
+	__u32 vendor_err;
+	__u32 byte_len;
+	union {
+		__u32 imm_data;
+		__u32 invalidate_rkey;
+	} ex;
+	__u32 qp_num;
+	__u32 src_qp;
+	__u32 wc_flags;
+	__u16 pkey_index;
+	__u16 slid;
+	__u8 sl;
+	__u8 dlid_path_bits;
+	__u8 port_num;
+	__u8 reserved;
+};
+
+struct ib_uverbs_poll_cq_resp {
+	__u32 count;
+	__u32 reserved;
+	struct ib_uverbs_wc wc[0];
+};
+
+struct ib_uverbs_req_notify_cq {
+	__u32 cq_handle;
+	__u32 solicited_only;
+};
+
+struct ib_uverbs_destroy_cq {
+	__u64 response;
+	__u32 cq_handle;
+	__u32 reserved;
+};
+
+struct ib_uverbs_destroy_cq_resp {
+	__u32 comp_events_reported;
+	__u32 async_events_reported;
+};
+
+struct ib_uverbs_global_route {
+	__u8  dgid[16];
+	__u32 flow_label;
+	__u8  sgid_index;
+	__u8  hop_limit;
+	__u8  traffic_class;
+	__u8  reserved;
+};
+
+struct ib_uverbs_ah_attr {
+	struct ib_uverbs_global_route grh;
+	__u16 dlid;
+	__u8  sl;
+	__u8  src_path_bits;
+	__u8  static_rate;
+	__u8  is_global;
+	__u8  port_num;
+	__u8  reserved;
+};
+
+struct ib_uverbs_qp_attr {
+	__u32	qp_attr_mask;
+	__u32	qp_state;
+	__u32	cur_qp_state;
+	__u32	path_mtu;
+	__u32	path_mig_state;
+	__u32	qkey;
+	__u32	rq_psn;
+	__u32	sq_psn;
+	__u32	dest_qp_num;
+	__u32	qp_access_flags;
+
+	struct ib_uverbs_ah_attr ah_attr;
+	struct ib_uverbs_ah_attr alt_ah_attr;
+
+	/* ib_qp_cap */
+	__u32	max_send_wr;
+	__u32	max_recv_wr;
+	__u32	max_send_sge;
+	__u32	max_recv_sge;
+	__u32	max_inline_data;
+
+	__u16	pkey_index;
+	__u16	alt_pkey_index;
+	__u8	en_sqd_async_notify;
+	__u8	sq_draining;
+	__u8	max_rd_atomic;
+	__u8	max_dest_rd_atomic;
+	__u8	min_rnr_timer;
+	__u8	port_num;
+	__u8	timeout;
+	__u8	retry_cnt;
+	__u8	rnr_retry;
+	__u8	alt_port_num;
+	__u8	alt_timeout;
+	__u8	reserved[5];
+};
+
+struct ib_uverbs_create_qp {
+	__u64 response;
+	__u64 user_handle;
+	__u32 pd_handle;
+	__u32 send_cq_handle;
+	__u32 recv_cq_handle;
+	__u32 srq_handle;
+	__u32 max_send_wr;
+	__u32 max_recv_wr;
+	__u32 max_send_sge;
+	__u32 max_recv_sge;
+	__u32 max_inline_data;
+	__u8  sq_sig_all;
+	__u8  qp_type;
+	__u8  is_srq;
+	__u8  reserved;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_open_qp {
+	__u64 response;
+	__u64 user_handle;
+	__u32 pd_handle;
+	__u32 qpn;
+	__u8  qp_type;
+	__u8  reserved[7];
+	__u64 driver_data[0];
+};
+
+/* also used for open response */
+struct ib_uverbs_create_qp_resp {
+	__u32 qp_handle;
+	__u32 qpn;
+	__u32 max_send_wr;
+	__u32 max_recv_wr;
+	__u32 max_send_sge;
+	__u32 max_recv_sge;
+	__u32 max_inline_data;
+	__u32 reserved;
+};
+
+/*
+ * This struct needs to remain a multiple of 8 bytes to keep the
+ * alignment of the modify QP parameters.
+ */
+struct ib_uverbs_qp_dest {
+	__u8  dgid[16];
+	__u32 flow_label;
+	__u16 dlid;
+	__u16 reserved;
+	__u8  sgid_index;
+	__u8  hop_limit;
+	__u8  traffic_class;
+	__u8  sl;
+	__u8  src_path_bits;
+	__u8  static_rate;
+	__u8  is_global;
+	__u8  port_num;
+};
+
+struct ib_uverbs_query_qp {
+	__u64 response;
+	__u32 qp_handle;
+	__u32 attr_mask;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_query_qp_resp {
+	struct ib_uverbs_qp_dest dest;
+	struct ib_uverbs_qp_dest alt_dest;
+	__u32 max_send_wr;
+	__u32 max_recv_wr;
+	__u32 max_send_sge;
+	__u32 max_recv_sge;
+	__u32 max_inline_data;
+	__u32 qkey;
+	__u32 rq_psn;
+	__u32 sq_psn;
+	__u32 dest_qp_num;
+	__u32 qp_access_flags;
+	__u16 pkey_index;
+	__u16 alt_pkey_index;
+	__u8  qp_state;
+	__u8  cur_qp_state;
+	__u8  path_mtu;
+	__u8  path_mig_state;
+	__u8  sq_draining;
+	__u8  max_rd_atomic;
+	__u8  max_dest_rd_atomic;
+	__u8  min_rnr_timer;
+	__u8  port_num;
+	__u8  timeout;
+	__u8  retry_cnt;
+	__u8  rnr_retry;
+	__u8  alt_port_num;
+	__u8  alt_timeout;
+	__u8  sq_sig_all;
+	__u8  reserved[5];
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_modify_qp {
+	struct ib_uverbs_qp_dest dest;
+	struct ib_uverbs_qp_dest alt_dest;
+	__u32 qp_handle;
+	__u32 attr_mask;
+	__u32 qkey;
+	__u32 rq_psn;
+	__u32 sq_psn;
+	__u32 dest_qp_num;
+	__u32 qp_access_flags;
+	__u16 pkey_index;
+	__u16 alt_pkey_index;
+	__u8  qp_state;
+	__u8  cur_qp_state;
+	__u8  path_mtu;
+	__u8  path_mig_state;
+	__u8  en_sqd_async_notify;
+	__u8  max_rd_atomic;
+	__u8  max_dest_rd_atomic;
+	__u8  min_rnr_timer;
+	__u8  port_num;
+	__u8  timeout;
+	__u8  retry_cnt;
+	__u8  rnr_retry;
+	__u8  alt_port_num;
+	__u8  alt_timeout;
+	__u8  reserved[2];
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_modify_qp_resp {
+};
+
+struct ib_uverbs_destroy_qp {
+	__u64 response;
+	__u32 qp_handle;
+	__u32 reserved;
+};
+
+struct ib_uverbs_destroy_qp_resp {
+	__u32 events_reported;
+};
+
+/*
+ * The ib_uverbs_sge structure isn't used anywhere, since we assume
+ * the ib_sge structure is packed the same way on 32-bit and 64-bit
+ * architectures in both kernel and user space.  It's just here to
+ * document the ABI.
+ */
+struct ib_uverbs_sge {
+	__u64 addr;
+	__u32 length;
+	__u32 lkey;
+};
+
+struct ib_uverbs_send_wr {
+	__u64 wr_id;
+	__u32 num_sge;
+	__u32 opcode;
+	__u32 send_flags;
+	union {
+		__u32 imm_data;
+		__u32 invalidate_rkey;
+	} ex;
+	union {
+		struct {
+			__u64 remote_addr;
+			__u32 rkey;
+			__u32 reserved;
+		} rdma;
+		struct {
+			__u64 remote_addr;
+			__u64 compare_add;
+			__u64 swap;
+			__u32 rkey;
+			__u32 reserved;
+		} atomic;
+		struct {
+			__u32 ah;
+			__u32 remote_qpn;
+			__u32 remote_qkey;
+			__u32 reserved;
+		} ud;
+	} wr;
+};
+
+struct ib_uverbs_post_send {
+	__u64 response;
+	__u32 qp_handle;
+	__u32 wr_count;
+	__u32 sge_count;
+	__u32 wqe_size;
+	struct ib_uverbs_send_wr send_wr[0];
+};
+
+struct ib_uverbs_post_send_resp {
+	__u32 bad_wr;
+};
+
+struct ib_uverbs_recv_wr {
+	__u64 wr_id;
+	__u32 num_sge;
+	__u32 reserved;
+};
+
+struct ib_uverbs_post_recv {
+	__u64 response;
+	__u32 qp_handle;
+	__u32 wr_count;
+	__u32 sge_count;
+	__u32 wqe_size;
+	struct ib_uverbs_recv_wr recv_wr[0];
+};
+
+struct ib_uverbs_post_recv_resp {
+	__u32 bad_wr;
+};
+
+struct ib_uverbs_post_srq_recv {
+	__u64 response;
+	__u32 srq_handle;
+	__u32 wr_count;
+	__u32 sge_count;
+	__u32 wqe_size;
+	struct ib_uverbs_recv_wr recv[0];
+};
+
+struct ib_uverbs_post_srq_recv_resp {
+	__u32 bad_wr;
+};
+
+struct ib_uverbs_create_ah {
+	__u64 response;
+	__u64 user_handle;
+	__u32 pd_handle;
+	__u32 reserved;
+	struct ib_uverbs_ah_attr attr;
+};
+
+struct ib_uverbs_create_ah_resp {
+	__u32 ah_handle;
+};
+
+struct ib_uverbs_destroy_ah {
+	__u32 ah_handle;
+};
+
+struct ib_uverbs_attach_mcast {
+	__u8  gid[16];
+	__u32 qp_handle;
+	__u16 mlid;
+	__u16 reserved;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_detach_mcast {
+	__u8  gid[16];
+	__u32 qp_handle;
+	__u16 mlid;
+	__u16 reserved;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_create_srq {
+	__u64 response;
+	__u64 user_handle;
+	__u32 pd_handle;
+	__u32 max_wr;
+	__u32 max_sge;
+	__u32 srq_limit;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_create_xsrq {
+	__u64 response;
+	__u64 user_handle;
+	__u32 srq_type;
+	__u32 pd_handle;
+	__u32 max_wr;
+	__u32 max_sge;
+	__u32 srq_limit;
+	__u32 reserved;
+	__u32 xrcd_handle;
+	__u32 cq_handle;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_create_srq_resp {
+	__u32 srq_handle;
+	__u32 max_wr;
+	__u32 max_sge;
+	__u32 srqn;
+};
+
+struct ib_uverbs_modify_srq {
+	__u32 srq_handle;
+	__u32 attr_mask;
+	__u32 max_wr;
+	__u32 srq_limit;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_query_srq {
+	__u64 response;
+	__u32 srq_handle;
+	__u32 reserved;
+	__u64 driver_data[0];
+};
+
+struct ib_uverbs_query_srq_resp {
+	__u32 max_wr;
+	__u32 max_sge;
+	__u32 srq_limit;
+	__u32 reserved;
+};
+
+struct ib_uverbs_destroy_srq {
+	__u64 response;
+	__u32 srq_handle;
+	__u32 reserved;
+};
+
+struct ib_uverbs_destroy_srq_resp {
+	__u32 events_reported;
+};
+
+#endif /* IB_USER_VERBS_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/rdma/rdma_netlink.h b/mips-qca-linux-uclibc/sysroot/usr/include/rdma/rdma_netlink.h
new file mode 100644
index 0000000..6a79ea8
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/rdma/rdma_netlink.h
@@ -0,0 +1,37 @@
+#ifndef _RDMA_NETLINK_H
+#define _RDMA_NETLINK_H
+
+#include <linux/types.h>
+
+enum {
+	RDMA_NL_RDMA_CM = 1
+};
+
+#define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10)
+#define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
+#define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
+
+enum {
+	RDMA_NL_RDMA_CM_ID_STATS = 0,
+	RDMA_NL_RDMA_CM_NUM_OPS
+};
+
+enum {
+	RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1,
+	RDMA_NL_RDMA_CM_ATTR_DST_ADDR,
+	RDMA_NL_RDMA_CM_NUM_ATTR,
+};
+
+struct rdma_cm_id_stats {
+	__u32	qp_num;
+	__u32	bound_dev_if;
+	__u32	port_space;
+	__s32	pid;
+	__u8	cm_state;
+	__u8	node_type;
+	__u8	port_num;
+	__u8	qp_type;
+};
+
+
+#endif /* _RDMA_NETLINK_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/rdma/rdma_user_cm.h b/mips-qca-linux-uclibc/sysroot/usr/include/rdma/rdma_user_cm.h
new file mode 100644
index 0000000..5348a00
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/rdma/rdma_user_cm.h
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2005-2006 Intel Corporation.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * 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 RDMA_USER_CM_H
+#define RDMA_USER_CM_H
+
+#include <linux/types.h>
+#include <linux/in6.h>
+#include <rdma/ib_user_verbs.h>
+#include <rdma/ib_user_sa.h>
+
+#define RDMA_USER_CM_ABI_VERSION	4
+
+#define RDMA_MAX_PRIVATE_DATA		256
+
+enum {
+	RDMA_USER_CM_CMD_CREATE_ID,
+	RDMA_USER_CM_CMD_DESTROY_ID,
+	RDMA_USER_CM_CMD_BIND_ADDR,
+	RDMA_USER_CM_CMD_RESOLVE_ADDR,
+	RDMA_USER_CM_CMD_RESOLVE_ROUTE,
+	RDMA_USER_CM_CMD_QUERY_ROUTE,
+	RDMA_USER_CM_CMD_CONNECT,
+	RDMA_USER_CM_CMD_LISTEN,
+	RDMA_USER_CM_CMD_ACCEPT,
+	RDMA_USER_CM_CMD_REJECT,
+	RDMA_USER_CM_CMD_DISCONNECT,
+	RDMA_USER_CM_CMD_INIT_QP_ATTR,
+	RDMA_USER_CM_CMD_GET_EVENT,
+	RDMA_USER_CM_CMD_GET_OPTION,
+	RDMA_USER_CM_CMD_SET_OPTION,
+	RDMA_USER_CM_CMD_NOTIFY,
+	RDMA_USER_CM_CMD_JOIN_MCAST,
+	RDMA_USER_CM_CMD_LEAVE_MCAST,
+	RDMA_USER_CM_CMD_MIGRATE_ID
+};
+
+/*
+ * command ABI structures.
+ */
+struct rdma_ucm_cmd_hdr {
+	__u32 cmd;
+	__u16 in;
+	__u16 out;
+};
+
+struct rdma_ucm_create_id {
+	__u64 uid;
+	__u64 response;
+	__u16 ps;
+	__u8  qp_type;
+	__u8  reserved[5];
+};
+
+struct rdma_ucm_create_id_resp {
+	__u32 id;
+};
+
+struct rdma_ucm_destroy_id {
+	__u64 response;
+	__u32 id;
+	__u32 reserved;
+};
+
+struct rdma_ucm_destroy_id_resp {
+	__u32 events_reported;
+};
+
+struct rdma_ucm_bind_addr {
+	__u64 response;
+	struct sockaddr_in6 addr;
+	__u32 id;
+};
+
+struct rdma_ucm_resolve_addr {
+	struct sockaddr_in6 src_addr;
+	struct sockaddr_in6 dst_addr;
+	__u32 id;
+	__u32 timeout_ms;
+};
+
+struct rdma_ucm_resolve_route {
+	__u32 id;
+	__u32 timeout_ms;
+};
+
+struct rdma_ucm_query_route {
+	__u64 response;
+	__u32 id;
+	__u32 reserved;
+};
+
+struct rdma_ucm_query_route_resp {
+	__u64 node_guid;
+	struct ib_user_path_rec ib_route[2];
+	struct sockaddr_in6 src_addr;
+	struct sockaddr_in6 dst_addr;
+	__u32 num_paths;
+	__u8 port_num;
+	__u8 reserved[3];
+};
+
+struct rdma_ucm_conn_param {
+	__u32 qp_num;
+	__u32 reserved;
+	__u8  private_data[RDMA_MAX_PRIVATE_DATA];
+	__u8  private_data_len;
+	__u8  srq;
+	__u8  responder_resources;
+	__u8  initiator_depth;
+	__u8  flow_control;
+	__u8  retry_count;
+	__u8  rnr_retry_count;
+	__u8  valid;
+};
+
+struct rdma_ucm_ud_param {
+	__u32 qp_num;
+	__u32 qkey;
+	struct ib_uverbs_ah_attr ah_attr;
+	__u8  private_data[RDMA_MAX_PRIVATE_DATA];
+	__u8  private_data_len;
+	__u8  reserved[7];
+};
+
+struct rdma_ucm_connect {
+	struct rdma_ucm_conn_param conn_param;
+	__u32 id;
+	__u32 reserved;
+};
+
+struct rdma_ucm_listen {
+	__u32 id;
+	__u32 backlog;
+};
+
+struct rdma_ucm_accept {
+	__u64 uid;
+	struct rdma_ucm_conn_param conn_param;
+	__u32 id;
+	__u32 reserved;
+};
+
+struct rdma_ucm_reject {
+	__u32 id;
+	__u8  private_data_len;
+	__u8  reserved[3];
+	__u8  private_data[RDMA_MAX_PRIVATE_DATA];
+};
+
+struct rdma_ucm_disconnect {
+	__u32 id;
+};
+
+struct rdma_ucm_init_qp_attr {
+	__u64 response;
+	__u32 id;
+	__u32 qp_state;
+};
+
+struct rdma_ucm_notify {
+	__u32 id;
+	__u32 event;
+};
+
+struct rdma_ucm_join_mcast {
+	__u64 response;		/* rdma_ucm_create_id_resp */
+	__u64 uid;
+	struct sockaddr_in6 addr;
+	__u32 id;
+};
+
+struct rdma_ucm_get_event {
+	__u64 response;
+};
+
+struct rdma_ucm_event_resp {
+	__u64 uid;
+	__u32 id;
+	__u32 event;
+	__u32 status;
+	union {
+		struct rdma_ucm_conn_param conn;
+		struct rdma_ucm_ud_param   ud;
+	} param;
+};
+
+/* Option levels */
+enum {
+	RDMA_OPTION_ID		= 0,
+	RDMA_OPTION_IB		= 1
+};
+
+/* Option details */
+enum {
+	RDMA_OPTION_ID_TOS	 = 0,
+	RDMA_OPTION_ID_REUSEADDR = 1,
+	RDMA_OPTION_IB_PATH	 = 1
+};
+
+struct rdma_ucm_set_option {
+	__u64 optval;
+	__u32 id;
+	__u32 level;
+	__u32 optname;
+	__u32 optlen;
+};
+
+struct rdma_ucm_migrate_id {
+	__u64 response;
+	__u32 id;
+	__u32 fd;
+};
+
+struct rdma_ucm_migrate_resp {
+	__u32 events_reported;
+};
+
+#endif /* RDMA_USER_CM_H */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_els.h b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_els.h
new file mode 100644
index 0000000..481abbd
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_els.h
@@ -0,0 +1,831 @@
+/*
+ * Copyright(c) 2007 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Maintained at www.Open-FCoE.org
+ */
+
+#ifndef _FC_ELS_H_
+#define	_FC_ELS_H_
+
+#include <linux/types.h>
+
+/*
+ * Fibre Channel Switch - Enhanced Link Services definitions.
+ * From T11 FC-LS Rev 1.2 June 7, 2005.
+ */
+
+/*
+ * ELS Command codes - byte 0 of the frame payload
+ */
+enum fc_els_cmd {
+	ELS_LS_RJT =	0x01,	/* ESL reject */
+	ELS_LS_ACC =	0x02,	/* ESL Accept */
+	ELS_PLOGI =	0x03,	/* N_Port login */
+	ELS_FLOGI =	0x04,	/* F_Port login */
+	ELS_LOGO =	0x05,	/* Logout */
+	ELS_ABTX =	0x06,	/* Abort exchange - obsolete */
+	ELS_RCS =	0x07,	/* read connection status */
+	ELS_RES =	0x08,	/* read exchange status block */
+	ELS_RSS =	0x09,	/* read sequence status block */
+	ELS_RSI =	0x0a,	/* read sequence initiative */
+	ELS_ESTS =	0x0b,	/* establish streaming */
+	ELS_ESTC =	0x0c,	/* estimate credit */
+	ELS_ADVC =	0x0d,	/* advise credit */
+	ELS_RTV =	0x0e,	/* read timeout value */
+	ELS_RLS =	0x0f,	/* read link error status block */
+	ELS_ECHO =	0x10,	/* echo */
+	ELS_TEST =	0x11,	/* test */
+	ELS_RRQ =	0x12,	/* reinstate recovery qualifier */
+	ELS_REC =	0x13,	/* read exchange concise */
+	ELS_SRR =	0x14,	/* sequence retransmission request */
+	ELS_PRLI =	0x20,	/* process login */
+	ELS_PRLO =	0x21,	/* process logout */
+	ELS_SCN =	0x22,	/* state change notification */
+	ELS_TPLS =	0x23,	/* test process login state */
+	ELS_TPRLO =	0x24,	/* third party process logout */
+	ELS_LCLM =	0x25,	/* login control list mgmt (obs) */
+	ELS_GAID =	0x30,	/* get alias_ID */
+	ELS_FACT =	0x31,	/* fabric activate alias_id */
+	ELS_FDACDT =	0x32,	/* fabric deactivate alias_id */
+	ELS_NACT =	0x33,	/* N-port activate alias_id */
+	ELS_NDACT =	0x34,	/* N-port deactivate alias_id */
+	ELS_QOSR =	0x40,	/* quality of service request */
+	ELS_RVCS =	0x41,	/* read virtual circuit status */
+	ELS_PDISC =	0x50,	/* discover N_port service params */
+	ELS_FDISC =	0x51,	/* discover F_port service params */
+	ELS_ADISC =	0x52,	/* discover address */
+	ELS_RNC =	0x53,	/* report node cap (obs) */
+	ELS_FARP_REQ =	0x54,	/* FC ARP request */
+	ELS_FARP_REPL =	0x55,	/* FC ARP reply */
+	ELS_RPS =	0x56,	/* read port status block */
+	ELS_RPL =	0x57,	/* read port list */
+	ELS_RPBC =	0x58,	/* read port buffer condition */
+	ELS_FAN =	0x60,	/* fabric address notification */
+	ELS_RSCN =	0x61,	/* registered state change notification */
+	ELS_SCR =	0x62,	/* state change registration */
+	ELS_RNFT =	0x63,	/* report node FC-4 types */
+	ELS_CSR =	0x68,	/* clock synch. request */
+	ELS_CSU =	0x69,	/* clock synch. update */
+	ELS_LINIT =	0x70,	/* loop initialize */
+	ELS_LSTS =	0x72,	/* loop status */
+	ELS_RNID =	0x78,	/* request node ID data */
+	ELS_RLIR =	0x79,	/* registered link incident report */
+	ELS_LIRR =	0x7a,	/* link incident record registration */
+	ELS_SRL =	0x7b,	/* scan remote loop */
+	ELS_SBRP =	0x7c,	/* set bit-error reporting params */
+	ELS_RPSC =	0x7d,	/* report speed capabilities */
+	ELS_QSA =	0x7e,	/* query security attributes */
+	ELS_EVFP =	0x7f,	/* exchange virt. fabrics params */
+	ELS_LKA =	0x80,	/* link keep-alive */
+	ELS_AUTH_ELS =	0x90,	/* authentication ELS */
+};
+
+/*
+ * Initializer useful for decoding table.
+ * Please keep this in sync with the above definitions.
+ */
+#define	FC_ELS_CMDS_INIT {			\
+	[ELS_LS_RJT] =	"LS_RJT",		\
+	[ELS_LS_ACC] =	"LS_ACC",		\
+	[ELS_PLOGI] =	"PLOGI",		\
+	[ELS_FLOGI] =	"FLOGI",		\
+	[ELS_LOGO] =	"LOGO",			\
+	[ELS_ABTX] =	"ABTX",			\
+	[ELS_RCS] =	"RCS",			\
+	[ELS_RES] =	"RES",			\
+	[ELS_RSS] =	"RSS",			\
+	[ELS_RSI] =	"RSI",			\
+	[ELS_ESTS] =	"ESTS",			\
+	[ELS_ESTC] =	"ESTC",			\
+	[ELS_ADVC] =	"ADVC",			\
+	[ELS_RTV] =	"RTV",			\
+	[ELS_RLS] =	"RLS",			\
+	[ELS_ECHO] =	"ECHO",			\
+	[ELS_TEST] =	"TEST",			\
+	[ELS_RRQ] =	"RRQ",			\
+	[ELS_REC] =	"REC",			\
+	[ELS_SRR] =	"SRR",			\
+	[ELS_PRLI] =	"PRLI",			\
+	[ELS_PRLO] =	"PRLO",			\
+	[ELS_SCN] =	"SCN",			\
+	[ELS_TPLS] =	"TPLS",			\
+	[ELS_TPRLO] =	"TPRLO",		\
+	[ELS_LCLM] =	"LCLM",			\
+	[ELS_GAID] =	"GAID",			\
+	[ELS_FACT] =	"FACT",			\
+	[ELS_FDACDT] =	"FDACDT",		\
+	[ELS_NACT] =	"NACT",			\
+	[ELS_NDACT] =	"NDACT",		\
+	[ELS_QOSR] =	"QOSR",			\
+	[ELS_RVCS] =	"RVCS",			\
+	[ELS_PDISC] =	"PDISC",		\
+	[ELS_FDISC] =	"FDISC",		\
+	[ELS_ADISC] =	"ADISC",		\
+	[ELS_RNC] =	"RNC",			\
+	[ELS_FARP_REQ] = "FARP_REQ",		\
+	[ELS_FARP_REPL] =  "FARP_REPL",		\
+	[ELS_RPS] =	"RPS",			\
+	[ELS_RPL] =	"RPL",			\
+	[ELS_RPBC] =	"RPBC",			\
+	[ELS_FAN] =	"FAN",			\
+	[ELS_RSCN] =	"RSCN",			\
+	[ELS_SCR] =	"SCR",			\
+	[ELS_RNFT] =	"RNFT",			\
+	[ELS_CSR] =	"CSR",			\
+	[ELS_CSU] =	"CSU",			\
+	[ELS_LINIT] =	"LINIT",		\
+	[ELS_LSTS] =	"LSTS",			\
+	[ELS_RNID] =	"RNID",			\
+	[ELS_RLIR] =	"RLIR",			\
+	[ELS_LIRR] =	"LIRR",			\
+	[ELS_SRL] =	"SRL",			\
+	[ELS_SBRP] =	"SBRP",			\
+	[ELS_RPSC] =	"RPSC",			\
+	[ELS_QSA] =	"QSA",			\
+	[ELS_EVFP] =	"EVFP",			\
+	[ELS_LKA] =	"LKA",			\
+	[ELS_AUTH_ELS] = "AUTH_ELS",		\
+}
+
+/*
+ * LS_ACC payload.
+ */
+struct fc_els_ls_acc {
+	__u8          la_cmd;		/* command code ELS_LS_ACC */
+	__u8          la_resv[3];	/* reserved */
+};
+
+/*
+ * ELS reject payload.
+ */
+struct fc_els_ls_rjt {
+	__u8	er_cmd;		/* command code ELS_LS_RJT */
+	__u8	er_resv[4];	/* reserved must be zero */
+	__u8	er_reason;	/* reason (enum fc_els_rjt_reason below) */
+	__u8	er_explan;	/* explanation (enum fc_els_rjt_explan below) */
+	__u8	er_vendor;	/* vendor specific code */
+};
+
+/*
+ * ELS reject reason codes (er_reason).
+ */
+enum fc_els_rjt_reason {
+	ELS_RJT_NONE =		0,	/* no reject - not to be sent */
+	ELS_RJT_INVAL =		0x01,	/* invalid ELS command code */
+	ELS_RJT_LOGIC =		0x03,	/* logical error */
+	ELS_RJT_BUSY =		0x05,	/* logical busy */
+	ELS_RJT_PROT =		0x07,	/* protocol error */
+	ELS_RJT_UNAB =		0x09,	/* unable to perform command request */
+	ELS_RJT_UNSUP =		0x0b,	/* command not supported */
+	ELS_RJT_INPROG =	0x0e,	/* command already in progress */
+	ELS_RJT_FIP =		0x20,	/* FIP error */
+	ELS_RJT_VENDOR =	0xff,	/* vendor specific error */
+};
+
+
+/*
+ * reason code explanation (er_explan).
+ */
+enum fc_els_rjt_explan {
+	ELS_EXPL_NONE =		0x00,	/* No additional explanation */
+	ELS_EXPL_SPP_OPT_ERR =	0x01,	/* service parameter error - options */
+	ELS_EXPL_SPP_ICTL_ERR =	0x03,	/* service parm error - initiator ctl */
+	ELS_EXPL_AH =		0x11,	/* invalid association header */
+	ELS_EXPL_AH_REQ =	0x13,	/* association_header required */
+	ELS_EXPL_SID =		0x15,	/* invalid originator S_ID */
+	ELS_EXPL_OXID_RXID =	0x17,	/* invalid OX_ID-RX_ID combination */
+	ELS_EXPL_INPROG =	0x19,	/* Request already in progress */
+	ELS_EXPL_PLOGI_REQD =	0x1e,	/* N_Port login required */
+	ELS_EXPL_INSUF_RES =	0x29,	/* insufficient resources */
+	ELS_EXPL_UNAB_DATA =	0x2a,	/* unable to supply requested data */
+	ELS_EXPL_UNSUPR =	0x2c,	/* Request not supported */
+	ELS_EXPL_INV_LEN =	0x2d,	/* Invalid payload length */
+	ELS_EXPL_NOT_NEIGHBOR = 0x62,	/* VN2VN_Port not in neighbor set */
+	/* TBD - above definitions incomplete */
+};
+
+/*
+ * Common service parameters (N ports).
+ */
+struct fc_els_csp {
+	__u8		sp_hi_ver;	/* highest version supported (obs.) */
+	__u8		sp_lo_ver;	/* highest version supported (obs.) */
+	__be16		sp_bb_cred;	/* buffer-to-buffer credits */
+	__be16		sp_features;	/* common feature flags */
+	__be16		sp_bb_data;	/* b-b state number and data field sz */
+	union {
+		struct {
+			__be16	_sp_tot_seq; /* total concurrent sequences */
+			__be16	_sp_rel_off; /* rel. offset by info cat */
+		} sp_plogi;
+		struct {
+			__be32	_sp_r_a_tov; /* resource alloc. timeout msec */
+		} sp_flogi_acc;
+	} sp_u;
+	__be32		sp_e_d_tov;	/* error detect timeout value */
+};
+#define	sp_tot_seq	sp_u.sp_plogi._sp_tot_seq
+#define	sp_rel_off	sp_u.sp_plogi._sp_rel_off
+#define	sp_r_a_tov	sp_u.sp_flogi_acc._sp_r_a_tov
+
+#define	FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */
+
+/*
+ * Minimum and maximum values for max data field size in service parameters.
+ */
+#define	FC_SP_MIN_MAX_PAYLOAD	FC_MIN_MAX_PAYLOAD
+#define	FC_SP_MAX_MAX_PAYLOAD	FC_MAX_PAYLOAD
+
+/*
+ * sp_features
+ */
+#define	FC_SP_FT_NPIV	0x8000	/* multiple N_Port_ID support (FLOGI) */
+#define	FC_SP_FT_CIRO	0x8000	/* continuously increasing rel off (PLOGI) */
+#define	FC_SP_FT_CLAD	0x8000	/* clean address (in FLOGI LS_ACC) */
+#define	FC_SP_FT_RAND	0x4000	/* random relative offset */
+#define	FC_SP_FT_VAL	0x2000	/* valid vendor version level */
+#define	FC_SP_FT_NPIV_ACC	0x2000	/* NPIV assignment (FLOGI LS_ACC) */
+#define	FC_SP_FT_FPORT	0x1000	/* F port (1) vs. N port (0) */
+#define	FC_SP_FT_ABB	0x0800	/* alternate BB_credit management */
+#define	FC_SP_FT_EDTR	0x0400	/* E_D_TOV Resolution is nanoseconds */
+#define	FC_SP_FT_MCAST	0x0200	/* multicast */
+#define	FC_SP_FT_BCAST	0x0100	/* broadcast */
+#define	FC_SP_FT_HUNT	0x0080	/* hunt group */
+#define	FC_SP_FT_SIMP	0x0040	/* dedicated simplex */
+#define	FC_SP_FT_SEC	0x0020	/* reserved for security */
+#define	FC_SP_FT_CSYN	0x0010	/* clock synch. supported */
+#define	FC_SP_FT_RTTOV	0x0008	/* R_T_TOV value 100 uS, else 100 mS */
+#define	FC_SP_FT_HALF	0x0004	/* dynamic half duplex */
+#define	FC_SP_FT_SEQC	0x0002	/* SEQ_CNT */
+#define	FC_SP_FT_PAYL	0x0001	/* FLOGI payload length 256, else 116 */
+
+/*
+ * Class-specific service parameters.
+ */
+struct fc_els_cssp {
+	__be16		cp_class;	/* class flags */
+	__be16		cp_init;	/* initiator flags */
+	__be16		cp_recip;	/* recipient flags */
+	__be16		cp_rdfs;	/* receive data field size */
+	__be16		cp_con_seq;	/* concurrent sequences */
+	__be16		cp_ee_cred;	/* N-port end-to-end credit */
+	__u8		cp_resv1;	/* reserved */
+	__u8		cp_open_seq;	/* open sequences per exchange */
+	__u8		_cp_resv2[2];	/* reserved */
+};
+
+/*
+ * cp_class flags.
+ */
+#define	FC_CPC_VALID	0x8000		/* class valid */
+#define	FC_CPC_IMIX	0x4000		/* intermix mode */
+#define	FC_CPC_SEQ	0x0800		/* sequential delivery */
+#define	FC_CPC_CAMP	0x0200		/* camp-on */
+#define	FC_CPC_PRI	0x0080		/* priority */
+
+/*
+ * cp_init flags.
+ * (TBD: not all flags defined here).
+ */
+#define	FC_CPI_CSYN	0x0010		/* clock synch. capable */
+
+/*
+ * cp_recip flags.
+ */
+#define	FC_CPR_CSYN	0x0008		/* clock synch. capable */
+
+/*
+ * NFC_ELS_FLOGI: Fabric login request.
+ * NFC_ELS_PLOGI: Port login request (same format).
+ */
+struct fc_els_flogi {
+	__u8		fl_cmd;		/* command */
+	__u8		_fl_resvd[3];	/* must be zero */
+	struct fc_els_csp fl_csp;	/* common service parameters */
+	__be64		fl_wwpn;	/* port name */
+	__be64		fl_wwnn;	/* node name */
+	struct fc_els_cssp fl_cssp[4];	/* class 1-4 service parameters */
+	__u8		fl_vend[16];	/* vendor version level */
+} __attribute__((__packed__));
+
+/*
+ * Process login service parameter page.
+ */
+struct fc_els_spp {
+	__u8		spp_type;	/* type code or common service params */
+	__u8		spp_type_ext;	/* type code extension */
+	__u8		spp_flags;
+	__u8		_spp_resvd;
+	__be32		spp_orig_pa;	/* originator process associator */
+	__be32		spp_resp_pa;	/* responder process associator */
+	__be32		spp_params;	/* service parameters */
+};
+
+/*
+ * spp_flags.
+ */
+#define	FC_SPP_OPA_VAL	    0x80	/* originator proc. assoc. valid */
+#define	FC_SPP_RPA_VAL	    0x40	/* responder proc. assoc. valid */
+#define	FC_SPP_EST_IMG_PAIR 0x20	/* establish image pair */
+#define	FC_SPP_RESP_MASK    0x0f	/* mask for response code (below) */
+
+/*
+ * SPP response code in spp_flags - lower 4 bits.
+ */
+enum fc_els_spp_resp {
+	FC_SPP_RESP_ACK	=	1,	/* request executed */
+	FC_SPP_RESP_RES =	2,	/* unable due to lack of resources */
+	FC_SPP_RESP_INIT =	3,	/* initialization not complete */
+	FC_SPP_RESP_NO_PA = 	4,	/* unknown process associator */
+	FC_SPP_RESP_CONF = 	5,	/* configuration precludes image pair */
+	FC_SPP_RESP_COND = 	6,	/* request completed conditionally */
+	FC_SPP_RESP_MULT = 	7,	/* unable to handle multiple SPPs */
+	FC_SPP_RESP_INVL = 	8,	/* SPP is invalid */
+};
+
+/*
+ * ELS_RRQ - Reinstate Recovery Qualifier
+ */
+struct fc_els_rrq {
+	__u8		rrq_cmd;	/* command (0x12) */
+	__u8		rrq_zero[3];	/* specified as zero - part of cmd */
+	__u8		rrq_resvd;	/* reserved */
+	__u8		rrq_s_id[3];	/* originator FID */
+	__be16		rrq_ox_id;	/* originator exchange ID */
+	__be16		rrq_rx_id;	/* responders exchange ID */
+};
+
+/*
+ * ELS_REC - Read exchange concise.
+ */
+struct fc_els_rec {
+	__u8		rec_cmd;	/* command (0x13) */
+	__u8		rec_zero[3];	/* specified as zero - part of cmd */
+	__u8		rec_resvd;	/* reserved */
+	__u8		rec_s_id[3];	/* originator FID */
+	__be16		rec_ox_id;	/* originator exchange ID */
+	__be16		rec_rx_id;	/* responders exchange ID */
+};
+
+/*
+ * ELS_REC LS_ACC payload.
+ */
+struct fc_els_rec_acc {
+	__u8		reca_cmd;	/* accept (0x02) */
+	__u8		reca_zero[3];	/* specified as zero - part of cmd */
+	__be16		reca_ox_id;	/* originator exchange ID */
+	__be16		reca_rx_id;	/* responders exchange ID */
+	__u8		reca_resvd1;	/* reserved */
+	__u8		reca_ofid[3];	/* originator FID */
+	__u8		reca_resvd2;	/* reserved */
+	__u8		reca_rfid[3];	/* responder FID */
+	__be32		reca_fc4value;	/* FC4 value */
+	__be32		reca_e_stat;	/* ESB (exchange status block) status */
+};
+
+/*
+ * ELS_PRLI - Process login request and response.
+ */
+struct fc_els_prli {
+	__u8		prli_cmd;	/* command */
+	__u8		prli_spp_len;	/* length of each serv. parm. page */
+	__be16		prli_len;	/* length of entire payload */
+	/* service parameter pages follow */
+};
+
+/*
+ * ELS_PRLO - Process logout request and response.
+ */
+struct fc_els_prlo {
+	__u8            prlo_cmd;       /* command */
+	__u8            prlo_obs;       /* obsolete, but shall be set to 10h */
+	__be16          prlo_len;       /* payload length */
+};
+
+/*
+ * ELS_ADISC payload
+ */
+struct fc_els_adisc {
+	__u8		adisc_cmd;
+	__u8		adisc_resv[3];
+	__u8            adisc_resv1;
+	__u8            adisc_hard_addr[3];
+	__be64          adisc_wwpn;
+	__be64          adisc_wwnn;
+	__u8            adisc_resv2;
+	__u8            adisc_port_id[3];
+} __attribute__((__packed__));
+
+/*
+ * ELS_LOGO - process or fabric logout.
+ */
+struct fc_els_logo {
+	__u8		fl_cmd;		/* command code */
+	__u8		fl_zero[3];	/* specified as zero - part of cmd */
+	__u8		fl_resvd;	/* reserved */
+	__u8		fl_n_port_id[3];/* N port ID */
+	__be64		fl_n_port_wwn;	/* port name */
+};
+
+/*
+ * ELS_RTV - read timeout value.
+ */
+struct fc_els_rtv {
+	__u8		rtv_cmd;	/* command code 0x0e */
+	__u8		rtv_zero[3];	/* specified as zero - part of cmd */
+};
+
+/*
+ * LS_ACC for ELS_RTV - read timeout value.
+ */
+struct fc_els_rtv_acc {
+	__u8		rtv_cmd;	/* command code 0x02 */
+	__u8		rtv_zero[3];	/* specified as zero - part of cmd */
+	__be32		rtv_r_a_tov;	/* resource allocation timeout value */
+	__be32		rtv_e_d_tov;	/* error detection timeout value */
+	__be32		rtv_toq;	/* timeout qualifier (see below) */
+};
+
+/*
+ * rtv_toq bits.
+ */
+#define	FC_ELS_RTV_EDRES (1 << 26)	/* E_D_TOV resolution is nS else mS */
+#define	FC_ELS_RTV_RTTOV (1 << 19)	/* R_T_TOV is 100 uS else 100 mS */
+
+/*
+ * ELS_SCR - state change registration payload.
+ */
+struct fc_els_scr {
+	__u8		scr_cmd;	/* command code */
+	__u8		scr_resv[6];	/* reserved */
+	__u8		scr_reg_func;	/* registration function (see below) */
+};
+
+enum fc_els_scr_func {
+	ELS_SCRF_FAB =	1,	/* fabric-detected registration */
+	ELS_SCRF_NPORT = 2,	/* Nx_Port-detected registration */
+	ELS_SCRF_FULL =	3,	/* full registration */
+	ELS_SCRF_CLEAR = 255,	/* remove any current registrations */
+};
+
+/*
+ * ELS_RSCN - registered state change notification payload.
+ */
+struct fc_els_rscn {
+	__u8		rscn_cmd;	/* RSCN opcode (0x61) */
+	__u8		rscn_page_len;	/* page length (4) */
+	__be16		rscn_plen;	/* payload length including this word */
+
+	/* followed by 4-byte generic affected Port_ID pages */
+};
+
+struct fc_els_rscn_page {
+	__u8		rscn_page_flags; /* event and address format */
+	__u8		rscn_fid[3];	/* fabric ID */
+};
+
+#define	ELS_RSCN_EV_QUAL_BIT	2	/* shift count for event qualifier */
+#define	ELS_RSCN_EV_QUAL_MASK	0xf	/* mask for event qualifier */
+#define	ELS_RSCN_ADDR_FMT_BIT	0	/* shift count for address format */
+#define	ELS_RSCN_ADDR_FMT_MASK	0x3	/* mask for address format */
+
+enum fc_els_rscn_ev_qual {
+	ELS_EV_QUAL_NONE = 0,		/* unspecified */
+	ELS_EV_QUAL_NS_OBJ = 1,		/* changed name server object */
+	ELS_EV_QUAL_PORT_ATTR = 2,	/* changed port attribute */
+	ELS_EV_QUAL_SERV_OBJ = 3,	/* changed service object */
+	ELS_EV_QUAL_SW_CONFIG = 4,	/* changed switch configuration */
+	ELS_EV_QUAL_REM_OBJ = 5,	/* removed object */
+};
+
+enum fc_els_rscn_addr_fmt {
+	ELS_ADDR_FMT_PORT = 0,	/* rscn_fid is a port address */
+	ELS_ADDR_FMT_AREA = 1,	/* rscn_fid is a area address */
+	ELS_ADDR_FMT_DOM = 2,	/* rscn_fid is a domain address */
+	ELS_ADDR_FMT_FAB = 3,	/* anything on fabric may have changed */
+};
+
+/*
+ * ELS_RNID - request Node ID.
+ */
+struct fc_els_rnid {
+	__u8		rnid_cmd;	/* RNID opcode (0x78) */
+	__u8		rnid_resv[3];	/* reserved */
+	__u8		rnid_fmt;	/* data format */
+	__u8		rnid_resv2[3];	/* reserved */
+};
+
+/*
+ * Node Identification Data formats (rnid_fmt)
+ */
+enum fc_els_rnid_fmt {
+	ELS_RNIDF_NONE = 0,		/* no specific identification data */
+	ELS_RNIDF_GEN = 0xdf,		/* general topology discovery format */
+};
+
+/*
+ * ELS_RNID response.
+ */
+struct fc_els_rnid_resp {
+	__u8		rnid_cmd;	/* response code (LS_ACC) */
+	__u8		rnid_resv[3];	/* reserved */
+	__u8		rnid_fmt;	/* data format */
+	__u8		rnid_cid_len;	/* common ID data length */
+	__u8		rnid_resv2;	/* reserved */
+	__u8		rnid_sid_len;	/* specific ID data length */
+};
+
+struct fc_els_rnid_cid {
+	__be64		rnid_wwpn;	/* N port name */
+	__be64		rnid_wwnn;	/* node name */
+};
+
+struct fc_els_rnid_gen {
+	__u8		rnid_vend_id[16]; /* vendor-unique ID */
+	__be32		rnid_atype;	/* associated type (see below) */
+	__be32		rnid_phys_port;	/* physical port number */
+	__be32		rnid_att_nodes;	/* number of attached nodes */
+	__u8		rnid_node_mgmt;	/* node management (see below) */
+	__u8		rnid_ip_ver;	/* IP version (see below) */
+	__be16		rnid_prot_port;	/* UDP / TCP port number */
+	__be32		rnid_ip_addr[4]; /* IP address */
+	__u8		rnid_resvd[2];	/* reserved */
+	__be16		rnid_vend_spec;	/* vendor-specific field */
+};
+
+enum fc_els_rnid_atype {
+	ELS_RNIDA_UNK =		0x01,	/* unknown */
+	ELS_RNIDA_OTHER =	0x02,	/* none of the following */
+	ELS_RNIDA_HUB =		0x03,
+	ELS_RNIDA_SWITCH =	0x04,
+	ELS_RNIDA_GATEWAY =	0x05,
+	ELS_RNIDA_CONV =	0x06,   /* Obsolete, do not use this value */
+	ELS_RNIDA_HBA =	        0x07,   /* Obsolete, do not use this value */
+	ELS_RNIDA_PROXY =       0x08,   /* Obsolete, do not use this value */
+	ELS_RNIDA_STORAGE =	0x09,
+	ELS_RNIDA_HOST =	0x0a,
+	ELS_RNIDA_SUBSYS =	0x0b,	/* storage subsystem (e.g., RAID) */
+	ELS_RNIDA_ACCESS =	0x0e,	/* access device (e.g. media changer) */
+	ELS_RNIDA_NAS =		0x11,	/* NAS server */
+	ELS_RNIDA_BRIDGE =	0x12,	/* bridge */
+	ELS_RNIDA_VIRT =	0x13,	/* virtualization device */
+	ELS_RNIDA_MF =		0xff,	/* multifunction device (bits below) */
+	ELS_RNIDA_MF_HUB =	1UL << 31, 	/* hub */
+	ELS_RNIDA_MF_SW =	1UL << 30, 	/* switch */
+	ELS_RNIDA_MF_GW =	1UL << 29,	/* gateway */
+	ELS_RNIDA_MF_ST =	1UL << 28,	/* storage */
+	ELS_RNIDA_MF_HOST =	1UL << 27,	/* host */
+	ELS_RNIDA_MF_SUB =	1UL << 26,	/* storage subsystem */
+	ELS_RNIDA_MF_ACC =	1UL << 25,	/* storage access dev */
+	ELS_RNIDA_MF_WDM =	1UL << 24,	/* wavelength division mux */
+	ELS_RNIDA_MF_NAS =	1UL << 23,	/* NAS server */
+	ELS_RNIDA_MF_BR =	1UL << 22,	/* bridge */
+	ELS_RNIDA_MF_VIRT =	1UL << 21,	/* virtualization device */
+};
+
+enum fc_els_rnid_mgmt {
+	ELS_RNIDM_SNMP =	0,
+	ELS_RNIDM_TELNET =	1,
+	ELS_RNIDM_HTTP =	2,
+	ELS_RNIDM_HTTPS =	3,
+	ELS_RNIDM_XML =		4,	/* HTTP + XML */
+};
+
+enum fc_els_rnid_ipver {
+	ELS_RNIDIP_NONE =	0,	/* no IP support or node mgmt. */
+	ELS_RNIDIP_V4 =		1,	/* IPv4 */
+	ELS_RNIDIP_V6 =		2,	/* IPv6 */
+};
+
+/*
+ * ELS RPL - Read Port List.
+ */
+struct fc_els_rpl {
+	__u8		rpl_cmd;	/* command */
+	__u8		rpl_resv[5];	/* reserved - must be zero */
+	__be16		rpl_max_size;	/* maximum response size or zero */
+	__u8		rpl_resv1;	/* reserved - must be zero */
+	__u8		rpl_index[3];	/* starting index */
+};
+
+/*
+ * Port number block in RPL response.
+ */
+struct fc_els_pnb {
+	__be32		pnb_phys_pn;	/* physical port number */
+	__u8		pnb_resv;	/* reserved */
+	__u8		pnb_port_id[3];	/* port ID */
+	__be64		pnb_wwpn;	/* port name */
+};
+
+/*
+ * RPL LS_ACC response.
+ */
+struct fc_els_rpl_resp {
+	__u8		rpl_cmd;	/* ELS_LS_ACC */
+	__u8		rpl_resv1;	/* reserved - must be zero */
+	__be16		rpl_plen;	/* payload length */
+	__u8		rpl_resv2;	/* reserved - must be zero */
+	__u8		rpl_llen[3];	/* list length */
+	__u8		rpl_resv3;	/* reserved - must be zero */
+	__u8		rpl_index[3];	/* starting index */
+	struct fc_els_pnb rpl_pnb[1];	/* variable number of PNBs */
+};
+
+/*
+ * Link Error Status Block.
+ */
+struct fc_els_lesb {
+	__be32		lesb_link_fail;	/* link failure count */
+	__be32		lesb_sync_loss;	/* loss of synchronization count */
+	__be32		lesb_sig_loss;	/* loss of signal count */
+	__be32		lesb_prim_err;	/* primitive sequence error count */
+	__be32		lesb_inv_word;	/* invalid transmission word count */
+	__be32		lesb_inv_crc;	/* invalid CRC count */
+};
+
+/*
+ * ELS RPS - Read Port Status Block request.
+ */
+struct fc_els_rps {
+	__u8		rps_cmd;	/* command */
+	__u8		rps_resv[2];	/* reserved - must be zero */
+	__u8		rps_flag;	/* flag - see below */
+	__be64		rps_port_spec;	/* port selection */
+};
+
+enum fc_els_rps_flag {
+	FC_ELS_RPS_DID =	0x00,	/* port identified by D_ID of req. */
+	FC_ELS_RPS_PPN =	0x01,	/* port_spec is physical port number */
+	FC_ELS_RPS_WWPN =	0x02,	/* port_spec is port WWN */
+};
+
+/*
+ * ELS RPS LS_ACC response.
+ */
+struct fc_els_rps_resp {
+	__u8		rps_cmd;	/* command - LS_ACC */
+	__u8		rps_resv[2];	/* reserved - must be zero */
+	__u8		rps_flag;	/* flag - see below */
+	__u8		rps_resv2[2];	/* reserved */
+	__be16		rps_status;	/* port status - see below */
+	struct fc_els_lesb rps_lesb;	/* link error status block */
+};
+
+enum fc_els_rps_resp_flag {
+	FC_ELS_RPS_LPEV =	0x01,	/* L_port extension valid */
+};
+
+enum fc_els_rps_resp_status {
+	FC_ELS_RPS_PTP =	1 << 5,	/* point-to-point connection */
+	FC_ELS_RPS_LOOP =	1 << 4,	/* loop mode */
+	FC_ELS_RPS_FAB =	1 << 3,	/* fabric present */
+	FC_ELS_RPS_NO_SIG =	1 << 2,	/* loss of signal */
+	FC_ELS_RPS_NO_SYNC =	1 << 1,	/* loss of synchronization */
+	FC_ELS_RPS_RESET =	1 << 0,	/* in link reset protocol */
+};
+
+/*
+ * ELS LIRR - Link Incident Record Registration request.
+ */
+struct fc_els_lirr {
+	__u8		lirr_cmd;	/* command */
+	__u8		lirr_resv[3];	/* reserved - must be zero */
+	__u8		lirr_func;	/* registration function */
+	__u8		lirr_fmt;	/* FC-4 type of RLIR requested */
+	__u8		lirr_resv2[2];	/* reserved - must be zero */
+};
+
+enum fc_els_lirr_func {
+	ELS_LIRR_SET_COND = 	0x01,	/* set - conditionally receive */
+	ELS_LIRR_SET_UNCOND = 	0x02,	/* set - unconditionally receive */
+	ELS_LIRR_CLEAR = 	0xff	/* clear registration */
+};
+
+/*
+ * ELS SRL - Scan Remote Loop request.
+ */
+struct fc_els_srl {
+	__u8		srl_cmd;	/* command */
+	__u8		srl_resv[3];	/* reserved - must be zero */
+	__u8		srl_flag;	/* flag - see below */
+	__u8		srl_flag_param[3];	/* flag parameter */
+};
+
+enum fc_els_srl_flag {
+	FC_ELS_SRL_ALL =	0x00,	/* scan all FL ports */
+	FC_ELS_SRL_ONE =	0x01,	/* scan specified loop */
+	FC_ELS_SRL_EN_PER =	0x02,	/* enable periodic scanning (param) */
+	FC_ELS_SRL_DIS_PER =	0x03,	/* disable periodic scanning */
+};
+
+/*
+ * ELS RLS - Read Link Error Status Block request.
+ */
+struct fc_els_rls {
+	__u8		rls_cmd;	/* command */
+	__u8		rls_resv[4];	/* reserved - must be zero */
+	__u8		rls_port_id[3];	/* port ID */
+};
+
+/*
+ * ELS RLS LS_ACC Response.
+ */
+struct fc_els_rls_resp {
+	__u8		rls_cmd;	/* ELS_LS_ACC */
+	__u8		rls_resv[3];	/* reserved - must be zero */
+	struct fc_els_lesb rls_lesb;	/* link error status block */
+};
+
+/*
+ * ELS RLIR - Registered Link Incident Report.
+ * This is followed by the CLIR and the CLID, described below.
+ */
+struct fc_els_rlir {
+	__u8		rlir_cmd;	/* command */
+	__u8		rlir_resv[3];	/* reserved - must be zero */
+	__u8		rlir_fmt;	/* format (FC4-type if type specific) */
+	__u8		rlir_clr_len;	/* common link incident record length */
+	__u8		rlir_cld_len;	/* common link incident desc. length */
+	__u8		rlir_slr_len;	/* spec. link incident record length */
+};
+
+/*
+ * CLIR - Common Link Incident Record Data. - Sent via RLIR.
+ */
+struct fc_els_clir {
+	__be64		clir_wwpn;	/* incident port name */
+	__be64		clir_wwnn;	/* incident port node name */
+	__u8		clir_port_type;	/* incident port type */
+	__u8		clir_port_id[3];	/* incident port ID */
+
+	__be64		clir_conn_wwpn;	/* connected port name */
+	__be64		clir_conn_wwnn;	/* connected node name */
+	__be64		clir_fab_name;	/* fabric name */
+	__be32		clir_phys_port;	/* physical port number */
+	__be32		clir_trans_id;	/* transaction ID */
+	__u8		clir_resv[3];	/* reserved */
+	__u8		clir_ts_fmt;	/* time stamp format */
+	__be64		clir_timestamp;	/* time stamp */
+};
+
+/*
+ * CLIR clir_ts_fmt - time stamp format values.
+ */
+enum fc_els_clir_ts_fmt {
+	ELS_CLIR_TS_UNKNOWN = 	0,	/* time stamp field unknown */
+	ELS_CLIR_TS_SEC_FRAC = 	1,	/* time in seconds and fractions */
+	ELS_CLIR_TS_CSU =	2,	/* time in clock synch update format */
+};
+
+/*
+ * Common Link Incident Descriptor - sent via RLIR.
+ */
+struct fc_els_clid {
+	__u8		clid_iq;	/* incident qualifier flags */
+	__u8		clid_ic;	/* incident code */
+	__be16		clid_epai;	/* domain/area of ISL */
+};
+
+/*
+ * CLID incident qualifier flags.
+ */
+enum fc_els_clid_iq {
+	ELS_CLID_SWITCH =	0x20,	/* incident port is a switch node */
+	ELS_CLID_E_PORT =	0x10,	/* incident is an ISL (E) port */
+	ELS_CLID_SEV_MASK =	0x0c,	/* severity 2-bit field mask */
+	ELS_CLID_SEV_INFO =	0x00,	/* report is informational */
+	ELS_CLID_SEV_INOP =	0x08,	/* link not operational */
+	ELS_CLID_SEV_DEG =	0x04,	/* link degraded but operational */
+	ELS_CLID_LASER =	0x02,	/* subassembly is a laser */
+	ELS_CLID_FRU =		0x01,	/* format can identify a FRU */
+};
+
+/*
+ * CLID incident code.
+ */
+enum fc_els_clid_ic {
+	ELS_CLID_IC_IMPL =	1,	/* implicit incident */
+	ELS_CLID_IC_BER =	2,	/* bit-error-rate threshold exceeded */
+	ELS_CLID_IC_LOS =	3,	/* loss of synch or signal */
+	ELS_CLID_IC_NOS =	4,	/* non-operational primitive sequence */
+	ELS_CLID_IC_PST =	5,	/* primitive sequence timeout */
+	ELS_CLID_IC_INVAL =	6,	/* invalid primitive sequence */
+	ELS_CLID_IC_LOOP_TO =	7,	/* loop initialization time out */
+	ELS_CLID_IC_LIP =	8,	/* receiving LIP */
+};
+
+#endif /* _FC_ELS_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_fs.h b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_fs.h
new file mode 100644
index 0000000..50f28b1
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_fs.h
@@ -0,0 +1,348 @@
+/*
+ * Copyright(c) 2007 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Maintained at www.Open-FCoE.org
+ */
+
+#ifndef _FC_FS_H_
+#define _FC_FS_H_
+
+#include <linux/types.h>
+
+/*
+ * Fibre Channel Framing and Signalling definitions.
+ * From T11 FC-FS-2 Rev 0.90 - 9 August 2005.
+ */
+
+/*
+ * Frame header
+ */
+struct fc_frame_header {
+	__u8          fh_r_ctl;	/* routing control */
+	__u8          fh_d_id[3];	/* Destination ID */
+
+	__u8          fh_cs_ctl;	/* class of service control / pri */
+	__u8          fh_s_id[3];	/* Source ID */
+
+	__u8          fh_type;		/* see enum fc_fh_type below */
+	__u8          fh_f_ctl[3];	/* frame control */
+
+	__u8          fh_seq_id;	/* sequence ID */
+	__u8          fh_df_ctl;	/* data field control */
+	__be16        fh_seq_cnt;	/* sequence count */
+
+	__be16        fh_ox_id;		/* originator exchange ID */
+	__be16        fh_rx_id;		/* responder exchange ID */
+	__be32        fh_parm_offset;	/* parameter or relative offset */
+};
+
+#define FC_FRAME_HEADER_LEN 24	/* expected length of structure */
+
+#define FC_MAX_PAYLOAD  2112U		/* max payload length in bytes */
+#define FC_MIN_MAX_PAYLOAD  256U 	/* lower limit on max payload */
+
+#define FC_MAX_FRAME	(FC_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
+#define FC_MIN_MAX_FRAME (FC_MIN_MAX_PAYLOAD + FC_FRAME_HEADER_LEN)
+
+/*
+ * fh_r_ctl - Routing control definitions.
+ */
+    /*
+     * FC-4 device_data.
+     */
+enum fc_rctl {
+	FC_RCTL_DD_UNCAT = 0x00,	/* uncategorized information */
+	FC_RCTL_DD_SOL_DATA = 0x01,	/* solicited data */
+	FC_RCTL_DD_UNSOL_CTL = 0x02,	/* unsolicited control */
+	FC_RCTL_DD_SOL_CTL = 0x03,	/* solicited control or reply */
+	FC_RCTL_DD_UNSOL_DATA = 0x04,	/* unsolicited data */
+	FC_RCTL_DD_DATA_DESC = 0x05,	/* data descriptor */
+	FC_RCTL_DD_UNSOL_CMD = 0x06,	/* unsolicited command */
+	FC_RCTL_DD_CMD_STATUS = 0x07,	/* command status */
+
+#define FC_RCTL_ILS_REQ FC_RCTL_DD_UNSOL_CTL	/* ILS request */
+#define FC_RCTL_ILS_REP FC_RCTL_DD_SOL_CTL	/* ILS reply */
+
+	/*
+	 * Extended Link_Data
+	 */
+	FC_RCTL_ELS_REQ = 0x22,	/* extended link services request */
+	FC_RCTL_ELS_REP = 0x23,	/* extended link services reply */
+	FC_RCTL_ELS4_REQ = 0x32, /* FC-4 ELS request */
+	FC_RCTL_ELS4_REP = 0x33, /* FC-4 ELS reply */
+	/*
+	 * Optional Extended Headers
+	 */
+	FC_RCTL_VFTH = 0x50,	/* virtual fabric tagging header */
+	FC_RCTL_IFRH = 0x51,	/* inter-fabric routing header */
+	FC_RCTL_ENCH = 0x52,	/* encapsulation header */
+	/*
+	 * Basic Link Services fh_r_ctl values.
+	 */
+	FC_RCTL_BA_NOP = 0x80,	/* basic link service NOP */
+	FC_RCTL_BA_ABTS = 0x81,	/* basic link service abort */
+	FC_RCTL_BA_RMC = 0x82,	/* remove connection */
+	FC_RCTL_BA_ACC = 0x84,	/* basic accept */
+	FC_RCTL_BA_RJT = 0x85,	/* basic reject */
+	FC_RCTL_BA_PRMT = 0x86,	/* dedicated connection preempted */
+	/*
+	 * Link Control Information.
+	 */
+	FC_RCTL_ACK_1 = 0xc0,	/* acknowledge_1 */
+	FC_RCTL_ACK_0 = 0xc1,	/* acknowledge_0 */
+	FC_RCTL_P_RJT = 0xc2,	/* port reject */
+	FC_RCTL_F_RJT = 0xc3,	/* fabric reject */
+	FC_RCTL_P_BSY = 0xc4,	/* port busy */
+	FC_RCTL_F_BSY = 0xc5,	/* fabric busy to data frame */
+	FC_RCTL_F_BSYL = 0xc6,	/* fabric busy to link control frame */
+	FC_RCTL_LCR = 0xc7,	/* link credit reset */
+	FC_RCTL_END = 0xc9,	/* end */
+};
+				    /* incomplete list of definitions */
+
+/*
+ * R_CTL names initializer.
+ * Please keep this matching the above definitions.
+ */
+#define FC_RCTL_NAMES_INIT { \
+	[FC_RCTL_DD_UNCAT] =		"uncat",			\
+	[FC_RCTL_DD_SOL_DATA] =		"sol data",			\
+	[FC_RCTL_DD_UNSOL_CTL] =	"unsol ctl",			\
+	[FC_RCTL_DD_SOL_CTL] =		"sol ctl/reply",		\
+	[FC_RCTL_DD_UNSOL_DATA] =	"unsol data",			\
+	[FC_RCTL_DD_DATA_DESC] =	"data desc",			\
+	[FC_RCTL_DD_UNSOL_CMD] =	"unsol cmd",			\
+	[FC_RCTL_DD_CMD_STATUS] =	"cmd status",			\
+	[FC_RCTL_ELS_REQ] =		"ELS req",			\
+	[FC_RCTL_ELS_REP] =		"ELS rep",			\
+	[FC_RCTL_ELS4_REQ] =		"FC-4 ELS req",			\
+	[FC_RCTL_ELS4_REP] =		"FC-4 ELS rep",			\
+	[FC_RCTL_BA_NOP] =		"BLS NOP",			\
+	[FC_RCTL_BA_ABTS] =		"BLS abort",			\
+	[FC_RCTL_BA_RMC] =		"BLS remove connection",	\
+	[FC_RCTL_BA_ACC] =		"BLS accept",			\
+	[FC_RCTL_BA_RJT] =		"BLS reject",			\
+	[FC_RCTL_BA_PRMT] =		"BLS dedicated connection preempted", \
+	[FC_RCTL_ACK_1] =		"LC ACK_1",			\
+	[FC_RCTL_ACK_0] =		"LC ACK_0",			\
+	[FC_RCTL_P_RJT] =		"LC port reject",		\
+	[FC_RCTL_F_RJT] =		"LC fabric reject",		\
+	[FC_RCTL_P_BSY] =		"LC port busy",			\
+	[FC_RCTL_F_BSY] =		"LC fabric busy to data frame",	\
+	[FC_RCTL_F_BSYL] =		"LC fabric busy to link control frame",\
+	[FC_RCTL_LCR] =			"LC link credit reset",		\
+	[FC_RCTL_END] =			"LC end",			\
+}
+
+/*
+ * Well-known fabric addresses.
+ */
+enum fc_well_known_fid {
+	FC_FID_NONE =           0x000000,       /* No destination */
+	FC_FID_BCAST =		0xffffff,	/* broadcast */
+	FC_FID_FLOGI =		0xfffffe,	/* fabric login */
+	FC_FID_FCTRL =		0xfffffd,	/* fabric controller */
+	FC_FID_DIR_SERV =	0xfffffc,	/* directory server */
+	FC_FID_TIME_SERV =	0xfffffb,	/* time server */
+	FC_FID_MGMT_SERV =	0xfffffa,	/* management server */
+	FC_FID_QOS =		0xfffff9,	/* QoS Facilitator */
+	FC_FID_ALIASES =	0xfffff8,	/* alias server (FC-PH2) */
+	FC_FID_SEC_KEY =	0xfffff7,	/* Security key dist. server */
+	FC_FID_CLOCK =		0xfffff6,	/* clock synch server */
+	FC_FID_MCAST_SERV =	0xfffff5,	/* multicast server */
+};
+
+#define	FC_FID_WELL_KNOWN_MAX	0xffffff /* highest well-known fabric ID */
+#define	FC_FID_WELL_KNOWN_BASE	0xfffff5 /* start of well-known fabric ID */
+
+/*
+ * Other well-known addresses, outside the above contiguous range.
+ */
+#define	FC_FID_DOM_MGR		0xfffc00	/* domain manager base */
+
+/*
+ * Fabric ID bytes.
+ */
+#define	FC_FID_DOMAIN		0
+#define	FC_FID_PORT		1
+#define	FC_FID_LINK		2
+
+/*
+ * fh_type codes
+ */
+enum fc_fh_type {
+	FC_TYPE_BLS =	0x00,	/* basic link service */
+	FC_TYPE_ELS =	0x01,	/* extended link service */
+	FC_TYPE_IP =	0x05,	/* IP over FC, RFC 4338 */
+	FC_TYPE_FCP =	0x08,	/* SCSI FCP */
+	FC_TYPE_CT =	0x20,	/* Fibre Channel Services (FC-CT) */
+	FC_TYPE_ILS =	0x22,	/* internal link service */
+};
+
+/*
+ * FC_TYPE names initializer.
+ * Please keep this matching the above definitions.
+ */
+#define FC_TYPE_NAMES_INIT {				\
+	[FC_TYPE_BLS] =		"BLS",			\
+	[FC_TYPE_ELS] =		"ELS",			\
+	[FC_TYPE_IP] =		"IP",			\
+	[FC_TYPE_FCP] =		"FCP",			\
+	[FC_TYPE_CT] =		"CT",			\
+	[FC_TYPE_ILS] =		"ILS",			\
+}
+
+/*
+ * Exchange IDs.
+ */
+#define FC_XID_UNKNOWN  0xffff	/* unknown exchange ID */
+#define FC_XID_MIN	0x0	/* supported min exchange ID */
+#define FC_XID_MAX	0xfffe	/* supported max exchange ID */
+
+/*
+ * fh_f_ctl - Frame control flags.
+ */
+#define	FC_FC_EX_CTX	(1 << 23)	/* sent by responder to exchange */
+#define	FC_FC_SEQ_CTX	(1 << 22)	/* sent by responder to sequence */
+#define	FC_FC_FIRST_SEQ (1 << 21)	/* first sequence of this exchange */
+#define	FC_FC_LAST_SEQ	(1 << 20)	/* last sequence of this exchange */
+#define	FC_FC_END_SEQ	(1 << 19)	/* last frame of sequence */
+#define	FC_FC_END_CONN	(1 << 18)	/* end of class 1 connection pending */
+#define	FC_FC_RES_B17	(1 << 17)	/* reserved */
+#define	FC_FC_SEQ_INIT	(1 << 16)	/* transfer of sequence initiative */
+#define	FC_FC_X_ID_REASS (1 << 15)	/* exchange ID has been changed */
+#define	FC_FC_X_ID_INVAL (1 << 14)	/* exchange ID invalidated */
+
+#define	FC_FC_ACK_1	(1 << 12)	/* 13:12 = 1: ACK_1 expected */
+#define	FC_FC_ACK_N	(2 << 12)	/* 13:12 = 2: ACK_N expected */
+#define	FC_FC_ACK_0	(3 << 12)	/* 13:12 = 3: ACK_0 expected */
+
+#define	FC_FC_RES_B11	(1 << 11)	/* reserved */
+#define	FC_FC_RES_B10	(1 << 10)	/* reserved */
+#define	FC_FC_RETX_SEQ	(1 << 9)	/* retransmitted sequence */
+#define	FC_FC_UNI_TX	(1 << 8)	/* unidirectional transmit (class 1) */
+#define	FC_FC_CONT_SEQ(i) ((i) << 6)
+#define	FC_FC_ABT_SEQ(i) ((i) << 4)
+#define	FC_FC_REL_OFF	(1 << 3)	/* parameter is relative offset */
+#define	FC_FC_RES2	(1 << 2)	/* reserved */
+#define	FC_FC_FILL(i)	((i) & 3)	/* 1:0: bytes of trailing fill */
+
+/*
+ * BA_ACC payload.
+ */
+struct fc_ba_acc {
+	__u8		ba_seq_id_val;	/* SEQ_ID validity */
+#define FC_BA_SEQ_ID_VAL 0x80
+	__u8		ba_seq_id;	/* SEQ_ID of seq last deliverable */
+	__u8		ba_resvd[2];	/* reserved */
+	__be16		ba_ox_id;	/* OX_ID for aborted seq or exch */
+	__be16		ba_rx_id;	/* RX_ID for aborted seq or exch */
+	__be16		ba_low_seq_cnt;	/* low SEQ_CNT of aborted seq */
+	__be16		ba_high_seq_cnt; /* high SEQ_CNT of aborted seq */
+};
+
+/*
+ * BA_RJT: Basic Reject payload.
+ */
+struct fc_ba_rjt {
+	__u8		br_resvd;	/* reserved */
+	__u8		br_reason;	/* reason code */
+	__u8		br_explan;	/* reason explanation */
+	__u8		br_vendor;	/* vendor unique code */
+};
+
+/*
+ * BA_RJT reason codes.
+ * From FS-2.
+ */
+enum fc_ba_rjt_reason {
+	FC_BA_RJT_NONE =	0,	/* in software this means no reject */
+	FC_BA_RJT_INVL_CMD =	0x01,	/* invalid command code */
+	FC_BA_RJT_LOG_ERR =	0x03,	/* logical error */
+	FC_BA_RJT_LOG_BUSY =	0x05,	/* logical busy */
+	FC_BA_RJT_PROTO_ERR =	0x07,	/* protocol error */
+	FC_BA_RJT_UNABLE =	0x09,	/* unable to perform request */
+	FC_BA_RJT_VENDOR =	0xff,	/* vendor-specific (see br_vendor) */
+};
+
+/*
+ * BA_RJT reason code explanations.
+ */
+enum fc_ba_rjt_explan {
+	FC_BA_RJT_EXP_NONE =	0x00,	/* no additional expanation */
+	FC_BA_RJT_INV_XID =	0x03,	/* invalid OX_ID-RX_ID combination */
+	FC_BA_RJT_ABT =		0x05,	/* sequence aborted, no seq info */
+};
+
+/*
+ * P_RJT or F_RJT: Port Reject or Fabric Reject parameter field.
+ */
+struct fc_pf_rjt {
+	__u8		rj_action;	/* reserved */
+	__u8		rj_reason;	/* reason code */
+	__u8		rj_resvd;	/* reserved */
+	__u8		rj_vendor;	/* vendor unique code */
+};
+
+/*
+ * P_RJT and F_RJT reject reason codes.
+ */
+enum fc_pf_rjt_reason {
+	FC_RJT_NONE =		0,	/* non-reject (reserved by standard) */
+	FC_RJT_INVL_DID =	0x01,	/* invalid destination ID */
+	FC_RJT_INVL_SID =	0x02,	/* invalid source ID */
+	FC_RJT_P_UNAV_T =	0x03,	/* port unavailable, temporary */
+	FC_RJT_P_UNAV =		0x04,	/* port unavailable, permanent */
+	FC_RJT_CLS_UNSUP =	0x05,	/* class not supported */
+	FC_RJT_DEL_USAGE =	0x06,	/* delimiter usage error */
+	FC_RJT_TYPE_UNSUP =	0x07,	/* type not supported */
+	FC_RJT_LINK_CTL =	0x08,	/* invalid link control */
+	FC_RJT_R_CTL =		0x09,	/* invalid R_CTL field */
+	FC_RJT_F_CTL =		0x0a,	/* invalid F_CTL field */
+	FC_RJT_OX_ID =		0x0b,	/* invalid originator exchange ID */
+	FC_RJT_RX_ID =		0x0c,	/* invalid responder exchange ID */
+	FC_RJT_SEQ_ID =		0x0d,	/* invalid sequence ID */
+	FC_RJT_DF_CTL =		0x0e,	/* invalid DF_CTL field */
+	FC_RJT_SEQ_CNT =	0x0f,	/* invalid SEQ_CNT field */
+	FC_RJT_PARAM =		0x10,	/* invalid parameter field */
+	FC_RJT_EXCH_ERR =	0x11,	/* exchange error */
+	FC_RJT_PROTO =		0x12,	/* protocol error */
+	FC_RJT_LEN =		0x13,	/* incorrect length */
+	FC_RJT_UNEXP_ACK =	0x14,	/* unexpected ACK */
+	FC_RJT_FAB_CLASS =	0x15,	/* class unsupported by fabric entity */
+	FC_RJT_LOGI_REQ =	0x16,	/* login required */
+	FC_RJT_SEQ_XS =		0x17,	/* excessive sequences attempted */
+	FC_RJT_EXCH_EST =	0x18,	/* unable to establish exchange */
+	FC_RJT_FAB_UNAV =	0x1a,	/* fabric unavailable */
+	FC_RJT_VC_ID =		0x1b,	/* invalid VC_ID (class 4) */
+	FC_RJT_CS_CTL =		0x1c,	/* invalid CS_CTL field */
+	FC_RJT_INSUF_RES =	0x1d,	/* insuff. resources for VC (Class 4) */
+	FC_RJT_INVL_CLS =	0x1f,	/* invalid class of service */
+	FC_RJT_PREEMT_RJT =	0x20,	/* preemption request rejected */
+	FC_RJT_PREEMT_DIS =	0x21,	/* preemption not enabled */
+	FC_RJT_MCAST_ERR =	0x22,	/* multicast error */
+	FC_RJT_MCAST_ET =	0x23,	/* multicast error terminate */
+	FC_RJT_PRLI_REQ =	0x24,	/* process login required */
+	FC_RJT_INVL_ATT =	0x25,	/* invalid attachment */
+	FC_RJT_VENDOR =		0xff,	/* vendor specific reject */
+};
+
+/* default timeout values */
+
+#define FC_DEF_E_D_TOV	2000UL
+#define FC_DEF_R_A_TOV	10000UL
+
+#endif /* _FC_FS_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_gs.h b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_gs.h
new file mode 100644
index 0000000..a37346d
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_gs.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright(c) 2007 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Maintained at www.Open-FCoE.org
+ */
+
+#ifndef _FC_GS_H_
+#define	_FC_GS_H_
+
+#include <linux/types.h>
+
+/*
+ * Fibre Channel Services - Common Transport.
+ * From T11.org FC-GS-2 Rev 5.3 November 1998.
+ */
+
+struct fc_ct_hdr {
+	__u8		ct_rev;		/* revision */
+	__u8		ct_in_id[3];	/* N_Port ID of original requestor */
+	__u8		ct_fs_type;	/* type of fibre channel service */
+	__u8		ct_fs_subtype;	/* subtype */
+	__u8		ct_options;
+	__u8		_ct_resvd1;
+	__be16		ct_cmd;		/* command / response code */
+	__be16		ct_mr_size;	/* maximum / residual size */
+	__u8		_ct_resvd2;
+	__u8		ct_reason;	/* reject reason */
+	__u8		ct_explan;	/* reason code explanation */
+	__u8		ct_vendor;	/* vendor unique data */
+};
+
+#define	FC_CT_HDR_LEN	16	/* expected sizeof (struct fc_ct_hdr) */
+
+enum fc_ct_rev {
+	FC_CT_REV = 1		/* common transport revision */
+};
+
+/*
+ * ct_fs_type values.
+ */
+enum fc_ct_fs_type {
+	FC_FST_ALIAS =	0xf8,	/* alias service */
+	FC_FST_MGMT =	0xfa,	/* management service */
+	FC_FST_TIME =	0xfb,	/* time service */
+	FC_FST_DIR =	0xfc,	/* directory service */
+};
+
+/*
+ * ct_cmd: Command / response codes
+ */
+enum fc_ct_cmd {
+	FC_FS_RJT =	0x8001,	/* reject */
+	FC_FS_ACC =	0x8002,	/* accept */
+};
+
+/*
+ * FS_RJT reason codes.
+ */
+enum fc_ct_reason {
+	FC_FS_RJT_CMD =		0x01,	/* invalid command code */
+	FC_FS_RJT_VER =		0x02,	/* invalid version level */
+	FC_FS_RJT_LOG =		0x03,	/* logical error */
+	FC_FS_RJT_IUSIZ =	0x04,	/* invalid IU size */
+	FC_FS_RJT_BSY =		0x05,	/* logical busy */
+	FC_FS_RJT_PROTO =	0x07,	/* protocol error */
+	FC_FS_RJT_UNABL =	0x09,	/* unable to perform command request */
+	FC_FS_RJT_UNSUP =	0x0b,	/* command not supported */
+};
+
+/*
+ * FS_RJT reason code explanations.
+ */
+enum fc_ct_explan {
+	FC_FS_EXP_NONE =	0x00,	/* no additional explanation */
+	FC_FS_EXP_PID =		0x01,	/* port ID not registered */
+	FC_FS_EXP_PNAM =	0x02,	/* port name not registered */
+	FC_FS_EXP_NNAM =	0x03,	/* node name not registered */
+	FC_FS_EXP_COS =		0x04,	/* class of service not registered */
+	FC_FS_EXP_FTNR =	0x07,	/* FC-4 types not registered */
+	/* definitions not complete */
+};
+
+#endif /* _FC_GS_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_ns.h b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_ns.h
new file mode 100644
index 0000000..f7751d5
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/fc/fc_ns.h
@@ -0,0 +1,208 @@
+/*
+ * Copyright(c) 2007 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Maintained at www.Open-FCoE.org
+ */
+
+#ifndef _FC_NS_H_
+#define	_FC_NS_H_
+
+#include <linux/types.h>
+
+/*
+ * Fibre Channel Services - Name Service (dNS)
+ * From T11.org FC-GS-2 Rev 5.3 November 1998.
+ */
+
+/*
+ * Common-transport sub-type for Name Server.
+ */
+#define	FC_NS_SUBTYPE	    2	/* fs_ct_hdr.ct_fs_subtype */
+
+/*
+ * Name server Requests.
+ * Note:  this is an incomplete list, some unused requests are omitted.
+ */
+enum fc_ns_req {
+	FC_NS_GA_NXT =	0x0100,		/* get all next */
+	FC_NS_GI_A =	0x0101,		/* get identifiers - scope */
+	FC_NS_GPN_ID =	0x0112,		/* get port name by ID */
+	FC_NS_GNN_ID =	0x0113,		/* get node name by ID */
+	FC_NS_GSPN_ID = 0x0118,		/* get symbolic port name */
+	FC_NS_GID_PN =	0x0121,		/* get ID for port name */
+	FC_NS_GID_NN =	0x0131,		/* get IDs for node name */
+	FC_NS_GID_FT =	0x0171,		/* get IDs by FC4 type */
+	FC_NS_GPN_FT =	0x0172,		/* get port names by FC4 type */
+	FC_NS_GID_PT =	0x01a1,		/* get IDs by port type */
+	FC_NS_RPN_ID =	0x0212,		/* reg port name for ID */
+	FC_NS_RNN_ID =	0x0213,		/* reg node name for ID */
+	FC_NS_RFT_ID =	0x0217,		/* reg FC4 type for ID */
+	FC_NS_RSPN_ID =	0x0218,		/* reg symbolic port name */
+	FC_NS_RFF_ID =	0x021f,		/* reg FC4 Features for ID */
+	FC_NS_RSNN_NN =	0x0239,		/* reg symbolic node name */
+};
+
+/*
+ * Port type values.
+ */
+enum fc_ns_pt {
+	FC_NS_UNID_PORT = 0x00,	/* unidentified */
+	FC_NS_N_PORT =	0x01,	/* N port */
+	FC_NS_NL_PORT =	0x02,	/* NL port */
+	FC_NS_FNL_PORT = 0x03,	/* F/NL port */
+	FC_NS_NX_PORT =	0x7f,	/* Nx port */
+	FC_NS_F_PORT =	0x81,	/* F port */
+	FC_NS_FL_PORT =	0x82,	/* FL port */
+	FC_NS_E_PORT =	0x84,	/* E port */
+	FC_NS_B_PORT =	0x85,	/* B port */
+};
+
+/*
+ * Port type object.
+ */
+struct fc_ns_pt_obj {
+	__u8		pt_type;
+};
+
+/*
+ * Port ID object
+ */
+struct fc_ns_fid {
+	__u8		fp_flags;	/* flags for responses only */
+	__u8		fp_fid[3];
+};
+
+/*
+ * fp_flags in port ID object, for responses only.
+ */
+#define	FC_NS_FID_LAST	0x80		/* last object */
+
+/*
+ * FC4-types object.
+ */
+#define	FC_NS_TYPES	256	/* number of possible FC-4 types */
+#define	FC_NS_BPW	32	/* bits per word in bitmap */
+
+struct fc_ns_fts {
+	__be32	ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */
+};
+
+/*
+ * FC4-features object.
+ */
+struct fc_ns_ff	{
+	__be32	fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */
+};
+
+/*
+ * GID_PT request.
+ */
+struct fc_ns_gid_pt {
+	__u8		fn_pt_type;
+	__u8		fn_domain_id_scope;
+	__u8		fn_area_id_scope;
+	__u8		fn_resvd;
+};
+
+/*
+ * GID_FT or GPN_FT request.
+ */
+struct fc_ns_gid_ft {
+	__u8		fn_resvd;
+	__u8		fn_domain_id_scope;
+	__u8		fn_area_id_scope;
+	__u8		fn_fc4_type;
+};
+
+/*
+ * GPN_FT response.
+ */
+struct fc_gpn_ft_resp {
+	__u8		fp_flags;	/* see fp_flags definitions above */
+	__u8		fp_fid[3];	/* port ID */
+	__be32		fp_resvd;
+	__be64		fp_wwpn;	/* port name */
+};
+
+/*
+ * GID_PN request
+ */
+struct fc_ns_gid_pn {
+	__be64     fn_wwpn;    /* port name */
+};
+
+/*
+ * GID_PN response or GSPN_ID request
+ */
+struct fc_gid_pn_resp {
+	__u8      fp_resvd;
+	__u8      fp_fid[3];     /* port ID */
+};
+
+/*
+ * GSPN_ID response
+ */
+struct fc_gspn_resp {
+	__u8	fp_name_len;
+	char	fp_name[];
+};
+
+/*
+ * RFT_ID request - register FC-4 types for ID.
+ */
+struct fc_ns_rft_id {
+	struct fc_ns_fid fr_fid;	/* port ID object */
+	struct fc_ns_fts fr_fts;	/* FC-4 types object */
+};
+
+/*
+ * RPN_ID request - register port name for ID.
+ * RNN_ID request - register node name for ID.
+ */
+struct fc_ns_rn_id {
+	struct fc_ns_fid fr_fid;	/* port ID object */
+	__be64		fr_wwn;		/* node name or port name */
+} __attribute__((__packed__));
+
+/*
+ * RSNN_NN request - register symbolic node name
+ */
+struct fc_ns_rsnn {
+	__be64		fr_wwn;		/* node name */
+	__u8		fr_name_len;
+	char		fr_name[];
+} __attribute__((__packed__));
+
+/*
+ * RSPN_ID request - register symbolic port name
+ */
+struct fc_ns_rspn {
+	struct fc_ns_fid fr_fid;	/* port ID object */
+	__u8		fr_name_len;
+	char		fr_name[];
+} __attribute__((__packed__));
+
+/*
+ * RFF_ID request - register FC-4 Features for ID.
+ */
+struct fc_ns_rff_id {
+	struct fc_ns_fid fr_fid;	/* port ID object */
+	__u8		fr_resvd[2];
+	__u8		fr_feat;	/* FC-4 Feature bits */
+	__u8		fr_type;	/* FC-4 type */
+} __attribute__((__packed__));
+
+#endif /* _FC_NS_H_ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/scsi/scsi_bsg_fc.h b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/scsi_bsg_fc.h
index a4b2333..91a4e4f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/scsi/scsi_bsg_fc.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/scsi_bsg_fc.h
@@ -292,7 +292,7 @@
 		struct fc_bsg_rport_els		r_els;
 		struct fc_bsg_rport_ct		r_ct;
 	} rqst_data;
-};
+} __attribute__((packed));
 
 
 /* response (request sense data) structure of the sg_io_v4 */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/scsi/scsi_netlink.h b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/scsi_netlink.h
index 489a792..c8b09e8 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/scsi/scsi_netlink.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/scsi/scsi_netlink.h
@@ -105,8 +105,8 @@
  *    PCI :  ID data is the 16 bit PCI Registered Vendor ID
  */
 #define SCSI_NL_VID_TYPE_SHIFT		56
-#define SCSI_NL_VID_TYPE_MASK		((u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
-#define SCSI_NL_VID_TYPE_PCI		((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
+#define SCSI_NL_VID_TYPE_MASK		((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT)
+#define SCSI_NL_VID_TYPE_PCI		((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT)
 #define SCSI_NL_VID_ID_MASK		(~ SCSI_NL_VID_TYPE_MASK)
 
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/sound/asound.h b/mips-qca-linux-uclibc/sysroot/usr/include/sound/asound.h
index 30d6653..3fd93a6 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/sound/asound.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/sound/asound.h
@@ -122,7 +122,7 @@
  *                                                                           *
  *****************************************************************************/
 
-#define SNDRV_PCM_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 9)
+#define SNDRV_PCM_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 10)
 
 typedef unsigned long snd_pcm_uframes_t;
 typedef signed long snd_pcm_sframes_t;
@@ -196,7 +196,11 @@
 #define	SNDRV_PCM_FORMAT_S18_3BE	((snd_pcm_format_t) 41)	/* in three bytes */
 #define	SNDRV_PCM_FORMAT_U18_3LE	((snd_pcm_format_t) 42)	/* in three bytes */
 #define	SNDRV_PCM_FORMAT_U18_3BE	((snd_pcm_format_t) 43)	/* in three bytes */
-#define	SNDRV_PCM_FORMAT_LAST		SNDRV_PCM_FORMAT_U18_3BE
+#define	SNDRV_PCM_FORMAT_G723_24	((snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
+#define	SNDRV_PCM_FORMAT_G723_24_1B	((snd_pcm_format_t) 45) /* 1 sample in 1 byte */
+#define	SNDRV_PCM_FORMAT_G723_40	((snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
+#define	SNDRV_PCM_FORMAT_G723_40_1B	((snd_pcm_format_t) 47) /* 1 sample in 1 byte */
+#define	SNDRV_PCM_FORMAT_LAST		SNDRV_PCM_FORMAT_G723_40_1B
 
 #ifdef SNDRV_LITTLE_ENDIAN
 #define	SNDRV_PCM_FORMAT_S16		SNDRV_PCM_FORMAT_S16_LE
@@ -239,6 +243,7 @@
 #define SNDRV_PCM_INFO_HALF_DUPLEX	0x00100000	/* only half duplex */
 #define SNDRV_PCM_INFO_JOINT_DUPLEX	0x00200000	/* playback and capture stream are somewhat correlated */
 #define SNDRV_PCM_INFO_SYNC_START	0x00400000	/* pcm support some kind of sync go */
+#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP	0x00800000	/* period wakeup can be disabled */
 #define SNDRV_PCM_INFO_FIFO_IN_FRAMES	0x80000000	/* internal kernel flag - FIFO size is in frames */
 
 typedef int __bitwise snd_pcm_state_t;
@@ -314,6 +319,8 @@
 #define	SNDRV_PCM_HW_PARAM_LAST_INTERVAL	SNDRV_PCM_HW_PARAM_TICK_TIME
 
 #define SNDRV_PCM_HW_PARAMS_NORESAMPLE	(1<<0)	/* avoid rate resampling */
+#define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER	(1<<1)	/* export buffer */
+#define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP	(1<<2)	/* disable period wakeups */
 
 struct snd_interval {
 	unsigned int min, max;
@@ -528,7 +535,7 @@
  *  Timer section - /dev/snd/timer
  */
 
-#define SNDRV_TIMER_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 5)
+#define SNDRV_TIMER_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 6)
 
 enum {
 	SNDRV_TIMER_CLASS_NONE = -1,
@@ -558,7 +565,7 @@
 #define SNDRV_TIMER_FLG_SLAVE		(1<<0)	/* cannot be controlled */
 
 struct snd_timer_id {
-	int dev_class;	
+	int dev_class;
 	int dev_sclass;
 	int card;
 	int device;
@@ -683,7 +690,7 @@
  *                                                                          *
  ****************************************************************************/
 
-#define SNDRV_CTL_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 6)
+#define SNDRV_CTL_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 7)
 
 struct snd_ctl_card_info {
 	int card;			/* card number */
@@ -746,7 +753,7 @@
 	snd_ctl_elem_iface_t iface;	/* interface identifier */
 	unsigned int device;		/* device/client number */
 	unsigned int subdevice;		/* subdevice (substream) number */
-        unsigned char name[44];		/* ASCII name of item */
+	unsigned char name[44];		/* ASCII name of item */
 	unsigned int index;		/* index of item */
 };
 
@@ -780,6 +787,8 @@
 			unsigned int items;	/* R: number of items */
 			unsigned int item;	/* W: item number */
 			char name[64];		/* R: value name */
+			__u64 names_ptr;	/* W: names list (ELEM_ADD only) */
+			unsigned int names_length;
 		} enumerated;
 		unsigned char reserved[128];
 	} value;
@@ -793,7 +802,7 @@
 struct snd_ctl_elem_value {
 	struct snd_ctl_elem_id id;	/* W: element ID */
 	unsigned int indirect: 1;	/* W: indirect access - obsoleted */
-        union {
+	union {
 		union {
 			long value[128];
 			long *value_ptr;	/* obsoleted */
@@ -811,15 +820,15 @@
 			unsigned char *data_ptr;	/* obsoleted */
 		} bytes;
 		struct snd_aes_iec958 iec958;
-        } value;                /* RO */
+	} value;		/* RO */
 	struct timespec tstamp;
-        unsigned char reserved[128-sizeof(struct timespec)];
+	unsigned char reserved[128-sizeof(struct timespec)];
 };
 
 struct snd_ctl_tlv {
-        unsigned int numid;	/* control element numeric identification */
-        unsigned int length;	/* in bytes aligned to 4 */
-        unsigned int tlv[0];	/* first TLV */
+	unsigned int numid;	/* control element numeric identification */
+	unsigned int length;	/* in bytes aligned to 4 */
+	unsigned int tlv[0];	/* first TLV */
 };
 
 #define SNDRV_CTL_IOCTL_PVERSION	_IOR('U', 0x00, int)
@@ -870,8 +879,8 @@
 			unsigned int mask;
 			struct snd_ctl_elem_id id;
 		} elem;
-                unsigned char data8[60];
-        } data;
+		unsigned char data8[60];
+	} data;
 };
 
 /*
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/sound/compress_offload.h b/mips-qca-linux-uclibc/sysroot/usr/include/sound/compress_offload.h
new file mode 100644
index 0000000..05341a4
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/sound/compress_offload.h
@@ -0,0 +1,161 @@
+/*
+ *  compress_offload.h - compress offload header definations
+ *
+ *  Copyright (C) 2011 Intel Corporation
+ *  Authors:	Vinod Koul <vinod.koul@linux.intel.com>
+ *		Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.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.
+ *
+ *  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 __COMPRESS_OFFLOAD_H
+#define __COMPRESS_OFFLOAD_H
+
+#include <linux/types.h>
+#include <sound/asound.h>
+#include <sound/compress_params.h>
+
+
+#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 0)
+/**
+ * struct snd_compressed_buffer: compressed buffer
+ * @fragment_size: size of buffer fragment in bytes
+ * @fragments: number of such fragments
+ */
+struct snd_compressed_buffer {
+	__u32 fragment_size;
+	__u32 fragments;
+};
+
+/**
+ * struct snd_compr_params: compressed stream params
+ * @buffer: buffer description
+ * @codec: codec parameters
+ * @no_wake_mode: dont wake on fragment elapsed
+ */
+struct snd_compr_params {
+	struct snd_compressed_buffer buffer;
+	struct snd_codec codec;
+	__u8 no_wake_mode;
+};
+
+/**
+ * struct snd_compr_tstamp: timestamp descriptor
+ * @byte_offset: Byte offset in ring buffer to DSP
+ * @copied_total: Total number of bytes copied from/to ring buffer to/by DSP
+ * @pcm_frames: Frames decoded or encoded by DSP. This field will evolve by
+ *	large steps and should only be used to monitor encoding/decoding
+ *	progress. It shall not be used for timing estimates.
+ * @pcm_io_frames: Frames rendered or received by DSP into a mixer or an audio
+ * output/input. This field should be used for A/V sync or time estimates.
+ * @sampling_rate: sampling rate of audio
+ */
+struct snd_compr_tstamp {
+	__u32 byte_offset;
+	__u32 copied_total;
+	snd_pcm_uframes_t pcm_frames;
+	snd_pcm_uframes_t pcm_io_frames;
+	__u32 sampling_rate;
+};
+
+/**
+ * struct snd_compr_avail: avail descriptor
+ * @avail: Number of bytes available in ring buffer for writing/reading
+ * @tstamp: timestamp infomation
+ */
+struct snd_compr_avail {
+	__u64 avail;
+	struct snd_compr_tstamp tstamp;
+};
+
+enum snd_compr_direction {
+	SND_COMPRESS_PLAYBACK = 0,
+	SND_COMPRESS_CAPTURE
+};
+
+/**
+ * struct snd_compr_caps: caps descriptor
+ * @codecs: pointer to array of codecs
+ * @direction: direction supported. Of type snd_compr_direction
+ * @min_fragment_size: minimum fragment supported by DSP
+ * @max_fragment_size: maximum fragment supported by DSP
+ * @min_fragments: min fragments supported by DSP
+ * @max_fragments: max fragments supported by DSP
+ * @num_codecs: number of codecs supported
+ * @reserved: reserved field
+ */
+struct snd_compr_caps {
+	__u32 num_codecs;
+	__u32 direction;
+	__u32 min_fragment_size;
+	__u32 max_fragment_size;
+	__u32 min_fragments;
+	__u32 max_fragments;
+	__u32 codecs[MAX_NUM_CODECS];
+	__u32 reserved[11];
+};
+
+/**
+ * struct snd_compr_codec_caps: query capability of codec
+ * @codec: codec for which capability is queried
+ * @num_descriptors: number of codec descriptors
+ * @descriptor: array of codec capability descriptor
+ */
+struct snd_compr_codec_caps {
+	__u32 codec;
+	__u32 num_descriptors;
+	struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS];
+};
+
+/**
+ * compress path ioctl definitions
+ * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP
+ * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec
+ * SNDRV_COMPRESS_SET_PARAMS: Set codec and stream parameters
+ * Note: only codec params can be changed runtime and stream params cant be
+ * SNDRV_COMPRESS_GET_PARAMS: Query codec params
+ * SNDRV_COMPRESS_TSTAMP: get the current timestamp value
+ * SNDRV_COMPRESS_AVAIL: get the current buffer avail value.
+ * This also queries the tstamp properties
+ * SNDRV_COMPRESS_PAUSE: Pause the running stream
+ * SNDRV_COMPRESS_RESUME: resume a paused stream
+ * SNDRV_COMPRESS_START: Start a stream
+ * SNDRV_COMPRESS_STOP: stop a running stream, discarding ring buffer content
+ * and the buffers currently with DSP
+ * SNDRV_COMPRESS_DRAIN: Play till end of buffers and stop after that
+ * SNDRV_COMPRESS_IOCTL_VERSION: Query the API version
+ */
+#define SNDRV_COMPRESS_IOCTL_VERSION	_IOR('C', 0x00, int)
+#define SNDRV_COMPRESS_GET_CAPS		_IOWR('C', 0x10, struct snd_compr_caps)
+#define SNDRV_COMPRESS_GET_CODEC_CAPS	_IOWR('C', 0x11,\
+						struct snd_compr_codec_caps)
+#define SNDRV_COMPRESS_SET_PARAMS	_IOW('C', 0x12, struct snd_compr_params)
+#define SNDRV_COMPRESS_GET_PARAMS	_IOR('C', 0x13, struct snd_codec)
+#define SNDRV_COMPRESS_TSTAMP		_IOR('C', 0x20, struct snd_compr_tstamp)
+#define SNDRV_COMPRESS_AVAIL		_IOR('C', 0x21, struct snd_compr_avail)
+#define SNDRV_COMPRESS_PAUSE		_IO('C', 0x30)
+#define SNDRV_COMPRESS_RESUME		_IO('C', 0x31)
+#define SNDRV_COMPRESS_START		_IO('C', 0x32)
+#define SNDRV_COMPRESS_STOP		_IO('C', 0x33)
+#define SNDRV_COMPRESS_DRAIN		_IO('C', 0x34)
+/*
+ * TODO
+ * 1. add mmap support
+ *
+ */
+#define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/sound/compress_params.h b/mips-qca-linux-uclibc/sysroot/usr/include/sound/compress_params.h
new file mode 100644
index 0000000..d97d69f
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/sound/compress_params.h
@@ -0,0 +1,397 @@
+/*
+ *  compress_params.h - codec types and parameters for compressed data
+ *  streaming interface
+ *
+ *  Copyright (C) 2011 Intel Corporation
+ *  Authors:	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+ *              Vinod Koul <vinod.koul@linux.intel.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.
+ *
+ *  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.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * The definitions in this file are derived from the OpenMAX AL version 1.1
+ * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below.
+ *
+ * Copyright (c) 2007-2010 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and/or associated documentation files (the
+ * "Materials "), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE 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
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ */
+#ifndef __SND_COMPRESS_PARAMS_H
+#define __SND_COMPRESS_PARAMS_H
+
+/* AUDIO CODECS SUPPORTED */
+#define MAX_NUM_CODECS 32
+#define MAX_NUM_CODEC_DESCRIPTORS 32
+#define MAX_NUM_BITRATES 32
+
+/* Codecs are listed linearly to allow for extensibility */
+#define SND_AUDIOCODEC_PCM                   ((__u32) 0x00000001)
+#define SND_AUDIOCODEC_MP3                   ((__u32) 0x00000002)
+#define SND_AUDIOCODEC_AMR                   ((__u32) 0x00000003)
+#define SND_AUDIOCODEC_AMRWB                 ((__u32) 0x00000004)
+#define SND_AUDIOCODEC_AMRWBPLUS             ((__u32) 0x00000005)
+#define SND_AUDIOCODEC_AAC                   ((__u32) 0x00000006)
+#define SND_AUDIOCODEC_WMA                   ((__u32) 0x00000007)
+#define SND_AUDIOCODEC_REAL                  ((__u32) 0x00000008)
+#define SND_AUDIOCODEC_VORBIS                ((__u32) 0x00000009)
+#define SND_AUDIOCODEC_FLAC                  ((__u32) 0x0000000A)
+#define SND_AUDIOCODEC_IEC61937              ((__u32) 0x0000000B)
+#define SND_AUDIOCODEC_G723_1                ((__u32) 0x0000000C)
+#define SND_AUDIOCODEC_G729                  ((__u32) 0x0000000D)
+
+/*
+ * Profile and modes are listed with bit masks. This allows for a
+ * more compact representation of fields that will not evolve
+ * (in contrast to the list of codecs)
+ */
+
+#define SND_AUDIOPROFILE_PCM                 ((__u32) 0x00000001)
+
+/* MP3 modes are only useful for encoders */
+#define SND_AUDIOCHANMODE_MP3_MONO           ((__u32) 0x00000001)
+#define SND_AUDIOCHANMODE_MP3_STEREO         ((__u32) 0x00000002)
+#define SND_AUDIOCHANMODE_MP3_JOINTSTEREO    ((__u32) 0x00000004)
+#define SND_AUDIOCHANMODE_MP3_DUAL           ((__u32) 0x00000008)
+
+#define SND_AUDIOPROFILE_AMR                 ((__u32) 0x00000001)
+
+/* AMR modes are only useful for encoders */
+#define SND_AUDIOMODE_AMR_DTX_OFF            ((__u32) 0x00000001)
+#define SND_AUDIOMODE_AMR_VAD1               ((__u32) 0x00000002)
+#define SND_AUDIOMODE_AMR_VAD2               ((__u32) 0x00000004)
+
+#define SND_AUDIOSTREAMFORMAT_UNDEFINED	     ((__u32) 0x00000000)
+#define SND_AUDIOSTREAMFORMAT_CONFORMANCE    ((__u32) 0x00000001)
+#define SND_AUDIOSTREAMFORMAT_IF1            ((__u32) 0x00000002)
+#define SND_AUDIOSTREAMFORMAT_IF2            ((__u32) 0x00000004)
+#define SND_AUDIOSTREAMFORMAT_FSF            ((__u32) 0x00000008)
+#define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD     ((__u32) 0x00000010)
+#define SND_AUDIOSTREAMFORMAT_ITU            ((__u32) 0x00000020)
+
+#define SND_AUDIOPROFILE_AMRWB               ((__u32) 0x00000001)
+
+/* AMRWB modes are only useful for encoders */
+#define SND_AUDIOMODE_AMRWB_DTX_OFF          ((__u32) 0x00000001)
+#define SND_AUDIOMODE_AMRWB_VAD1             ((__u32) 0x00000002)
+#define SND_AUDIOMODE_AMRWB_VAD2             ((__u32) 0x00000004)
+
+#define SND_AUDIOPROFILE_AMRWBPLUS           ((__u32) 0x00000001)
+
+#define SND_AUDIOPROFILE_AAC                 ((__u32) 0x00000001)
+
+/* AAC modes are required for encoders and decoders */
+#define SND_AUDIOMODE_AAC_MAIN               ((__u32) 0x00000001)
+#define SND_AUDIOMODE_AAC_LC                 ((__u32) 0x00000002)
+#define SND_AUDIOMODE_AAC_SSR                ((__u32) 0x00000004)
+#define SND_AUDIOMODE_AAC_LTP                ((__u32) 0x00000008)
+#define SND_AUDIOMODE_AAC_HE                 ((__u32) 0x00000010)
+#define SND_AUDIOMODE_AAC_SCALABLE           ((__u32) 0x00000020)
+#define SND_AUDIOMODE_AAC_ERLC               ((__u32) 0x00000040)
+#define SND_AUDIOMODE_AAC_LD                 ((__u32) 0x00000080)
+#define SND_AUDIOMODE_AAC_HE_PS              ((__u32) 0x00000100)
+#define SND_AUDIOMODE_AAC_HE_MPS             ((__u32) 0x00000200)
+
+/* AAC formats are required for encoders and decoders */
+#define SND_AUDIOSTREAMFORMAT_MP2ADTS        ((__u32) 0x00000001)
+#define SND_AUDIOSTREAMFORMAT_MP4ADTS        ((__u32) 0x00000002)
+#define SND_AUDIOSTREAMFORMAT_MP4LOAS        ((__u32) 0x00000004)
+#define SND_AUDIOSTREAMFORMAT_MP4LATM        ((__u32) 0x00000008)
+#define SND_AUDIOSTREAMFORMAT_ADIF           ((__u32) 0x00000010)
+#define SND_AUDIOSTREAMFORMAT_MP4FF          ((__u32) 0x00000020)
+#define SND_AUDIOSTREAMFORMAT_RAW            ((__u32) 0x00000040)
+
+#define SND_AUDIOPROFILE_WMA7                ((__u32) 0x00000001)
+#define SND_AUDIOPROFILE_WMA8                ((__u32) 0x00000002)
+#define SND_AUDIOPROFILE_WMA9                ((__u32) 0x00000004)
+#define SND_AUDIOPROFILE_WMA10               ((__u32) 0x00000008)
+
+#define SND_AUDIOMODE_WMA_LEVEL1             ((__u32) 0x00000001)
+#define SND_AUDIOMODE_WMA_LEVEL2             ((__u32) 0x00000002)
+#define SND_AUDIOMODE_WMA_LEVEL3             ((__u32) 0x00000004)
+#define SND_AUDIOMODE_WMA_LEVEL4             ((__u32) 0x00000008)
+#define SND_AUDIOMODE_WMAPRO_LEVELM0         ((__u32) 0x00000010)
+#define SND_AUDIOMODE_WMAPRO_LEVELM1         ((__u32) 0x00000020)
+#define SND_AUDIOMODE_WMAPRO_LEVELM2         ((__u32) 0x00000040)
+#define SND_AUDIOMODE_WMAPRO_LEVELM3         ((__u32) 0x00000080)
+
+#define SND_AUDIOSTREAMFORMAT_WMA_ASF        ((__u32) 0x00000001)
+/*
+ * Some implementations strip the ASF header and only send ASF packets
+ * to the DSP
+ */
+#define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR  ((__u32) 0x00000002)
+
+#define SND_AUDIOPROFILE_REALAUDIO           ((__u32) 0x00000001)
+
+#define SND_AUDIOMODE_REALAUDIO_G2           ((__u32) 0x00000001)
+#define SND_AUDIOMODE_REALAUDIO_8            ((__u32) 0x00000002)
+#define SND_AUDIOMODE_REALAUDIO_10           ((__u32) 0x00000004)
+#define SND_AUDIOMODE_REALAUDIO_SURROUND     ((__u32) 0x00000008)
+
+#define SND_AUDIOPROFILE_VORBIS              ((__u32) 0x00000001)
+
+#define SND_AUDIOMODE_VORBIS                 ((__u32) 0x00000001)
+
+#define SND_AUDIOPROFILE_FLAC                ((__u32) 0x00000001)
+
+/*
+ * Define quality levels for FLAC encoders, from LEVEL0 (fast)
+ * to LEVEL8 (best)
+ */
+#define SND_AUDIOMODE_FLAC_LEVEL0            ((__u32) 0x00000001)
+#define SND_AUDIOMODE_FLAC_LEVEL1            ((__u32) 0x00000002)
+#define SND_AUDIOMODE_FLAC_LEVEL2            ((__u32) 0x00000004)
+#define SND_AUDIOMODE_FLAC_LEVEL3            ((__u32) 0x00000008)
+#define SND_AUDIOMODE_FLAC_LEVEL4            ((__u32) 0x00000010)
+#define SND_AUDIOMODE_FLAC_LEVEL5            ((__u32) 0x00000020)
+#define SND_AUDIOMODE_FLAC_LEVEL6            ((__u32) 0x00000040)
+#define SND_AUDIOMODE_FLAC_LEVEL7            ((__u32) 0x00000080)
+#define SND_AUDIOMODE_FLAC_LEVEL8            ((__u32) 0x00000100)
+
+#define SND_AUDIOSTREAMFORMAT_FLAC           ((__u32) 0x00000001)
+#define SND_AUDIOSTREAMFORMAT_FLAC_OGG       ((__u32) 0x00000002)
+
+/* IEC61937 payloads without CUVP and preambles */
+#define SND_AUDIOPROFILE_IEC61937            ((__u32) 0x00000001)
+/* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */
+#define SND_AUDIOPROFILE_IEC61937_SPDIF      ((__u32) 0x00000002)
+
+/*
+ * IEC modes are mandatory for decoders. Format autodetection
+ * will only happen on the DSP side with mode 0. The PCM mode should
+ * not be used, the PCM codec should be used instead.
+ */
+#define SND_AUDIOMODE_IEC_REF_STREAM_HEADER  ((__u32) 0x00000000)
+#define SND_AUDIOMODE_IEC_LPCM		     ((__u32) 0x00000001)
+#define SND_AUDIOMODE_IEC_AC3		     ((__u32) 0x00000002)
+#define SND_AUDIOMODE_IEC_MPEG1		     ((__u32) 0x00000004)
+#define SND_AUDIOMODE_IEC_MP3		     ((__u32) 0x00000008)
+#define SND_AUDIOMODE_IEC_MPEG2		     ((__u32) 0x00000010)
+#define SND_AUDIOMODE_IEC_AACLC		     ((__u32) 0x00000020)
+#define SND_AUDIOMODE_IEC_DTS		     ((__u32) 0x00000040)
+#define SND_AUDIOMODE_IEC_ATRAC		     ((__u32) 0x00000080)
+#define SND_AUDIOMODE_IEC_SACD		     ((__u32) 0x00000100)
+#define SND_AUDIOMODE_IEC_EAC3		     ((__u32) 0x00000200)
+#define SND_AUDIOMODE_IEC_DTS_HD	     ((__u32) 0x00000400)
+#define SND_AUDIOMODE_IEC_MLP		     ((__u32) 0x00000800)
+#define SND_AUDIOMODE_IEC_DST		     ((__u32) 0x00001000)
+#define SND_AUDIOMODE_IEC_WMAPRO	     ((__u32) 0x00002000)
+#define SND_AUDIOMODE_IEC_REF_CXT            ((__u32) 0x00004000)
+#define SND_AUDIOMODE_IEC_HE_AAC	     ((__u32) 0x00008000)
+#define SND_AUDIOMODE_IEC_HE_AAC2	     ((__u32) 0x00010000)
+#define SND_AUDIOMODE_IEC_MPEG_SURROUND	     ((__u32) 0x00020000)
+
+#define SND_AUDIOPROFILE_G723_1              ((__u32) 0x00000001)
+
+#define SND_AUDIOMODE_G723_1_ANNEX_A         ((__u32) 0x00000001)
+#define SND_AUDIOMODE_G723_1_ANNEX_B         ((__u32) 0x00000002)
+#define SND_AUDIOMODE_G723_1_ANNEX_C         ((__u32) 0x00000004)
+
+#define SND_AUDIOPROFILE_G729                ((__u32) 0x00000001)
+
+#define SND_AUDIOMODE_G729_ANNEX_A           ((__u32) 0x00000001)
+#define SND_AUDIOMODE_G729_ANNEX_B           ((__u32) 0x00000002)
+
+/* <FIXME: multichannel encoders aren't supported for now. Would need
+   an additional definition of channel arrangement> */
+
+/* VBR/CBR definitions */
+#define SND_RATECONTROLMODE_CONSTANTBITRATE  ((__u32) 0x00000001)
+#define SND_RATECONTROLMODE_VARIABLEBITRATE  ((__u32) 0x00000002)
+
+/* Encoder options */
+
+struct snd_enc_wma {
+	__u32 super_block_align; /* WMA Type-specific data */
+};
+
+
+/**
+ * struct snd_enc_vorbis
+ * @quality: Sets encoding quality to n, between -1 (low) and 10 (high).
+ * In the default mode of operation, the quality level is 3.
+ * Normal quality range is 0 - 10.
+ * @managed: Boolean. Set  bitrate  management  mode. This turns off the
+ * normal VBR encoding, but allows hard or soft bitrate constraints to be
+ * enforced by the encoder. This mode can be slower, and may also be
+ * lower quality. It is primarily useful for streaming.
+ * @max_bit_rate: Enabled only if managed is TRUE
+ * @min_bit_rate: Enabled only if managed is TRUE
+ * @downmix: Boolean. Downmix input from stereo to mono (has no effect on
+ * non-stereo streams). Useful for lower-bitrate encoding.
+ *
+ * These options were extracted from the OpenMAX IL spec and Gstreamer vorbisenc
+ * properties
+ *
+ * For best quality users should specify VBR mode and set quality levels.
+ */
+
+struct snd_enc_vorbis {
+	__s32 quality;
+	__u32 managed;
+	__u32 max_bit_rate;
+	__u32 min_bit_rate;
+	__u32 downmix;
+};
+
+
+/**
+ * struct snd_enc_real
+ * @quant_bits: number of coupling quantization bits in the stream
+ * @start_region: coupling start region in the stream
+ * @num_regions: number of regions value
+ *
+ * These options were extracted from the OpenMAX IL spec
+ */
+
+struct snd_enc_real {
+	__u32 quant_bits;
+	__u32 start_region;
+	__u32 num_regions;
+};
+
+/**
+ * struct snd_enc_flac
+ * @num: serial number, valid only for OGG formats
+ *	needs to be set by application
+ * @gain: Add replay gain tags
+ *
+ * These options were extracted from the FLAC online documentation
+ * at http://flac.sourceforge.net/documentation_tools_flac.html
+ *
+ * To make the API simpler, it is assumed that the user will select quality
+ * profiles. Additional options that affect encoding quality and speed can
+ * be added at a later stage if needed.
+ *
+ * By default the Subset format is used by encoders.
+ *
+ * TAGS such as pictures, etc, cannot be handled by an offloaded encoder and are
+ * not supported in this API.
+ */
+
+struct snd_enc_flac {
+	__u32 num;
+	__u32 gain;
+};
+
+struct snd_enc_generic {
+	__u32 bw;	/* encoder bandwidth */
+	__s32 reserved[15];
+};
+
+union snd_codec_options {
+	struct snd_enc_wma wma;
+	struct snd_enc_vorbis vorbis;
+	struct snd_enc_real real;
+	struct snd_enc_flac flac;
+	struct snd_enc_generic generic;
+};
+
+/** struct snd_codec_desc - description of codec capabilities
+ * @max_ch: Maximum number of audio channels
+ * @sample_rates: Sampling rates in Hz, use SNDRV_PCM_RATE_xxx for this
+ * @bit_rate: Indexed array containing supported bit rates
+ * @num_bitrates: Number of valid values in bit_rate array
+ * @rate_control: value is specified by SND_RATECONTROLMODE defines.
+ * @profiles: Supported profiles. See SND_AUDIOPROFILE defines.
+ * @modes: Supported modes. See SND_AUDIOMODE defines
+ * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines
+ * @min_buffer: Minimum buffer size handled by codec implementation
+ * @reserved: reserved for future use
+ *
+ * This structure provides a scalar value for profiles, modes and stream
+ * format fields.
+ * If an implementation supports multiple combinations, they will be listed as
+ * codecs with different descriptors, for example there would be 2 descriptors
+ * for AAC-RAW and AAC-ADTS.
+ * This entails some redundancy but makes it easier to avoid invalid
+ * configurations.
+ *
+ */
+
+struct snd_codec_desc {
+	__u32 max_ch;
+	__u32 sample_rates;
+	__u32 bit_rate[MAX_NUM_BITRATES];
+	__u32 num_bitrates;
+	__u32 rate_control;
+	__u32 profiles;
+	__u32 modes;
+	__u32 formats;
+	__u32 min_buffer;
+	__u32 reserved[15];
+};
+
+/** struct snd_codec
+ * @id: Identifies the supported audio encoder/decoder.
+ *		See SND_AUDIOCODEC macros.
+ * @ch_in: Number of input audio channels
+ * @ch_out: Number of output channels. In case of contradiction between
+ *		this field and the channelMode field, the channelMode field
+ *		overrides.
+ * @sample_rate: Audio sample rate of input data
+ * @bit_rate: Bitrate of encoded data. May be ignored by decoders
+ * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines.
+ *               Encoders may rely on profiles for quality levels.
+ *		 May be ignored by decoders.
+ * @profile: Mandatory for encoders, can be mandatory for specific
+ *		decoders as well. See SND_AUDIOPROFILE defines.
+ * @level: Supported level (Only used by WMA at the moment)
+ * @ch_mode: Channel mode for encoder. See SND_AUDIOCHANMODE defines
+ * @format: Format of encoded bistream. Mandatory when defined.
+ *		See SND_AUDIOSTREAMFORMAT defines.
+ * @align: Block alignment in bytes of an audio sample.
+ *		Only required for PCM or IEC formats.
+ * @options: encoder-specific settings
+ * @reserved: reserved for future use
+ */
+
+struct snd_codec {
+	__u32 id;
+	__u32 ch_in;
+	__u32 ch_out;
+	__u32 sample_rate;
+	__u32 bit_rate;
+	__u32 rate_control;
+	__u32 profile;
+	__u32 level;
+	__u32 ch_mode;
+	__u32 format;
+	__u32 align;
+	union snd_codec_options options;
+	__u32 reserved[3];
+};
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/sound/hdsp.h b/mips-qca-linux-uclibc/sysroot/usr/include/sound/hdsp.h
index ec6fa56..56b11a7 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/sound/hdsp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/sound/hdsp.h
@@ -28,6 +28,7 @@
 	Multiface,
 	H9652,
 	H9632,
+	RPM,
 	Undefined,
 };
 
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/sound/hdspm.h b/mips-qca-linux-uclibc/sysroot/usr/include/sound/hdspm.h
index 81990b2..1f59ea2 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/sound/hdspm.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/sound/hdspm.h
@@ -3,8 +3,8 @@
 /*
  *   Copyright (C) 2003 Winfried Ritsch (IEM)
  *   based on hdsp.h from Thomas Charbonnel (thomas@undata.org)
- *                      
- *    
+ *
+ *
  *   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
@@ -23,50 +23,41 @@
 /* Maximum channels is 64 even on 56Mode you have 64playbacks to matrix */
 #define HDSPM_MAX_CHANNELS      64
 
+enum hdspm_io_type {
+	MADI,
+	MADIface,
+	AIO,
+	AES32,
+	RayDAT
+};
+
+enum hdspm_speed {
+	ss,
+	ds,
+	qs
+};
+
 /* -------------------- IOCTL Peak/RMS Meters -------------------- */
 
-/* peam rms level structure like we get from hardware 
-  
-   maybe in future we can memory map it so I just copy it
-   to user on ioctl call now an dont change anything
-   rms are made out of low and high values
-   where (long) ????_rms = (????_rms_l >> 8) + ((????_rms_h & 0xFFFFFF00)<<24)
-   (i asume so from the code)
-*/
-
 struct hdspm_peak_rms {
+	uint32_t input_peaks[64];
+	uint32_t playback_peaks[64];
+	uint32_t output_peaks[64];
 
-	unsigned int level_offset[1024];
+	uint64_t input_rms[64];
+	uint64_t playback_rms[64];
+	uint64_t output_rms[64];
 
-	unsigned int input_peak[64];
-	unsigned int playback_peak[64];
-	unsigned int output_peak[64];
-	unsigned int xxx_peak[64];	/* not used */
-
-	unsigned int reserved[256];	/* not used */
-
-	unsigned int input_rms_l[64];
-	unsigned int playback_rms_l[64];
-	unsigned int output_rms_l[64];
-	unsigned int xxx_rms_l[64];	/* not used */
-
-	unsigned int input_rms_h[64];
-	unsigned int playback_rms_h[64];
-	unsigned int output_rms_h[64];
-	unsigned int xxx_rms_h[64];	/* not used */
+	uint8_t speed; /* enum {ss, ds, qs} */
+	int status2;
 };
 
-struct hdspm_peak_rms_ioctl {
-	struct hdspm_peak_rms *peak;
-};
-
-/* use indirect access due to the limit of ioctl bit size */
 #define SNDRV_HDSPM_IOCTL_GET_PEAK_RMS \
-	_IOR('H', 0x40, struct hdspm_peak_rms_ioctl)
+	_IOR('H', 0x42, struct hdspm_peak_rms)
 
 /* ------------ CONFIG block IOCTL ---------------------- */
 
-struct hdspm_config_info {
+struct hdspm_config {
 	unsigned char pref_sync_ref;
 	unsigned char wordclock_sync_check;
 	unsigned char madi_sync_check;
@@ -80,18 +71,121 @@
 	unsigned int analog_out;
 };
 
-#define SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO \
-	_IOR('H', 0x41, struct hdspm_config_info)
+#define SNDRV_HDSPM_IOCTL_GET_CONFIG \
+	_IOR('H', 0x41, struct hdspm_config)
 
+/**
+ * If there's a TCO (TimeCode Option) board installed,
+ * there are further options and status data available.
+ * The hdspm_ltc structure contains the current SMPTE
+ * timecode and some status information and can be
+ * obtained via SNDRV_HDSPM_IOCTL_GET_LTC or in the
+ * hdspm_status struct.
+ **/
 
-/* get Soundcard Version */
-
-struct hdspm_version {
-	unsigned short firmware_rev;
+enum hdspm_ltc_format {
+	format_invalid,
+	fps_24,
+	fps_25,
+	fps_2997,
+	fps_30
 };
 
-#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x43, struct hdspm_version)
+enum hdspm_ltc_frame {
+	frame_invalid,
+	drop_frame,
+	full_frame
+};
 
+enum hdspm_ltc_input_format {
+	ntsc,
+	pal,
+	no_video
+};
+
+struct hdspm_ltc {
+	unsigned int ltc;
+
+	enum hdspm_ltc_format format;
+	enum hdspm_ltc_frame frame;
+	enum hdspm_ltc_input_format input_format;
+};
+
+#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_mixer_ioctl)
+
+/**
+ * The status data reflects the device's current state
+ * as determined by the card's configuration and
+ * connection status.
+ **/
+
+enum hdspm_sync {
+	hdspm_sync_no_lock = 0,
+	hdspm_sync_lock = 1,
+	hdspm_sync_sync = 2
+};
+
+enum hdspm_madi_input {
+	hdspm_input_optical = 0,
+	hdspm_input_coax = 1
+};
+
+enum hdspm_madi_channel_format {
+	hdspm_format_ch_64 = 0,
+	hdspm_format_ch_56 = 1
+};
+
+enum hdspm_madi_frame_format {
+	hdspm_frame_48 = 0,
+	hdspm_frame_96 = 1
+};
+
+enum hdspm_syncsource {
+	syncsource_wc = 0,
+	syncsource_madi = 1,
+	syncsource_tco = 2,
+	syncsource_sync = 3,
+	syncsource_none = 4
+};
+
+struct hdspm_status {
+	uint8_t card_type; /* enum hdspm_io_type */
+	enum hdspm_syncsource autosync_source;
+
+	uint64_t card_clock;
+	uint32_t master_period;
+
+	union {
+		struct {
+			uint8_t sync_wc; /* enum hdspm_sync */
+			uint8_t sync_madi; /* enum hdspm_sync */
+			uint8_t sync_tco; /* enum hdspm_sync */
+			uint8_t sync_in; /* enum hdspm_sync */
+			uint8_t madi_input; /* enum hdspm_madi_input */
+			uint8_t channel_format; /* enum hdspm_madi_channel_format */
+			uint8_t frame_format; /* enum hdspm_madi_frame_format */
+		} madi;
+	} card_specific;
+};
+
+#define SNDRV_HDSPM_IOCTL_GET_STATUS \
+	_IOR('H', 0x47, struct hdspm_status)
+
+/**
+ * Get information about the card and its add-ons.
+ **/
+
+#define HDSPM_ADDON_TCO 1
+
+struct hdspm_version {
+	uint8_t card_type; /* enum hdspm_io_type */
+	char cardname[20];
+	unsigned int serial;
+	unsigned short firmware_rev;
+	int addons;
+};
+
+#define SNDRV_HDSPM_IOCTL_GET_VERSION _IOR('H', 0x48, struct hdspm_version)
 
 /* ------------- get Matrix Mixer IOCTL --------------- */
 
@@ -99,11 +193,11 @@
  * 32768 Bytes
  */
 
-/* organisation is 64 channelfader in a continous memory block */
+/* organisation is 64 channelfader in a continuous memory block */
 /* equivalent to hardware definition, maybe for future feature of mmap of
  * them
  */
-/* each of 64 outputs has 64 infader and 64 outfader: 
+/* each of 64 outputs has 64 infader and 64 outfader:
    Ins to Outs mixer[out].in[in], Outstreams to Outs mixer[out].pb[pb] */
 
 #define HDSPM_MIXER_CHANNELS HDSPM_MAX_CHANNELS
@@ -131,4 +225,5 @@
 typedef struct hdspm_channelfader snd_hdspm_channelfader_t;
 typedef struct hdspm_mixer hdspm_mixer_t;
 
-#endif				/* __SOUND_HDSPM_H */
+
+#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/sound/sb16_csp.h b/mips-qca-linux-uclibc/sysroot/usr/include/sound/sb16_csp.h
index 50a351f..b342eb9 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/sound/sb16_csp.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/sound/sb16_csp.h
@@ -99,7 +99,14 @@
 /* get CSP information */
 #define SNDRV_SB_CSP_IOCTL_INFO		_IOR('H', 0x10, struct snd_sb_csp_info)
 /* load microcode to CSP */
-#define SNDRV_SB_CSP_IOCTL_LOAD_CODE	_IOW('H', 0x11, struct snd_sb_csp_microcode)
+/* NOTE: struct snd_sb_csp_microcode overflows the max size (13 bits)
+ * defined for some architectures like MIPS, and it leads to build errors.
+ * (x86 and co have 14-bit size, thus it's valid, though.)
+ * As a workaround for skipping the size-limit check, here we don't use the
+ * normal _IOW() macro but _IOC() with the manual argument.
+ */
+#define SNDRV_SB_CSP_IOCTL_LOAD_CODE	\
+	_IOC(_IOC_WRITE, 'H', 0x11, sizeof(struct snd_sb_csp_microcode))
 /* unload microcode from CSP */
 #define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE	_IO('H', 0x12)
 /* start CSP */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/sound/sscape_ioctl.h b/mips-qca-linux-uclibc/sysroot/usr/include/sound/sscape_ioctl.h
deleted file mode 100644
index c6653eb..0000000
--- a/mips-qca-linux-uclibc/sysroot/usr/include/sound/sscape_ioctl.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef SSCAPE_IOCTL_H
-#define SSCAPE_IOCTL_H
-
-
-struct sscape_bootblock
-{
-  unsigned char code[256];
-  unsigned version;
-};
-
-#define SSCAPE_MICROCODE_SIZE  65536
-
-struct sscape_microcode
-{
-  unsigned char *code;
-};
-
-#define SND_SSCAPE_LOAD_BOOTB  _IOWR('P', 100, struct sscape_bootblock)
-#define SND_SSCAPE_LOAD_MCODE  _IOW ('P', 101, struct sscape_microcode)
-
-#endif
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/video/edid.h b/mips-qca-linux-uclibc/sysroot/usr/include/video/edid.h
index 81911a9..6aeb974 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/video/edid.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/video/edid.h
@@ -1,11 +1,9 @@
 #ifndef __linux_video_edid_h__
 #define __linux_video_edid_h__
 
-
 struct edid_info {
 	unsigned char dummy[128];
 };
 
 
-
 #endif /* __linux_video_edid_h__ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/video/sisfb.h b/mips-qca-linux-uclibc/sysroot/usr/include/video/sisfb.h
index 0b01f0c..22b7b3d 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/include/video/sisfb.h
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/video/sisfb.h
@@ -151,7 +151,7 @@
 	__u32  sisfb_result[4];
 };
 
-/* Addtional IOCTLs for communication sisfb <> X driver                */
+/* Additional IOCTLs for communication sisfb <> X driver                */
 /* If changing this, vgatypes.h must also be changed (for X driver)    */
 
 /* ioctl for identifying and giving some info (esp. memory heap start) */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/include/xen/privcmd.h b/mips-qca-linux-uclibc/sysroot/usr/include/xen/privcmd.h
new file mode 100644
index 0000000..8fb03c5
--- /dev/null
+++ b/mips-qca-linux-uclibc/sysroot/usr/include/xen/privcmd.h
@@ -0,0 +1,77 @@
+/******************************************************************************
+ * privcmd.h
+ *
+ * Interface to /proc/xen/privcmd.
+ *
+ * Copyright (c) 2003-2005, K A Fraser
+ *
+ * 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; or, when distributed
+ * separately from the Linux kernel or incorporated into other
+ * software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * 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 __LINUX_PUBLIC_PRIVCMD_H__
+#define __LINUX_PUBLIC_PRIVCMD_H__
+
+#include <linux/types.h>
+
+
+typedef unsigned long xen_pfn_t;
+
+struct privcmd_hypercall {
+	__u64 op;
+	__u64 arg[5];
+};
+
+struct privcmd_mmap_entry {
+	__u64 va;
+	__u64 mfn;
+	__u64 npages;
+};
+
+struct privcmd_mmap {
+	int num;
+	domid_t dom; /* target domain */
+	struct privcmd_mmap_entry *entry;
+};
+
+struct privcmd_mmapbatch {
+	int num;     /* number of pages to populate */
+	domid_t dom; /* target domain */
+	__u64 addr;  /* virtual address */
+	xen_pfn_t *arr; /* array of mfns - top nibble set on err */
+};
+
+/*
+ * @cmd: IOCTL_PRIVCMD_HYPERCALL
+ * @arg: &privcmd_hypercall_t
+ * Return: Value returned from execution of the specified hypercall.
+ */
+#define IOCTL_PRIVCMD_HYPERCALL					\
+	_IOC(_IOC_NONE, 'P', 0, sizeof(struct privcmd_hypercall))
+#define IOCTL_PRIVCMD_MMAP					\
+	_IOC(_IOC_NONE, 'P', 2, sizeof(struct privcmd_mmap))
+#define IOCTL_PRIVCMD_MMAPBATCH					\
+	_IOC(_IOC_NONE, 'P', 3, sizeof(struct privcmd_mmapbatch))
+
+#endif /* __LINUX_PUBLIC_PRIVCMD_H__ */
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/crt1.o b/mips-qca-linux-uclibc/sysroot/usr/lib/crt1.o
index 3d1fd4a..fe85d57 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/crt1.o
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/crt1.o
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/libbfd-2.24.so b/mips-qca-linux-uclibc/sysroot/usr/lib/libbfd-2.24.so
index 77f2cdd..9c76c1b 100755
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/libbfd-2.24.so
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/libbfd-2.24.so
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/libbfd.a b/mips-qca-linux-uclibc/sysroot/usr/lib/libbfd.a
index 349f772..0e50911 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/libbfd.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/libbfd.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/libc.a b/mips-qca-linux-uclibc/sysroot/usr/lib/libc.a
index bfa732b..e8e4f87 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/libc.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/libc.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/libcrypt.a b/mips-qca-linux-uclibc/sysroot/usr/lib/libcrypt.a
index c941e70..17e1b28 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/libcrypt.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/libcrypt.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/libdl.a b/mips-qca-linux-uclibc/sysroot/usr/lib/libdl.a
index 5793d3a..6ac107c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/libdl.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/libdl.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/libm.a b/mips-qca-linux-uclibc/sysroot/usr/lib/libm.a
index 8d623f0..67e2523 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/libm.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/libm.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/libnsl.a b/mips-qca-linux-uclibc/sysroot/usr/lib/libnsl.a
index 89c5a4a..4fa0cd0 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/libnsl.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/libnsl.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/libpthread.a b/mips-qca-linux-uclibc/sysroot/usr/lib/libpthread.a
index 65a6ba6..b063f7b 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/libpthread.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/libpthread.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/libresolv.a b/mips-qca-linux-uclibc/sysroot/usr/lib/libresolv.a
index 1be4d26..4a4006f 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/libresolv.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/libresolv.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/librt.a b/mips-qca-linux-uclibc/sysroot/usr/lib/librt.a
index 00ccec2..ed15b31 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/librt.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/librt.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/libthread_db.a b/mips-qca-linux-uclibc/sysroot/usr/lib/libthread_db.a
index 7045bed..0df1fa9 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/libthread_db.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/libthread_db.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/libutil.a b/mips-qca-linux-uclibc/sysroot/usr/lib/libutil.a
index bef882a..7f6a57c 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/libutil.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/libutil.a
Binary files differ
diff --git a/mips-qca-linux-uclibc/sysroot/usr/lib/uclibc_nonshared.a b/mips-qca-linux-uclibc/sysroot/usr/lib/uclibc_nonshared.a
index 18c3e6a..20dc9af 100644
--- a/mips-qca-linux-uclibc/sysroot/usr/lib/uclibc_nonshared.a
+++ b/mips-qca-linux-uclibc/sysroot/usr/lib/uclibc_nonshared.a
Binary files differ