Drop "benchmark" netlink message and "benchmark-nl" dpctl command.
authorBen Pfaff <blp@nicira.com>
Tue, 1 Jul 2008 17:52:34 +0000 (10:52 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 1 Jul 2008 17:59:04 +0000 (10:59 -0700)
The new OFPT_ECHO_REQUEST and OFPT_ECHO_REPLY OpenFlow messages
have the same functionality and are more general (in that they
are not Netlink-specific).

datapath/Modules.mk
datapath/datapath.c
datapath/datapath_t.c [deleted file]
datapath/datapath_t.h [deleted file]
datapath/linux-2.4/.gitignore
datapath/linux-2.6/.gitignore
include/dpif.h
include/openflow-netlink.h
lib/dpif.c
utilities/dpctl.8
utilities/dpctl.c

index 099be0e43f876de463d093953c0ca0970835efd2..23e54da71b0daf280680a17f02d160f5679feea6 100644 (file)
@@ -5,7 +5,6 @@ openflow_sources = \
        chain.c \
        crc32.c \
        datapath.c \
-       datapath_t.c \
        dp_dev.c \
        flow.c \
        forward.c \
@@ -18,7 +17,6 @@ openflow_headers = \
        compat.h \
        crc32.h \
        datapath.h \
-       datapath_t.h \
        dp_dev.h \
        flow.h \
        forward.h \
index 55c2c61227a5041611c7bba88085057bfd797a47..a4c6a2de80c7510906703535ea16e452bc38d933 100644 (file)
@@ -36,7 +36,6 @@
 #include "dp_dev.h"
 #include "forward.h"
 #include "flow.h"
-#include "datapath_t.h"
 
 #include "compat.h"
 
@@ -1489,20 +1488,6 @@ static struct genl_ops dp_genl_ops_openflow = {
        .dumpit = dp_genl_openflow_dumpit,
 };
 
-static struct nla_policy dp_genl_benchmark_policy[DP_GENL_A_MAX + 1] = {
-       [DP_GENL_A_DP_IDX] = { .type = NLA_U32 },
-       [DP_GENL_A_NPACKETS] = { .type = NLA_U32 },
-       [DP_GENL_A_PSIZE] = { .type = NLA_U32 },
-};
-
-static struct genl_ops dp_genl_ops_benchmark_nl = {
-       .cmd = DP_GENL_C_BENCHMARK_NL,
-       .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
-       .policy = dp_genl_benchmark_policy,
-       .doit = dp_genl_benchmark_nl,
-       .dumpit = NULL,
-};
-
 static struct genl_ops *dp_genl_all_ops[] = {
        /* Keep this operation first.  Generic Netlink dispatching
         * looks up operations with linear search, so we want it at the
@@ -1514,7 +1499,6 @@ static struct genl_ops *dp_genl_all_ops[] = {
        &dp_genl_ops_query_dp,
        &dp_genl_ops_add_port,
        &dp_genl_ops_del_port,
-       &dp_genl_ops_benchmark_nl,
 };
 
 static int dp_init_netlink(void)
diff --git a/datapath/datapath_t.c b/datapath/datapath_t.c
deleted file mode 100644 (file)
index 33a64a6..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-#include "datapath_t.h"
-#include <linux/skbuff.h>
-#include <linux/in.h>
-#include <linux/ip.h>
-#include <linux/if_ether.h>
-#include <linux/udp.h>
-#include <linux/rcupdate.h>
-
-#include "datapath.h"
-
-static struct sk_buff *
-gen_sk_buff(struct datapath *dp, uint32_t packet_size)
-{
-       int in_port;
-       struct sk_buff *skb;
-       struct ethhdr *eh;
-       struct iphdr *ih;
-       struct udphdr *uh;
-
-       for (in_port = 0; in_port < OFPP_MAX; in_port++) {
-               if (dp->ports[in_port] != NULL)
-                       break;
-       }
-
-       if (in_port == OFPP_MAX) {
-               printk("benchmark: no in_port to send packets as\n");
-               return NULL;
-       }
-
-       skb = alloc_skb(packet_size, GFP_ATOMIC);
-       if (!skb) {
-               printk("benchmark: cannot allocate skb for benchmark\n");
-               return NULL;
-       }
-
-       skb_put(skb, packet_size);
-       skb_set_mac_header(skb, 0);
-       eh = eth_hdr(skb);
-       memcpy(eh->h_dest, "\x12\x34\x56\x78\x9a\xbc", ETH_ALEN);
-       memcpy(eh->h_source, "\xab\xcd\xef\x12\x34\x56", ETH_ALEN);
-       eh->h_proto = htons(ETH_P_IP);
-       skb_set_network_header(skb, sizeof(*eh));
-       ih = ip_hdr(skb);
-       ih->ihl = 5;
-       ih->version = IPVERSION;
-       ih->tos = 0;
-       ih->tot_len = htons(packet_size - sizeof(*eh));
-       ih->id = htons(12345);
-       ih->frag_off = 0;
-       ih->ttl = IPDEFTTL;
-       ih->protocol = IPPROTO_UDP;
-       ih->check = 0; /* want this to be right?! */
-       ih->saddr = 0x12345678;
-       ih->daddr = 0x1234abcd;
-       skb_set_transport_header(skb, sizeof(*eh) + sizeof(*ih));
-       uh = udp_hdr(skb);
-       uh->source = htons(1234);
-       uh->dest = htons(5678);
-       uh->len = htons(packet_size - sizeof(*eh) - sizeof(*ih));
-       uh->check = 0;
-       if (dp_set_origin(dp, in_port, skb)) {
-               printk("benchmark: could not set origin\n");
-               kfree_skb(skb);
-               return NULL;
-       }
-
-       return skb;
-}
-
-int
-dp_genl_benchmark_nl(struct sk_buff *skb, struct genl_info *info)
-{
-       struct datapath *dp;
-       uint32_t num_packets = 0;
-       int i, err = 0;
-       struct sk_buff *skb2;
-
-       if (!info->attrs[DP_GENL_A_DP_IDX] || !info->attrs[DP_GENL_A_NPACKETS]
-                       || !info->attrs[DP_GENL_A_PSIZE])
-               return -EINVAL;
-
-       num_packets = nla_get_u32((info->attrs[DP_GENL_A_NPACKETS]));
-
-       rcu_read_lock();
-       dp = dp_get(nla_get_u32((info->attrs[DP_GENL_A_DP_IDX])));
-       if (!dp)
-               err = -ENOENT;
-       else {
-               if (num_packets == 0)
-                       goto benchmark_unlock;
-
-               skb2 = gen_sk_buff(dp, nla_get_u32((info->attrs[DP_GENL_A_PSIZE])));
-               if (skb2 == NULL) {
-                       err = -ENOMEM;
-                       goto benchmark_unlock;
-               }
-
-               for (i = 0; i < num_packets; i++) {
-                       struct sk_buff *copy = skb_get(skb2);
-                       if (copy == NULL) {
-                               printk("benchmark: skb_get failed\n");
-                               err = -ENOMEM;
-                               break;
-                       }
-                       if ((err = dp_output_control(dp, copy, -1,
-                                               0, OFPR_ACTION)))
-                       {
-                               printk("benchmark: output control ret %d on iter %d\n", err, i);
-                               break;
-                       }
-               }
-               kfree_skb(skb2);
-       }
-
-benchmark_unlock:
-       rcu_read_unlock();
-       return err;
-}
diff --git a/datapath/datapath_t.h b/datapath/datapath_t.h
deleted file mode 100644 (file)
index 868e734..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef DATAPATH_T_H
-#define DATAPATH_T_H 1
-
-#include <linux/socket.h>
-#include <linux/capability.h>
-#include <linux/skbuff.h>
-#include <net/genetlink.h>
-#include "openflow-netlink.h"
-
-int dp_genl_benchmark_nl(struct sk_buff *, struct genl_info *);
-
-#endif
index af45ff28e49d28be499ddd47f9f87f350cd43ae0..a503159f31f4889e81dc7a5f2f7d4340f4922193 100644 (file)
@@ -7,7 +7,6 @@
 /flow.c
 /forward.c
 /forward_t.c
-/datapath_t.c
 /table-hash.c
 /table-linear.c
 /table-mac.c
index eee68d01e9d5d145c2b01c3db4791fa2a89c0233..20b482998d583fe75cd1c1cfe84fe5f801e5ecb8 100644 (file)
@@ -5,7 +5,6 @@
 /crc32.c
 /crc_t.c
 /datapath.c
-/datapath_t.c
 /dp_dev.c
 /flow.c
 /forward.c
index 4f806d7aa872e89151ca06b6263ca981f1ec9763..122c64d8a857289dd044da7971389607f6ee2fe4 100644 (file)
@@ -60,6 +60,5 @@ int dpif_add_dp(struct dpif *);
 int dpif_del_dp(struct dpif *);
 int dpif_add_port(struct dpif *, const char *netdev);
 int dpif_del_port(struct dpif *, const char *netdev);
-int dpif_benchmark_nl(struct dpif *, uint32_t, uint32_t);
 
 #endif /* dpif.h */
index 7774cd587f9ab7fe4b78bcf867b87db46e3c0027..0b67c9905577af7ab4bd2bd0e42a4d0f4350185e 100644 (file)
@@ -61,8 +61,6 @@ enum dp_genl_command {
        DP_GENL_C_DEL_PORT,      /* Remove port from datapath. */
        DP_GENL_C_OPENFLOW,  /* Encapsulated OpenFlow protocol. */
 
-    DP_GENL_C_BENCHMARK_NL, /* Benchmark netlink connection */
-
        __DP_GENL_C_MAX,
        DP_GENL_C_MAX = __DP_GENL_C_MAX - 1
 };
index 506efe3dd296f11938f2500c8f6739a9b76a19b8..5d9c33c6a17f7a4b37d2c6d34a76d82310cd8fb2 100644 (file)
@@ -269,25 +269,6 @@ dpif_del_port(struct dpif *dp, const char *netdev)
 {
     return send_mgmt_command(dp, DP_GENL_C_DEL_PORT, netdev);
 }
-
-/* Tells dp to send num_packets up through netlink for benchmarking*/
-int
-dpif_benchmark_nl(struct dpif *dp, uint32_t num_packets, uint32_t packet_size)
-{
-    struct buffer request;
-    int retval;
-
-    buffer_init(&request, 0);
-    nl_msg_put_genlmsghdr(&request, dp->sock, 0, openflow_family,
-                          NLM_F_REQUEST, DP_GENL_C_BENCHMARK_NL, 1);
-    nl_msg_put_u32(&request, DP_GENL_A_DP_IDX, dp->dp_idx);
-    nl_msg_put_u32(&request, DP_GENL_A_NPACKETS, num_packets);
-    nl_msg_put_u32(&request, DP_GENL_A_PSIZE, packet_size);
-    retval = nl_sock_send(dp->sock, &request, true);
-    buffer_uninit(&request);
-
-    return retval;
-}
 \f
 static const struct nl_policy openflow_multicast_policy[] = {
     [DP_GENL_A_DP_IDX] = { .type = NL_A_U32 },
index 1a714d2ccf0e269521f7e447343aa86e3c5fd5a2..34d887a75bb7c9174eb0d5199b0dde2392cb6656 100644 (file)
@@ -85,12 +85,6 @@ Prints to the console all OpenFlow packets sent by datapath
 \fIdp_idx\fR to its controller, where \fIdp_idx\fR is the ID of an
 existing datapath.
 
-.TP
-\fBbenchmark-nl nl:\fIdp_idx n size\fR
-Checks the netlink performance between the kernel and userspace.
-This is done by sending \fIN\fR packets of \fIsize\fR bytes from
-the kernel module to dpctl.
-
 .PP
 The following commands can be used regardless of the connection method.
 
index 526b1bd891b19a369238e6eb308ea1bc7c638877..804071af6ef1455788ce36fa16ff65b349766d84 100644 (file)
@@ -167,7 +167,6 @@ usage(void)
            "  addif nl:DP_ID IFACE        add IFACE as a port on DP_ID\n"
            "  delif nl:DP_ID IFACE        delete IFACE as a port on DP_ID\n"
            "  monitor nl:DP_ID            print packets received\n"
-           "  benchmark-nl nl:DP_ID N SIZE   send N packets of SIZE bytes\n"
 #endif
            "\nCommands that apply to local datapaths and remote switches:\n"
            "  show SWITCH                 show information\n"
@@ -280,44 +279,6 @@ static void do_monitor(int argc UNUSED, char *argv[])
         buffer_delete(b);
     }
 }
-
-#define BENCHMARK_INCR   100
-
-static void do_benchmark_nl(int argc UNUSED, char *argv[])
-{
-    struct dpif dp;
-    uint32_t num_packets, i, milestone;
-    struct timeval start, end;
-
-    open_nl_vconn(argv[1], false, &dp);
-    num_packets = atoi(argv[2]);
-    milestone = BENCHMARK_INCR;
-    run(dpif_benchmark_nl(&dp, num_packets, atoi(argv[3])), "benchmark_nl");
-    if (gettimeofday(&start, NULL) == -1) {
-        run(errno, "gettimeofday");
-    }
-    for (i = 0; i < num_packets;i++) {
-        struct buffer *b;
-        run(dpif_recv_openflow(&dp, &b, true), "dpif_recv_openflow");
-        if (i == milestone) {
-            gettimeofday(&end, NULL);
-            printf("%u packets received in %f ms\n",
-                   BENCHMARK_INCR,
-                   (1000*(double)(end.tv_sec - start.tv_sec))
-                   + (.001*(end.tv_usec - start.tv_usec)));
-            milestone += BENCHMARK_INCR;
-            start = end;
-        }
-        buffer_delete(b);
-    }
-    gettimeofday(&end, NULL);
-    printf("%u packets received in %f ms\n",
-           i - (milestone - BENCHMARK_INCR),
-           (1000*(double)(end.tv_sec - start.tv_sec))
-           + (.001*(end.tv_usec - start.tv_usec)));
-
-    dpif_close(&dp);
-}
 #endif /* HAVE_NETLINK */
 \f
 /* Generic commands. */
@@ -918,7 +879,6 @@ static struct command all_commands[] = {
     { "deldp", 1, 1, do_del_dp },
     { "addif", 2, 2, do_add_port },
     { "delif", 2, 2, do_del_port },
-    { "benchmark-nl", 3, 3, do_benchmark_nl },
 #endif
 
     { "show", 1, 1, do_show },