Mercurial > illumos > illumos-gate
changeset 10322:ba47e44899a2
6801886 iSER target can lose some of its channel establishment code
author | Priya Krishnan <Priya.Krishnan@Sun.COM> |
---|---|
date | Mon, 17 Aug 2009 11:13:26 -0400 |
parents | 44087508eb73 |
children | c049adde84fe |
files | usr/src/uts/common/io/ib/clients/iser/iser.c usr/src/uts/common/io/ib/clients/iser/iser_cm.c usr/src/uts/common/io/ib/clients/iser/iser_ib.c usr/src/uts/common/sys/ib/clients/iser/iser_ib.h |
diffstat | 4 files changed, 133 insertions(+), 56 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/io/ib/clients/iser/iser.c Mon Aug 17 12:22:38 2009 +0800 +++ b/usr/src/uts/common/io/ib/clients/iser/iser.c Mon Aug 17 11:13:26 2009 -0400 @@ -392,7 +392,7 @@ iser_ib_conv_sockaddr2ibtaddr(raddr, &remote_ip); iser_ib_conv_sockaddr2ibtaddr(laddr, &local_ip); - return (iser_ib_alloc_rc_channel(&local_ip, &remote_ip)); + return (iser_ib_alloc_channel_pathlookup(&local_ip, &remote_ip)); } /*
--- a/usr/src/uts/common/io/ib/clients/iser/iser_cm.c Mon Aug 17 12:22:38 2009 +0800 +++ b/usr/src/uts/common/io/ib/clients/iser/iser_cm.c Mon Aug 17 11:13:26 2009 -0400 @@ -149,12 +149,24 @@ ipcm_info.dst_addr.un.ip4addr); /* Allocate a channel to establish the new connection */ - chan = iser_ib_alloc_rc_channel(&ipcm_info.dst_addr, - &ipcm_info.src_addr); + chan = iser_ib_alloc_channel_nopathlookup( + evp->cm_event.req.req_hca_guid, + evp->cm_event.req.req_prim_hca_port); if (chan == NULL) { + ISER_LOG(CE_NOTE, "iser_ib_handle_cm_req: failed to allocate " + "a channel from src IP (0x%08x) src port (0x%04x) " + "to dst IP: (0x%08x) on hca(%llx %d)", + ipcm_info.src_addr.un.ip4addr, ipcm_info.src_port, + ipcm_info.dst_addr.un.ip4addr, + (longlong_t)evp->cm_event.req.req_hca_guid, + evp->cm_event.req.req_prim_hca_port); return (IBT_CM_REJECT); } + /* Set the local and remote ip */ + chan->ic_localip = ipcm_info.dst_addr; + chan->ic_remoteip = ipcm_info.src_addr; + /* Set the local and remote port numbers on the channel handle */ chan->ic_lport = svc_hdl->is_svc_req.sr_port; chan->ic_rport = ipcm_info.src_port;
--- a/usr/src/uts/common/io/ib/clients/iser/iser_ib.c Mon Aug 17 12:22:38 2009 +0800 +++ b/usr/src/uts/common/io/ib/clients/iser/iser_ib.c Mon Aug 17 11:13:26 2009 -0400 @@ -350,20 +350,124 @@ } /* + * iser_ib_alloc_channel_nopathlookup + * + * This function allocates a reliable connected channel. This function does + * not invoke ibt_get_ip_paths() to do the path lookup. The HCA GUID and + * port are input to this function. + */ +iser_chan_t * +iser_ib_alloc_channel_nopathlookup(ib_guid_t hca_guid, uint8_t hca_port) +{ + iser_hca_t *hca; + iser_chan_t *chan; + + /* Lookup the hca using the gid in the path info */ + hca = iser_ib_guid2hca(hca_guid); + if (hca == NULL) { + ISER_LOG(CE_NOTE, "iser_ib_alloc_channel_nopathlookup: failed " + "to lookup HCA(%llx) handle", (longlong_t)hca_guid); + return (NULL); + } + + chan = iser_ib_alloc_rc_channel(hca, hca_port); + if (chan == NULL) { + ISER_LOG(CE_NOTE, "iser_ib_alloc_channel_nopathlookup: failed " + "to alloc channel on HCA(%llx) %d", + (longlong_t)hca_guid, hca_port); + return (NULL); + } + + ISER_LOG(CE_NOTE, "iser_ib_alloc_channel_pathlookup success: " + "chanhdl (0x%p), HCA(%llx) %d", + (void *)chan->ic_chanhdl, (longlong_t)hca_guid, hca_port); + + return (chan); +} + +/* + * iser_ib_alloc_channel_pathlookup + * + * This function allocates a reliable connected channel but first invokes + * ibt_get_ip_paths() with the given local and remote addres to get the + * HCA lgid and the port number. + */ +iser_chan_t * +iser_ib_alloc_channel_pathlookup( + ibt_ip_addr_t *local_ip, ibt_ip_addr_t *remote_ip) +{ + ibt_path_info_t ibt_path; + ibt_path_ip_src_t path_src_ip; + ib_gid_t lgid; + uint8_t hca_port; /* from path */ + iser_hca_t *hca; + iser_chan_t *chan; + int status; + + /* Lookup a path to the given destination */ + status = iser_ib_get_paths( + local_ip, remote_ip, &ibt_path, &path_src_ip); + + if (status != ISER_STATUS_SUCCESS) { + ISER_LOG(CE_NOTE, "iser_ib_alloc_channel_pathlookup: faild " + "Path lookup IP:[%llx to %llx] failed: status (%d)", + (longlong_t)local_ip->un.ip4addr, + (longlong_t)remote_ip->un.ip4addr, + status); + return (NULL); + } + + /* get the local gid from the path info */ + lgid = ibt_path.pi_prim_cep_path.cep_adds_vect.av_sgid; + + /* get the hca port from the path info */ + hca_port = ibt_path.pi_prim_cep_path.cep_hca_port_num; + + /* Lookup the hca using the gid in the path info */ + hca = iser_ib_gid2hca(lgid); + if (hca == NULL) { + ISER_LOG(CE_NOTE, "iser_ib_alloc_channel_pathlookup: failed " + "to lookup HCA (%llx) handle", + (longlong_t)hca->hca_guid); + return (NULL); + } + + chan = iser_ib_alloc_rc_channel(hca, hca_port); + if (chan == NULL) { + ISER_LOG(CE_NOTE, "iser_ib_alloc_channel_pathlookup: failed " + "to alloc channel from IP:[%llx to %llx] on HCA (%llx) %d", + (longlong_t)local_ip->un.ip4addr, + (longlong_t)remote_ip->un.ip4addr, + (longlong_t)hca->hca_guid, hca_port); + return (NULL); + } + + ISER_LOG(CE_NOTE, "iser_ib_alloc_channel_pathlookup success: " + "chanhdl (0x%p), IP:[%llx to %llx], lgid (%llx:%llx), HCA(%llx) %d", + (void *)chan->ic_chanhdl, + (longlong_t)local_ip->un.ip4addr, + (longlong_t)remote_ip->un.ip4addr, + (longlong_t)lgid.gid_prefix, (longlong_t)lgid.gid_guid, + (longlong_t)hca->hca_guid, hca_port); + + chan->ic_ibt_path = ibt_path; + chan->ic_localip = path_src_ip.ip_primary; + chan->ic_remoteip = *remote_ip; + + return (chan); +} + +/* * iser_ib_alloc_rc_channel * * This function allocates a reliable communication channel using the specified * channel attributes. */ iser_chan_t * -iser_ib_alloc_rc_channel(ibt_ip_addr_t *local_ip, ibt_ip_addr_t *remote_ip) +iser_ib_alloc_rc_channel(iser_hca_t *hca, uint8_t hca_port) { iser_chan_t *chan; - ib_gid_t lgid; - uint8_t hca_port; /* from path */ - iser_hca_t *hca; - ibt_path_ip_src_t path_src_ip; ibt_rc_chan_alloc_args_t chanargs; uint_t sq_size, rq_size; int status; @@ -373,40 +477,8 @@ mutex_init(&chan->ic_lock, NULL, MUTEX_DRIVER, NULL); mutex_init(&chan->ic_sq_post_lock, NULL, MUTEX_DRIVER, NULL); - /* Lookup a path to the given destination */ - status = iser_ib_get_paths(local_ip, remote_ip, &chan->ic_ibt_path, - &path_src_ip); - - if (status != ISER_STATUS_SUCCESS) { - ISER_LOG(CE_NOTE, "iser_ib_get_paths failed: status (%d)", - status); - mutex_destroy(&chan->ic_lock); - mutex_destroy(&chan->ic_sq_post_lock); - kmem_free(chan, sizeof (iser_chan_t)); - return (NULL); - } - - /* get the local gid from the path info */ - lgid = chan->ic_ibt_path.pi_prim_cep_path.cep_adds_vect.av_sgid; - - /* get the hca port from the path info */ - hca_port = chan->ic_ibt_path.pi_prim_cep_path.cep_hca_port_num; - - /* Lookup the hca using the gid in the path info */ - hca = iser_ib_gid2hca(lgid); - if (hca == NULL) { - ISER_LOG(CE_NOTE, "iser_ib_alloc_rc_channel: failed " - "to lookup HCA handle"); - mutex_destroy(&chan->ic_lock); - mutex_destroy(&chan->ic_sq_post_lock); - kmem_free(chan, sizeof (iser_chan_t)); - return (NULL); - } - - /* Set up the iSER channel handle with HCA and IP data */ + /* Set up the iSER channel handle with HCA */ chan->ic_hca = hca; - chan->ic_localip = path_src_ip.ip_primary; - chan->ic_remoteip = *remote_ip; /* * Determine the queue sizes, based upon the HCA query data. @@ -486,14 +558,6 @@ /* Set the 'channel' as the client private data */ (void) ibt_set_chan_private(chan->ic_chanhdl, chan); - ISER_LOG(CE_NOTE, "iser_ib_alloc_rc_channel success: " - "chanhdl (0x%p), IP:[%llx to %llx], lgid (%llx:%llx), HCA(%llx) %d", - (void *)chan->ic_chanhdl, - (longlong_t)local_ip->un.ip4addr, - (longlong_t)remote_ip->un.ip4addr, - (longlong_t)lgid.gid_prefix, (longlong_t)lgid.gid_guid, - (longlong_t)hca->hca_guid, hca_port); - return (chan); } @@ -707,7 +771,6 @@ uint_t nposted; int status, i; iser_qp_t *iser_qp; - ib_gid_t lgid; /* Pull our iSER channel handle from the private data */ chan = (iser_chan_t *)ibt_get_chan_private(chanhdl); @@ -726,11 +789,8 @@ /* get the QP handle from the iser_chan */ iser_qp = &chan->ic_qp; - /* get the local gid from the path info */ - lgid = chan->ic_ibt_path.pi_prim_cep_path.cep_adds_vect.av_sgid; + hca = chan->ic_hca; - /* get the hca port from the path info */ - hca = iser_ib_gid2hca(lgid); if (hca == NULL) { ISER_LOG(CE_NOTE, "iser_ib_post_recv: unable to retrieve " "HCA handle");
--- a/usr/src/uts/common/sys/ib/clients/iser/iser_ib.h Mon Aug 17 12:22:38 2009 +0800 +++ b/usr/src/uts/common/sys/ib/clients/iser/iser_ib.h Mon Aug 17 11:13:26 2009 -0400 @@ -178,8 +178,13 @@ ibt_ip_addr_t *local_ip, ibt_ip_addr_t *remote_ip, ibt_path_info_t *path, ibt_path_ip_src_t *path_src_ip); -iser_chan_t *iser_ib_alloc_rc_channel(ibt_ip_addr_t *local_ip, - ibt_ip_addr_t *remote_ip); +iser_chan_t *iser_ib_alloc_channel_pathlookup( + ibt_ip_addr_t *local_ip, ibt_ip_addr_t *remote_ip); + +iser_chan_t *iser_ib_alloc_channel_nopathlookup( + ib_guid_t hca_guid, uint8_t hca_port); + +iser_chan_t *iser_ib_alloc_rc_channel(iser_hca_t *hca, uint8_t hca_port); int iser_ib_open_rc_channel(iser_chan_t *chan);