Merge branch 'develop'
[archipelago] / xseg / peers / user / xseg-tool.c
index 94e1e6c..f2eca51 100644 (file)
@@ -251,15 +251,15 @@ void report_request(struct xseg_request *req)
        fprintf(stderr,
                "Request %lx: target[%u](xptr: %llu): %s, data[%llu](xptr: %llu): %s \n\t"
                "offset: %llu, size: %llu, serviced; %llu, op: %u, state: %u, flags: %u \n\t"
        fprintf(stderr,
                "Request %lx: target[%u](xptr: %llu): %s, data[%llu](xptr: %llu): %s \n\t"
                "offset: %llu, size: %llu, serviced; %llu, op: %u, state: %u, flags: %u \n\t"
-               "src: %u, src_transit: %u, dst: %u, dst_transit: %u\n",
+               "src: %u, transit: %u, dst: %u, effective dst: %u\n",
                (unsigned long) req, req->targetlen, (unsigned long long)req->target,
                target,
                (unsigned long long) req->datalen, (unsigned long long) req->data,
                data,
                (unsigned long long) req->offset, (unsigned long long) req->size,
                (unsigned long long) req->serviced, req->op, req->state, req->flags,
                (unsigned long) req, req->targetlen, (unsigned long long)req->target,
                target,
                (unsigned long long) req->datalen, (unsigned long long) req->data,
                data,
                (unsigned long long) req->offset, (unsigned long long) req->size,
                (unsigned long long) req->serviced, req->op, req->state, req->flags,
-               (unsigned int) req->src_portno, (unsigned int) req->src_transit_portno,
-               (unsigned int) req->dst_portno, (unsigned int) req->dst_transit_portno);
+               (unsigned int) req->src_portno, (unsigned int) req->transit_portno,
+               (unsigned int) req->dst_portno, (unsigned int) req->effective_dst_portno);
 
 
 }
 
 
 }
@@ -1070,7 +1070,7 @@ int cmd_submit_reqs(long loops, long concurrent_reqs, int op)
 
        struct xseg_request *submitted = NULL, *received;
        long nr_submitted = 0, nr_received = 0, nr_failed = 0, nr_mismatch = 0, nr_flying = 0;
 
        struct xseg_request *submitted = NULL, *received;
        long nr_submitted = 0, nr_received = 0, nr_failed = 0, nr_mismatch = 0, nr_flying = 0;
-       int reported = 0, r;
+       int r;
        uint64_t offset;
        uint32_t targetlen = 10, chunksize = 4096;
        struct timeval tv1, tv2;
        uint64_t offset;
        uint32_t targetlen = 10, chunksize = 4096;
        struct timeval tv1, tv2;
@@ -1097,7 +1097,6 @@ int cmd_submit_reqs(long loops, long concurrent_reqs, int op)
                        //FIXME
                        ++nr_flying;
                        nr_submitted += 1;
                        //FIXME
                        ++nr_flying;
                        nr_submitted += 1;
-                       reported = 0;
                        offset = 0;//pick(size);
 
                        submitted->offset = offset;
                        offset = 0;//pick(size);
 
                        submitted->offset = offset;
@@ -1180,13 +1179,13 @@ int cmd_report(uint32_t portno)
        lock_status(&port->rq_lock, rls, 64);
        lock_status(&port->pq_lock, pls, 64);
        fprintf(stderr, "port %u:\n"
        lock_status(&port->rq_lock, rls, 64);
        lock_status(&port->pq_lock, pls, 64);
        fprintf(stderr, "port %u:\n"
-               "   requests: %llu/%llu  src gw: %u  dst gw: %u\n"
+               "   requests: %llu/%llu  next: %u  dst gw: %u\n"
                "       free_queue [%p] count : %4llu | %s\n"
                "    request_queue [%p] count : %4llu | %s\n"
                "      reply_queue [%p] count : %4llu | %s\n",
                portno, (unsigned long long)port->alloc_reqs, 
                (unsigned long long)port->max_alloc_reqs,
                "       free_queue [%p] count : %4llu | %s\n"
                "    request_queue [%p] count : %4llu | %s\n"
                "      reply_queue [%p] count : %4llu | %s\n",
                portno, (unsigned long long)port->alloc_reqs, 
                (unsigned long long)port->max_alloc_reqs,
-               xseg->src_gw[portno],
+               xseg->path_next[portno],
                xseg->dst_gw[portno],
                (void *)fq, (unsigned long long)xq_count(fq), fls,
                (void *)rq, (unsigned long long)xq_count(rq), rls,
                xseg->dst_gw[portno],
                (void *)fq, (unsigned long long)xq_count(fq), fls,
                (void *)rq, (unsigned long long)xq_count(rq), rls,
@@ -1755,6 +1754,12 @@ int cmd_signal(uint32_t portno)
        return xseg_signal(xseg, portno);
 }
 
        return xseg_signal(xseg, portno);
 }
 
+int cmd_set_next(xport portno, xport next)
+{
+       xseg->path_next[portno] = next;
+       return 0;
+}
+
 int parse_ports(char *str)
 {
        int ret = 0;
 int parse_ports(char *str)
 {
        int ret = 0;
@@ -1847,6 +1852,12 @@ int main(int argc, char **argv)
                        continue;
                }
 
                        continue;
                }
 
+               if (!strcmp(argv[i], "set-next") && (i + 2 < argc)) {
+                       ret = cmd_set_next(atol(argv[i+1]), atol(argv[i+2]));
+                       i += 2;
+                       continue;
+               }
+
                if (!strcmp(argv[i], "signal") && (i + 1 < argc)) {
                        ret = cmd_signal(atol(argv[i+1]));
                        i += 1;
                if (!strcmp(argv[i], "signal") && (i + 1 < argc)) {
                        ret = cmd_signal(atol(argv[i+1]));
                        i += 1;
@@ -1886,7 +1897,7 @@ int main(int argc, char **argv)
 
                if (!strcmp(argv[i], "failreq") && (i + 1 < argc)) {
                        struct xseg_request *req;
 
                if (!strcmp(argv[i], "failreq") && (i + 1 < argc)) {
                        struct xseg_request *req;
-                       sscanf(argv[i+1], "%lx", &req);
+                       sscanf(argv[i+1], "%lx", (unsigned long *)&req);
                        ret = cmd_request(req, FAIL);
                        i += 1;
                        continue;
                        ret = cmd_request(req, FAIL);
                        i += 1;
                        continue;