arvindmvepa / netmap

Automatically exported from code.google.com/p/netmap
0 stars 0 forks source link

[PATCH] Allow use of pipes in pkt-gen through "-E" #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
All is in the title I think... It would be great to have a "contribute" address 
or something for Netmap. (Or maybe I didn't find it?).

Maybe it's on purpose but the help for "-e" is missing, you could add at line 
1335 :
        "\t-e buffers       number of extra buffers to allocate\n"
But maybe -e was only for testing purpose...

Tom

---
From: Tom Barbette <tom.barbette@ulg.ac.be>
Date: Wed, 3 Dec 2014 14:52:40 +0100
Subject: [PATCH] Allow use of pipes in pkt-gen through "-E"

---
 examples/pkt-gen.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/examples/pkt-gen.c b/examples/pkt-gen.c
index 1b23b79..06d31b6 100644
--- a/examples/pkt-gen.c
+++ b/examples/pkt-gen.c
@@ -199,6 +199,7 @@ struct glob_arg {
    char *nmr_config;
    int dummy_send;
    int virt_header;    /* send also the virt_header */
+   int extra_pipes;    /* goes in nr_arg1 */
    int extra_bufs;     /* goes in nr_arg3 */
 };
 enum dev_type { DEV_NONE, DEV_NETMAP, DEV_PCAP, DEV_TAP };
@@ -1327,9 +1328,10 @@ usage(void)
        "\t-T report_ms     milliseconds between reports\n"
        "\t-P           use libpcap instead of netmap\n"
        "\t-w wait_for_link_time    in seconds\n"
-       "\t-R rate      in packets per second\n"
+       "\t-R rate          in packets per second\n"
        "\t-X           dump payload\n"
-       "\t-H len       add empty virtio-net-header with size 'len'\n"
+       "\t-H len           add empty virtio-net-header with size 'len'\n"
+       "\t-E pipes     allocate extra space for a number of pipes\n"
        "",
        cmd);

@@ -1601,7 +1603,7 @@ main(int arc, char **argv)
    g.virt_header = 0;

    while ( (ch = getopt(arc, argv,
-           "a:f:F:n:i:Il:d:s:D:S:b:c:o:p:T:w:WvR:XC:H:e:m:")) != -1) {
+           "a:f:F:n:i:Il:d:s:D:S:b:c:o:p:T:w:WvR:XC:H:e:E:m:")) != -1) {
        struct sf *fn;

        switch(ch) {
@@ -1735,6 +1737,9 @@ main(int arc, char **argv)
        case 'e': /* extra bufs */
            g.extra_bufs = atoi(optarg);
            break;
+       case 'E':
+           g.extra_pipes = atoi(optarg);
+           break;
        case 'm':
            if (strcmp(optarg, "tx") == 0) {
                g.options |= OPT_MONITOR_TX;
@@ -1823,6 +1828,9 @@ main(int arc, char **argv)
    if (g.extra_bufs) {
        base_nmd.nr_arg3 = g.extra_bufs;
    }
+   if (g.extra_pipes) {
+       base_nmd.nr_arg1 = g.extra_pipes;
+   }

    /*
     * Open the netmap device using nm_open().
-- 
1.9.3

Original issue reported on code.google.com by mapp...@gmail.com on 3 Dec 2014 at 2:01

GoogleCodeExporter commented 9 years ago
I was also wondering if it's possible to use pipes without any Netmap device, 
just to replace the unix pipe. So without having any "parent"? Only solution 
for now is to add a bridge with one virtual adapter, right?

Tom

Original comment by mapp...@gmail.com on 3 Dec 2014 at 2:03

GoogleCodeExporter commented 9 years ago
Thank you for the patch, I have applied it to our internal master.

The way pipes are allocated right now is cumbersome and yes, they need a 
parent. The original use case was for fan-out/in from/to the parent port. 
Things may change in the future, but there are currently some issues to be 
solved.

Original comment by giuseppe.lettieri73 on 12 Dec 2014 at 1:55