Revision: 2295
Author:
regra...@gmail.com
Date: Thu Jan 29 17:02:38 2015 UTC
Log: Fixes issue when using UDP transport with similarly addressed
(logical or physical) matching and non-matching NIs simultaneously
https://code.google.com/p/portals4/source/detail?r=2295
Modified:
/trunk/src/ib/ptl_ni.c
/trunk/src/ib/ptl_tgt.c
/trunk/src/ib/ptl_udp.c
=======================================
--- /trunk/src/ib/ptl_ni.c Tue Apr 1 14:37:21 2014 UTC
+++ /trunk/src/ib/ptl_ni.c Thu Jan 29 17:02:38 2015 UTC
@@ -342,7 +342,9 @@
PTL_FASTLOCK_INIT(&ni->physical.lock);
}
+#if !WITH_TRANSPORT_UDP
mr_init(ni);
+#endif
err = init_pools(ni);
if (unlikely(err))
=======================================
--- /trunk/src/ib/ptl_tgt.c Mon Oct 20 20:05:30 2014 UTC
+++ /trunk/src/ib/ptl_tgt.c Thu Jan 29 17:02:38 2015 UTC
@@ -1797,6 +1797,8 @@
rep_hdr->moffset = cpu_to_le64(buf->moffset);
rep_hdr->h1.operation = OP_REPLY;
rep_hdr->h1.matching_list = buf->matching_list;
+ ni_t *ni = obj_to_ni(buf);
+ rep_hdr->h1.ni_type = ni->ni_type;
if (buf->le && buf->le->ptl_list == PTL_PRIORITY_LIST) {
/* The LE must be released before we sent the ack. */
=======================================
--- /trunk/src/ib/ptl_udp.c Wed Dec 3 15:22:45 2014 UTC
+++ /trunk/src/ib/ptl_udp.c Thu Jan 29 17:02:38 2015 UTC
@@ -763,17 +763,21 @@
} else {
hdr = (req_hdr_t *) & thebuf->data;
}
+
+ ptl_info("QQQQQQQQQQQQQQ: ni_type of incoming message: %x and ni_type
of %x\n",hdr->h1.ni_type,ni->ni_type);
if (((hdr->h1.physical == 0) && (!!(ni->options & PTL_NI_PHYSICAL))) ||
- ((hdr->h1.physical == 1) && (!!(ni->options & PTL_NI_LOGICAL)))) {
- //this datagram is not meant for us
- ptl_info("packet not meant for this logical NI, dropping \n");
- free(thebuf);
- //this time interval is just to back off, it is completely
arbitrary
- //although 20us is a reasonable approximation of the time to
- //fetch a recv through the kernel UDP networking stack
- usleep(20);
- return NULL;
+ ((hdr->h1.physical == 1) && (!!(ni->options & PTL_NI_LOGICAL))) ||
+ (hdr->h1.ni_type != ni->ni_type)) {
+ //this datagram is not meant for us
+ ptl_info("packet not meant for this NI, dropping \n");
+ free(thebuf);
+ //this time interval is just to back off, it is completely
arbitrary
+ //although 20us is a reasonable approximation of the time to
+ //fetch a recv through the kernel UDP networking stack
+ usleep(20);
+ return NULL;
+
}
//we are going to be handling multiple messages, implemented through a
recvmsg call
if (thebuf->rlength > sizeof(buf_t)) {
@@ -912,11 +916,13 @@
if (((!!(ni->options & PTL_NI_LOGICAL)) &&
(hdr->h1.physical == 0)) ||
((!!(ni->options & PTL_NI_PHYSICAL)) &&
- (hdr->h1.physical == 1))) {
- //this is an exact match
- found_one = 1;
- ptl_info("found a matching in-progress transfer
\n");
- break;
+ (hdr->h1.physical == 1)) &&
+ (hdr->h1.ni_type == ni->ni_type)) {
+ //this is an exact match
+ found_one = 1;
+ ptl_info("found a matching in-progress
transfer \n");
+ break;
+
}
}
@@ -1167,6 +1173,7 @@
ptl_info("addressing type for connection is: %x \n",
!!(ni->options & PTL_NI_LOGICAL));
hdr->h1.physical = !!(ni->options & PTL_NI_PHYSICAL);
+ hdr->h1.ni_type = ni->ni_type;
conn_buf->transfer.udp.conn_msg = msg;
conn_buf->length = (sizeof(buf_t));