linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] First set of Intel branch merger for libcfs/lnet
       [not found] <uja.ornl@gmail.com>
@ 2015-05-21 22:46 ` James Simmons
  2015-05-22 18:32 ` [PATCH 1/6] staging:lustre:remove useless libcfs_sock_release James Simmons
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2015-05-21 22:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, HPDD-discuss, lustre-devel, James Simmons

This is the first set of patches that are current in the Intel branch
which are apart of the effort to cleanup LNet/libcfs.

James Simmons (3):
  staging:lustre: remove tcpip abstraction from libcfs
  staging:lustre: remove kernel defines in userland headers
  staging:lustre: cleanup libcfs lock handling

 .../staging/lustre/include/linux/libcfs/libcfs.h   |   21 -
 .../lustre/include/linux/libcfs/libcfs_private.h   |   51 --
 .../lustre/include/linux/lnet/api-support.h        |   44 --
 drivers/staging/lustre/include/linux/lnet/api.h    |   51 +-
 .../staging/lustre/include/linux/lnet/lib-lnet.h   |  264 ++-------
 .../staging/lustre/include/linux/lnet/lib-types.h  |  649 +++++++++-----------
 .../lustre/include/linux/lnet/linux/api-support.h  |   42 --
 .../lustre/include/linux/lnet/linux/lib-lnet.h     |   71 ---
 .../lustre/include/linux/lnet/linux/lib-types.h    |   45 --
 .../staging/lustre/include/linux/lnet/linux/lnet.h |   56 --
 .../lustre/include/linux/lnet/lnet-sysctl.h        |   49 --
 drivers/staging/lustre/include/linux/lnet/lnet.h   |   11 +-
 .../staging/lustre/include/linux/lnet/lnetctl.h    |   36 +-
 drivers/staging/lustre/include/linux/lnet/lnetst.h |  665 ++++++++++++--------
 drivers/staging/lustre/include/linux/lnet/nidstr.h |   73 +++
 drivers/staging/lustre/include/linux/lnet/ptllnd.h |   93 ---
 .../lustre/include/linux/lnet/ptllnd_wire.h        |  119 ----
 .../staging/lustre/include/linux/lnet/socklnd.h    |   91 ++--
 drivers/staging/lustre/include/linux/lnet/types.h  |  266 +++++++--
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |    4 +-
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.h    |    9 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |   16 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.h    |    3 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |    7 +-
 .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c  |   21 +-
 .../lustre/lnet/klnds/socklnd/socklnd_proto.c      |   30 +-
 drivers/staging/lustre/lnet/lnet/Makefile          |    7 +-
 drivers/staging/lustre/lnet/lnet/acceptor.c        |   47 +-
 drivers/staging/lustre/lnet/lnet/api-ni.c          |  100 +---
 drivers/staging/lustre/lnet/lnet/config.c          |   21 +-
 drivers/staging/lustre/lnet/lnet/lib-eq.c          |    2 +-
 drivers/staging/lustre/lnet/lnet/lib-md.c          |    6 +-
 drivers/staging/lustre/lnet/lnet/lib-me.c          |   24 +-
 drivers/staging/lustre/lnet/lnet/lib-msg.c         |   22 +-
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |  616 ++++++++++++++++++
 drivers/staging/lustre/lnet/lnet/module.c          |    4 +-
 drivers/staging/lustre/lnet/lnet/router.c          |  145 -----
 drivers/staging/lustre/lustre/include/lustre_net.h |    4 +-
 drivers/staging/lustre/lustre/libcfs/Makefile      |    1 -
 drivers/staging/lustre/lustre/libcfs/fail.c        |    2 +-
 .../lustre/lustre/libcfs/linux/linux-tcpip.c       |  623 ------------------
 .../lustre/lustre/libcfs/linux/linux-tracefile.c   |    4 +-
 drivers/staging/lustre/lustre/libcfs/module.c      |   11 +-
 drivers/staging/lustre/lustre/libcfs/tracefile.c   |    2 +-
 44 files changed, 1856 insertions(+), 2572 deletions(-)
 delete mode 100644 drivers/staging/lustre/include/linux/lnet/api-support.h
 delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/api-support.h
 delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-lnet.h
 delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lib-types.h
 delete mode 100644 drivers/staging/lustre/include/linux/lnet/linux/lnet.h
 delete mode 100644 drivers/staging/lustre/include/linux/lnet/lnet-sysctl.h
 create mode 100644 drivers/staging/lustre/include/linux/lnet/nidstr.h
 delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd.h
 delete mode 100644 drivers/staging/lustre/include/linux/lnet/ptllnd_wire.h
 create mode 100644 drivers/staging/lustre/lnet/lnet/lib-socket.c
 delete mode 100644 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/6] staging:lustre:remove useless libcfs_sock_release
       [not found] <uja.ornl@gmail.com>
  2015-05-21 22:46 ` [PATCH 0/3] First set of Intel branch merger for libcfs/lnet James Simmons
@ 2015-05-22 18:32 ` James Simmons
  2015-05-22 18:32 ` [PATCH 2/6] staging:lustre:remove useless libcfs_sock_abort_accept James Simmons
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2015-05-22 18:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, HPDD-discuss, lustre-devel, James Simmons

There is no reason to have a one line exported function
libcfs_sock_release. Instead we can call sock_release directly.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |    1 -
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |    2 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.h    |    2 +-
 drivers/staging/lustre/lnet/lnet/acceptor.c        |    8 ++++----
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |    8 --------
 5 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 947df7e..7a7a525 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -103,7 +103,6 @@ int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);
 int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port);
 int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout);
 int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout);
-void libcfs_sock_release(struct socket *sock);
 
 /* need both kernel and user-land acceptor */
 #define LNET_ACCEPTOR_MIN_RESERVED_PORT    512
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 7586b7e..e642752 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -1386,7 +1386,7 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,
 	LIBCFS_FREE(conn, sizeof(*conn));
 
  failed_0:
-	libcfs_sock_release(sock);
+	sock_release(sock);
 	return rc;
 }
 
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index c54c995..f3b4923 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -453,7 +453,7 @@ ksocknal_connsock_decref(ksock_conn_t *conn)
 	LASSERT(atomic_read(&conn->ksnc_sock_refcount) > 0);
 	if (atomic_dec_and_test(&conn->ksnc_sock_refcount)) {
 		LASSERT(conn->ksnc_closing);
-		libcfs_sock_release(conn->ksnc_sock);
+		sock_release(conn->ksnc_sock);
 		conn->ksnc_sock = NULL;
 		ksocknal_finalize_zcreq(conn);
 	}
diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c
index 72fd1bf..14673ef 100644
--- a/drivers/staging/lustre/lnet/lnet/acceptor.c
+++ b/drivers/staging/lustre/lnet/lnet/acceptor.c
@@ -197,7 +197,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
 	goto failed;
 
  failed_sock:
-	libcfs_sock_release(sock);
+	sock_release(sock);
  failed:
 	lnet_connect_console_error(rc, peer_nid, peer_ip, peer_port);
 	return rc;
@@ -379,7 +379,7 @@ lnet_acceptor(void *arg)
 
 		/* maybe we're waken up with libcfs_sock_abort_accept() */
 		if (lnet_acceptor_state.pta_shutdown) {
-			libcfs_sock_release(newsock);
+			sock_release(newsock);
 			break;
 		}
 
@@ -410,10 +410,10 @@ lnet_acceptor(void *arg)
 		continue;
 
 failed:
-		libcfs_sock_release(newsock);
+		sock_release(newsock);
 	}
 
-	libcfs_sock_release(lnet_acceptor_state.pta_sock);
+	sock_release(lnet_acceptor_state.pta_sock);
 	lnet_acceptor_state.pta_sock = NULL;
 
 	CDEBUG(D_NET, "Acceptor stopping\n");
diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c
index 7f80612..259db61 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
@@ -614,11 +614,3 @@ libcfs_sock_connect (struct socket **sockp, int *fatal,
 }
 
 EXPORT_SYMBOL(libcfs_sock_connect);
-
-void
-libcfs_sock_release (struct socket *sock)
-{
-	sock_release(sock);
-}
-
-EXPORT_SYMBOL(libcfs_sock_release);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/6] staging:lustre:remove useless libcfs_sock_abort_accept
       [not found] <uja.ornl@gmail.com>
  2015-05-21 22:46 ` [PATCH 0/3] First set of Intel branch merger for libcfs/lnet James Simmons
  2015-05-22 18:32 ` [PATCH 1/6] staging:lustre:remove useless libcfs_sock_release James Simmons
@ 2015-05-22 18:32 ` James Simmons
  2015-05-22 18:32 ` [PATCH 3/6] staging:lustre: rename tcpip handling functions to lnet_* prefix James Simmons
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2015-05-22 18:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, HPDD-discuss, lustre-devel, James Simmons

Another one of those silly one line wrappers which is not
needed. Replace libcfs_sock_abort_accept wrapper with a
direct call to wake_up_all on the lnet_acceptor_state sock.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |    1 -
 drivers/staging/lustre/lnet/lnet/acceptor.c        |    4 ++--
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |    8 --------
 3 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 7a7a525..854ba6a 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -94,7 +94,6 @@ int libcfs_ipif_enumerate(char ***names);
 void libcfs_ipif_free_enumeration(char **names, int n);
 int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog);
 int libcfs_sock_accept(struct socket **newsockp, struct socket *sock);
-void libcfs_sock_abort_accept(struct socket *sock);
 int libcfs_sock_connect(struct socket **sockp, int *fatal,
 			__u32 local_ip, int local_port,
 			__u32 peer_ip, int peer_port);
diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c
index 14673ef..8c6726a 100644
--- a/drivers/staging/lustre/lnet/lnet/acceptor.c
+++ b/drivers/staging/lustre/lnet/lnet/acceptor.c
@@ -377,7 +377,7 @@ lnet_acceptor(void *arg)
 			continue;
 		}
 
-		/* maybe we're waken up with libcfs_sock_abort_accept() */
+		/* maybe the LNet acceptor thread has been waken */
 		if (lnet_acceptor_state.pta_shutdown) {
 			sock_release(newsock);
 			break;
@@ -493,7 +493,7 @@ lnet_acceptor_stop(void)
 		return;
 
 	lnet_acceptor_state.pta_shutdown = 1;
-	libcfs_sock_abort_accept(lnet_acceptor_state.pta_sock);
+	wake_up_all(sk_sleep(lnet_acceptor_state.pta_sock->sk));
 
 	/* block until acceptor signals exit */
 	wait_for_completion(&lnet_acceptor_state.pta_signal);
diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c
index 259db61..bb8d9c2 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
@@ -568,14 +568,6 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock)
 
 EXPORT_SYMBOL(libcfs_sock_accept);
 
-void
-libcfs_sock_abort_accept (struct socket *sock)
-{
-	wake_up_all(sk_sleep(sock->sk));
-}
-
-EXPORT_SYMBOL(libcfs_sock_abort_accept);
-
 int
 libcfs_sock_connect (struct socket **sockp, int *fatal,
 		     __u32 local_ip, int local_port,
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/6] staging:lustre: rename tcpip handling functions to lnet_* prefix
       [not found] <uja.ornl@gmail.com>
                   ` (2 preceding siblings ...)
  2015-05-22 18:32 ` [PATCH 2/6] staging:lustre:remove useless libcfs_sock_abort_accept James Simmons
@ 2015-05-22 18:32 ` James Simmons
  2015-05-22 18:32 ` [PATCH 4/6] staging:lustre: use available kernel wrappers in lib-socket.c James Simmons
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2015-05-22 18:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, HPDD-discuss, lustre-devel, James Simmons

With all the TCPIP handling done in the lnet layer we should
rename all the functions with the prefix lnet_*. One other
change done was changing the remove argument of lnet_sock_getaddr
from a int to a bool.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |   15 -----
 .../staging/lustre/include/linux/lnet/lib-lnet.h   |   16 +++++
 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c    |    2 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |   11 ++--
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |    6 +-
 .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c  |   15 ++---
 .../lustre/lnet/klnds/socklnd/socklnd_proto.c      |   43 ++++++-------
 drivers/staging/lustre/lnet/lnet/acceptor.c        |   43 ++++++-------
 drivers/staging/lustre/lnet/lnet/config.c          |   21 +++----
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |   66 +++++++++----------
 10 files changed, 110 insertions(+), 128 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 854ba6a..f54bab6 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -88,21 +88,6 @@ static inline int __is_po2(unsigned long long val)
 int libcfs_arch_init(void);
 void libcfs_arch_cleanup(void);
 
-/* libcfs tcpip */
-int libcfs_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask);
-int libcfs_ipif_enumerate(char ***names);
-void libcfs_ipif_free_enumeration(char **names, int n);
-int libcfs_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog);
-int libcfs_sock_accept(struct socket **newsockp, struct socket *sock);
-int libcfs_sock_connect(struct socket **sockp, int *fatal,
-			__u32 local_ip, int local_port,
-			__u32 peer_ip, int peer_port);
-int libcfs_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize);
-int libcfs_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);
-int libcfs_sock_getaddr(struct socket *socket, int remote, __u32 *ip, int *port);
-int libcfs_sock_write(struct socket *sock, void *buffer, int nob, int timeout);
-int libcfs_sock_read(struct socket *sock, void *buffer, int nob, int timeout);
-
 /* need both kernel and user-land acceptor */
 #define LNET_ACCEPTOR_MIN_RESERVED_PORT    512
 #define LNET_ACCEPTOR_MAX_RESERVED_PORT    1023
diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
index 0038d29..5175588 100644
--- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
+++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
@@ -846,6 +846,22 @@ int lnet_acceptor_port(void);
 int lnet_acceptor_start(void);
 void lnet_acceptor_stop(void);
 
+int lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask);
+int lnet_ipif_enumerate(char ***names);
+void lnet_ipif_free_enumeration(char **names, int n);
+int lnet_sock_setbuf(struct socket *socket, int txbufsize, int rxbufsize);
+int lnet_sock_getbuf(struct socket *socket, int *txbufsize, int *rxbufsize);
+int lnet_sock_getaddr(struct socket *socket, bool remote, __u32 *ip, int *port);
+int lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout);
+int lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout);
+
+int lnet_sock_listen(struct socket **sockp, __u32 ip, int port, int backlog);
+int lnet_sock_accept(struct socket **newsockp, struct socket *sock);
+int lnet_sock_connect(struct socket **sockp, int *fatal,
+		      __u32 local_ip, int local_port,
+		      __u32 peer_ip, int peer_port);
+void libcfs_sock_release(struct socket *sock);
+
 void lnet_get_tunables(void);
 int lnet_peers_start_down(void);
 int lnet_peer_buffer_credits(lnet_ni_t *ni);
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index 3bad441..be4de56 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -2620,7 +2620,7 @@ static kib_dev_t *kiblnd_create_dev(char *ifname)
 	int		up;
 	int		rc;
 
-	rc = libcfs_ipif_query(ifname, &up, &ip, &netmask);
+	rc = lnet_ipif_query(ifname, &up, &ip, &netmask);
 	if (rc != 0) {
 		CERROR("Can't query IPoIB interface %s: %d\n",
 		       ifname, rc);
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index e642752..a27dddf 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -968,7 +968,7 @@ ksocknal_accept(lnet_ni_t *ni, struct socket *sock)
 	__u32	       peer_ip;
 	int		 peer_port;
 
-	rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port);
+	rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port);
 	LASSERT(rc == 0);		      /* we succeeded before */
 
 	LIBCFS_ALLOC(cr, sizeof(*cr));
@@ -2594,7 +2594,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)
 	int	 rc;
 	int	 n;
 
-	n = libcfs_ipif_enumerate(&names);
+	n = lnet_ipif_enumerate(&names);
 	if (n <= 0) {
 		CERROR("Can't enumerate interfaces: %d\n", n);
 		return n;
@@ -2608,7 +2608,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)
 		if (!strcmp(names[i], "lo")) /* skip the loopback IF */
 			continue;
 
-		rc = libcfs_ipif_query(names[i], &up, &ip, &mask);
+		rc = lnet_ipif_query(names[i], &up, &ip, &mask);
 		if (rc != 0) {
 			CWARN("Can't get interface %s info: %d\n",
 			      names[i], rc);
@@ -2634,7 +2634,7 @@ ksocknal_enumerate_interfaces(ksock_net_t *net)
 		j++;
 	}
 
-	libcfs_ipif_free_enumeration(names, n);
+	lnet_ipif_free_enumeration(names, n);
 
 	if (j == 0)
 		CERROR("Can't find any usable interfaces\n");
@@ -2796,8 +2796,7 @@ ksocknal_startup(lnet_ni_t *ni)
 			if (ni->ni_interfaces[i] == NULL)
 				break;
 
-			rc = libcfs_ipif_query(
-				ni->ni_interfaces[i], &up,
+			rc = lnet_ipif_query(ni->ni_interfaces[i], &up,
 				&net->ksnn_interfaces[i].ksni_ipaddr,
 				&net->ksnn_interfaces[i].ksni_netmask);
 
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
index fa7ad88..352f03e 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
@@ -1707,7 +1707,7 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn,
 	timeout = active ? *ksocknal_tunables.ksnd_timeout :
 			    lnet_acceptor_timeout();
 
-	rc = libcfs_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout);
+	rc = lnet_sock_read(sock, &hello->kshm_magic, sizeof (hello->kshm_magic), timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading HELLO from %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
@@ -1726,8 +1726,8 @@ ksocknal_recv_hello (lnet_ni_t *ni, ksock_conn_t *conn,
 		return -EPROTO;
 	}
 
-	rc = libcfs_sock_read(sock, &hello->kshm_version,
-			      sizeof(hello->kshm_version), timeout);
+	rc = lnet_sock_read(sock, &hello->kshm_version,
+			    sizeof(hello->kshm_version), timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading HELLO from %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
index f5e8ab0..589f0d6 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
@@ -39,9 +39,8 @@
 int
 ksocknal_lib_get_conn_addrs(ksock_conn_t *conn)
 {
-	int rc = libcfs_sock_getaddr(conn->ksnc_sock, 1,
-				     &conn->ksnc_ipaddr,
-				     &conn->ksnc_port);
+	int rc = lnet_sock_getaddr(conn->ksnc_sock, 1, &conn->ksnc_ipaddr,
+				   &conn->ksnc_port);
 
 	/* Didn't need the {get,put}connsock dance to deref ksnc_sock... */
 	LASSERT(!conn->ksnc_closing);
@@ -51,8 +50,7 @@ ksocknal_lib_get_conn_addrs(ksock_conn_t *conn)
 		return rc;
 	}
 
-	rc = libcfs_sock_getaddr(conn->ksnc_sock, 0,
-				 &conn->ksnc_myipaddr, NULL);
+	rc = lnet_sock_getaddr(conn->ksnc_sock, 0, &conn->ksnc_myipaddr, NULL);
 	if (rc != 0) {
 		CERROR("Error %d getting sock local IP\n", rc);
 		return rc;
@@ -436,7 +434,7 @@ ksocknal_lib_get_conn_tunables(ksock_conn_t *conn, int *txmem, int *rxmem, int *
 		return -ESHUTDOWN;
 	}
 
-	rc = libcfs_sock_getbuf(sock, txmem, rxmem);
+	rc = lnet_sock_getbuf(sock, txmem, rxmem);
 	if (rc == 0) {
 		len = sizeof(*nagle);
 		rc = kernel_getsockopt(sock, SOL_TCP, TCP_NODELAY,
@@ -498,9 +496,8 @@ ksocknal_lib_setup_sock(struct socket *sock)
 		}
 	}
 
-	rc = libcfs_sock_setbuf(sock,
-				*ksocknal_tunables.ksnd_tx_buffer_size,
-				*ksocknal_tunables.ksnd_rx_buffer_size);
+	rc = lnet_sock_setbuf(sock, *ksocknal_tunables.ksnd_tx_buffer_size,
+			      *ksocknal_tunables.ksnd_rx_buffer_size);
 	if (rc != 0) {
 		CERROR("Can't set buffer tx %d, rx %d buffers: %d\n",
 			*ksocknal_tunables.ksnd_tx_buffer_size,
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c
index 8596581..48197eb 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c
@@ -495,9 +495,7 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello)
 	hdr->msg.hello.type = cpu_to_le32 (hello->kshm_ctype);
 	hdr->msg.hello.incarnation = cpu_to_le64 (hello->kshm_src_incarnation);
 
-	rc = libcfs_sock_write(sock, hdr, sizeof(*hdr),
-			       lnet_acceptor_timeout());
-
+	rc = lnet_sock_write(sock, hdr, sizeof(*hdr), lnet_acceptor_timeout());
 	if (rc != 0) {
 		CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n",
 			rc, &conn->ksnc_ipaddr, conn->ksnc_port);
@@ -511,9 +509,9 @@ ksocknal_send_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello)
 		hello->kshm_ips[i] = __cpu_to_le32 (hello->kshm_ips[i]);
 	}
 
-	rc = libcfs_sock_write(sock, hello->kshm_ips,
-			       hello->kshm_nips * sizeof(__u32),
-			       lnet_acceptor_timeout());
+	rc = lnet_sock_write(sock, hello->kshm_ips,
+			     hello->kshm_nips * sizeof(__u32),
+			     lnet_acceptor_timeout());
 	if (rc != 0) {
 		CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n",
 			rc, hello->kshm_nips,
@@ -544,9 +542,8 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello)
 		LNET_UNLOCK();
 	}
 
-	rc = libcfs_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips),
-			       lnet_acceptor_timeout());
-
+	rc = lnet_sock_write(sock, hello, offsetof(ksock_hello_msg_t, kshm_ips),
+			     lnet_acceptor_timeout());
 	if (rc != 0) {
 		CNETERR("Error %d sending HELLO hdr to %pI4h/%d\n",
 			rc, &conn->ksnc_ipaddr, conn->ksnc_port);
@@ -556,9 +553,9 @@ ksocknal_send_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello)
 	if (hello->kshm_nips == 0)
 		return 0;
 
-	rc = libcfs_sock_write(sock, hello->kshm_ips,
-			       hello->kshm_nips * sizeof(__u32),
-			       lnet_acceptor_timeout());
+	rc = lnet_sock_write(sock, hello->kshm_ips,
+			     hello->kshm_nips * sizeof(__u32),
+			     lnet_acceptor_timeout());
 	if (rc != 0) {
 		CNETERR("Error %d sending HELLO payload (%d) to %pI4h/%d\n",
 			rc, hello->kshm_nips,
@@ -583,9 +580,9 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello,
 		return -ENOMEM;
 	}
 
-	rc = libcfs_sock_read(sock, &hdr->src_nid,
-			      sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid),
-			      timeout);
+	rc = lnet_sock_read(sock, &hdr->src_nid,
+			    sizeof(*hdr) - offsetof(lnet_hdr_t, src_nid),
+			    timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading rest of HELLO hdr from %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
@@ -619,8 +616,8 @@ ksocknal_recv_hello_v1(ksock_conn_t *conn, ksock_hello_msg_t *hello,
 	if (hello->kshm_nips == 0)
 		goto out;
 
-	rc = libcfs_sock_read(sock, hello->kshm_ips,
-			      hello->kshm_nips * sizeof(__u32), timeout);
+	rc = lnet_sock_read(sock, hello->kshm_ips,
+			    hello->kshm_nips * sizeof(__u32), timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading IPs from ip %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
@@ -656,10 +653,10 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout
 	else
 		conn->ksnc_flip = 1;
 
-	rc = libcfs_sock_read(sock, &hello->kshm_src_nid,
-			      offsetof(ksock_hello_msg_t, kshm_ips) -
-				       offsetof(ksock_hello_msg_t, kshm_src_nid),
-			      timeout);
+	rc = lnet_sock_read(sock, &hello->kshm_src_nid,
+			    offsetof(ksock_hello_msg_t, kshm_ips) -
+				     offsetof(ksock_hello_msg_t, kshm_src_nid),
+			    timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading HELLO from %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
@@ -687,8 +684,8 @@ ksocknal_recv_hello_v2(ksock_conn_t *conn, ksock_hello_msg_t *hello, int timeout
 	if (hello->kshm_nips == 0)
 		return 0;
 
-	rc = libcfs_sock_read(sock, hello->kshm_ips,
-			      hello->kshm_nips * sizeof(__u32), timeout);
+	rc = lnet_sock_read(sock, hello->kshm_ips,
+			    hello->kshm_nips * sizeof(__u32), timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading IPs from ip %pI4h\n",
 			rc, &conn->ksnc_ipaddr);
diff --git a/drivers/staging/lustre/lnet/lnet/acceptor.c b/drivers/staging/lustre/lnet/lnet/acceptor.c
index 8c6726a..d323899 100644
--- a/drivers/staging/lustre/lnet/lnet/acceptor.c
+++ b/drivers/staging/lustre/lnet/lnet/acceptor.c
@@ -155,9 +155,8 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
 	     --port) {
 		/* Iterate through reserved ports. */
 
-		rc = libcfs_sock_connect(&sock, &fatal,
-					 local_ip, port,
-					 peer_ip, peer_port);
+		rc = lnet_sock_connect(&sock, &fatal, local_ip, port, peer_ip,
+				       peer_port);
 		if (rc != 0) {
 			if (fatal)
 				goto failed;
@@ -184,8 +183,7 @@ lnet_connect(struct socket **sockp, lnet_nid_t peer_nid,
 			lnet_net_unlock(LNET_LOCK_EX);
 		}
 
-		rc = libcfs_sock_write(sock, &cr, sizeof(cr),
-				       accept_timeout);
+		rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout);
 		if (rc != 0)
 			goto failed_sock;
 
@@ -220,7 +218,7 @@ lnet_accept(struct socket *sock, __u32 magic)
 
 	LASSERT(sizeof(cr) <= 16);	     /* not too big for the stack */
 
-	rc = libcfs_sock_getaddr(sock, 1, &peer_ip, &peer_port);
+	rc = lnet_sock_getaddr(sock, 1, &peer_ip, &peer_port);
 	LASSERT(rc == 0);		      /* we succeeded before */
 
 	if (!lnet_accept_magic(magic, LNET_PROTO_ACCEPTOR_MAGIC)) {
@@ -234,8 +232,8 @@ lnet_accept(struct socket *sock, __u32 magic)
 			memset(&cr, 0, sizeof(cr));
 			cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC;
 			cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
-			rc = libcfs_sock_write(sock, &cr, sizeof(cr),
-					       accept_timeout);
+			rc = lnet_sock_write(sock, &cr, sizeof(cr),
+					     accept_timeout);
 
 			if (rc != 0)
 				CERROR("Error sending magic+version in response to LNET magic from %pI4h: %d\n",
@@ -257,9 +255,8 @@ lnet_accept(struct socket *sock, __u32 magic)
 
 	flip = (magic != LNET_PROTO_ACCEPTOR_MAGIC);
 
-	rc = libcfs_sock_read(sock, &cr.acr_version,
-			      sizeof(cr.acr_version),
-			      accept_timeout);
+	rc = lnet_sock_read(sock, &cr.acr_version, sizeof(cr.acr_version),
+			    accept_timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading connection request version from %pI4h\n",
 			rc, &peer_ip);
@@ -280,19 +277,17 @@ lnet_accept(struct socket *sock, __u32 magic)
 		cr.acr_magic = LNET_PROTO_ACCEPTOR_MAGIC;
 		cr.acr_version = LNET_PROTO_ACCEPTOR_VERSION;
 
-		rc = libcfs_sock_write(sock, &cr, sizeof(cr),
-				       accept_timeout);
-
+		rc = lnet_sock_write(sock, &cr, sizeof(cr), accept_timeout);
 		if (rc != 0)
 			CERROR("Error sending magic+version in response to version %d from %pI4h: %d\n",
 			       peer_version, &peer_ip, rc);
 		return -EPROTO;
 	}
 
-	rc = libcfs_sock_read(sock, &cr.acr_nid,
-			      sizeof(cr) -
-			      offsetof(lnet_acceptor_connreq_t, acr_nid),
-			      accept_timeout);
+	rc = lnet_sock_read(sock, &cr.acr_nid,
+			    sizeof(cr) -
+			    offsetof(lnet_acceptor_connreq_t, acr_nid),
+			    accept_timeout);
 	if (rc != 0) {
 		CERROR("Error %d reading connection request from %pI4h\n",
 			rc, &peer_ip);
@@ -343,8 +338,8 @@ lnet_acceptor(void *arg)
 
 	cfs_block_allsigs();
 
-	rc = libcfs_sock_listen(&lnet_acceptor_state.pta_sock,
-				0, accept_port, accept_backlog);
+	rc = lnet_sock_listen(&lnet_acceptor_state.pta_sock, 0, accept_port,
+			      accept_backlog);
 	if (rc != 0) {
 		if (rc == -EADDRINUSE)
 			LCONSOLE_ERROR_MSG(0x122, "Can't start acceptor on port %d: port already in use\n",
@@ -367,7 +362,7 @@ lnet_acceptor(void *arg)
 
 	while (!lnet_acceptor_state.pta_shutdown) {
 
-		rc = libcfs_sock_accept(&newsock, lnet_acceptor_state.pta_sock);
+		rc = lnet_sock_accept(&newsock, lnet_acceptor_state.pta_sock);
 		if (rc != 0) {
 			if (rc != -EAGAIN) {
 				CWARN("Accept error %d: pausing...\n", rc);
@@ -383,7 +378,7 @@ lnet_acceptor(void *arg)
 			break;
 		}
 
-		rc = libcfs_sock_getaddr(newsock, 1, &peer_ip, &peer_port);
+		rc = lnet_sock_getaddr(newsock, 1, &peer_ip, &peer_port);
 		if (rc != 0) {
 			CERROR("Can't determine new connection's address\n");
 			goto failed;
@@ -395,8 +390,8 @@ lnet_acceptor(void *arg)
 			goto failed;
 		}
 
-		rc = libcfs_sock_read(newsock, &magic, sizeof(magic),
-				      accept_timeout);
+		rc = lnet_sock_read(newsock, &magic, sizeof(magic),
+				    accept_timeout);
 		if (rc != 0) {
 			CERROR("Error %d reading connection request from %pI4h\n",
 				rc, &peer_ip);
diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c
index 2dc4c4a..d8c8f2e 100644
--- a/drivers/staging/lustre/lnet/lnet/config.c
+++ b/drivers/staging/lustre/lnet/lnet/config.c
@@ -1118,7 +1118,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 	__u32     *ipaddrs2;
 	int	nip;
 	char     **ifnames;
-	int	nif = libcfs_ipif_enumerate(&ifnames);
+	int	nif = lnet_ipif_enumerate(&ifnames);
 	int	i;
 	int	rc;
 
@@ -1128,7 +1128,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 	LIBCFS_ALLOC(ipaddrs, nif * sizeof(*ipaddrs));
 	if (ipaddrs == NULL) {
 		CERROR("Can't allocate ipaddrs[%d]\n", nif);
-		libcfs_ipif_free_enumeration(ifnames, nif);
+		lnet_ipif_free_enumeration(ifnames, nif);
 		return -ENOMEM;
 	}
 
@@ -1136,8 +1136,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 		if (!strcmp(ifnames[i], "lo"))
 			continue;
 
-		rc = libcfs_ipif_query(ifnames[i], &up,
-				       &ipaddrs[nip], &netmask);
+		rc = lnet_ipif_query(ifnames[i], &up, &ipaddrs[nip], &netmask);
 		if (rc != 0) {
 			CWARN("Can't query interface %s: %d\n",
 			      ifnames[i], rc);
@@ -1153,7 +1152,7 @@ lnet_ipaddr_enumerate(__u32 **ipaddrsp)
 		nip++;
 	}
 
-	libcfs_ipif_free_enumeration(ifnames, nif);
+	lnet_ipif_free_enumeration(ifnames, nif);
 
 	if (nip == nif) {
 		*ipaddrsp = ipaddrs;
@@ -1237,8 +1236,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 			return -EPERM;
 		}
 
-		rc = libcfs_ipif_query(ni->ni_interfaces[0],
-				       &up, &ip, &netmask);
+		rc = lnet_ipif_query(ni->ni_interfaces[0], &up, &ip, &netmask);
 		if (rc != 0) {
 			CERROR("Net %s can't query interface %s: %d\n",
 			       libcfs_net2str(net), ni->ni_interfaces[0], rc);
@@ -1255,7 +1253,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 		return 0;
 	}
 
-	n = libcfs_ipif_enumerate(&names);
+	n = lnet_ipif_enumerate(&names);
 	if (n <= 0) {
 		CERROR("Net %s can't enumerate interfaces: %d\n",
 		       libcfs_net2str(net), n);
@@ -1266,8 +1264,7 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 		if (!strcmp(names[i], "lo")) /* skip the loopback IF */
 			continue;
 
-		rc = libcfs_ipif_query(names[i], &up, &ip, &netmask);
-
+		rc = lnet_ipif_query(names[i], &up, &ip, &netmask);
 		if (rc != 0) {
 			CWARN("Net %s can't query interface %s: %d\n",
 			      libcfs_net2str(net), names[i], rc);
@@ -1280,13 +1277,13 @@ lnet_set_ip_niaddr(lnet_ni_t *ni)
 			continue;
 		}
 
-		libcfs_ipif_free_enumeration(names, n);
+		lnet_ipif_free_enumeration(names, n);
 		ni->ni_nid = LNET_MKNID(net, ip);
 		return 0;
 	}
 
 	CERROR("Net %s can't find any interfaces\n", libcfs_net2str(net));
-	libcfs_ipif_free_enumeration(names, n);
+	lnet_ipif_free_enumeration(names, n);
 	return -ENOENT;
 }
 EXPORT_SYMBOL(lnet_set_ip_niaddr);
diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c
index bb8d9c2..2e87168 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
@@ -45,7 +45,7 @@
 #include <linux/syscalls.h>
 
 static int
-libcfs_sock_ioctl(int cmd, unsigned long arg)
+lnet_sock_ioctl(int cmd, unsigned long arg)
 {
 	mm_segment_t	oldmm = get_fs();
 	struct socket  *sock;
@@ -76,7 +76,7 @@ out:
 }
 
 int
-libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
+lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 {
 	struct ifreq   ifr;
 	int	    nob;
@@ -92,8 +92,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 	CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ);
 
 	strcpy(ifr.ifr_name, name);
-	rc = libcfs_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr);
-
+	rc = lnet_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr);
 	if (rc != 0) {
 		CERROR("Can't get flags for interface %s\n", name);
 		return rc;
@@ -110,8 +109,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 
 	strcpy(ifr.ifr_name, name);
 	ifr.ifr_addr.sa_family = AF_INET;
-	rc = libcfs_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr);
-
+	rc = lnet_sock_ioctl(SIOCGIFADDR, (unsigned long)&ifr);
 	if (rc != 0) {
 		CERROR("Can't get IP address for interface %s\n", name);
 		return rc;
@@ -122,8 +120,7 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 
 	strcpy(ifr.ifr_name, name);
 	ifr.ifr_addr.sa_family = AF_INET;
-	rc = libcfs_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr);
-
+	rc = lnet_sock_ioctl(SIOCGIFNETMASK, (unsigned long)&ifr);
 	if (rc != 0) {
 		CERROR("Can't get netmask for interface %s\n", name);
 		return rc;
@@ -135,10 +132,10 @@ libcfs_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 	return 0;
 }
 
-EXPORT_SYMBOL(libcfs_ipif_query);
+EXPORT_SYMBOL(lnet_ipif_query);
 
 int
-libcfs_ipif_enumerate (char ***namesp)
+lnet_ipif_enumerate (char ***namesp)
 {
 	/* Allocate and fill in 'names', returning # interfaces/error */
 	char	   **names;
@@ -172,8 +169,7 @@ libcfs_ipif_enumerate (char ***namesp)
 		ifc.ifc_buf = (char *)ifr;
 		ifc.ifc_len = nalloc * sizeof(*ifr);
 
-		rc = libcfs_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc);
-
+		rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc);
 		if (rc < 0) {
 			CERROR ("Error %d enumerating interfaces\n", rc);
 			goto out1;
@@ -226,17 +222,17 @@ libcfs_ipif_enumerate (char ***namesp)
 
  out2:
 	if (rc < 0)
-		libcfs_ipif_free_enumeration(names, nfound);
+		lnet_ipif_free_enumeration(names, nfound);
  out1:
 	LIBCFS_FREE(ifr, nalloc * sizeof(*ifr));
  out0:
 	return rc;
 }
 
-EXPORT_SYMBOL(libcfs_ipif_enumerate);
+EXPORT_SYMBOL(lnet_ipif_enumerate);
 
 void
-libcfs_ipif_free_enumeration (char **names, int n)
+lnet_ipif_free_enumeration (char **names, int n)
 {
 	int      i;
 
@@ -248,10 +244,10 @@ libcfs_ipif_free_enumeration (char **names, int n)
 	LIBCFS_FREE(names, n * sizeof(*names));
 }
 
-EXPORT_SYMBOL(libcfs_ipif_free_enumeration);
+EXPORT_SYMBOL(lnet_ipif_free_enumeration);
 
 int
-libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
+lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
 {
 	int	    rc;
 	long	   ticks = timeout * HZ;
@@ -310,10 +306,10 @@ libcfs_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
 
 	return 0;
 }
-EXPORT_SYMBOL(libcfs_sock_write);
+EXPORT_SYMBOL(lnet_sock_write);
 
 int
-libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout)
+lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout)
 {
 	int	    rc;
 	long	   ticks = timeout * HZ;
@@ -366,10 +362,10 @@ libcfs_sock_read (struct socket *sock, void *buffer, int nob, int timeout)
 	}
 }
 
-EXPORT_SYMBOL(libcfs_sock_read);
+EXPORT_SYMBOL(lnet_sock_read);
 
 static int
-libcfs_sock_create (struct socket **sockp, int *fatal,
+lnet_sock_create (struct socket **sockp, int *fatal,
 		    __u32 local_ip, int local_port)
 {
 	struct sockaddr_in  locaddr;
@@ -424,7 +420,7 @@ libcfs_sock_create (struct socket **sockp, int *fatal,
 }
 
 int
-libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize)
+lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize)
 {
 	int		 option;
 	int		 rc;
@@ -454,10 +450,10 @@ libcfs_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize)
 	return 0;
 }
 
-EXPORT_SYMBOL(libcfs_sock_setbuf);
+EXPORT_SYMBOL(lnet_sock_setbuf);
 
 int
-libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port)
+lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port)
 {
 	struct sockaddr_in sin;
 	int		len = sizeof (sin);
@@ -480,10 +476,10 @@ libcfs_sock_getaddr (struct socket *sock, int remote, __u32 *ip, int *port)
 	return 0;
 }
 
-EXPORT_SYMBOL(libcfs_sock_getaddr);
+EXPORT_SYMBOL(lnet_sock_getaddr);
 
 int
-libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize)
+lnet_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize)
 {
 
 	if (txbufsize != NULL) {
@@ -497,16 +493,16 @@ libcfs_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize)
 	return 0;
 }
 
-EXPORT_SYMBOL(libcfs_sock_getbuf);
+EXPORT_SYMBOL(lnet_sock_getbuf);
 
 int
-libcfs_sock_listen (struct socket **sockp,
+lnet_sock_listen (struct socket **sockp,
 		    __u32 local_ip, int local_port, int backlog)
 {
 	int      fatal;
 	int      rc;
 
-	rc = libcfs_sock_create(sockp, &fatal, local_ip, local_port);
+	rc = lnet_sock_create(sockp, &fatal, local_ip, local_port);
 	if (rc != 0) {
 		if (!fatal)
 			CERROR("Can't create socket: port %d already in use\n",
@@ -523,10 +519,10 @@ libcfs_sock_listen (struct socket **sockp,
 	return rc;
 }
 
-EXPORT_SYMBOL(libcfs_sock_listen);
+EXPORT_SYMBOL(lnet_sock_listen);
 
 int
-libcfs_sock_accept (struct socket **newsockp, struct socket *sock)
+lnet_sock_accept (struct socket **newsockp, struct socket *sock)
 {
 	wait_queue_t   wait;
 	struct socket *newsock;
@@ -566,17 +562,17 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock)
 	return rc;
 }
 
-EXPORT_SYMBOL(libcfs_sock_accept);
+EXPORT_SYMBOL(lnet_sock_accept);
 
 int
-libcfs_sock_connect (struct socket **sockp, int *fatal,
+lnet_sock_connect (struct socket **sockp, int *fatal,
 		     __u32 local_ip, int local_port,
 		     __u32 peer_ip, int peer_port)
 {
 	struct sockaddr_in  srvaddr;
 	int		 rc;
 
-	rc = libcfs_sock_create(sockp, fatal, local_ip, local_port);
+	rc = lnet_sock_create(sockp, fatal, local_ip, local_port);
 	if (rc != 0)
 		return rc;
 
@@ -605,4 +601,4 @@ libcfs_sock_connect (struct socket **sockp, int *fatal,
 	return rc;
 }
 
-EXPORT_SYMBOL(libcfs_sock_connect);
+EXPORT_SYMBOL(lnet_sock_connect);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/6] staging:lustre: use available kernel wrappers in lib-socket.c
       [not found] <uja.ornl@gmail.com>
                   ` (3 preceding siblings ...)
  2015-05-22 18:32 ` [PATCH 3/6] staging:lustre: rename tcpip handling functions to lnet_* prefix James Simmons
@ 2015-05-22 18:32 ` James Simmons
  2015-05-22 18:32 ` [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c James Simmons
  2015-05-22 18:32 ` [PATCH 6/6] staging:lustre: Update license and copyright " James Simmons
  6 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2015-05-22 18:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, HPDD-discuss, lustre-devel, James Simmons

Instead of handling calls to struct proto ourselves we can use
equivalent kernel wrappers. No wrapper exist for unlocked ioctl
handling so we create one here for our use. I expect some day
that function will be integrated into sock.c.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lnet/lnet/lib-socket.c |   47 ++++++++++++++++---------
 1 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c
index 2e87168..2d46a69 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
@@ -35,22 +35,37 @@
  */
 #define DEBUG_SUBSYSTEM S_LNET
 
-#include "../../include/linux/libcfs/libcfs.h"
-#include "../../include/linux/lnet/lib-lnet.h"
-
 #include <linux/if.h>
 #include <linux/in.h>
+#include <linux/net.h>
 #include <linux/file.h>
+#include <linux/pagemap.h>
 /* For sys_open & sys_close */
 #include <linux/syscalls.h>
+#include <net/sock.h>
+
+#include "../../include/linux/libcfs/libcfs.h"
+#include "../../include/linux/lnet/lib-lnet.h"
+
+static int
+kernel_sock_unlocked_ioctl(struct file *filp, int cmd, unsigned long arg)
+{
+	mm_segment_t oldfs = get_fs();
+	int err;
+
+	set_fs(KERNEL_DS);
+	err = filp->f_op->unlocked_ioctl(filp, cmd, arg);
+	set_fs(oldfs);
+
+	return err;
+}
 
 static int
 lnet_sock_ioctl(int cmd, unsigned long arg)
 {
-	mm_segment_t	oldmm = get_fs();
+	struct file    *sock_filp;
 	struct socket  *sock;
 	int		rc;
-	struct file    *sock_filp;
 
 	rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock);
 	if (rc != 0) {
@@ -65,10 +80,7 @@ lnet_sock_ioctl(int cmd, unsigned long arg)
 		goto out;
 	}
 
-	set_fs(KERNEL_DS);
-	if (sock_filp->f_op->unlocked_ioctl)
-		rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg);
-	set_fs(oldmm);
+	rc = kernel_sock_unlocked_ioctl(sock_filp, cmd, arg);
 
 	fput(sock_filp);
 out:
@@ -398,8 +410,8 @@ lnet_sock_create (struct socket **sockp, int *fatal,
 		locaddr.sin_addr.s_addr = (local_ip == 0) ?
 					  INADDR_ANY : htonl(local_ip);
 
-		rc = sock->ops->bind(sock, (struct sockaddr *)&locaddr,
-				     sizeof(locaddr));
+		rc = kernel_bind(sock, (struct sockaddr *)&locaddr,
+				 sizeof(locaddr));
 		if (rc == -EADDRINUSE) {
 			CDEBUG(D_NET, "Port %d already in use\n", local_port);
 			*fatal = 0;
@@ -459,8 +471,10 @@ lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port)
 	int		len = sizeof (sin);
 	int		rc;
 
-	rc = sock->ops->getname (sock, (struct sockaddr *)&sin, &len,
-				 remote ? 2 : 0);
+	if (remote)
+		rc = kernel_getpeername(sock, (struct sockaddr *)&sin, &len);
+	else
+		rc = kernel_getsockname(sock, (struct sockaddr *)&sin, &len);
 	if (rc != 0) {
 		CERROR ("Error %d getting sock %s IP/port\n",
 			rc, remote ? "peer" : "local");
@@ -510,7 +524,7 @@ lnet_sock_listen (struct socket **sockp,
 		return rc;
 	}
 
-	rc = (*sockp)->ops->listen(*sockp, backlog);
+	rc = kernel_listen(*sockp, backlog);
 	if (rc == 0)
 		return 0;
 
@@ -581,9 +595,8 @@ lnet_sock_connect (struct socket **sockp, int *fatal,
 	srvaddr.sin_port = htons(peer_port);
 	srvaddr.sin_addr.s_addr = htonl(peer_ip);
 
-	rc = (*sockp)->ops->connect(*sockp,
-				    (struct sockaddr *)&srvaddr, sizeof(srvaddr),
-				    0);
+	rc = kernel_connect(*sockp, (struct sockaddr *)&srvaddr,
+			    sizeof(srvaddr), 0);
 	if (rc == 0)
 		return 0;
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c
       [not found] <uja.ornl@gmail.com>
                   ` (4 preceding siblings ...)
  2015-05-22 18:32 ` [PATCH 4/6] staging:lustre: use available kernel wrappers in lib-socket.c James Simmons
@ 2015-05-22 18:32 ` James Simmons
  2015-05-25  9:37   ` Dan Carpenter
  2015-05-22 18:32 ` [PATCH 6/6] staging:lustre: Update license and copyright " James Simmons
  6 siblings, 1 reply; 11+ messages in thread
From: James Simmons @ 2015-05-22 18:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, HPDD-discuss, lustre-devel, James Simmons

Handle all the style issues reported by checkpatch.pl.
Remove general white spaces, spaces in function calls,
etc.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c    |    4 +-
 drivers/staging/lustre/lnet/lnet/lib-socket.c      |  210 +++++++++-----------
 2 files changed, 98 insertions(+), 116 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index a27dddf..caccb00 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -1378,14 +1378,14 @@ ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,
 	ksocknal_txlist_done(ni, &zombies, 1);
 	ksocknal_peer_decref(peer);
 
- failed_1:
+failed_1:
 	if (hello != NULL)
 		LIBCFS_FREE(hello, offsetof(ksock_hello_msg_t,
 					    kshm_ips[LNET_MAX_INTERFACES]));
 
 	LIBCFS_FREE(conn, sizeof(*conn));
 
- failed_0:
+failed_0:
 	sock_release(sock);
 	return rc;
 }
diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c
index 2d46a69..f0b187d 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
@@ -63,13 +63,13 @@ kernel_sock_unlocked_ioctl(struct file *filp, int cmd, unsigned long arg)
 static int
 lnet_sock_ioctl(int cmd, unsigned long arg)
 {
-	struct file    *sock_filp;
-	struct socket  *sock;
-	int		rc;
+	struct file *sock_filp;
+	struct socket *sock;
+	int rc;
 
-	rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock);
+	rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock);
 	if (rc != 0) {
-		CERROR ("Can't create socket: %d\n", rc);
+		CERROR("Can't create socket: %d\n", rc);
 		return rc;
 	}
 
@@ -88,12 +88,12 @@ out:
 }
 
 int
-lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
+lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask)
 {
-	struct ifreq   ifr;
-	int	    nob;
-	int	    rc;
-	__u32	  val;
+	struct ifreq ifr;
+	int nob;
+	int rc;
+	__u32 val;
 
 	nob = strnlen(name, IFNAMSIZ);
 	if (nob == IFNAMSIZ) {
@@ -101,7 +101,7 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 		return -EINVAL;
 	}
 
-	CLASSERT (sizeof(ifr.ifr_name) >= IFNAMSIZ);
+	CLASSERT(sizeof(ifr.ifr_name) >= IFNAMSIZ);
 
 	strcpy(ifr.ifr_name, name);
 	rc = lnet_sock_ioctl(SIOCGIFFLAGS, (unsigned long)&ifr);
@@ -116,7 +116,6 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 		*ip = *mask = 0;
 		return 0;
 	}
-
 	*up = 1;
 
 	strcpy(ifr.ifr_name, name);
@@ -143,23 +142,21 @@ lnet_ipif_query (char *name, int *up, __u32 *ip, __u32 *mask)
 
 	return 0;
 }
-
 EXPORT_SYMBOL(lnet_ipif_query);
 
 int
-lnet_ipif_enumerate (char ***namesp)
+lnet_ipif_enumerate(char ***namesp)
 {
 	/* Allocate and fill in 'names', returning # interfaces/error */
-	char	   **names;
-	int	     toobig;
-	int	     nalloc;
-	int	     nfound;
-	struct ifreq   *ifr;
-	struct ifconf   ifc;
-	int	     rc;
-	int	     nob;
-	int	     i;
-
+	char **names;
+	int toobig;
+	int nalloc;
+	int nfound;
+	struct ifreq *ifr;
+	struct ifconf ifc;
+	int rc;
+	int nob;
+	int i;
 
 	nalloc = 16;	/* first guess at max interfaces */
 	toobig = 0;
@@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp)
 		if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) {
 			toobig = 1;
 			nalloc = PAGE_CACHE_SIZE/sizeof(*ifr);
-			CWARN("Too many interfaces: only enumerating first %d\n",
-			      nalloc);
+			CWARN("Too many interfaces: only enumerating "
+			      "first %d\n", nalloc);
 		}
 
 		LIBCFS_ALLOC(ifr, nalloc * sizeof(*ifr));
 		if (ifr == NULL) {
-			CERROR ("ENOMEM enumerating up to %d interfaces\n", nalloc);
+			CERROR("ENOMEM enumerating up to %d interfaces\n",
+			       nalloc);
 			rc = -ENOMEM;
 			goto out0;
 		}
@@ -183,14 +181,14 @@ lnet_ipif_enumerate (char ***namesp)
 
 		rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc);
 		if (rc < 0) {
-			CERROR ("Error %d enumerating interfaces\n", rc);
+			CERROR("Error %d enumerating interfaces\n", rc);
 			goto out1;
 		}
 
-		LASSERT (rc == 0);
+		LASSERT(rc == 0);
 
 		nfound = ifc.ifc_len/sizeof(*ifr);
-		LASSERT (nfound <= nalloc);
+		LASSERT(nfound <= nalloc);
 
 		if (nfound < nalloc || toobig)
 			break;
@@ -209,8 +207,7 @@ lnet_ipif_enumerate (char ***namesp)
 	}
 
 	for (i = 0; i < nfound; i++) {
-
-		nob = strnlen (ifr[i].ifr_name, IFNAMSIZ);
+		nob = strnlen(ifr[i].ifr_name, IFNAMSIZ);
 		if (nob == IFNAMSIZ) {
 			/* no space for terminating NULL */
 			CERROR("interface name %.*s too long (%d max)\n",
@@ -232,41 +229,39 @@ lnet_ipif_enumerate (char ***namesp)
 	*namesp = names;
 	rc = nfound;
 
- out2:
+out2:
 	if (rc < 0)
 		lnet_ipif_free_enumeration(names, nfound);
- out1:
+out1:
 	LIBCFS_FREE(ifr, nalloc * sizeof(*ifr));
- out0:
+out0:
 	return rc;
 }
-
 EXPORT_SYMBOL(lnet_ipif_enumerate);
 
 void
-lnet_ipif_free_enumeration (char **names, int n)
+lnet_ipif_free_enumeration(char **names, int n)
 {
-	int      i;
+	int i;
 
-	LASSERT (n > 0);
+	LASSERT(n > 0);
 
 	for (i = 0; i < n && names[i] != NULL; i++)
 		LIBCFS_FREE(names[i], IFNAMSIZ);
 
 	LIBCFS_FREE(names, n * sizeof(*names));
 }
-
 EXPORT_SYMBOL(lnet_ipif_free_enumeration);
 
 int
-lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
+lnet_sock_write(struct socket *sock, void *buffer, int nob, int timeout)
 {
-	int	    rc;
-	long	   ticks = timeout * HZ;
-	unsigned long  then;
+	int rc;
+	long ticks = timeout * HZ;
+	unsigned long then;
 	struct timeval tv;
 
-	LASSERT (nob > 0);
+	LASSERT(nob > 0);
 	/* Caller may pass a zero timeout if she thinks the socket buffer is
 	 * empty enough to take the whole message immediately */
 
@@ -286,9 +281,10 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
 				.tv_usec = ((ticks % HZ) * 1000000) / HZ
 			};
 			rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO,
-					     (char *)&tv, sizeof(tv));
+					       (char *)&tv, sizeof(tv));
 			if (rc != 0) {
-				CERROR("Can't set socket send timeout %ld.%06d: %d\n",
+				CERROR("Can't set socket send timeout "
+				       "%ld.%06d: %d\n",
 				       (long)tv.tv_sec, (int)tv.tv_usec, rc);
 				return rc;
 			}
@@ -305,7 +301,7 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
 			return rc;
 
 		if (rc == 0) {
-			CERROR ("Unexpected zero rc\n");
+			CERROR("Unexpected zero rc\n");
 			return -ECONNABORTED;
 		}
 
@@ -315,21 +311,20 @@ lnet_sock_write (struct socket *sock, void *buffer, int nob, int timeout)
 		buffer = ((char *)buffer) + rc;
 		nob -= rc;
 	}
-
 	return 0;
 }
 EXPORT_SYMBOL(lnet_sock_write);
 
 int
-lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout)
+lnet_sock_read(struct socket *sock, void *buffer, int nob, int timeout)
 {
-	int	    rc;
-	long	   ticks = timeout * HZ;
-	unsigned long  then;
+	int rc;
+	long ticks = timeout * HZ;
+	unsigned long then;
 	struct timeval tv;
 
-	LASSERT (nob > 0);
-	LASSERT (ticks > 0);
+	LASSERT(nob > 0);
+	LASSERT(ticks > 0);
 
 	for (;;) {
 		struct kvec  iov = {
@@ -337,7 +332,7 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout)
 			.iov_len  = nob
 		};
 		struct msghdr msg = {
-			.msg_flags      = 0
+			.msg_flags = 0
 		};
 
 		/* Set receive timeout to remaining time */
@@ -346,7 +341,7 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout)
 			.tv_usec = ((ticks % HZ) * 1000000) / HZ
 		};
 		rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,
-				     (char *)&tv, sizeof(tv));
+				       (char *)&tv, sizeof(tv));
 		if (rc != 0) {
 			CERROR("Can't set socket recv timeout %ld.%06d: %d\n",
 			       (long)tv.tv_sec, (int)tv.tv_usec, rc);
@@ -373,31 +368,30 @@ lnet_sock_read (struct socket *sock, void *buffer, int nob, int timeout)
 			return -ETIMEDOUT;
 	}
 }
-
 EXPORT_SYMBOL(lnet_sock_read);
 
 static int
-lnet_sock_create (struct socket **sockp, int *fatal,
-		    __u32 local_ip, int local_port)
+lnet_sock_create(struct socket **sockp, int *fatal, __u32 local_ip,
+		 int local_port)
 {
-	struct sockaddr_in  locaddr;
-	struct socket      *sock;
-	int		 rc;
-	int		 option;
+	struct sockaddr_in locaddr;
+	struct socket *sock;
+	int rc;
+	int option;
 
 	/* All errors are fatal except bind failure if the port is in use */
 	*fatal = 1;
 
-	rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock);
+	rc = sock_create(PF_INET, SOCK_STREAM, 0, &sock);
 	*sockp = sock;
 	if (rc != 0) {
-		CERROR ("Can't create socket: %d\n", rc);
+		CERROR("Can't create socket: %d\n", rc);
 		return rc;
 	}
 
 	option = 1;
 	rc = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
-			     (char *)&option, sizeof (option));
+			       (char *)&option, sizeof(option));
 	if (rc != 0) {
 		CERROR("Can't set SO_REUSEADDR for socket: %d\n", rc);
 		goto failed;
@@ -423,27 +417,26 @@ lnet_sock_create (struct socket **sockp, int *fatal,
 			goto failed;
 		}
 	}
-
 	return 0;
 
- failed:
+failed:
 	sock_release(sock);
 	return rc;
 }
 
 int
-lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize)
+lnet_sock_setbuf(struct socket *sock, int txbufsize, int rxbufsize)
 {
-	int		 option;
-	int		 rc;
+	int option;
+	int rc;
 
 	if (txbufsize != 0) {
 		option = txbufsize;
 		rc = kernel_setsockopt(sock, SOL_SOCKET, SO_SNDBUF,
-				     (char *)&option, sizeof (option));
+				       (char *)&option, sizeof(option));
 		if (rc != 0) {
-			CERROR ("Can't set send buffer %d: %d\n",
-				option, rc);
+			CERROR("Can't set send buffer %d: %d\n",
+			       option, rc);
 			return rc;
 		}
 	}
@@ -451,70 +444,63 @@ lnet_sock_setbuf (struct socket *sock, int txbufsize, int rxbufsize)
 	if (rxbufsize != 0) {
 		option = rxbufsize;
 		rc = kernel_setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
-				      (char *)&option, sizeof (option));
+				      (char *)&option, sizeof(option));
 		if (rc != 0) {
-			CERROR ("Can't set receive buffer %d: %d\n",
-				option, rc);
+			CERROR("Can't set receive buffer %d: %d\n",
+			       option, rc);
 			return rc;
 		}
 	}
-
 	return 0;
 }
-
 EXPORT_SYMBOL(lnet_sock_setbuf);
 
 int
-lnet_sock_getaddr (struct socket *sock, bool remote, __u32 *ip, int *port)
+lnet_sock_getaddr(struct socket *sock, bool remote, __u32 *ip, int *port)
 {
 	struct sockaddr_in sin;
-	int		len = sizeof (sin);
-	int		rc;
+	int len = sizeof(sin);
+	int rc;
 
 	if (remote)
 		rc = kernel_getpeername(sock, (struct sockaddr *)&sin, &len);
 	else
 		rc = kernel_getsockname(sock, (struct sockaddr *)&sin, &len);
 	if (rc != 0) {
-		CERROR ("Error %d getting sock %s IP/port\n",
-			rc, remote ? "peer" : "local");
+		CERROR("Error %d getting sock %s IP/port\n",
+		       rc, remote ? "peer" : "local");
 		return rc;
 	}
 
 	if (ip != NULL)
-		*ip = ntohl (sin.sin_addr.s_addr);
+		*ip = ntohl(sin.sin_addr.s_addr);
 
 	if (port != NULL)
-		*port = ntohs (sin.sin_port);
+		*port = ntohs(sin.sin_port);
 
 	return 0;
 }
-
 EXPORT_SYMBOL(lnet_sock_getaddr);
 
 int
-lnet_sock_getbuf (struct socket *sock, int *txbufsize, int *rxbufsize)
+lnet_sock_getbuf(struct socket *sock, int *txbufsize, int *rxbufsize)
 {
-
-	if (txbufsize != NULL) {
+	if (txbufsize != NULL)
 		*txbufsize = sock->sk->sk_sndbuf;
-	}
 
-	if (rxbufsize != NULL) {
+	if (rxbufsize != NULL)
 		*rxbufsize = sock->sk->sk_rcvbuf;
-	}
 
 	return 0;
 }
-
 EXPORT_SYMBOL(lnet_sock_getbuf);
 
 int
-lnet_sock_listen (struct socket **sockp,
-		    __u32 local_ip, int local_port, int backlog)
+lnet_sock_listen(struct socket **sockp, __u32 local_ip, int local_port,
+		 int backlog)
 {
-	int      fatal;
-	int      rc;
+	int fatal;
+	int rc;
 
 	rc = lnet_sock_create(sockp, &fatal, local_ip, local_port);
 	if (rc != 0) {
@@ -532,15 +518,14 @@ lnet_sock_listen (struct socket **sockp,
 	sock_release(*sockp);
 	return rc;
 }
-
 EXPORT_SYMBOL(lnet_sock_listen);
 
 int
-lnet_sock_accept (struct socket **newsockp, struct socket *sock)
+lnet_sock_accept(struct socket **newsockp, struct socket *sock)
 {
-	wait_queue_t   wait;
+	wait_queue_t wait;
 	struct socket *newsock;
-	int	    rc;
+	int rc;
 
 	init_waitqueue_entry(&wait, current);
 
@@ -571,26 +556,24 @@ lnet_sock_accept (struct socket **newsockp, struct socket *sock)
 	*newsockp = newsock;
 	return 0;
 
- failed:
+failed:
 	sock_release(newsock);
 	return rc;
 }
-
 EXPORT_SYMBOL(lnet_sock_accept);
 
 int
-lnet_sock_connect (struct socket **sockp, int *fatal,
-		     __u32 local_ip, int local_port,
-		     __u32 peer_ip, int peer_port)
+lnet_sock_connect(struct socket **sockp, int *fatal, __u32 local_ip,
+		  int local_port, __u32 peer_ip, int peer_port)
 {
-	struct sockaddr_in  srvaddr;
-	int		 rc;
+	struct sockaddr_in srvaddr;
+	int rc;
 
 	rc = lnet_sock_create(sockp, fatal, local_ip, local_port);
 	if (rc != 0)
 		return rc;
 
-	memset (&srvaddr, 0, sizeof (srvaddr));
+	memset(&srvaddr, 0, sizeof(srvaddr));
 	srvaddr.sin_family = AF_INET;
 	srvaddr.sin_port = htons(peer_port);
 	srvaddr.sin_addr.s_addr = htonl(peer_ip);
@@ -607,11 +590,10 @@ lnet_sock_connect (struct socket **sockp, int *fatal,
 	*fatal = !(rc == -EADDRNOTAVAIL);
 
 	CDEBUG_LIMIT(*fatal ? D_NETERROR : D_NET,
-	       "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc,
-	       &local_ip, local_port, &peer_ip, peer_port);
+		     "Error %d connecting %pI4h/%d -> %pI4h/%d\n", rc,
+		     &local_ip, local_port, &peer_ip, peer_port);
 
 	sock_release(*sockp);
 	return rc;
 }
-
 EXPORT_SYMBOL(lnet_sock_connect);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/6] staging:lustre: Update license and copyright for lib-socket.c
       [not found] <uja.ornl@gmail.com>
                   ` (5 preceding siblings ...)
  2015-05-22 18:32 ` [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c James Simmons
@ 2015-05-22 18:32 ` James Simmons
  6 siblings, 0 replies; 11+ messages in thread
From: James Simmons @ 2015-05-22 18:32 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, HPDD-discuss, lustre-devel, James Simmons

Point to the right place for GNU license. Update Intel copyright.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 drivers/staging/lustre/lnet/lnet/lib-socket.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c
index f0b187d..2f8443c 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
@@ -15,11 +15,7 @@
  *
  * 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.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,11 +23,11 @@
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2015 Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
+ * Lustre is a trademark of Seagate, Inc.
  */
 #define DEBUG_SUBSYSTEM S_LNET
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c
  2015-05-22 18:32 ` [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c James Simmons
@ 2015-05-25  9:37   ` Dan Carpenter
  2015-05-27 15:01     ` [lustre-devel] " Simmons, James A.
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Carpenter @ 2015-05-25  9:37 UTC (permalink / raw)
  To: James Simmons
  Cc: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger,
	HPDD-discuss, Linux Kernel Mailing List, lustre-devel

On Fri, May 22, 2015 at 02:32:31PM -0400, James Simmons wrote:
> @@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp)
>  		if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) {
>  			toobig = 1;
>  			nalloc = PAGE_CACHE_SIZE/sizeof(*ifr);
> -			CWARN("Too many interfaces: only enumerating first %d\n",
> -			      nalloc);
> +			CWARN("Too many interfaces: only enumerating "
> +			      "first %d\n", nalloc);
>  		}

Don't split string literals, it makes them hard to grep for.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [lustre-devel] [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c
  2015-05-25  9:37   ` Dan Carpenter
@ 2015-05-27 15:01     ` Simmons, James A.
  2015-05-27 15:24       ` Dan Carpenter
  0 siblings, 1 reply; 11+ messages in thread
From: Simmons, James A. @ 2015-05-27 15:01 UTC (permalink / raw)
  To: 'Dan Carpenter', James Simmons
  Cc: devel, Greg Kroah-Hartman, Linux Kernel Mailing List,
	Oleg Drokin, HPDD-discuss, lustre-devel

>>On Fri, May 22, 2015 at 02:32:31PM -0400, James Simmons wrote:
>> @@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp)
>>  		if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) {
>>  			toobig = 1;
>>  			nalloc = PAGE_CACHE_SIZE/sizeof(*ifr);
>> -			CWARN("Too many interfaces: only enumerating first %d\n",
>> -			      nalloc);
>> +			CWARN("Too many interfaces: only enumerating "
>> +			      "first %d\n", nalloc);
>>  		}
>
>Don't split string literals, it makes them hard to grep for.

Will fix. The CWARN will go over 80 characters but from the recent emails that is more acceptable.
If this is the only problem then this patch set it ready.  I have more patch series that are dependent
on this first one. Should I push the other patch series with a note that it is dependent on the tcpip
cleanup or wait until it is merged? Also how does one find out when the patch has been merged?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [lustre-devel] [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c
  2015-05-27 15:01     ` [lustre-devel] " Simmons, James A.
@ 2015-05-27 15:24       ` Dan Carpenter
  2015-05-27 21:04         ` Simmons, James A.
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Carpenter @ 2015-05-27 15:24 UTC (permalink / raw)
  To: Simmons, James A.
  Cc: James Simmons, devel, Greg Kroah-Hartman,
	Linux Kernel Mailing List, Oleg Drokin, HPDD-discuss,
	lustre-devel

On Wed, May 27, 2015 at 03:01:37PM +0000, Simmons, James A. wrote:
> >>On Fri, May 22, 2015 at 02:32:31PM -0400, James Simmons wrote:
> >> @@ -167,13 +164,14 @@ lnet_ipif_enumerate (char ***namesp)
> >>  		if (nalloc * sizeof(*ifr) > PAGE_CACHE_SIZE) {
> >>  			toobig = 1;
> >>  			nalloc = PAGE_CACHE_SIZE/sizeof(*ifr);
> >> -			CWARN("Too many interfaces: only enumerating first %d\n",
> >> -			      nalloc);
> >> +			CWARN("Too many interfaces: only enumerating "
> >> +			      "first %d\n", nalloc);
> >>  		}
> >
> >Don't split string literals, it makes them hard to grep for.
> 
> Will fix. The CWARN will go over 80 characters but from the recent emails that is more acceptable.
> If this is the only problem then this patch set it ready.

Normally the right thing to do here would be to send a fixed
[patch 5/6 v2] using the --in-reply-to option so that it appears as a
reply to the original [patch 5/6].

> I have more patch series that are dependent
> on this first one. Should I push the other patch series with a note that it is dependent on the tcpip
> cleanup or wait until it is merged? Also how does one find out when the patch has been merged?

You will get an email when these are merged.

This is the only issue, I had.  No one else has complained so that means
no one else has any objections.  Greg hasn't merged it yet and he might
find a problem with it, but it seems like a straight forward patchset
so that's unlikely.

The only issue is that this patchset was sent in a confusing way.  It
doesn't have a v2 tag and it was tacked on to the old thread.  Greg
tends to not waste time being confused and just deletes the whole thread
when that happens.

The notes that "This depends on XXX being applied." are kind of nice but
no one spends a lot of time worrying about that stuff.  Greg just
applies the patches in the order that they hit his inbox and they either
apply or he tells people to update and resend.

So send your follow on patches.  If everything applies then good.  If
not then you can resend, which is a few commands in git and not a big
deal.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [lustre-devel] [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c
  2015-05-27 15:24       ` Dan Carpenter
@ 2015-05-27 21:04         ` Simmons, James A.
  0 siblings, 0 replies; 11+ messages in thread
From: Simmons, James A. @ 2015-05-27 21:04 UTC (permalink / raw)
  To: 'Dan Carpenter'
  Cc: James Simmons, devel, Greg Kroah-Hartman,
	Linux Kernel Mailing List, Oleg Drokin, HPDD-discuss,
	lustre-devel

>> >
>> >Don't split string literals, it makes them hard to grep for.
>> 
>> Will fix. The CWARN will go over 80 characters but from the recent emails that is more acceptable.
>> If this is the only problem then this patch set it ready.
>
>Normally the right thing to do here would be to send a fixed
>[patch 5/6 v2] using the --in-reply-to option so that it appears as a
>reply to the original [patch 5/6].

Made a note of that for future reference. 

>> I have more patch series that are dependent
>> on this first one. Should I push the other patch series with a note that it is dependent on the tcpip
>> cleanup or wait until it is merged? Also how does one find out when the patch has been merged?
>
>You will get an email when these are merged.
>
>This is the only issue, I had.  No one else has complained so that means
>no one else has any objections.  Greg hasn't merged it yet and he might
>find a problem with it, but it seems like a straight forward patchset
>so that's unlikely.

Ugh. I was off by one for the number of patches so I need to send a new batch.

>The only issue is that this patchset was sent in a confusing way.  It
>doesn't have a v2 tag and it was tacked on to the old thread.  Greg
>tends to not waste time being confused and just deletes the whole thread
>when that happens.

Forgot to change the patch tag number. I will send a new batch with v2 so it
is a new thread.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-05-27 21:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <uja.ornl@gmail.com>
2015-05-21 22:46 ` [PATCH 0/3] First set of Intel branch merger for libcfs/lnet James Simmons
2015-05-22 18:32 ` [PATCH 1/6] staging:lustre:remove useless libcfs_sock_release James Simmons
2015-05-22 18:32 ` [PATCH 2/6] staging:lustre:remove useless libcfs_sock_abort_accept James Simmons
2015-05-22 18:32 ` [PATCH 3/6] staging:lustre: rename tcpip handling functions to lnet_* prefix James Simmons
2015-05-22 18:32 ` [PATCH 4/6] staging:lustre: use available kernel wrappers in lib-socket.c James Simmons
2015-05-22 18:32 ` [PATCH 5/6] staging:lustre: style cleanups for lib-socket.c James Simmons
2015-05-25  9:37   ` Dan Carpenter
2015-05-27 15:01     ` [lustre-devel] " Simmons, James A.
2015-05-27 15:24       ` Dan Carpenter
2015-05-27 21:04         ` Simmons, James A.
2015-05-22 18:32 ` [PATCH 6/6] staging:lustre: Update license and copyright " James Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).