Whamcloud - gitweb
LU-2675 lnet: remove lnet/include/lnet/linux/ 32/12932/4
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 4 Dec 2014 17:10:44 +0000 (11:10 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 26 Dec 2014 18:07:59 +0000 (18:07 +0000)
Remove the linux specific headers from lnet/include/lnet/linux/,
moving whatever was worthwhile from them to their parent headers or
elsewhere. Also remove lnet/klnds/socklnd/socklnd_lib-linux.h and
rename lnet/klnds/socklnd/socklnd_lib-linux.c to socklnd_lib.c.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Id10683e95277791f9c99492907369a608b28a1fb
Reviewed-on: http://review.whamcloud.com/12932
Tested-by: Jenkins
Reviewed-by: Isaac Huang <he.huang@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
19 files changed:
lnet/autoconf/lustre-lnet.m4
lnet/include/lnet/Makefile.am
lnet/include/lnet/lib-lnet.h
lnet/include/lnet/lib-types.h
lnet/include/lnet/linux/.gitignore [deleted file]
lnet/include/lnet/linux/Makefile.am [deleted file]
lnet/include/lnet/linux/lib-lnet.h [deleted file]
lnet/include/lnet/linux/lib-types.h [deleted file]
lnet/include/lnet/linux/lnet.h [deleted file]
lnet/include/lnet/lnet.h
lnet/klnds/gnilnd/gnilnd_cb.c
lnet/klnds/mxlnd/mxlnd_cb.c
lnet/klnds/o2iblnd/o2iblnd.c
lnet/klnds/ralnd/ralnd_cb.c
lnet/klnds/socklnd/Makefile.in
lnet/klnds/socklnd/autoMakefile.am
lnet/klnds/socklnd/socklnd.h
lnet/klnds/socklnd/socklnd_lib-linux.h [deleted file]
lnet/klnds/socklnd/socklnd_lib.c [moved from lnet/klnds/socklnd/socklnd_lib-linux.c with 99% similarity]

index 9b0924f..ad390bf 100644 (file)
@@ -705,7 +705,6 @@ lnet/autoconf/Makefile
 lnet/doc/Makefile
 lnet/include/Makefile
 lnet/include/lnet/Makefile
-lnet/include/lnet/linux/Makefile
 lnet/klnds/Makefile
 lnet/klnds/autoMakefile
 lnet/klnds/mxlnd/autoMakefile
index 1a34a9f..50530b5 100644 (file)
@@ -1,8 +1,5 @@
 lnetdir=$(includedir)/lnet
 
-SUBDIRS = linux
-DIST_SUBDIRS = linux
-
 EXTRA_DIST = \
        api.h \
        lib-dlc.h \
index a48a5d3..baee919 100644 (file)
@@ -41,7 +41,7 @@
 #ifndef __LNET_LIB_LNET_H__
 #define __LNET_LIB_LNET_H__
 
-#include <lnet/linux/lib-lnet.h>
+#define LNET_ROUTER
 
 #include <libcfs/libcfs.h>
 #include <lnet/types.h>
index b55d598..6d2bb38 100644 (file)
 #ifndef __LNET_LIB_TYPES_H__
 #define __LNET_LIB_TYPES_H__
 
-#include <lnet/linux/lib-types.h>
+#ifdef __KERNEL__
+# include <linux/uio.h>
+# include <linux/types.h>
+#else /* !__KERNEL__ */
+# define LNET_USE_LIB_FREELIST
+# include <sys/types.h>
+#endif /* __KERNEL__ */
 
 #include <libcfs/libcfs.h>
 #include <libcfs/list.h>
diff --git a/lnet/include/lnet/linux/.gitignore b/lnet/include/lnet/linux/.gitignore
deleted file mode 100644 (file)
index 10a7e8d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/Makefile.in
diff --git a/lnet/include/lnet/linux/Makefile.am b/lnet/include/lnet/linux/Makefile.am
deleted file mode 100644 (file)
index 7efb58d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-EXTRA_DIST = lib-lnet.h lib-types.h lnet.h
diff --git a/lnet/include/lnet/linux/lib-lnet.h b/lnet/include/lnet/linux/lib-lnet.h
deleted file mode 100644 (file)
index a7ad1b8..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * 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 version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#ifndef __LNET_LINUX_LIB_LNET_H__
-#define __LNET_LINUX_LIB_LNET_H__
-
-#ifndef __LNET_LIB_LNET_H__
-#error Do not #include this file directly. #include <lnet/lib-lnet.h> instead
-#endif
-
-#ifdef __KERNEL__
-# include <asm/page.h>
-# include <linux/string.h>
-# include <asm/io.h>
-# include <libcfs/libcfs.h>
-
-static inline __u64
-lnet_page2phys (struct page *p)
-{
-        /* compiler optimizer will elide unused branches */
-
-        switch (sizeof(typeof(page_to_phys(p)))) {
-        case 4:
-                /* page_to_phys returns a 32 bit physical address.  This must
-                 * be a 32 bit machine with <= 4G memory and we must ensure we
-                 * don't sign extend when converting to 64 bits. */
-                return (unsigned long)page_to_phys(p);
-
-        case 8:
-                /* page_to_phys returns a 64 bit physical address :) */
-                return page_to_phys(p);
-                
-        default:
-                LBUG();
-                return 0;
-        }
-}
-
-#else  /* __KERNEL__ */
-# include <libcfs/list.h>
-# include <string.h>
-# ifdef HAVE_LIBPTHREAD
-#  include <pthread.h>
-# endif
-#endif
-
-#define LNET_ROUTER
-
-#endif /* __LNET_LINUX_LIB_LNET_H__ */
diff --git a/lnet/include/lnet/linux/lib-types.h b/lnet/include/lnet/linux/lib-types.h
deleted file mode 100644 (file)
index 6e6ed5d..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * 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 version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#ifndef __LNET_LINUX_LIB_TYPES_H__
-#define __LNET_LINUX_LIB_TYPES_H__
-
-#ifndef __LNET_LIB_TYPES_H__
-#error Do not #include this file directly. #include <lnet/lib-types.h> instead
-#endif
-
-#ifdef __KERNEL__
-# include <linux/uio.h>
-# include <linux/types.h>
-#else
-# define LNET_USE_LIB_FREELIST
-# include <sys/types.h>
-#endif
-
-#endif
diff --git a/lnet/include/lnet/linux/lnet.h b/lnet/include/lnet/linux/lnet.h
deleted file mode 100644 (file)
index d641bce..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * 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 version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#ifndef __LNET_LINUX_LNET_H__
-#define __LNET_LINUX_LNET_H__
-
-#ifndef __LNET_H__
-#error Do not #include this file directly. #include <lnet/lnet.h> instead
-#endif
-
-/*
- * lnet.h
- *
- * User application interface file
- */
-
-#if defined (__KERNEL__)
-#include <linux/uio.h>
-#include <linux/types.h>
-
-#ifdef HAVE_TCP_SENDPAGE_USE_SOCKET
-#define cfs_tcp_sendpage(sk, page, offset, size, flags) \
-        tcp_sendpage((sk)->sk_socket, page, offset, size, flags)
-#else
-#define cfs_tcp_sendpage(sk, page, offset, size, flags) \
-        tcp_sendpage(sk, page, offset, size, flags)
-#endif
-#else
-#include <sys/types.h>
-#include <sys/uio.h>
-#endif
-
-#endif
index 6b86a22..bc27a2e 100644 (file)
@@ -40,7 +40,6 @@
  *
  * User application interface file
  */
-#include <lnet/linux/lnet.h>
 
 #include <lnet/types.h>
 #include <lnet/api.h>
index 7a176e1..705a341 100644 (file)
@@ -23,6 +23,7 @@
  *
  */
 
+#include <asm/page.h>
 #include <linux/nmi.h>
 #include "gnilnd.h"
 
@@ -709,7 +710,7 @@ kgnilnd_setup_phys_buffer(kgn_tx_t *tx, int nkiov, lnet_kiov_t *kiov,
                               "nkiov %u offset %u\n",
                      kiov->kiov_page, kiov->kiov_offset, kiov->kiov_len, nob, nkiov, offset);
 
-               phys->address = lnet_page2phys(kiov->kiov_page);
+               phys->address = page_to_phys(kiov->kiov_page);
                phys++;
                kiov++;
                nkiov--;
index 191af47..9c54d54 100644 (file)
@@ -41,6 +41,7 @@
  * Author: Scott Atchley <atchley at myri.com>
  */
 
+#include <asm/page.h>
 #include "mxlnd.h"
 
 mx_endpoint_addr_t MX_EPA_NULL; /* use to determine if an endpoint is NULL */
@@ -1885,7 +1886,8 @@ mxlnd_setup_kiov(kmx_ctx_t *ctx, u32 niov, lnet_kiov_t *kiov, u32 offset, u32 no
         ctx->mxc_nseg = niov;
         sum = 0;
         for (i = 0; i < niov; i++) {
-                seg[i].segment_ptr = lnet_page2phys(kiov[first_kiov + i].kiov_page);
+               seg[i].segment_ptr =
+                       page_to_phys(kiov[first_kiov + i].kiov_page);
                 seg[i].segment_length = kiov[first_kiov + i].kiov_len;
                 if (i == 0) {
                         seg[i].segment_ptr += (u64) first_kiov_offset;
index 8734120..135f5ef 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Eric Barton <eric@bartonsoftware.com>
  */
 
+#include <asm/page.h>
 #include "o2iblnd.h"
 
 static lnd_t the_o2iblnd;
@@ -1262,9 +1263,9 @@ kiblnd_map_rx_descs(kib_conn_t *conn)
                                                    rx->rx_msgaddr));
                 KIBLND_UNMAP_ADDR_SET(rx, rx_msgunmap, rx->rx_msgaddr);
 
-                CDEBUG(D_NET,"rx %d: %p "LPX64"("LPX64")\n",
-                       i, rx->rx_msg, rx->rx_msgaddr,
-                       lnet_page2phys(pg) + pg_off);
+               CDEBUG(D_NET, "rx %d: %p "LPX64"("LPX64")\n",
+                      i, rx->rx_msg, rx->rx_msgaddr,
+                      (__u64)(page_to_phys(pg) + pg_off));
 
                 pg_off += IBLND_MSG_SIZE;
                 LASSERT (pg_off <= PAGE_SIZE);
index b9e2bc0..2e6ba70 100644 (file)
@@ -38,6 +38,7 @@
  * Author: Eric Barton <eric@bartonsoftware.com>
  */
 
+#include <asm/page.h>
 #include "ralnd.h"
 
 void
@@ -229,7 +230,7 @@ kranal_setup_phys_buffer (kra_tx_t *tx, int nkiov, lnet_kiov_t *kiov,
         tx->tx_nob = nob;
         tx->tx_buffer = (void *)((unsigned long)(kiov->kiov_offset + offset));
 
-        phys->Address = lnet_page2phys(kiov->kiov_page);
+       phys->Address = page_to_phys(kiov->kiov_page);
         phys++;
 
         resid = nob - (kiov->kiov_len - offset);
@@ -254,7 +255,7 @@ kranal_setup_phys_buffer (kra_tx_t *tx, int nkiov, lnet_kiov_t *kiov,
                         return -EMSGSIZE;
                 }
 
-                phys->Address = lnet_page2phys(kiov->kiov_page);
+               phys->Address = page_to_phys(kiov->kiov_page);
                 phys++;
 
                 resid -= PAGE_SIZE;
index e517d75..b29f617 100644 (file)
@@ -1,5 +1,10 @@
 MODULES := ksocklnd
 
-ksocklnd-objs := socklnd.o socklnd_cb.o socklnd_proto.o socklnd_modparams.o socklnd_lib-linux.o
+ksocklnd-objs := \
+       socklnd.o \
+       socklnd_cb.o \
+       socklnd_lib.o \
+       socklnd_modparams.o \
+       socklnd_proto.o
 
 @INCLUDE_RULES@
index 8fac7a6..1141b1c 100644 (file)
@@ -1,11 +1,7 @@
 if MODULES
-if LINUX
-
-  modulenet_DATA := ksocklnd$(KMODEXT)
-
-endif # LINUX
+modulenet_DATA := ksocklnd$(KMODEXT)
 endif # MODULES
 
-EXTRA_DIST := $(ksocklnd-objs:%.o=%.c) socklnd_lib-linux.h socklnd.h
+EXTRA_DIST := $(ksocklnd-objs:%.o=%.c) socklnd.h
 
-MOSTLYCLEANFILES = @MOSTLYCLEANFILES@ socklnd_lib.c
+MOSTLYCLEANFILES = @MOSTLYCLEANFILES@
index a795a96..052b9ee 100644 (file)
  *
  */
 
+#ifndef _SOCKLND_SOCKLND_H_
+#define _SOCKLND_SOCKLND_H_
+
 #define DEBUG_PORTAL_ALLOC
 #define DEBUG_SUBSYSTEM S_LND
 
-#include "socklnd_lib-linux.h"
+#include <asm/irq.h>
+#include <linux/crc32.h>
+#include <linux/errno.h>
+#include <linux/if.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/kmod.h>
+#include <linux/list.h>
+#include <linux/mm.h>
+#include <linux/module.h>
+#include <linux/stat.h>
+#include <linux/string.h>
+#include <linux/syscalls.h>
+#include <linux/sysctl.h>
+#include <linux/uio.h>
+#include <linux/unistd.h>
+#include <net/sock.h>
+#include <net/tcp.h>
 
 #include <libcfs/libcfs.h>
 #include <lnet/lnet.h>
 #include <lnet/lib-lnet.h>
 #include <lnet/socklnd.h>
 
+#ifdef HAVE_TCP_SENDPAGE_USE_SOCKET
+# define cfs_tcp_sendpage(sk, page, offset, size, flags) \
+       tcp_sendpage((sk)->sk_socket, page, offset, size, flags)
+#else /* !HAVE_TCP_SENDPAGE_USE_SOCKET */
+# define cfs_tcp_sendpage(sk, page, offset, size, flags) \
+       tcp_sendpage(sk, page, offset, size, flags)
+#endif /* HAVE_TCP_SENDPAGE_USE_SOCKET */
+
+/* assume one thread for each connection type */
+#define SOCKNAL_NSCHEDS                3
+#define SOCKNAL_NSCHEDS_HIGH   (SOCKNAL_NSCHEDS << 1)
+
 #define SOCKNAL_PEER_HASH_SIZE  101             /* # peer lists */
 #define SOCKNAL_RESCHED         100             /* # scheduler loops before reschedule */
 #define SOCKNAL_INSANITY_RECONN 5000            /* connd is trying on reconn infinitely */
@@ -446,6 +478,18 @@ extern ksock_proto_t ksocknal_protocol_v3x;
 #define CPU_MASK_NONE   0UL
 #endif
 
+static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
+{
+#if 1
+       return crc32_le(crc, p, len);
+#else
+       while (len-- > 0)
+               crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ;
+
+       return crc;
+#endif
+}
+
 static inline int
 ksocknal_route_mask(void)
 {
@@ -641,3 +685,5 @@ extern void ksocknal_lib_csum_tx(ksock_tx_t *tx);
 
 extern int ksocknal_lib_memory_pressure(ksock_conn_t *conn);
 extern int ksocknal_lib_bind_thread_to_cpu(int id);
+
+#endif /* _SOCKLND_SOCKLND_H_ */
diff --git a/lnet/klnds/socklnd/socklnd_lib-linux.h b/lnet/klnds/socklnd/socklnd_lib-linux.h
deleted file mode 100644 (file)
index 6979809..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * 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 version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-
-#define DEBUG_PORTAL_ALLOC
-
-#ifndef __LINUX_SOCKNAL_LIB_H__
-#define __LINUX_SOCKNAL_LIB_H__
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/version.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/stat.h>
-#include <linux/errno.h>
-#include <linux/unistd.h>
-#include <net/sock.h>
-#include <net/tcp.h>
-#include <linux/uio.h>
-#include <linux/if.h>
-
-#include <asm/uaccess.h>
-#include <asm/irq.h>
-
-#include <linux/init.h>
-#include <linux/fs.h>
-#include <linux/file.h>
-#include <linux/stat.h>
-#include <linux/list.h>
-#include <linux/kmod.h>
-#include <linux/sysctl.h>
-#include <asm/uaccess.h>
-#include <asm/div64.h>
-#include <linux/syscalls.h>
-
-#include <libcfs/libcfs.h>
-
-#include <linux/crc32.h>
-static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
-{
-#if 1
-        return crc32_le(crc, p, len);
-#else
-        while (len-- > 0)
-                crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ;
-        return crc;
-#endif
-}
-
-#define SOCKNAL_WSPACE(sk)       sk_stream_wspace(sk)
-#define SOCKNAL_MIN_WSPACE(sk)   sk_stream_min_wspace(sk)
-
-/* assume one thread for each connection type */
-#define SOCKNAL_NSCHEDS                3
-#define SOCKNAL_NSCHEDS_HIGH   (SOCKNAL_NSCHEDS << 1)
-
-#endif
similarity index 99%
rename from lnet/klnds/socklnd/socklnd_lib-linux.c
rename to lnet/klnds/socklnd/socklnd_lib.c
index 2815a36..a5f63f0 100644 (file)
@@ -1000,8 +1000,8 @@ ksocknal_write_space (struct sock *sk)
        read_lock(&ksocknal_data.ksnd_global_lock);
 
         conn = sk->sk_user_data;
-        wspace = SOCKNAL_WSPACE(sk);
-        min_wpace = SOCKNAL_MIN_WSPACE(sk);
+       wspace = sk_stream_wspace(sk);
+       min_wpace = sk_stream_min_wspace(sk);
 
         CDEBUG(D_NET, "sk %p wspace %d low water %d conn %p%s%s%s\n",
                sk, wspace, min_wpace, conn,