Date: Tue, 22 Jun 2010 08:00:58 +0000 (UTC) From: Jeff Roberson <jeff@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r209419 - projects/ofed/head/sys/ofed/include/linux Message-ID: <201006220800.o5M80wmk082040@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jeff Date: Tue Jun 22 08:00:58 2010 New Revision: 209419 URL: http://svn.freebsd.org/changeset/base/209419 Log: - Add notifier, radix-tree, and ilog2 support and prototypes along with other minor revisions to the linux wrapper layer. Sponsored by: Isilon Systems, iX Systems, and Panasas. Added: projects/ofed/head/sys/ofed/include/linux/inet.h projects/ofed/head/sys/ofed/include/linux/io.h projects/ofed/head/sys/ofed/include/linux/log2.h projects/ofed/head/sys/ofed/include/linux/notifier.h projects/ofed/head/sys/ofed/include/linux/radix-tree.h Modified: projects/ofed/head/sys/ofed/include/linux/bitops.h projects/ofed/head/sys/ofed/include/linux/kernel.h projects/ofed/head/sys/ofed/include/linux/netdevice.h Modified: projects/ofed/head/sys/ofed/include/linux/bitops.h ============================================================================== --- projects/ofed/head/sys/ofed/include/linux/bitops.h Tue Jun 22 07:55:30 2010 (r209418) +++ projects/ofed/head/sys/ofed/include/linux/bitops.h Tue Jun 22 08:00:58 2010 (r209419) @@ -28,7 +28,11 @@ #ifndef _LINUX_BITOPS_H_ #define _LINUX_BITOPS_H_ -#define BITS_PER_LONG (sizeof(long) * 8) +#ifdef __LP64__ +#define BITS_PER_LONG 64 +#else +#define BITS_PER_LONG 32 +#endif #define BIT_MASK(n) (~0UL >> (BITS_PER_LONG - (n))) #define BITS_TO_LONGS(n) roundup2((n), BITS_PER_LONG) Added: projects/ofed/head/sys/ofed/include/linux/inet.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/sys/ofed/include/linux/inet.h Tue Jun 22 08:00:58 2010 (r209419) @@ -0,0 +1,31 @@ +/*- + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * All rights reserved. + * + * 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 unmodified, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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_INET_H_ +#define _LINUX_INET_H_ +#endif /* _LINUX_INET_H_ */ Added: projects/ofed/head/sys/ofed/include/linux/io.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/sys/ofed/include/linux/io.h Tue Jun 22 08:00:58 2010 (r209419) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * All rights reserved. + * + * 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 unmodified, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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_IO_H_ +#define _LINUX_IO_H_ + +static inline uint64_t +__raw_readq(const volatile void *addr) +{ + return *(const volatile uint64_t *)addr; +} + +static inline void +__raw_writeq(uint64_t b, volatile void *addr) +{ + *(volatile uint64_t *)addr = b; +} + +#endif /* _LINUX_IO_H_ */ Modified: projects/ofed/head/sys/ofed/include/linux/kernel.h ============================================================================== --- projects/ofed/head/sys/ofed/include/linux/kernel.h Tue Jun 22 07:55:30 2010 (r209418) +++ projects/ofed/head/sys/ofed/include/linux/kernel.h Tue Jun 22 08:00:58 2010 (r209419) @@ -42,6 +42,8 @@ #include <linux/jiffies.h> #include <linux/wait.h> #include <linux/fs.h> +#include <linux/notifier.h> +#include <linux/log2.h> #include <asm/byteorder.h> #define BUG() panic("BUG") Added: projects/ofed/head/sys/ofed/include/linux/log2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/sys/ofed/include/linux/log2.h Tue Jun 22 08:00:58 2010 (r209419) @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * All rights reserved. + * + * 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 unmodified, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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_LOG2_H_ +#define _LINUX_LOG2_H_ + +#include <sys/types.h> +#include <sys/libkern.h> + +static inline unsigned long +roundup_pow_of_two(unsigned long x) +{ + return (1UL << flsl(x - 1)); +} + +static inline unsigned long +rounddown_pow_of_two(unsigned long x) +{ + return (1UL << (flsl(x) - 1)); +} + +static inline unsigned long +ilog2(unsigned long x) +{ + return (flsl(x) - 1); +} + +#endif /* _LINUX_LOG2_H_ */ Modified: projects/ofed/head/sys/ofed/include/linux/netdevice.h ============================================================================== --- projects/ofed/head/sys/ofed/include/linux/netdevice.h Tue Jun 22 07:55:30 2010 (r209418) +++ projects/ofed/head/sys/ofed/include/linux/netdevice.h Tue Jun 22 08:00:58 2010 (r209419) @@ -29,6 +29,7 @@ #define _LINUX_NETDEVICE_H_ #include <sys/socket.h> +#include <sys/types.h> #include <net/if_types.h> #include <net/if.h> @@ -40,6 +41,7 @@ #include <linux/ethtool.h> #include <linux/workqueue.h> #include <linux/net.h> +#include <linux/notifier.h> struct net { }; Added: projects/ofed/head/sys/ofed/include/linux/notifier.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/sys/ofed/include/linux/notifier.h Tue Jun 22 08:00:58 2010 (r209419) @@ -0,0 +1,38 @@ +/*- + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * All rights reserved. + * + * 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 unmodified, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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_NOTIFIER_H_ +#define _LINUX_NOTIFIER_H_ + +struct notifier_block { + int (*notifier_call)(struct notifier_block *, unsigned long, void *); + struct notifier_block *next; + int priority; +}; + +#endif /* _LINUX_NOTIFIER_H_ */ Added: projects/ofed/head/sys/ofed/include/linux/radix-tree.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/ofed/head/sys/ofed/include/linux/radix-tree.h Tue Jun 22 08:00:58 2010 (r209419) @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * All rights reserved. + * + * 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 unmodified, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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_RADIX_TREE_H_ +#define _LINUX_RADIX_TREE_H_ + +struct radix_tree_root { +}; + +#define RADIX_TREE_INIT(root) + +void *radix_tree_lookup(struct radix_tree_root *, unsigned long); +void *radix_tree_delete(struct radix_tree_root *, unsigned long); +int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); + +#endif /* _LINUX_RADIX_TREE_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006220800.o5M80wmk082040>