[dpdk-dev] [PATCH] Rate as a decimal number
Wiles, Keith
keith.wiles at intel.com
Thu Apr 21 18:59:52 CEST 2016
>Currently Pktgen does not accept a decimal number for the rate. This patch makes possible to set a decimal number as a rate.
>
>Signed-off-by: Iñaki Murillo Arroyo <inaki.murilloa at ehu.eus>
>---
> app/cmd-functions.c | 71 +-
> app/cmd-functions.h | 38 +
> app/lpktgenlib.c | 2 +-
> app/pktgen-cmds.c | 10 +-
> app/pktgen-cmds.c.orig | 2622 ++++++++++++++++++++++++++++++++++++++++++++++++
> app/pktgen-cmds.h | 2 +-
> app/pktgen-port-cfg.h | 2 +-
> app/pktgen.c | 2 +-
> 8 files changed, 2737 insertions(+), 12 deletions(-)
> create mode 100644 app/pktgen-cmds.c.orig
>
>diff --git a/app/cmd-functions.c b/app/cmd-functions.c
>index b2fda7c..a009907 100644
>--- a/app/cmd-functions.c
>+++ b/app/cmd-functions.c
>@@ -1805,7 +1805,7 @@ struct cmd_set_result {
> cmdline_fixed_string_t set;
> cmdline_portlist_t portlist;
> cmdline_fixed_string_t what;
>- uint32_t value;
>+ float value;
> };
>
Looks like you checked in the pktgen-cmds.c.orig file and it shows up here are the complete file. Can you remove it and resend the patch again with Pktgen in the subject and called v2 version.
Thanks
> rate = 1;
>diff --git a/app/pktgen-cmds.c.orig b/app/pktgen-cmds.c.orig
>new file mode 100644
>index 0000000..83ba230
>--- /dev/null
>+++ b/app/pktgen-cmds.c.orig
>@@ -0,0 +1,2622 @@
>+/*-
>+ * Copyright (c) <2010>, Intel Corporation
>+ * All rights reserved.
>+ *
>+ * Redistribution and use in source and binary forms, with or without
>+ * modification, are permitted provided that the following conditions
>+ * are met:
>+ *
>+ * - Redistributions of source code must retain the above copyright
>+ * notice, this list of conditions and the following disclaimer.
>+ *
>+ * - Redistributions in binary form must reproduce the above copyright
>+ * notice, this list of conditions and the following disclaimer in
>+ * the documentation and/or other materials provided with the
>+ * distribution.
>+ *
>+ * - Neither the name of Intel Corporation nor the names of its
>+ * contributors may be used to endorse or promote products derived
>+ * from this software without specific prior written permission.
>+ *
>+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
>+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
>+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
>+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
>+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
>+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
>+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
>+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
>+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
>+ * OF THE POSSIBILITY OF SUCH DAMAGE.
>+ */
>
>diff --git a/app/pktgen-cmds.h b/app/pktgen-cmds.h
>index 683abc3..1c50e59 100644
>--- a/app/pktgen-cmds.h
>+++ b/app/pktgen-cmds.h
>@@ -135,7 +135,7 @@ extern void pktgen_set_pkt_size(port_info_t *info, uint32_t size);
> extern void pktgen_set_port_value(port_info_t *info,
> char type,
> uint32_t portValue);
>-extern void pktgen_set_tx_rate(port_info_t *info, uint32_t rate);
>+extern void pktgen_set_tx_rate(port_info_t *info, float rate);
> extern void pktgen_set_ipaddr(port_info_t *info, char type,
> cmdline_ipaddr_t *ip);
> extern void pktgen_set_dst_mac(port_info_t *info, cmdline_etheraddr_t *mac);
>diff --git a/app/pktgen-port-cfg.h b/app/pktgen-port-cfg.h
>index bd5876c..a20286d 100644
>--- a/app/pktgen-port-cfg.h
>+++ b/app/pktgen-port-cfg.h
>@@ -193,7 +193,7 @@ typedef struct port_info_s {
> uint16_t pid; /**< Port ID value */
> uint16_t tx_burst; /**< Number of TX burst packets */
> uint8_t pad0;
>- uint8_t tx_rate; /**< Percentage rate for tx packets */
>+ float tx_rate; /**< Percentage rate for tx packets */
> rte_atomic32_t port_flags; /**< Special send flags for ARP and other */
>
> rte_atomic64_t transmit_count; /**< Packets to transmit loaded into current_tx_count */
>diff --git a/app/pktgen.c b/app/pktgen.c
>index a0705ab..a64e0ca 100644
>--- a/app/pktgen.c
>+++ b/app/pktgen.c
>@@ -143,7 +143,7 @@ pktgen_packet_rate(port_info_t *info)
> info->tx_pps = pps;
> info->tx_cycles = ((cpp * info->tx_burst) /
> wr_get_port_txcnt(pktgen.l2p, info->pid));
>- info->tx_cycles -= ff[info->tx_rate / 10];
>+ info->tx_cycles -= ff[(int)info->tx_rate / 10];
> }
>
> /**************************************************************************//**
>--
>1.9.1
>
>
Regards,
Keith
More information about the dev
mailing list