rpms/kernel/devel linux-2.6-openib-sdp.patch, NONE, 1.1.2.1 kernel-2.6.spec, 1.2519.4.20, 1.2519.4.21

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Aug 30 21:35:16 UTC 2006


Author: dzickus

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv22751

Modified Files:
      Tag: kernel-2_6_17-1_2519_el5_beta1
	kernel-2.6.spec 
Added Files:
      Tag: kernel-2_6_17-1_2519_el5_beta1
	linux-2.6-openib-sdp.patch 
Log Message:
adding the infiniband sdp layer



linux-2.6-openib-sdp.patch:
 Kconfig              |    2 
 Makefile             |    1 
 ulp/sdp/Kconfig      |   28 
 ulp/sdp/Makefile     |    6 
 ulp/sdp/sdp.h        |  165 +++++
 ulp/sdp/sdp_bcopy.c  |  469 ++++++++++++++++
 ulp/sdp/sdp_cma.c    |  475 ++++++++++++++++
 ulp/sdp/sdp_main.c   | 1429 +++++++++++++++++++++++++++++++++++++++++++++++++++
 ulp/sdp/sdp_socket.h |   13 
 9 files changed, 2588 insertions(+)

--- NEW FILE linux-2.6-openib-sdp.patch ---
diff -uprN linux-2.6.17.noarch.orig/drivers/infiniband/Kconfig linux-2.6.17.noarch.sdp/drivers/infiniband/Kconfig
--- linux-2.6.17.noarch.orig/drivers/infiniband/Kconfig	2006-07-25 17:32:46.000000000 -0400
+++ linux-2.6.17.noarch.sdp/drivers/infiniband/Kconfig	2006-08-30 16:13:20.000000000 -0400
@@ -39,6 +39,8 @@ config INFINIBAND_USER_ACCESS
 
 source "drivers/infiniband/ulp/ipoib/Kconfig"
 
+source "drivers/infiniband/ulp/sdp/Kconfig"
+
 source "drivers/infiniband/ulp/srp/Kconfig"
 
 source "drivers/infiniband/ulp/iser/Kconfig"
diff -uprN linux-2.6.17.noarch.orig/drivers/infiniband/Makefile linux-2.6.17.noarch.sdp/drivers/infiniband/Makefile
--- linux-2.6.17.noarch.orig/drivers/infiniband/Makefile	2006-07-25 17:32:49.000000000 -0400
+++ linux-2.6.17.noarch.sdp/drivers/infiniband/Makefile	2006-08-30 16:13:28.000000000 -0400
@@ -2,5 +2,6 @@ obj-$(CONFIG_INFINIBAND)		+= core/
 obj-$(CONFIG_INFINIBAND_MTHCA)		+= hw/mthca/
 obj-$(CONFIG_IPATH_CORE)		+= hw/ipath/
 obj-$(CONFIG_INFINIBAND_IPOIB)		+= ulp/ipoib/
+obj-$(CONFIG_INFINIBAND_SDP)		+= ulp/sdp/
 obj-$(CONFIG_INFINIBAND_SRP)		+= ulp/srp/
 obj-$(CONFIG_INFINIBAND_ISER)		+= ulp/iser/
diff -uprN linux-2.6.17.noarch.orig/drivers/infiniband/ulp/sdp/Kconfig linux-2.6.17.noarch.sdp/drivers/infiniband/ulp/sdp/Kconfig
--- linux-2.6.17.noarch.orig/drivers/infiniband/ulp/sdp/Kconfig	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.17.noarch.sdp/drivers/infiniband/ulp/sdp/Kconfig	2006-07-25 22:31:03.000000000 -0400
@@ -0,0 +1,28 @@
+config INFINIBAND_SDP
+	tristate "Sockets Direct Protocol"
+	depends on INFINIBAND && INFINIBAND_IPOIB
+	---help---
+	  Support for Sockets Direct Protocol (SDP).  This provides
+          sockets semantics over InfiniBand via address family
+          AF_INET_SDP (address family 27).  You can also LD_PRELOAD the
+          libsdp library from <http://openib.org> to have standard
+          sockets applications use SDP.
+
+config INFINIBAND_SDP_DEBUG
+	bool "Sockets Direct Protocol debugging"
+	depends on INFINIBAND_SDP
+	---help---
+	  This option causes debugging code to be compiled into the
+	  SDP driver.  The output can be turned on via the debug_level
+	  module parameter  (which can also be set through sysfs after the
+	  driver is loaded).
+
+config INFINIBAND_SDP_DEBUG_DATA
+        bool "Sockets Direct Protocol data path debugging"
+        depends on INFINIBAND_SDP_DEBUG
+        ---help---
+          This option compiles debugging code into the the data path
+          of the SDP driver.  The output can be turned on via the
+          data_debug_level module parameter; however, even with output
+          turned off, this debugging code will have some performance
+          impact.
diff -uprN linux-2.6.17.noarch.orig/drivers/infiniband/ulp/sdp/Makefile linux-2.6.17.noarch.sdp/drivers/infiniband/ulp/sdp/Makefile
--- linux-2.6.17.noarch.orig/drivers/infiniband/ulp/sdp/Makefile	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.17.noarch.sdp/drivers/infiniband/ulp/sdp/Makefile	2006-07-25 22:31:03.000000000 -0400
@@ -0,0 +1,6 @@
+EXTRA_CFLAGS += -Idrivers/infiniband/include
+EXTRA_CFLAGS += -ggdb
+
+obj-$(CONFIG_INFINIBAND_SDP) += ib_sdp.o
+
+ib_sdp-objs := sdp_main.o sdp_cma.o sdp_bcopy.o
diff -uprN linux-2.6.17.noarch.orig/drivers/infiniband/ulp/sdp/sdp_bcopy.c linux-2.6.17.noarch.sdp/drivers/infiniband/ulp/sdp/sdp_bcopy.c
--- linux-2.6.17.noarch.orig/drivers/infiniband/ulp/sdp/sdp_bcopy.c	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.17.noarch.sdp/drivers/infiniband/ulp/sdp/sdp_bcopy.c	2006-07-25 22:31:03.000000000 -0400
@@ -0,0 +1,469 @@
+/*
+ * Copyright (c) 2006 Mellanox Technologies Ltd.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * $Id$
+ */
+#include <linux/interrupt.h>
+#include <linux/dma-mapping.h>
+#include <rdma/ib_verbs.h>
+#include <rdma/rdma_cm.h>
+#include "sdp.h"
+
+/* Like tcp_fin */
+static void sdp_fin(struct sock *sk)
+{
+	sdp_dbg(sk, "%s\n", __func__);
+
+	sk->sk_shutdown |= RCV_SHUTDOWN;
+	sock_set_flag(sk, SOCK_DONE);
+
+
+	sk_stream_mem_reclaim(sk);
+
+	if (!sock_flag(sk, SOCK_DEAD)) {
+		sk->sk_state_change(sk);
+
+		/* Do not send POLL_HUP for half duplex close. */
+		if (sk->sk_shutdown == SHUTDOWN_MASK ||
+		    sk->sk_state == TCP_CLOSE)
+			sk_wake_async(sk, 1, POLL_HUP);
+		else
+			sk_wake_async(sk, 1, POLL_IN);
+	}
+}
+
+void sdp_post_send(struct sdp_sock *ssk, struct sk_buff *skb, u8 mid)
+{
+	struct sdp_buf *tx_req;
+	struct sdp_bsdh *h = (struct sdp_bsdh *)skb_push(skb, sizeof *h);
+	unsigned mseq = ssk->tx_head;
+	int i, rc, frags;
+	dma_addr_t addr;
+	struct device *hwdev;
+	struct ib_sge *sge;
+	struct ib_send_wr *bad_wr;
+
+	h->mid = mid;
+	h->flags = 0; /* TODO: OOB */
+	h->bufs = htons(ssk->rx_head - ssk->rx_tail);
+	h->len = htonl(skb->len);
+	h->mseq = htonl(mseq);
+	h->mseq_ack = htonl(ssk->mseq_ack);
+
+	tx_req = &ssk->tx_ring[mseq & (SDP_TX_SIZE - 1)];
+	tx_req->skb = skb;
+	hwdev = ssk->dma_device;
+	sge = ssk->ibsge;
+	addr = dma_map_single(hwdev,
+			      skb->data, skb->len - skb->data_len,
+			      DMA_TO_DEVICE);
+	tx_req->mapping[0] = addr;
+	
+	/* TODO: proper error handling */
+	BUG_ON(dma_mapping_error(addr));
+
+	sge->addr = (u64)addr;
+	sge->length = skb->len - skb->data_len;
+	sge->lkey = ssk->mr->lkey;
+	frags = skb_shinfo(skb)->nr_frags;
+	for (i = 0; i < frags; ++i) {
+		++sge;
+		addr = dma_map_page(hwdev, skb_shinfo(skb)->frags[i].page,
+				    skb_shinfo(skb)->frags[i].page_offset,
+				    skb_shinfo(skb)->frags[i].size,
+				    DMA_TO_DEVICE);
+		BUG_ON(dma_mapping_error(addr));
+		tx_req->mapping[i + 1] = addr;
+		sge->addr = addr;
+		sge->length = skb_shinfo(skb)->frags[i].size;
+		sge->lkey = ssk->mr->lkey;
+	}
+
+	ssk->tx_wr.next = NULL;
+	ssk->tx_wr.wr_id = ssk->tx_head;
+	ssk->tx_wr.sg_list = ssk->ibsge;
+	ssk->tx_wr.num_sge = frags + 1;
+	ssk->tx_wr.opcode = IB_WR_SEND;
+	ssk->tx_wr.send_flags = IB_SEND_SIGNALED;
+	if (unlikely(mid != SDP_MID_DATA))
+		ssk->tx_wr.send_flags |= IB_SEND_SOLICITED;
+	rc = ib_post_send(ssk->qp, &ssk->tx_wr, &bad_wr);
+	BUG_ON(rc);
+	++ssk->tx_head;
+	--ssk->bufs;
+	ssk->remote_credits = ssk->rx_head - ssk->rx_tail;
+}
+
+struct sk_buff *sdp_send_completion(struct sdp_sock *ssk, int mseq)
+{
+	struct device *hwdev;
+	struct sdp_buf *tx_req;
+	struct sk_buff *skb;
+	int i, frags;
+
[...2236 lines suppressed...]
+
+out:
+	release_sock(sk);
+	return err;
+}
+
+static void sdp_unhash(struct sock *sk)
+{
+        sdp_dbg(sk, "%s\n", __func__);
+}
+
+static inline unsigned int sdp_listen_poll(const struct sock *sk)
+{
+	        return !list_empty(&sdp_sk(sk)->accept_queue) ?
+			(POLLIN | POLLRDNORM) : 0;
+}
+
+static unsigned int sdp_poll(struct file *file, struct socket *socket,
+			     struct poll_table_struct *wait)
+{
+	int mask;
+	sdp_dbg(socket->sk, "%s\n", __func__);
+
+	mask = datagram_poll(file, socket, wait);
+	/* TODO: Slightly ugly: it would be nicer if there was function
+	 * like datagram_poll that didn't include poll_wait,
+	 * then we could reverse the order. */
+	if (socket->sk->sk_state == TCP_LISTEN)
+		return sdp_listen_poll(socket->sk);
+
+	if (sdp_sk(socket->sk)->urg_data & TCP_URG_VALID)
+		mask |= POLLPRI;
+	return mask;
+}
+
+static void sdp_enter_memory_pressure(void)
+{
+	sdp_dbg(NULL, "%s\n", __func__);
+}
+
+static atomic_t sockets_allocated;
+static atomic_t memory_allocated;
+static atomic_t orphan_count;
+static int memory_pressure;
+struct proto sdp_proto = {
+        .close       = sdp_close,
+        .connect     = sdp_connect,
+        .disconnect  = sdp_disconnect,
+        .accept      = sdp_accept,
+        .ioctl       = sdp_ioctl,
+        .init        = sdp_init_sock,
+        .shutdown    = sdp_shutdown,
+        .setsockopt  = sdp_setsockopt,
+        .getsockopt  = sdp_getsockopt,
+        .sendmsg     = sdp_sendmsg,
+        .recvmsg     = sdp_recvmsg,
+	.unhash      = sdp_unhash,
+        .get_port    = sdp_get_port,
+	/* Wish we had this: .listen   = sdp_listen */
+	.enter_memory_pressure = sdp_enter_memory_pressure,
+	.sockets_allocated = &sockets_allocated,
+	.memory_allocated = &memory_allocated,
+	.memory_pressure = &memory_pressure,
+	.orphan_count = &orphan_count,
+        .sysctl_mem             = sysctl_tcp_mem,
+        .sysctl_wmem            = sysctl_tcp_wmem,
+        .sysctl_rmem            = sysctl_tcp_rmem,
+	.max_header  = sizeof(struct sdp_bsdh),
+        .obj_size    = sizeof(struct sdp_sock),
+	.owner	     = THIS_MODULE,
+	.name	     = "SDP",
+};
+
+static struct proto_ops sdp_proto_ops = {
+	.family     = PF_INET,
+	.owner      = THIS_MODULE,
+	.release    = inet_release,
+	.bind       = inet_bind,
+	.connect    = inet_stream_connect, /* TODO: inet_datagram connect would
+					      autobind, but need to fix get_port
+					      with port 0 first. */
+	.socketpair = sock_no_socketpair,
+	.accept     = inet_accept,
+	.getname    = inet_getname,
+	.poll       = sdp_poll,
+	.ioctl      = inet_ioctl,
+	.listen     = sdp_inet_listen,
+	.shutdown   = inet_shutdown,
+	.setsockopt = sock_common_setsockopt,
+	.getsockopt = sock_common_getsockopt,
+	.sendmsg    = inet_sendmsg,
+	.recvmsg    = sock_common_recvmsg,
+	.mmap       = sock_no_mmap,
+	.sendpage   = sock_no_sendpage,
+};
+
+static int sdp_create_socket(struct socket *sock, int protocol)
+{
+	struct sock *sk;
+	int rc;
+
+	sdp_dbg(NULL, "%s: type %d protocol %d\n", __func__, sock->type, protocol);
+
+	if (sock->type != SOCK_STREAM) {
+		sdp_warn(NULL, "SDP: unsupported type %d.\n", sock->type);
+		return -ESOCKTNOSUPPORT;
+	}
+
+	/* IPPROTO_IP is a wildcard match */
+	if (protocol != IPPROTO_TCP && protocol != IPPROTO_IP) {
+		sdp_warn(NULL, "SDP: unsupported protocol %d.\n", protocol);
+		return -EPROTONOSUPPORT;
+	}
+
+	sk = sk_alloc(PF_INET_SDP, GFP_KERNEL, &sdp_proto, 1);
+	if (!sk) {
+		sdp_warn(NULL, "SDP: failed to allocate socket.\n");
+		return -ENOMEM;
+	}
+	sock_init_data(sock, sk);
+	sk->sk_protocol = 0x0 /* TODO: inherit tcp socket to use IPPROTO_TCP */;
+
+	rc = sdp_init_sock(sk);
+	if (rc) {
+		sdp_warn(sk, "SDP: failed to init sock.\n");
+		sk_common_release(sk);
+		return -ENOMEM;
+	}
+
+	sk->sk_destruct = sdp_destruct;
+
+	sock->ops = &sdp_proto_ops;
+	sock->state = SS_UNCONNECTED;
+	return 0;
+}
+
+static struct net_proto_family sdp_net_proto = {
+	.family = AF_INET_SDP,
+	.create = sdp_create_socket,
+	.owner  = THIS_MODULE,
+};
+
+static int __init sdp_init(void)
+{
+	int rc;
+
+	sdp_workqueue = create_singlethread_workqueue("sdp");
+	if (!sdp_workqueue) {
+		return -ENOMEM;
+	}
+
+	rc = proto_register(&sdp_proto, 1);
+	if (rc) {
+		printk(KERN_WARNING "%s: proto_register failed: %d\n", __func__, rc);
+		destroy_workqueue(sdp_workqueue);
+		return rc;
+	}
+
+	rc = sock_register(&sdp_net_proto);
+	if (rc) {
+		printk(KERN_WARNING "%s: sock_register failed: %d\n", __func__, rc);
+		proto_unregister(&sdp_proto);
+		destroy_workqueue(sdp_workqueue);
+		return rc;
+	}
+
+	return 0;
+}
+
+static void __exit sdp_exit(void)
+{
+	sock_unregister(PF_INET_SDP);
+	proto_unregister(&sdp_proto);
+
+	if (atomic_read(&orphan_count))
+		printk(KERN_WARNING "%s: orphan_count %d\n", __func__,
+		       atomic_read(&orphan_count));
+	destroy_workqueue(sdp_workqueue);
+	flush_scheduled_work();
+}
+
+module_init(sdp_init);
+module_exit(sdp_exit);
diff -uprN linux-2.6.17.noarch.orig/drivers/infiniband/ulp/sdp/sdp_socket.h linux-2.6.17.noarch.sdp/drivers/infiniband/ulp/sdp/sdp_socket.h
--- linux-2.6.17.noarch.orig/drivers/infiniband/ulp/sdp/sdp_socket.h	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.17.noarch.sdp/drivers/infiniband/ulp/sdp/sdp_socket.h	2006-07-25 22:31:03.000000000 -0400
@@ -0,0 +1,13 @@
+/* Stuff that should go into include/linux/socket.h */
+
+#ifndef SDP_SOCKET_H
+#define SDP_SOCKET_H
+
+#ifndef AF_INET_SDP
+#define AF_INET_SDP 27
+#define PF_INET_SDP AF_INET_SDP
+#endif
+
+/* TODO: AF_INET6_SDP ? */
+
+#endif


Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.2519.4.20
retrieving revision 1.2519.4.21
diff -u -r1.2519.4.20 -r1.2519.4.21
--- kernel-2.6.spec	30 Aug 2006 19:26:40 -0000	1.2519.4.20
+++ kernel-2.6.spec	30 Aug 2006 21:35:13 -0000	1.2519.4.21
@@ -468,6 +468,8 @@
 # Lockdep fixes.
 Patch2400: linux-2.6-lockdep-fixes.patch
 
+# Infiniband driver
+Patch2500: linux-2.6-openib-sdp.patch
 
 #
 # 10000 to 20000 is for stuff that has to come last due to the
@@ -1055,6 +1057,9 @@
 # Lockdep fixes
 %patch2400 -p1
 
+# Infiniband driver
+%patch2500 -p1
+
 #
 # Patches 5000 to 6000 are reserved for new drivers that are about to
 # be merged upstream
@@ -1790,6 +1795,9 @@
 
 %changelog
 * Wed Aug 29 2006 Don Zickus <dzickus at redhat.com>
+- added #199756 - include latest Infiniband SDP support (Doug Ledford)
+
+* Wed Aug 29 2006 Don Zickus <dzickus at redhat.com>
 - now that we build EHEA, fix it to compile
 
 * Wed Aug 29 2006 Don Zickus <dzickus at redhat.com>




More information about the fedora-cvs-commits mailing list