Skip to content

Commit

Permalink
Merge branch 'for-davem' of git://oss.oracle.com/git/agrover/linux-2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
David S. Miller committed Sep 9, 2010
2 parents f27e21a + 905d64c commit cf0ac2b
Show file tree
Hide file tree
Showing 42 changed files with 2,614 additions and 1,613 deletions.
1 change: 1 addition & 0 deletions include/linux/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
106 changes: 65 additions & 41 deletions include/linux/rds.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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;
};

Expand All @@ -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 */
26 changes: 22 additions & 4 deletions net/rds/af_rds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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:
Expand Down Expand Up @@ -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);
Expand All @@ -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;

Expand Down
Loading

0 comments on commit cf0ac2b

Please sign in to comment.