Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf0ac2b8 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'for-davem' of git://oss.oracle.com/git/agrover/linux-2.6

parents f27e21a8 905d64c8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -302,6 +302,7 @@ header-y += quota.h
header-y += radeonfb.h
header-y += random.h
header-y += raw.h
header-y += rds.h
header-y += reboot.h
header-y += reiserfs_fs.h
header-y += reiserfs_xattr.h
+65 −41
Original line number Diff line number Diff line
@@ -73,6 +73,10 @@
#define RDS_CMSG_RDMA_MAP		3
#define RDS_CMSG_RDMA_STATUS		4
#define RDS_CMSG_CONG_UPDATE		5
#define RDS_CMSG_ATOMIC_FADD		6
#define RDS_CMSG_ATOMIC_CSWP		7
#define RDS_CMSG_MASKED_ATOMIC_FADD	8
#define RDS_CMSG_MASKED_ATOMIC_CSWP	9

#define RDS_INFO_FIRST			10000
#define RDS_INFO_COUNTERS		10000
@@ -89,9 +93,9 @@
#define RDS_INFO_LAST			10010

struct rds_info_counter {
	u_int8_t	name[32];
	u_int64_t	value;
} __packed;
	uint8_t	name[32];
	uint64_t	value;
} __attribute__((packed));

#define RDS_INFO_CONNECTION_FLAG_SENDING	0x01
#define RDS_INFO_CONNECTION_FLAG_CONNECTING	0x02
@@ -100,56 +104,48 @@ struct rds_info_counter {
#define TRANSNAMSIZ	16

struct rds_info_connection {
	u_int64_t	next_tx_seq;
	u_int64_t	next_rx_seq;
	uint64_t	next_tx_seq;
	uint64_t	next_rx_seq;
	__be32		laddr;
	__be32		faddr;
	u_int8_t	transport[TRANSNAMSIZ];		/* null term ascii */
	u_int8_t	flags;
} __packed;

struct rds_info_flow {
	__be32		laddr;
	__be32		faddr;
	u_int32_t	bytes;
	__be16		lport;
	__be16		fport;
} __packed;
	uint8_t	transport[TRANSNAMSIZ];		/* null term ascii */
	uint8_t	flags;
} __attribute__((packed));

#define RDS_INFO_MESSAGE_FLAG_ACK               0x01
#define RDS_INFO_MESSAGE_FLAG_FAST_ACK          0x02

struct rds_info_message {
	u_int64_t	seq;
	u_int32_t	len;
	uint64_t	seq;
	uint32_t	len;
	__be32		laddr;
	__be32		faddr;
	__be16		lport;
	__be16		fport;
	u_int8_t	flags;
} __packed;
	uint8_t	flags;
} __attribute__((packed));

struct rds_info_socket {
	u_int32_t	sndbuf;
	uint32_t	sndbuf;
	__be32		bound_addr;
	__be32		connected_addr;
	__be16		bound_port;
	__be16		connected_port;
	u_int32_t	rcvbuf;
	u_int64_t	inum;
} __packed;
	uint32_t	rcvbuf;
	uint64_t	inum;
} __attribute__((packed));

struct rds_info_tcp_socket {
	__be32          local_addr;
	__be16          local_port;
	__be32          peer_addr;
	__be16          peer_port;
	u_int64_t       hdr_rem;
	u_int64_t       data_rem;
	u_int32_t       last_sent_nxt;
	u_int32_t       last_expected_una;
	u_int32_t       last_seen_una;
} __packed;
	uint64_t       hdr_rem;
	uint64_t       data_rem;
	uint32_t       last_sent_nxt;
	uint32_t       last_expected_una;
	uint32_t       last_seen_una;
} __attribute__((packed));

#define RDS_IB_GID_LEN	16
struct rds_info_rdma_connection {
@@ -203,42 +199,69 @@ struct rds_info_rdma_connection {
 * (so that the application does not have to worry about
 * alignment).
 */
typedef u_int64_t	rds_rdma_cookie_t;
typedef uint64_t	rds_rdma_cookie_t;

struct rds_iovec {
	u_int64_t	addr;
	u_int64_t	bytes;
	uint64_t	addr;
	uint64_t	bytes;
};

struct rds_get_mr_args {
	struct rds_iovec vec;
	u_int64_t	cookie_addr;
	uint64_t	cookie_addr;
	uint64_t	flags;
};

struct rds_get_mr_for_dest_args {
	struct sockaddr_storage	dest_addr;
	struct rds_iovec 	vec;
	u_int64_t		cookie_addr;
	uint64_t		cookie_addr;
	uint64_t		flags;
};

struct rds_free_mr_args {
	rds_rdma_cookie_t cookie;
	u_int64_t	flags;
	uint64_t	flags;
};

struct rds_rdma_args {
	rds_rdma_cookie_t cookie;
	struct rds_iovec remote_vec;
	u_int64_t	local_vec_addr;
	u_int64_t	nr_local;
	u_int64_t	flags;
	u_int64_t	user_token;
	uint64_t	local_vec_addr;
	uint64_t	nr_local;
	uint64_t	flags;
	uint64_t	user_token;
};

struct rds_atomic_args {
	rds_rdma_cookie_t cookie;
	uint64_t 	local_addr;
	uint64_t 	remote_addr;
	union {
		struct {
			uint64_t	compare;
			uint64_t	swap;
		} cswp;
		struct {
			uint64_t	add;
		} fadd;
		struct {
			uint64_t	compare;
			uint64_t	swap;
			uint64_t	compare_mask;
			uint64_t	swap_mask;
		} m_cswp;
		struct {
			uint64_t	add;
			uint64_t	nocarry_mask;
		} m_fadd;
	};
	uint64_t	flags;
	uint64_t	user_token;
};

struct rds_rdma_notify {
	u_int64_t	user_token;
	uint64_t	user_token;
	int32_t		status;
};

@@ -257,5 +280,6 @@ struct rds_rdma_notify {
#define RDS_RDMA_USE_ONCE	0x0008	/* free MR after use */
#define RDS_RDMA_DONTWAIT	0x0010	/* Don't wait in SET_BARRIER */
#define RDS_RDMA_NOTIFY_ME	0x0020	/* Notify when operation completes */
#define RDS_RDMA_SILENT		0x0040	/* Do not interrupt remote */

#endif /* IB_RDS_H */
+22 −4
Original line number Diff line number Diff line
@@ -39,7 +39,15 @@
#include <net/sock.h>

#include "rds.h"
#include "rdma.h"

char *rds_str_array(char **array, size_t elements, size_t index)
{
	if ((index < elements) && array[index])
		return array[index];
	else
		return "unknown";
}
EXPORT_SYMBOL(rds_str_array);

/* this is just used for stats gathering :/ */
static DEFINE_SPINLOCK(rds_sock_lock);
@@ -62,7 +70,7 @@ static int rds_release(struct socket *sock)
	struct rds_sock *rs;
	unsigned long flags;

	if (sk == NULL)
	if (!sk)
		goto out;

	rs = rds_sk_to_rs(sk);
@@ -73,7 +81,15 @@ static int rds_release(struct socket *sock)
	 * with the socket. */
	rds_clear_recv_queue(rs);
	rds_cong_remove_socket(rs);

	/*
	 * the binding lookup hash uses rcu, we need to
	 * make sure we sychronize_rcu before we free our
	 * entry
	 */
	rds_remove_bound(rs);
	synchronize_rcu();

	rds_send_drop_to(rs, NULL);
	rds_rdma_drop_keys(rs);
	rds_notify_queue_get(rs, NULL);
@@ -83,6 +99,8 @@ static int rds_release(struct socket *sock)
	rds_sock_count--;
	spin_unlock_irqrestore(&rds_sock_lock, flags);

	rds_trans_put(rs->rs_transport);

	sock->sk = NULL;
	sock_put(sk);
out:
@@ -514,7 +532,7 @@ static void rds_sock_info(struct socket *sock, unsigned int len,
	spin_unlock_irqrestore(&rds_sock_lock, flags);
}

static void __exit rds_exit(void)
static void rds_exit(void)
{
	sock_unregister(rds_family_ops.family);
	proto_unregister(&rds_proto);
@@ -529,7 +547,7 @@ static void __exit rds_exit(void)
}
module_exit(rds_exit);

static int __init rds_init(void)
static int rds_init(void)
{
	int ret;

+42 −40
Original line number Diff line number Diff line
@@ -34,45 +34,52 @@
#include <net/sock.h>
#include <linux/in.h>
#include <linux/if_arp.h>
#include <linux/jhash.h>
#include "rds.h"

/*
 * XXX this probably still needs more work.. no INADDR_ANY, and rbtrees aren't
 * particularly zippy.
 *
 * This is now called for every incoming frame so we arguably care much more
 * about it than we used to.
 */
#define BIND_HASH_SIZE 1024
static struct hlist_head bind_hash_table[BIND_HASH_SIZE];
static DEFINE_SPINLOCK(rds_bind_lock);
static struct rb_root rds_bind_tree = RB_ROOT;

static struct rds_sock *rds_bind_tree_walk(__be32 addr, __be16 port,
static struct hlist_head *hash_to_bucket(__be32 addr, __be16 port)
{
	return bind_hash_table + (jhash_2words((u32)addr, (u32)port, 0) &
				  (BIND_HASH_SIZE - 1));
}

static struct rds_sock *rds_bind_lookup(__be32 addr, __be16 port,
					struct rds_sock *insert)
{
	struct rb_node **p = &rds_bind_tree.rb_node;
	struct rb_node *parent = NULL;
	struct rds_sock *rs;
	struct hlist_node *node;
	struct hlist_head *head = hash_to_bucket(addr, port);
	u64 cmp;
	u64 needle = ((u64)be32_to_cpu(addr) << 32) | be16_to_cpu(port);

	while (*p) {
		parent = *p;
		rs = rb_entry(parent, struct rds_sock, rs_bound_node);

	rcu_read_lock();
	hlist_for_each_entry_rcu(rs, node, head, rs_bound_node) {
		cmp = ((u64)be32_to_cpu(rs->rs_bound_addr) << 32) |
		      be16_to_cpu(rs->rs_bound_port);

		if (needle < cmp)
			p = &(*p)->rb_left;
		else if (needle > cmp)
			p = &(*p)->rb_right;
		else
		if (cmp == needle) {
			rcu_read_unlock();
			return rs;
		}
	}
	rcu_read_unlock();

	if (insert) {
		rb_link_node(&insert->rs_bound_node, parent, p);
		rb_insert_color(&insert->rs_bound_node, &rds_bind_tree);
		/*
		 * make sure our addr and port are set before
		 * we are added to the list, other people
		 * in rcu will find us as soon as the
		 * hlist_add_head_rcu is done
		 */
		insert->rs_bound_addr = addr;
		insert->rs_bound_port = port;
		rds_sock_addref(insert);

		hlist_add_head_rcu(&insert->rs_bound_node, head);
	}
	return NULL;
}
@@ -86,15 +93,13 @@ static struct rds_sock *rds_bind_tree_walk(__be32 addr, __be16 port,
struct rds_sock *rds_find_bound(__be32 addr, __be16 port)
{
	struct rds_sock *rs;
	unsigned long flags;

	spin_lock_irqsave(&rds_bind_lock, flags);
	rs = rds_bind_tree_walk(addr, port, NULL);
	rs = rds_bind_lookup(addr, port, NULL);

	if (rs && !sock_flag(rds_rs_to_sk(rs), SOCK_DEAD))
		rds_sock_addref(rs);
	else
		rs = NULL;
	spin_unlock_irqrestore(&rds_bind_lock, flags);

	rdsdebug("returning rs %p for %pI4:%u\n", rs, &addr,
		ntohs(port));
@@ -121,21 +126,14 @@ static int rds_add_bound(struct rds_sock *rs, __be32 addr, __be16 *port)
	do {
		if (rover == 0)
			rover++;
		if (rds_bind_tree_walk(addr, cpu_to_be16(rover), rs) == NULL) {
			*port = cpu_to_be16(rover);
		if (!rds_bind_lookup(addr, cpu_to_be16(rover), rs)) {
			*port = rs->rs_bound_port;
			ret = 0;
			break;
		}
	} while (rover++ != last);

	if (ret == 0)  {
		rs->rs_bound_addr = addr;
		rs->rs_bound_port = *port;
		rds_sock_addref(rs);

			rdsdebug("rs %p binding to %pI4:%d\n",
			  rs, &addr, (int)ntohs(*port));
			break;
		}
	} while (rover++ != last);

	spin_unlock_irqrestore(&rds_bind_lock, flags);

@@ -153,7 +151,7 @@ void rds_remove_bound(struct rds_sock *rs)
		  rs, &rs->rs_bound_addr,
		  ntohs(rs->rs_bound_port));

		rb_erase(&rs->rs_bound_node, &rds_bind_tree);
		hlist_del_init_rcu(&rs->rs_bound_node);
		rds_sock_put(rs);
		rs->rs_bound_addr = 0;
	}
@@ -184,7 +182,7 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
		goto out;

	trans = rds_trans_get_preferred(sin->sin_addr.s_addr);
	if (trans == NULL) {
	if (!trans) {
		ret = -EADDRNOTAVAIL;
		rds_remove_bound(rs);
		if (printk_ratelimit())
@@ -198,5 +196,9 @@ int rds_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)

out:
	release_sock(sk);

	/* we might have called rds_remove_bound on error */
	if (ret)
		synchronize_rcu();
	return ret;
}
+4 −4
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ static struct rds_cong_map *rds_cong_from_addr(__be32 addr)
	unsigned long flags;

	map = kzalloc(sizeof(struct rds_cong_map), GFP_KERNEL);
	if (map == NULL)
	if (!map)
		return NULL;

	map->m_addr = addr;
@@ -159,7 +159,7 @@ static struct rds_cong_map *rds_cong_from_addr(__be32 addr)
	ret = rds_cong_tree_walk(addr, map);
	spin_unlock_irqrestore(&rds_cong_lock, flags);

	if (ret == NULL) {
	if (!ret) {
		ret = map;
		map = NULL;
	}
@@ -205,7 +205,7 @@ int rds_cong_get_maps(struct rds_connection *conn)
	conn->c_lcong = rds_cong_from_addr(conn->c_laddr);
	conn->c_fcong = rds_cong_from_addr(conn->c_faddr);

	if (conn->c_lcong == NULL || conn->c_fcong == NULL)
	if (!(conn->c_lcong && conn->c_fcong))
		return -ENOMEM;

	return 0;
@@ -221,7 +221,7 @@ void rds_cong_queue_updates(struct rds_cong_map *map)
	list_for_each_entry(conn, &map->m_conn_list, c_map_item) {
		if (!test_and_set_bit(0, &conn->c_map_queued)) {
			rds_stats_inc(s_cong_update_queued);
			queue_delayed_work(rds_wq, &conn->c_send_w, 0);
			rds_send_xmit(conn);
		}
	}

Loading