Commit 07ebafba authored by Tom Tucker's avatar Tom Tucker Committed by Roland Dreier

RDMA: iWARP Core Changes.

Modifications to the existing rdma header files, core files, drivers,
and ulp files to support iWARP, including:
 - Hook iWARP CM into the build system and use it in rdma_cm.
 - Convert enum ib_node_type to enum rdma_node_type, which includes
   the possibility of RDMA_NODE_RNIC, and update everything for this.
Signed-off-by: default avatarTom Tucker <tom@opengridcomputing.com>
Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 922a8e9f
infiniband-$(CONFIG_INFINIBAND_ADDR_TRANS) := ib_addr.o rdma_cm.o infiniband-$(CONFIG_INFINIBAND_ADDR_TRANS) := ib_addr.o rdma_cm.o
obj-$(CONFIG_INFINIBAND) += ib_core.o ib_mad.o ib_sa.o \ obj-$(CONFIG_INFINIBAND) += ib_core.o ib_mad.o ib_sa.o \
ib_cm.o $(infiniband-y) ib_cm.o iw_cm.o $(infiniband-y)
obj-$(CONFIG_INFINIBAND_USER_MAD) += ib_umad.o obj-$(CONFIG_INFINIBAND_USER_MAD) += ib_umad.o
obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o ib_ucm.o obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o ib_ucm.o
...@@ -14,6 +14,8 @@ ib_sa-y := sa_query.o ...@@ -14,6 +14,8 @@ ib_sa-y := sa_query.o
ib_cm-y := cm.o ib_cm-y := cm.o
iw_cm-y := iwcm.o
rdma_cm-y := cma.o rdma_cm-y := cma.o
ib_addr-y := addr.o ib_addr-y := addr.o
......
...@@ -61,12 +61,15 @@ static LIST_HEAD(req_list); ...@@ -61,12 +61,15 @@ static LIST_HEAD(req_list);
static DECLARE_WORK(work, process_req, NULL); static DECLARE_WORK(work, process_req, NULL);
static struct workqueue_struct *addr_wq; static struct workqueue_struct *addr_wq;
static int copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev,
unsigned char *dst_dev_addr) const unsigned char *dst_dev_addr)
{ {
switch (dev->type) { switch (dev->type) {
case ARPHRD_INFINIBAND: case ARPHRD_INFINIBAND:
dev_addr->dev_type = IB_NODE_CA; dev_addr->dev_type = RDMA_NODE_IB_CA;
break;
case ARPHRD_ETHER:
dev_addr->dev_type = RDMA_NODE_RNIC;
break; break;
default: default:
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
...@@ -78,6 +81,7 @@ static int copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev, ...@@ -78,6 +81,7 @@ static int copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev,
memcpy(dev_addr->dst_dev_addr, dst_dev_addr, MAX_ADDR_LEN); memcpy(dev_addr->dst_dev_addr, dst_dev_addr, MAX_ADDR_LEN);
return 0; return 0;
} }
EXPORT_SYMBOL(rdma_copy_addr);
int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
{ {
...@@ -89,7 +93,7 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) ...@@ -89,7 +93,7 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
if (!dev) if (!dev)
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
ret = copy_addr(dev_addr, dev, NULL); ret = rdma_copy_addr(dev_addr, dev, NULL);
dev_put(dev); dev_put(dev);
return ret; return ret;
} }
...@@ -161,7 +165,7 @@ static int addr_resolve_remote(struct sockaddr_in *src_in, ...@@ -161,7 +165,7 @@ static int addr_resolve_remote(struct sockaddr_in *src_in,
/* If the device does ARP internally, return 'done' */ /* If the device does ARP internally, return 'done' */
if (rt->idev->dev->flags & IFF_NOARP) { if (rt->idev->dev->flags & IFF_NOARP) {
copy_addr(addr, rt->idev->dev, NULL); rdma_copy_addr(addr, rt->idev->dev, NULL);
goto put; goto put;
} }
...@@ -181,7 +185,7 @@ static int addr_resolve_remote(struct sockaddr_in *src_in, ...@@ -181,7 +185,7 @@ static int addr_resolve_remote(struct sockaddr_in *src_in,
src_in->sin_addr.s_addr = rt->rt_src; src_in->sin_addr.s_addr = rt->rt_src;
} }
ret = copy_addr(addr, neigh->dev, neigh->ha); ret = rdma_copy_addr(addr, neigh->dev, neigh->ha);
release: release:
neigh_release(neigh); neigh_release(neigh);
put: put:
...@@ -245,7 +249,7 @@ static int addr_resolve_local(struct sockaddr_in *src_in, ...@@ -245,7 +249,7 @@ static int addr_resolve_local(struct sockaddr_in *src_in,
if (ZERONET(src_ip)) { if (ZERONET(src_ip)) {
src_in->sin_family = dst_in->sin_family; src_in->sin_family = dst_in->sin_family;
src_in->sin_addr.s_addr = dst_ip; src_in->sin_addr.s_addr = dst_ip;
ret = copy_addr(addr, dev, dev->dev_addr); ret = rdma_copy_addr(addr, dev, dev->dev_addr);
} else if (LOOPBACK(src_ip)) { } else if (LOOPBACK(src_ip)) {
ret = rdma_translate_ip((struct sockaddr *)dst_in, addr); ret = rdma_translate_ip((struct sockaddr *)dst_in, addr);
if (!ret) if (!ret)
......
...@@ -62,12 +62,13 @@ struct ib_update_work { ...@@ -62,12 +62,13 @@ struct ib_update_work {
static inline int start_port(struct ib_device *device) static inline int start_port(struct ib_device *device)
{ {
return device->node_type == IB_NODE_SWITCH ? 0 : 1; return (device->node_type == RDMA_NODE_IB_SWITCH) ? 0 : 1;
} }
static inline int end_port(struct ib_device *device) static inline int end_port(struct ib_device *device)
{ {
return device->node_type == IB_NODE_SWITCH ? 0 : device->phys_port_cnt; return (device->node_type == RDMA_NODE_IB_SWITCH) ?
0 : device->phys_port_cnt;
} }
int ib_get_cached_gid(struct ib_device *device, int ib_get_cached_gid(struct ib_device *device,
......
...@@ -3280,6 +3280,9 @@ static void cm_add_one(struct ib_device *device) ...@@ -3280,6 +3280,9 @@ static void cm_add_one(struct ib_device *device)
int ret; int ret;
u8 i; u8 i;
if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
return;
cm_dev = kmalloc(sizeof(*cm_dev) + sizeof(*port) * cm_dev = kmalloc(sizeof(*cm_dev) + sizeof(*port) *
device->phys_port_cnt, GFP_KERNEL); device->phys_port_cnt, GFP_KERNEL);
if (!cm_dev) if (!cm_dev)
......
This diff is collapsed.
...@@ -505,7 +505,7 @@ int ib_query_port(struct ib_device *device, ...@@ -505,7 +505,7 @@ int ib_query_port(struct ib_device *device,
u8 port_num, u8 port_num,
struct ib_port_attr *port_attr) struct ib_port_attr *port_attr)
{ {
if (device->node_type == IB_NODE_SWITCH) { if (device->node_type == RDMA_NODE_IB_SWITCH) {
if (port_num) if (port_num)
return -EINVAL; return -EINVAL;
} else if (port_num < 1 || port_num > device->phys_port_cnt) } else if (port_num < 1 || port_num > device->phys_port_cnt)
...@@ -580,7 +580,7 @@ int ib_modify_port(struct ib_device *device, ...@@ -580,7 +580,7 @@ int ib_modify_port(struct ib_device *device,
u8 port_num, int port_modify_mask, u8 port_num, int port_modify_mask,
struct ib_port_modify *port_modify) struct ib_port_modify *port_modify)
{ {
if (device->node_type == IB_NODE_SWITCH) { if (device->node_type == RDMA_NODE_IB_SWITCH) {
if (port_num) if (port_num)
return -EINVAL; return -EINVAL;
} else if (port_num < 1 || port_num > device->phys_port_cnt) } else if (port_num < 1 || port_num > device->phys_port_cnt)
......
...@@ -2876,7 +2876,10 @@ static void ib_mad_init_device(struct ib_device *device) ...@@ -2876,7 +2876,10 @@ static void ib_mad_init_device(struct ib_device *device)
{ {
int start, end, i; int start, end, i;
if (device->node_type == IB_NODE_SWITCH) { if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
return;
if (device->node_type == RDMA_NODE_IB_SWITCH) {
start = 0; start = 0;
end = 0; end = 0;
} else { } else {
...@@ -2923,7 +2926,7 @@ static void ib_mad_remove_device(struct ib_device *device) ...@@ -2923,7 +2926,7 @@ static void ib_mad_remove_device(struct ib_device *device)
{ {
int i, num_ports, cur_port; int i, num_ports, cur_port;
if (device->node_type == IB_NODE_SWITCH) { if (device->node_type == RDMA_NODE_IB_SWITCH) {
num_ports = 1; num_ports = 1;
cur_port = 0; cur_port = 0;
} else { } else {
......
...@@ -919,7 +919,10 @@ static void ib_sa_add_one(struct ib_device *device) ...@@ -919,7 +919,10 @@ static void ib_sa_add_one(struct ib_device *device)
struct ib_sa_device *sa_dev; struct ib_sa_device *sa_dev;
int s, e, i; int s, e, i;
if (device->node_type == IB_NODE_SWITCH) if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
return;
if (device->node_type == RDMA_NODE_IB_SWITCH)
s = e = 0; s = e = 0;
else { else {
s = 1; s = 1;
......
...@@ -64,7 +64,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp, ...@@ -64,7 +64,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp,
/* C14-9:2 */ /* C14-9:2 */
if (hop_ptr && hop_ptr < hop_cnt) { if (hop_ptr && hop_ptr < hop_cnt) {
if (node_type != IB_NODE_SWITCH) if (node_type != RDMA_NODE_IB_SWITCH)
return 0; return 0;
/* smp->return_path set when received */ /* smp->return_path set when received */
...@@ -77,7 +77,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp, ...@@ -77,7 +77,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp,
if (hop_ptr == hop_cnt) { if (hop_ptr == hop_cnt) {
/* smp->return_path set when received */ /* smp->return_path set when received */
smp->hop_ptr++; smp->hop_ptr++;
return (node_type == IB_NODE_SWITCH || return (node_type == RDMA_NODE_IB_SWITCH ||
smp->dr_dlid == IB_LID_PERMISSIVE); smp->dr_dlid == IB_LID_PERMISSIVE);
} }
...@@ -95,7 +95,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp, ...@@ -95,7 +95,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp,
/* C14-13:2 */ /* C14-13:2 */
if (2 <= hop_ptr && hop_ptr <= hop_cnt) { if (2 <= hop_ptr && hop_ptr <= hop_cnt) {
if (node_type != IB_NODE_SWITCH) if (node_type != RDMA_NODE_IB_SWITCH)
return 0; return 0;
smp->hop_ptr--; smp->hop_ptr--;
...@@ -107,7 +107,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp, ...@@ -107,7 +107,7 @@ int smi_handle_dr_smp_send(struct ib_smp *smp,
if (hop_ptr == 1) { if (hop_ptr == 1) {
smp->hop_ptr--; smp->hop_ptr--;
/* C14-13:3 -- SMPs destined for SM shouldn't be here */ /* C14-13:3 -- SMPs destined for SM shouldn't be here */
return (node_type == IB_NODE_SWITCH || return (node_type == RDMA_NODE_IB_SWITCH ||
smp->dr_slid == IB_LID_PERMISSIVE); smp->dr_slid == IB_LID_PERMISSIVE);
} }
...@@ -142,7 +142,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp, ...@@ -142,7 +142,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp,
/* C14-9:2 -- intermediate hop */ /* C14-9:2 -- intermediate hop */
if (hop_ptr && hop_ptr < hop_cnt) { if (hop_ptr && hop_ptr < hop_cnt) {
if (node_type != IB_NODE_SWITCH) if (node_type != RDMA_NODE_IB_SWITCH)
return 0; return 0;
smp->return_path[hop_ptr] = port_num; smp->return_path[hop_ptr] = port_num;
...@@ -156,7 +156,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp, ...@@ -156,7 +156,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp,
smp->return_path[hop_ptr] = port_num; smp->return_path[hop_ptr] = port_num;
/* smp->hop_ptr updated when sending */ /* smp->hop_ptr updated when sending */
return (node_type == IB_NODE_SWITCH || return (node_type == RDMA_NODE_IB_SWITCH ||
smp->dr_dlid == IB_LID_PERMISSIVE); smp->dr_dlid == IB_LID_PERMISSIVE);
} }
...@@ -175,7 +175,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp, ...@@ -175,7 +175,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp,
/* C14-13:2 */ /* C14-13:2 */
if (2 <= hop_ptr && hop_ptr <= hop_cnt) { if (2 <= hop_ptr && hop_ptr <= hop_cnt) {
if (node_type != IB_NODE_SWITCH) if (node_type != RDMA_NODE_IB_SWITCH)
return 0; return 0;
/* smp->hop_ptr updated when sending */ /* smp->hop_ptr updated when sending */
...@@ -190,7 +190,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp, ...@@ -190,7 +190,7 @@ int smi_handle_dr_smp_recv(struct ib_smp *smp,
return 1; return 1;
} }
/* smp->hop_ptr updated when sending */ /* smp->hop_ptr updated when sending */
return (node_type == IB_NODE_SWITCH); return (node_type == RDMA_NODE_IB_SWITCH);
} }
/* C14-13:4 -- hop_ptr = 0 -> give to SM */ /* C14-13:4 -- hop_ptr = 0 -> give to SM */
......
...@@ -589,10 +589,11 @@ static ssize_t show_node_type(struct class_device *cdev, char *buf) ...@@ -589,10 +589,11 @@ static ssize_t show_node_type(struct class_device *cdev, char *buf)
return -ENODEV; return -ENODEV;
switch (dev->node_type) { switch (dev->node_type) {
case IB_NODE_CA: return sprintf(buf, "%d: CA\n", dev->node_type); case RDMA_NODE_IB_CA: return sprintf(buf, "%d: CA\n", dev->node_type);
case IB_NODE_SWITCH: return sprintf(buf, "%d: switch\n", dev->node_type); case RDMA_NODE_RNIC: return sprintf(buf, "%d: RNIC\n", dev->node_type);
case IB_NODE_ROUTER: return sprintf(buf, "%d: router\n", dev->node_type); case RDMA_NODE_IB_SWITCH: return sprintf(buf, "%d: switch\n", dev->node_type);
default: return sprintf(buf, "%d: <unknown>\n", dev->node_type); case RDMA_NODE_IB_ROUTER: return sprintf(buf, "%d: router\n", dev->node_type);
default: return sprintf(buf, "%d: <unknown>\n", dev->node_type);
} }
} }
...@@ -708,7 +709,7 @@ int ib_device_register_sysfs(struct ib_device *device) ...@@ -708,7 +709,7 @@ int ib_device_register_sysfs(struct ib_device *device)
if (ret) if (ret)
goto err_put; goto err_put;
if (device->node_type == IB_NODE_SWITCH) { if (device->node_type == RDMA_NODE_IB_SWITCH) {
ret = add_port(device, 0); ret = add_port(device, 0);
if (ret) if (ret)
goto err_put; goto err_put;
......
...@@ -1247,7 +1247,8 @@ static void ib_ucm_add_one(struct ib_device *device) ...@@ -1247,7 +1247,8 @@ static void ib_ucm_add_one(struct ib_device *device)
{ {
struct ib_ucm_device *ucm_dev; struct ib_ucm_device *ucm_dev;
if (!device->alloc_ucontext) if (!device->alloc_ucontext ||
rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
return; return;
ucm_dev = kzalloc(sizeof *ucm_dev, GFP_KERNEL); ucm_dev = kzalloc(sizeof *ucm_dev, GFP_KERNEL);
......
...@@ -1032,7 +1032,10 @@ static void ib_umad_add_one(struct ib_device *device) ...@@ -1032,7 +1032,10 @@ static void ib_umad_add_one(struct ib_device *device)
struct ib_umad_device *umad_dev; struct ib_umad_device *umad_dev;
int s, e, i; int s, e, i;
if (device->node_type == IB_NODE_SWITCH) if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
return;
if (device->node_type == RDMA_NODE_IB_SWITCH)
s = e = 0; s = e = 0;
else { else {
s = 1; s = 1;
......
...@@ -79,6 +79,23 @@ enum ib_rate mult_to_ib_rate(int mult) ...@@ -79,6 +79,23 @@ enum ib_rate mult_to_ib_rate(int mult)
} }
EXPORT_SYMBOL(mult_to_ib_rate); EXPORT_SYMBOL(mult_to_ib_rate);
enum rdma_transport_type
rdma_node_get_transport(enum rdma_node_type node_type)
{
switch (node_type) {
case RDMA_NODE_IB_CA:
case RDMA_NODE_IB_SWITCH:
case RDMA_NODE_IB_ROUTER:
return RDMA_TRANSPORT_IB;
case RDMA_NODE_RNIC:
return RDMA_TRANSPORT_IWARP;
default:
BUG();
return 0;
}
}
EXPORT_SYMBOL(rdma_node_get_transport);
/* Protection domains */ /* Protection domains */
struct ib_pd *ib_alloc_pd(struct ib_device *device) struct ib_pd *ib_alloc_pd(struct ib_device *device)
......
...@@ -269,7 +269,7 @@ int ehca_register_device(struct ehca_shca *shca) ...@@ -269,7 +269,7 @@ int ehca_register_device(struct ehca_shca *shca)
(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) | (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) |
(1ull << IB_USER_VERBS_CMD_DETACH_MCAST); (1ull << IB_USER_VERBS_CMD_DETACH_MCAST);
shca->ib_device.node_type = IB_NODE_CA; shca->ib_device.node_type = RDMA_NODE_IB_CA;
shca->ib_device.phys_port_cnt = shca->num_ports; shca->ib_device.phys_port_cnt = shca->num_ports;
shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev; shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev;
shca->ib_device.query_device = ehca_query_device; shca->ib_device.query_device = ehca_query_device;
......
...@@ -1538,7 +1538,7 @@ int ipath_register_ib_device(struct ipath_devdata *dd) ...@@ -1538,7 +1538,7 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
(1ull << IB_USER_VERBS_CMD_QUERY_SRQ) | (1ull << IB_USER_VERBS_CMD_QUERY_SRQ) |
(1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) | (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ) |
(1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV); (1ull << IB_USER_VERBS_CMD_POST_SRQ_RECV);
dev->node_type = IB_NODE_CA; dev->node_type = RDMA_NODE_IB_CA;
dev->phys_port_cnt = 1; dev->phys_port_cnt = 1;
dev->dma_device = &dd->pcidev->dev; dev->dma_device = &dd->pcidev->dev;
dev->class_dev.dev = dev->dma_device; dev->class_dev.dev = dev->dma_device;
......
...@@ -1288,7 +1288,7 @@ int mthca_register_device(struct mthca_dev *dev) ...@@ -1288,7 +1288,7 @@ int mthca_register_device(struct mthca_dev *dev)
(1ull << IB_USER_VERBS_CMD_DESTROY_QP) | (1ull << IB_USER_VERBS_CMD_DESTROY_QP) |
(1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) | (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) |
(1ull << IB_USER_VERBS_CMD_DETACH_MCAST); (1ull << IB_USER_VERBS_CMD_DETACH_MCAST);
dev->ib_dev.node_type = IB_NODE_CA; dev->ib_dev.node_type = RDMA_NODE_IB_CA;
dev->ib_dev.phys_port_cnt = dev->limits.num_ports; dev->ib_dev.phys_port_cnt = dev->limits.num_ports;
dev->ib_dev.dma_device = &dev->pdev->dev; dev->ib_dev.dma_device = &dev->pdev->dev;
dev->ib_dev.class_dev.dev = &dev->pdev->dev; dev->ib_dev.class_dev.dev = &dev->pdev->dev;
......
...@@ -1111,13 +1111,16 @@ static void ipoib_add_one(struct ib_device *device) ...@@ -1111,13 +1111,16 @@ static void ipoib_add_one(struct ib_device *device)
struct ipoib_dev_priv *priv; struct ipoib_dev_priv *priv;
int s, e, p; int s, e, p;
if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
return;
dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL); dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL);
if (!dev_list) if (!dev_list)
return; return;
INIT_LIST_HEAD(dev_list); INIT_LIST_HEAD(dev_list);
if (device->node_type == IB_NODE_SWITCH) { if (device->node_type == RDMA_NODE_IB_SWITCH) {
s = 0; s = 0;
e = 0; e = 0;
} else { } else {
...@@ -1141,6 +1144,9 @@ static void ipoib_remove_one(struct ib_device *device) ...@@ -1141,6 +1144,9 @@ static void ipoib_remove_one(struct ib_device *device)
struct ipoib_dev_priv *priv, *tmp; struct ipoib_dev_priv *priv, *tmp;
struct list_head *dev_list; struct list_head *dev_list;
if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
return;
dev_list = ib_get_client_data(device, &ipoib_client); dev_list = ib_get_client_data(device, &ipoib_client);
list_for_each_entry_safe(priv, tmp, dev_list, list) { list_for_each_entry_safe(priv, tmp, dev_list, list) {
......
...@@ -1899,7 +1899,7 @@ static void srp_add_one(struct ib_device *device) ...@@ -1899,7 +1899,7 @@ static void srp_add_one(struct ib_device *device)
if (IS_ERR(srp_dev->fmr_pool)) if (IS_ERR(srp_dev->fmr_pool))
srp_dev->fmr_pool = NULL; srp_dev->fmr_pool = NULL;
if (device->node_type == IB_NODE_SWITCH) { if (device->node_type == RDMA_NODE_IB_SWITCH) {
s = 0; s = 0;
e = 0; e = 0;
} else { } else {
......
...@@ -40,7 +40,7 @@ struct rdma_dev_addr { ...@@ -40,7 +40,7 @@ struct rdma_dev_addr {
unsigned char src_dev_addr[MAX_ADDR_LEN]; unsigned char src_dev_addr[MAX_ADDR_LEN];
unsigned char dst_dev_addr[MAX_ADDR_LEN]; unsigned char dst_dev_addr[MAX_ADDR_LEN];
unsigned char broadcast[MAX_ADDR_LEN]; unsigned char broadcast[MAX_ADDR_LEN];
enum ib_node_type dev_type; enum rdma_node_type dev_type;
}; };
/** /**
...@@ -72,6 +72,9 @@ int rdma_resolve_ip(struct sockaddr *src_addr, struct sockaddr *dst_addr, ...@@ -72,6 +72,9 @@ int rdma_resolve_ip(struct sockaddr *src_addr, struct sockaddr *dst_addr,
void rdma_addr_cancel(struct rdma_dev_addr *addr); void rdma_addr_cancel(struct rdma_dev_addr *addr);
int rdma_copy_addr(struct rdma_dev_addr *dev_addr, struct net_device *dev,
const unsigned char *dst_dev_addr);
static inline int ip_addr_size(struct sockaddr *addr) static inline int ip_addr_size(struct sockaddr *addr)
{ {
return addr->sa_family == AF_INET6 ? return addr->sa_family == AF_INET6 ?
...@@ -113,4 +116,16 @@ static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr, ...@@ -113,4 +116,16 @@ static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr,
memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid); memcpy(dev_addr->dst_dev_addr + 4, gid, sizeof *gid);
} }
static inline void iw_addr_get_sgid(struct rdma_dev_addr *dev_addr,
union ib_gid *gid)
{
memcpy(gid, dev_addr->src_dev_addr, sizeof *gid);
}
static inline void iw_addr_get_dgid(struct rdma_dev_addr *dev_addr,
union ib_gid *gid)
{
memcpy(gid, dev_addr->dst_dev_addr, sizeof *gid);
}
#endif /* IB_ADDR_H */ #endif /* IB_ADDR_H */
...@@ -56,12 +56,22 @@ union ib_gid { ...@@ -56,12 +56,22 @@ union ib_gid {
} global; } global;
}; };
enum ib_node_type { enum rdma_node_type {
IB_NODE_CA = 1, /* IB values map to NodeInfo:NodeType. */
IB_NODE_SWITCH, RDMA_NODE_IB_CA = 1,
IB_NODE_ROUTER RDMA_NODE_IB_SWITCH,
RDMA_NODE_IB_ROUTER,
RDMA_NODE_RNIC
}; };
enum rdma_transport_type {
RDMA_TRANSPORT_IB,
RDMA_TRANSPORT_IWARP
};
enum rdma_transport_type
rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__;
enum ib_device_cap_flags { enum ib_device_cap_flags {
IB_DEVICE_RESIZE_MAX_WR = 1, IB_DEVICE_RESIZE_MAX_WR = 1,
IB_DEVICE_BAD_PKEY_CNTR = (1<<1), IB_DEVICE_BAD_PKEY_CNTR = (1<<1),
...@@ -78,6 +88,9 @@ enum ib_device_cap_flags { ...@@ -78,6 +88,9 @@ enum ib_device_cap_flags {
IB_DEVICE_RC_RNR_NAK_GEN = (1<<12), IB_DEVICE_RC_RNR_NAK_GEN = (1<<12),
IB_DEVICE_SRQ_RESIZE = (1<<13), IB_DEVICE_SRQ_RESIZE = (1<<13),
IB_DEVICE_N_NOTIFY_CQ = (1<<14), IB_DEVICE_N_NOTIFY_CQ = (1<<14),
IB_DEVICE_ZERO_STAG = (1<<15),
IB_DEVICE_SEND_W_INV = (1<<16),
IB_DEVICE_MEM_WINDOW = (1<<17)
}; };
enum ib_atomic_cap { enum ib_atomic_cap {
...@@ -835,6 +848,8 @@ struct ib_cache { ...@@ -835,6 +848,8 @@ struct ib_cache {
u8 *lmc_cache; u8 *lmc_cache;
}; };
struct iw_cm_verbs;
struct ib_device { struct ib_device {
struct device *dma_device; struct device *dma_device;
...@@ -851,6 +866,8 @@ struct ib_device { ...@@ -851,6 +866,8 @@ struct ib_device {
u32 flags; u32 flags;
struct iw_cm_verbs *iwcm;
int (*query_device)(struct ib_device *device, int (*query_device)(struct ib_device *device,
struct ib_device_attr *device_attr); struct ib_device_attr *device_attr);
int (*query_port)(struct ib_device *device, int (*query_port)(struct ib_device *device,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment