From patchwork Thu Aug 29 22:54:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Drescher X-Patchwork-Id: 58283 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 078A61E536; Fri, 30 Aug 2019 00:54:33 +0200 (CEST) Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by dpdk.org (Postfix) with ESMTP id 708421E535 for ; Fri, 30 Aug 2019 00:54:31 +0200 (CEST) Received: by mail-qk1-f196.google.com with SMTP id u190so4541433qkh.5 for ; Thu, 29 Aug 2019 15:54:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Lct+IAiJYeq3qc7Im0oCGPOmkcUE5rdMdjzqNqpibAI=; b=e3yl/mqq0VMplwYPeCX+JrHbkkzk3mJ/etYUpvoWjUk1KZY51jz+o+e0dKjkaFOdWA NBOwyIJkVyWibw+llrzuRCG2A+5PAQqIcjpuSHbrzn+e/LZ2prIL7t7O3vjK9HTN8h69 DDXgqdj4pscVZ0TeTYeHrZ0hrkJwh/rn+swGllztpcJ4TfVo18DxavM/LsMOoxqmfvFZ x7AOtjLF7qPrjdYP8ILpk84LSMZZgFDkmfByT/u/jenylKbndFGMWtY7PjPS4kKz8QZx Ad6CZsNOFZg7+yOG87ehdu1LiOH3jRvydLi6RpFCXVuRD0bxBppR+3dwJ1yrDjNTPtM+ 2/8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Lct+IAiJYeq3qc7Im0oCGPOmkcUE5rdMdjzqNqpibAI=; b=V2p6wS42tgUhrbv9JDF4czDNz62GBkq0LXmwYbL+yRw6y6Q86TlwenOJCWVxET1U7C 3thYtx+aWWVDRPd3QQ/4vIqR4+rzBUFZR1c4tg1TGJX0ONjlkyhtgGKsUAelhn4EaE1v 6dhHD2bS6Vn9O94dJDMfXYnW4Eg2nBMqUeW77X9XqLlqTdT5tnCmXyA560tvQvEnfr+l L0zn2BMwiKqkeusfy67v0A0UQrlF8hhgY+Y9timTCxatUlMmyOSSy0dWrKd6hMQW5qim uOABWzM4ezoHD1G5ebp1FhaLA+oMLHwiAONHj5HzDwzMfM9MhJeSAEVfEc6V5aUfSaV2 pffg== X-Gm-Message-State: APjAAAXJYRFxwtVh6w2F7nOHuC6FmfZoLMY8W4YPZcHYTIt8dabNnbUR qS6Upj9pjVxJJC1lLHZk+g== X-Google-Smtp-Source: APXvYqyyl1B+XHENM/3RDPw9/mu488akBzTnfbeB13fmTI9J6wScfYClmlQyHZGZT9BKI9quxdDXZA== X-Received: by 2002:a05:620a:1193:: with SMTP id b19mr6319008qkk.413.1567119270781; Thu, 29 Aug 2019 15:54:30 -0700 (PDT) Received: from cpp-rtp-gca-06.cisco.com ([2001:420:27c1:b05:225:b5ff:fe00:81d]) by smtp.googlemail.com with ESMTPSA id f27sm1706355qkl.25.2019.08.29.15.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 15:54:30 -0700 (PDT) From: Adam Drescher To: keith.wiles@intel.com Cc: dev@dpdk.org Date: Thu, 29 Aug 2019 22:54:13 +0000 Message-Id: <20190829225413.4756-1-adam.r.drescher@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] pktgen: fix config file output X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The 'save' TUI command does not export certain configuration commands with the correct syntax. As a result, when loading this config file later these commands will fail (eg. range MAC addresses, range ports). This patch fixes a number of these cases. Signed-off-by: Adam Drescher --- app/pktgen-cmds.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/app/pktgen-cmds.c b/app/pktgen-cmds.c index 1f00a21..ca62d20 100644 --- a/app/pktgen-cmds.c +++ b/app/pktgen-cmds.c @@ -184,7 +184,7 @@ pktgen_script_save(char *path) inet_mtoa(buff, sizeof(buff), &pkt->eth_dst_addr)); fprintf(fd, "set %d src mac %s\n", info->pid, inet_mtoa(buff, sizeof(buff), &pkt->eth_src_addr)); - fprintf(fd, "set %d vlanid %d\n\n", i, pkt->vlanid); + fprintf(fd, "set %d vlan %d\n\n", i, pkt->vlanid); fprintf(fd, "set %d pattern %s\n", i, (info->fill_pattern_type == ABC_FILL_PATTERN) ? "abc" : @@ -238,35 +238,36 @@ pktgen_script_save(char *path) (flags & PROCESS_RX_TAP_PKTS) ? "en" : "dis", i); fprintf(fd, "%sable %d tx_tap\n", (flags & PROCESS_TX_TAP_PKTS) ? "en" : "dis", i); - fprintf(fd, "%sable %d vlan\n\n", + fprintf(fd, "%sable %d vlan\n", (flags & SEND_VLAN_ID) ? "en" : "dis", i); - fprintf(fd, "%sable %d vlan\n\n", + fprintf(fd, "%sable %d rate\n\n", (flags & SEND_RATE_PACKETS) ? "en" : "dis", i); fprintf(fd, "#\n# Range packet information:\n"); - fprintf(fd, "range %d mac src start %s\n", i, + fprintf(fd, "range %d src mac start %s\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->src_mac, &eaddr))); - fprintf(fd, "range %d mac src min %s\n", i, + fprintf(fd, "range %d src mac min %s\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->src_mac_min, &eaddr))); - fprintf(fd, "range %d mac src max %s\n", i, + fprintf(fd, "range %d src mac max %s\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->src_mac_max, &eaddr))); - fprintf(fd, "range %d mac src inc %s\n", i, + fprintf(fd, "range %d src mac inc %s\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->src_mac_inc, &eaddr))); - fprintf(fd, "range %d mac dst start %s\n", i, + fprintf(fd, "\n"); + fprintf(fd, "range %d dst mac start %s\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->dst_mac, &eaddr))); - fprintf(fd, "range %d mac dst min %s\n", i, + fprintf(fd, "range %d dst mac min %s\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->dst_mac_min, &eaddr))); - fprintf(fd, "range %d mac dst max %s\n", i, + fprintf(fd, "range %d dst mac max %s\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->dst_mac_max, &eaddr))); - fprintf(fd, "range %d mac dst inc %s\n", i, + fprintf(fd, "range %d dst mac inc %s\n", i, inet_mtoa(buff, sizeof(buff), inet_h64tom(range->dst_mac_inc, &eaddr))); @@ -304,16 +305,16 @@ pktgen_script_save(char *path) (range->ip_proto == PG_IPPROTO_ICMP) ? "icmp" : "tcp"); fprintf(fd, "\n"); - fprintf(fd, "range %d sport start %d\n", i, range->src_port); - fprintf(fd, "range %d sport min %d\n", i, range->src_port_min); - fprintf(fd, "range %d sport max %d\n", i, range->src_port_max); - fprintf(fd, "range %d sport inc %d\n", i, range->src_port_inc); + fprintf(fd, "range %d src port start %d\n", i, range->src_port); + fprintf(fd, "range %d src port min %d\n", i, range->src_port_min); + fprintf(fd, "range %d src port max %d\n", i, range->src_port_max); + fprintf(fd, "range %d src port inc %d\n", i, range->src_port_inc); fprintf(fd, "\n"); - fprintf(fd, "range %d dport start %d\n", i, range->dst_port); - fprintf(fd, "range %d dport min %d\n", i, range->dst_port_min); - fprintf(fd, "range %d dport max %d\n", i, range->dst_port_max); - fprintf(fd, "range %d dport inc %d\n", i, range->dst_port_inc); + fprintf(fd, "range %d dst port start %d\n", i, range->dst_port); + fprintf(fd, "range %d dst port min %d\n", i, range->dst_port_min); + fprintf(fd, "range %d dst port max %d\n", i, range->dst_port_max); + fprintf(fd, "range %d dst port inc %d\n", i, range->dst_port_inc); fprintf(fd, "\n"); fprintf(fd, "range %d ttl start %d\n", i, range->ttl); @@ -353,7 +354,7 @@ pktgen_script_save(char *path) fprintf(fd, "rate %d fps %d\n", i, rate->fps); fprintf(fd, "rate %d lines %d\n", i, rate->vlines); fprintf(fd, "rate %d pixels %d\n", i, rate->pixels); - fprintf(fd, "rate %d color %d\n", i, rate->color_bits); + fprintf(fd, "rate %d color bits %d\n", i, rate->color_bits); fprintf(fd, "rate %d payload size %d\n\n", i, rate->payload); fprintf(fd, "rate %d overhead %d\n", i, rate->overhead);