6958745 Few issues during rdbms bring-up with rdsv3
6954116 IB drivers declare invalid elf dependencies, confuse pkgdepend, cause build noise
6955657 rds port space should be IP address specific
6955311 support of rds-info
6953258 on error ret from umem_lockmemory rdsv3_ib_get_mr() needs to negate that errno before its return
--- a/usr/src/uts/common/io/ib/clients/rdsv3/af_rds.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/af_rds.c Mon Jun 07 16:40:07 2010 -0700
@@ -299,8 +299,12 @@
rval = rdsv3_do_ip_ioctl(so4, &buf, &bufsize, &numifs);
if (rval != 0) break;
if (cmd == SIOCGLIFNUM) {
- (void) ddi_copyout(&numifs, (void *)arg,
- sizeof (int), 0);
+ struct lifnum lifn;
+ lifn.lifn_family = AF_INET_OFFLOAD;
+ lifn.lifn_flags = 0;
+ lifn.lifn_count = numifs;
+ (void) ddi_copyout(&lifn, (void *)arg,
+ sizeof (struct lifnum), 0);
} else {
len = 0;
for (lifrp = (struct lifreq *)buf, rc = 0; rc < numifs;
@@ -448,6 +452,12 @@
break;
default:
+ if ((cmd >= RDSV3_INFO_FIRST) &&
+ (cmd <= RDSV3_INFO_LAST)) {
+ return (rdsv3_info_ioctl((struct rsock *)proto_handle,
+ cmd, (char *)arg, rvalp));
+ }
+ RDSV3_DPRINTF2("rdsv3_ioctl", "Unknown ioctl cmd: %d", cmd);
cmn_err(CE_CONT, "unsupported IOCTL cmd: %d \n", cmd);
rval = EOPNOTSUPP;
}
@@ -602,11 +612,6 @@
}
return (0);
default:
- if ((optname >= RDSV3_INFO_FIRST) &&
- (optname <= RDSV3_INFO_LAST)) {
- return (rdsv3_info_getsockopt(sk, optname, optval,
- optlen));
- }
RDSV3_DPRINTF2("rdsv3_getsockopt",
"Unknown: level: %d optname: %d", level, optname);
ret = -ENOPROTOOPT;
--- a/usr/src/uts/common/io/ib/clients/rdsv3/bind.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/bind.c Mon Jun 07 16:40:07 2010 -0700
@@ -46,8 +46,9 @@
{
struct rdsv3_sock *rs;
avl_index_t where;
+ uint64_t needle = ((uint64_t)addr << 32) | port;
- rs = avl_find(&rdsv3_bind_tree, &port, &where);
+ rs = avl_find(&rdsv3_bind_tree, &needle, &where);
if ((rs == NULL) && (insert != NULL)) {
insert->rs_bound_addr = addr;
insert->rs_bound_port = port;
--- a/usr/src/uts/common/io/ib/clients/rdsv3/connection.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/connection.c Mon Jun 07 16:40:07 2010 -0700
@@ -412,11 +412,7 @@
int (*visitor)(struct rdsv3_connection *, void *),
size_t item_len)
{
-#if !defined(__lock_lint) && !defined(__GNUC__)
- uint64_t buffer[(item_len + 7) / 8];
-#else
- uint64_t buffer[256];
-#endif
+ uint8_t *buffer;
struct rdsv3_connection *conn;
rw_enter(&rdsv3_conn_lock, RW_READER);
@@ -430,27 +426,34 @@
return;
}
+ /* allocate a little extra as this can get cast to a uint64_t */
+ buffer = kmem_zalloc(item_len + 8, KM_SLEEP);
+
conn = (struct rdsv3_connection *)avl_first(&rdsv3_conn_hash);
do {
/* XXX no c_lock usage.. */
- if (!visitor(conn, buffer))
- continue;
-
- /*
- * We copy as much as we can fit in the buffer,
- * but we count all items so that the caller
- * can resize the buffer.
- */
- if (len >= item_len) {
- rdsv3_info_copy(iter, buffer, item_len);
- len -= item_len;
+ if (visitor(conn, buffer)) {
+ /*
+ * We copy as much as we can fit in the buffer,
+ * but we count all items so that the caller
+ * can resize the buffer.
+ */
+ if (len >= item_len) {
+ RDSV3_DPRINTF4("rdsv3_for_each_conn_info",
+ "buffer: %p iter: %p bytes: %d", buffer,
+ iter->addr + iter->offset, item_len);
+ rdsv3_info_copy(iter, buffer, item_len);
+ len -= item_len;
+ }
+ lens->nr++;
}
- lens->nr++;
conn = AVL_NEXT(&rdsv3_conn_hash, conn);
} while (conn != NULL);
rw_exit(&rdsv3_conn_lock);
+
+ kmem_free(buffer, item_len + 8);
}
static int
--- a/usr/src/uts/common/io/ib/clients/rdsv3/ib.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/ib.c Mon Jun 07 16:40:07 2010 -0700
@@ -80,7 +80,7 @@
ibt_hca_attr_t *dev_attr;
char name[64];
- RDSV3_DPRINTF4("rdsv3_ib_add_one", "device: %p", device);
+ RDSV3_DPRINTF2("rdsv3_ib_add_one", "device: %p", device);
/* Only handle IB (no iWARP) devices */
if (device->node_type != RDMA_NODE_IB_CA)
@@ -146,7 +146,7 @@
ib_set_client_data(device, &rdsv3_ib_client, rds_ibdev);
- RDSV3_DPRINTF4("rdsv3_ib_add_one", "Return: device: %p", device);
+ RDSV3_DPRINTF2("rdsv3_ib_add_one", "Return: device: %p", device);
goto free_attr;
@@ -164,7 +164,7 @@
struct rdsv3_ib_device *rds_ibdev;
struct rdsv3_ib_ipaddr *i_ipaddr, *i_next;
- RDSV3_DPRINTF4("rdsv3_ib_remove_one", "device: %p", device);
+ RDSV3_DPRINTF2("rdsv3_ib_remove_one", "device: %p", device);
rds_ibdev = ib_get_client_data(device, &rdsv3_ib_client);
if (!rds_ibdev)
@@ -205,7 +205,7 @@
list_remove_node(&rds_ibdev->list);
kmem_free(rds_ibdev, sizeof (*rds_ibdev));
- RDSV3_DPRINTF4("rdsv3_ib_remove_one", "Return: device: %p", device);
+ RDSV3_DPRINTF2("rdsv3_ib_remove_one", "Return: device: %p", device);
}
#ifndef __lock_lint
--- a/usr/src/uts/common/io/ib/clients/rdsv3/ib_rdma.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/ib_rdma.c Mon Jun 07 16:40:07 2010 -0700
@@ -364,7 +364,7 @@
&umem_cookie, NULL, NULL);
if (ret != 0) {
kmem_free((void *) ibmr, sizeof (*ibmr));
- ibmr = ERR_PTR(ret);
+ ibmr = ERR_PTR(-ret);
return (ibmr);
}
--- a/usr/src/uts/common/io/ib/clients/rdsv3/ib_recv.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/ib_recv.c Mon Jun 07 16:40:07 2010 -0700
@@ -964,8 +964,6 @@
return (ret);
}
-uint_t MaxRecvMemory = 128 * 1024 * 1024;
-
extern int rdsv3_ib_inc_constructor(void *buf, void *arg, int kmflags);
extern void rdsv3_ib_inc_destructor(void *buf, void *arg);
@@ -974,9 +972,6 @@
{
RDSV3_DPRINTF4("rdsv3_ib_recv_init", "Enter");
- /* XXX - hard code it to 128 MB */
- rdsv3_ib_sysctl_max_recv_allocation = MaxRecvMemory / RDSV3_FRAG_SIZE;
-
rdsv3_ib_incoming_slab = kmem_cache_create("rdsv3_ib_incoming",
sizeof (struct rdsv3_ib_incoming), 0, rdsv3_ib_inc_constructor,
rdsv3_ib_inc_destructor, NULL, NULL, NULL, 0);
--- a/usr/src/uts/common/io/ib/clients/rdsv3/ib_sysctl.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/ib_sysctl.c Mon Jun 07 16:40:07 2010 -0700
@@ -55,11 +55,12 @@
*
*/
#include <sys/ib/clients/rdsv3/ib.h>
+#include <sys/ib/clients/rdsv3/rdsv3_debug.h>
unsigned long rdsv3_ib_sysctl_max_send_wr = RDSV3_IB_DEFAULT_SEND_WR;
unsigned long rdsv3_ib_sysctl_max_recv_wr = RDSV3_IB_DEFAULT_RECV_WR;
unsigned long rdsv3_ib_sysctl_max_recv_allocation =
- (128 * 1024 * 1024) / RDSV3_FRAG_SIZE;
+ (512 * 1024 * 1024) / RDSV3_FRAG_SIZE;
/* hardware will fail CQ creation long before this */
unsigned long rdsv3_ib_sysctl_max_unsig_wrs = 16;
@@ -86,5 +87,18 @@
int
rdsv3_ib_sysctl_init(void)
{
+ RDSV3_DPRINTF2("rdsv3_ib_sysctl_init",
+ "rdsv3_ib_sysctl_max_send_wr = 0x%lx "
+ "rdsv3_ib_sysctl_max_recv_wr = 0x%lx "
+ "rdsv3_ib_sysctl_max_recv_allocation = 0x%lx "
+ "rdsv3_ib_sysctl_max_unsig_wrs = 0x%lx "
+ "rdsv3_ib_sysctl_max_unsig_bytes = 0x%lx "
+ "rdsv3_ib_sysctl_flow_control = 0x%x",
+ rdsv3_ib_sysctl_max_send_wr,
+ rdsv3_ib_sysctl_max_recv_wr,
+ rdsv3_ib_sysctl_max_recv_allocation,
+ rdsv3_ib_sysctl_max_unsig_wrs,
+ rdsv3_ib_sysctl_max_unsig_bytes,
+ rdsv3_ib_sysctl_flow_control);
return (0);
}
--- a/usr/src/uts/common/io/ib/clients/rdsv3/info.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/info.c Mon Jun 07 16:40:07 2010 -0700
@@ -57,6 +57,7 @@
#include <sys/rds.h>
#include <sys/ib/clients/rdsv3/rdsv3.h>
+#include <sys/ib/clients/rdsv3/rdsv3_debug.h>
/*
* This file implements a getsockopt() call which copies a set of fixed
@@ -113,43 +114,91 @@
* @optval points to the userspace buffer that the information snapshot
* will be copied into.
*
- * @optlen on input is the size of the buffer in userspace. @optlen
- * on output is the size of the requested snapshot in bytes.
- *
* This function returns -errno if there is a failure, particularly -ENOSPC
* if the given userspace buffer was not large enough to fit the snapshot.
* On success it returns the positive number of bytes of each array element
* in the snapshot.
*/
int
-rdsv3_info_getsockopt(struct rsock *sock, int optname, char *optval,
- socklen_t *optlen)
+rdsv3_info_ioctl(struct rsock *sock, int optname, char *optval,
+ int32_t *rvalp)
{
struct rdsv3_info_iterator iter;
struct rdsv3_info_lengths lens;
rdsv3_info_func func;
+ struct rds_info_arg arg;
+ uint32_t ulen = 0, klen;
func = rdsv3_info_funcs[optname - RDSV3_INFO_FIRST];
if (func == NULL) {
- return (-ENOPROTOOPT);
+ RDSV3_DPRINTF2("rdsv3_info_ioctl",
+ "No Info Function, optname: %d", optname);
+ return (ENOPROTOOPT);
+ }
+
+ if (optval == NULL) {
+ RDSV3_DPRINTF2("rdsv3_info_ioctl", "optval is NULL");
+ return (EINVAL);
+ }
+ if (ddi_copyin(optval, &arg, sizeof (struct rds_info_arg), 0) != 0) {
+ RDSV3_DPRINTF2("rdsv3_info_ioctl",
+ "ddi_copyin for address: 0x%p failed", optval);
+ return (EFAULT);
}
- if (*optlen == sizeof (struct rdsv3_info_lengths)) {
- iter.addr = NULL;
- } else {
- iter.addr = optval;
+ RDSV3_DPRINTF4("rdsv3_info_ioctl",
+ "optname: %d lenp: %llx datap: %llx", optname, arg.lenp, arg.datap);
+
+ if (arg.lenp == NULL) {
+ RDSV3_DPRINTF2("rdsv3_info_ioctl", "arg.lenp is NULL");
+ return (EFAULT);
+ }
+
+ if (ddi_copyin((void *)(uintptr_t)arg.lenp, &ulen,
+ sizeof (uint32_t), 0) != 0) {
+ RDSV3_DPRINTF2("rdsv3_info_ioctl",
+ "ddi_copyin for address, lenp: 0x%p failed", arg.lenp);
+ return (EFAULT);
}
+ RDSV3_DPRINTF3("rdsv3_info_ioctl", "optname: %d len: %d datap: %p",
+ optname, ulen, arg.datap);
+
+ bzero(&iter, sizeof (struct rdsv3_info_iterator));
+ /* a 0 len call is just trying to probe its length */
+ if (ulen == 0) {
+ iter.addr = NULL;
+ } else if (arg.datap == NULL) {
+ RDSV3_DPRINTF2("rdsv3_info_ioctl",
+ "arg.datap is NULL, ulen set to: %d", ulen);
+ return (EINVAL);
+ } else {
+ iter.addr = (char *)(uintptr_t)arg.datap;
+ }
iter.offset = 0;
- func(sock, *optlen, &iter, &lens);
- ASSERT(lens.each != 0);
+ bzero(&lens, sizeof (struct rdsv3_info_lengths));
+ func(sock, ulen, &iter, &lens);
+
+ klen = lens.nr * lens.each;
- if (iter.addr == NULL) {
- bcopy(&lens, optval, sizeof (struct rdsv3_info_lengths));
- } else {
- *optlen = lens.nr * lens.each;
+ if (ddi_copyout(&klen, (void *)(uintptr_t)arg.lenp,
+ sizeof (uint32_t), 0) != 0) {
+ RDSV3_DPRINTF2("rdsv3_info_ioctl",
+ "ddi_copyout(%p %p) failed", &klen, arg.lenp);
+ return (EFAULT);
}
+ RDSV3_DPRINTF3("rdsv3_info_ioctl",
+ "optname: %d ulen: %d klen: %d each: %d", optname, ulen, klen,
+ lens.each);
+
+ if (ulen < klen) {
+ return (ENOSPC);
+ }
+
+ RDSV3_DPRINTF4("rdsv3_info_ioctl", "Return optname: %d", optname);
+
+ *rvalp = lens.each;
return (0);
}
--- a/usr/src/uts/common/io/ib/clients/rdsv3/message.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/message.c Mon Jun 07 16:40:07 2010 -0700
@@ -389,8 +389,12 @@
ret = uiomove(rdsv3_sg_page(sg), rdsv3_sg_len(sg), UIO_WRITE,
uiop);
- if (ret)
+ if (ret) {
+ RDSV3_DPRINTF2("rdsv3_message_copy_from_user",
+ "uiomove failed");
+ ret = -ret;
goto out;
+ }
total_len -= rdsv3_sg_len(sg);
sg++;
--- a/usr/src/uts/common/io/ib/clients/rdsv3/rds_recv.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/rds_recv.c Mon Jun 07 16:40:07 2010 -0700
@@ -466,13 +466,18 @@
{
struct rsock *sk = rdsv3_rs_to_sk(rs);
long timeo;
- int ret = 0, nonblock = msg_flags & MSG_DONTWAIT;
+ int ret = 0;
struct sockaddr_in *sin = NULL;
struct rdsv3_incoming *inc = NULL;
+ boolean_t nonblock = B_FALSE;
RDSV3_DPRINTF4("rdsv3_recvmsg",
"Enter(rs: %p size: %d msg_flags: 0x%x)", rs, size, msg_flags);
+ if ((uio->uio_fmode & (FNDELAY | FNONBLOCK)) ||
+ (msg_flags & MSG_DONTWAIT))
+ nonblock = B_TRUE;
+
/* udp_recvmsg()->sock_recvtimeo() gets away without locking too.. */
timeo = rdsv3_rcvtimeo(sk, nonblock);
--- a/usr/src/uts/common/io/ib/clients/rdsv3/rdsv3_impl.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/rdsv3_impl.c Mon Jun 07 16:40:07 2010 -0700
@@ -262,6 +262,7 @@
/* save the record */
bcopy(lp, rlp, sizeof (struct lifreq));
+ rlp->lifr_addr.ss_family = AF_INET_OFFLOAD;
rlp++;
}
@@ -475,6 +476,7 @@
/* save the record */
bcopy(lp, rlp, sizeof (struct ifreq));
+ rlp->ifr_addr.sa_family = AF_INET_OFFLOAD;
rlp++;
}
@@ -1142,19 +1144,16 @@
return (1);
}
-/* XXX - need to enhance to compare IP address and port */
int
rdsv3_bind_node_compare(const void *a, const void *b)
{
- uint16_be_t port = *(in_port_t *)a;
+ uint64_t needle = *(uint64_t *)a;
struct rdsv3_sock *rs = (struct rdsv3_sock *)b;
- RDSV3_DPRINTF5("rdsv3_bind_node_compare", "Enter (%x %x)", port,
- rs->rs_bound_port);
-
- if (port > rs->rs_bound_port)
+ if (needle > (((uint64_t)rs->rs_bound_addr << 32) | rs->rs_bound_port))
return (+1);
- else if (port < rs->rs_bound_port)
+ else if (needle <
+ (((uint64_t)rs->rs_bound_addr << 32) | rs->rs_bound_port))
return (-1);
return (0);
--- a/usr/src/uts/common/io/ib/clients/rdsv3/stats.c Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/io/ib/clients/rdsv3/stats.c Mon Jun 07 16:40:07 2010 -0700
@@ -129,7 +129,7 @@
struct rdsv3_info_iterator *iter,
struct rdsv3_info_lengths *lens)
{
- struct rdsv3_statistics stats = {0, };
+ struct rdsv3_statistics stats;
uint64_t *src;
uint64_t *sum;
size_t i;
@@ -143,10 +143,14 @@
goto trans;
}
+ bzero(&stats, sizeof (struct rdsv3_statistics));
+
for (cpu = 0; cpu < NR_CPUS; cpu++) {
src = (uint64_t *)&(rdsv3_per_cpu(rdsv3_stats, cpu));
sum = (uint64_t *)&stats;
- for (i = 0; i < sizeof (stats) / sizeof (uint64_t); i++)
+ for (i = 0;
+ i < sizeof (struct rdsv3_statistics) / sizeof (uint64_t);
+ i++)
*(sum++) += *(src++);
}
--- a/usr/src/uts/common/sys/ib/clients/rdsv3/info.h Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/sys/ib/clients/rdsv3/info.h Mon Jun 07 16:40:07 2010 -0700
@@ -48,12 +48,12 @@
struct rdsv3_info_lengths *lens);
#define rdsv3_info_copy(iter, data, bytes) \
- bcopy(data, iter->addr + iter->offset, bytes); \
+ (void) ddi_copyout(data, iter->addr + iter->offset, bytes, 0); \
iter->offset += bytes
void rdsv3_info_register_func(int optname, rdsv3_info_func func);
void rdsv3_info_deregister_func(int optname, rdsv3_info_func func);
-int rdsv3_info_getsockopt(struct rsock *sock, int optname, char *optval,
- socklen_t *optlen);
+int rdsv3_info_ioctl(struct rsock *sock, int optname, char *optval,
+ int32_t *rvalp);
#endif /* _RDSV3_INFO_H */
--- a/usr/src/uts/common/sys/rds.h Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/common/sys/rds.h Mon Jun 07 16:40:07 2010 -0700
@@ -131,6 +131,11 @@
#define RDSV3_INFO_IWARP_CONNECTIONS 10010
#define RDSV3_INFO_LAST 10010
+struct rds_info_arg {
+ uint64_t lenp;
+ uint64_t datap;
+};
+
#ifndef __lock_lint
#pragma pack(1)
struct rdsv3_info_counter {
--- a/usr/src/uts/intel/ibp/Makefile Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/intel/ibp/Makefile Mon Jun 07 16:40:07 2010 -0700
@@ -37,7 +37,7 @@
ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE)
CONF_SRCDIR = $(UTSBASE)/common/io/ib/clients/ibd
LDFLAGS += -dy -Nmisc/mac -Nmisc/ibtl -Nmisc/ibcm -Nmisc/ibmf -Ndrv/ip \
- -Nmisc/dls -Nmisc/dld
+ -Nmisc/dls -Ndrv/dld
WARLOCK_OUT = $(IBD_OBJS:%.o=%.ll)
WARLOCK_OK = $(MODULE).ok
WLCMD_DIR = $(UTSBASE)/common/io/warlock
--- a/usr/src/uts/intel/rdsv3/Makefile Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/intel/rdsv3/Makefile Mon Jun 07 16:40:07 2010 -0700
@@ -35,7 +35,7 @@
LINTS = $(RDSV3_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE)
CFLAGS += $(CCVERBOSE) $(_XPG4_2)
-LDFLAGS += -dy -Nfs/sockfs -Nmisc/ksocket -Nmisc/ip -Nmisc/ibtl -Nmisc/ibcm -Nmisc/sol_ofs
+LDFLAGS += -dy -Nfs/sockfs -Nmisc/ksocket -Ndrv/ip -Nmisc/ibtl -Nmisc/ibcm -Nmisc/sol_ofs
CONF_SRCDIR = $(UTSBASE)/common/io/ib/clients/rdsv3
#
# Include common rules.
--- a/usr/src/uts/sparc/ibp/Makefile Mon Jun 07 17:33:23 2010 -0400
+++ b/usr/src/uts/sparc/ibp/Makefile Mon Jun 07 16:40:07 2010 -0700
@@ -37,7 +37,7 @@
ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE)
CONF_SRCDIR = $(UTSBASE)/common/io/ib/clients/ibd
LDFLAGS += -dy -Nmisc/mac -Nmisc/ibtl -Nmisc/ibcm -Nmisc/ibmf -Ndrv/ip \
- -Nmisc/dls -Nmisc/dld
+ -Nmisc/dls -Ndrv/dld
WARLOCK_OUT = $(IBD_OBJS:%.o=%.ll)
WARLOCK_OK = $(MODULE).ok
WLCMD_DIR = $(UTSBASE)/common/io/warlock