netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Daniel Borkmann <dborkman@redhat.com>
Cc: David Miller <davem@davemloft.net>,
	Francesco Fondelli <francesco.fondelli@gmail.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net 2/3] pktgen: give user result when disable vlan/svlan
Date: Thu, 15 May 2014 19:05:56 +0800	[thread overview]
Message-ID: <20140515110556.GO25631@localhost.localdomain> (raw)
In-Reply-To: <5374903F.6040202@redhat.com>

On Thu, May 15, 2014 at 12:00:31PM +0200, Daniel Borkmann wrote:
> On 05/15/2014 11:46 AM, Hangbin Liu wrote:
> >Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> >---
> >  net/core/pktgen.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> >diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> >index dcf367f..1809bdf 100644
> >--- a/net/core/pktgen.c
> >+++ b/net/core/pktgen.c
> >@@ -1573,8 +1573,7 @@ static ssize_t pktgen_if_write(struct file *file,
> >  			pkt_dev->vlan_id = 0xffff; /* turn off VLAN/SVLAN */
> >  			pkt_dev->svlan_id = 0xffff;
> >
> >-			if (debug)
> >-				pr_debug("VLAN/SVLAN turned off\n");
> >+			sprintf(pg_result, "OK: VLAN/SVLAN turned off");
> 
> I think that might break user scripts as pg_result is copied to user
> space, and currently only expected to return 'OK: svlan_id=%u' if it
> was actually successful. Unfortunately, scripts that might only check
> for 'OK' in the string could make wrong assumptions later on.

But the original behavior will keep the last return value, which may make user
confused. e.g.

# echo vlan_id 10 > /proc/net/pktgen/eno4
# cat /proc/net/pktgen/eno4
Params: count 1000  min_pkt_size: 0  max_pkt_size: 0
     frags: 0  delay: 0  clone_skb: 0  ifname: eno4
     flows: 0 flowlen: 0
     queue_map_min: 0  queue_map_max: 0
     dst_min:   dst_max:
        src_min:   src_max:
     src_mac: 6c:ae:8b:20:7b:cc dst_mac: 00:00:00:00:00:00
     udp_src_min: 9  udp_src_max: 9  udp_dst_min: 9  udp_dst_max: 9
     src_mac_count: 0  dst_mac_count: 0
     vlan_id: 10  vlan_p: 0  vlan_cfi: 0
     Flags:
Current:
     pkts-sofar: 0  errors: 0
     started: 0us  stopped: 0us idle: 0us
     seq_num: 0  cur_dst_mac_offset: 0  cur_src_mac_offset: 0
     cur_saddr: 0.0.0.0  cur_daddr: 0.0.0.0
     cur_udp_dst: 0  cur_udp_src: 0
     cur_queue_map: 0
     flows: 0
Result: OK: vlan_id=10

# echo vlan_id 9999 > /proc/net/pktgen/eno4
# cat /proc/net/pktgen/eno4
Params: count 1000  min_pkt_size: 0  max_pkt_size: 0
     frags: 0  delay: 0  clone_skb: 0  ifname: eno4
     flows: 0 flowlen: 0
     queue_map_min: 0  queue_map_max: 0
     dst_min:   dst_max:
        src_min:   src_max:
     src_mac: 6c:ae:8b:20:7b:cc dst_mac: 00:00:00:00:00:00
     udp_src_min: 9  udp_src_max: 9  udp_dst_min: 9  udp_dst_max: 9
     src_mac_count: 0  dst_mac_count: 0
     Flags:
Current:
     pkts-sofar: 0  errors: 0
     started: 0us  stopped: 0us idle: 0us
     seq_num: 0  cur_dst_mac_offset: 0  cur_src_mac_offset: 0
     cur_saddr: 0.0.0.0  cur_daddr: 0.0.0.0
     cur_udp_dst: 0  cur_udp_src: 0
     cur_queue_map: 0
     flows: 0
Result: OK: vlan_id=10

> 
> >  		}
> >  		return count;
> >  	}
> >@@ -1629,8 +1628,7 @@ static ssize_t pktgen_if_write(struct file *file,
> >  		} else {
> >  			pkt_dev->svlan_id = 0xffff;
> >
> >-			if (debug)
> >-				pr_debug("SVLAN turned off\n");
> >+			sprintf(pg_result, "OK: SVLAN turned off");
> 
> Ditto.
> 
> >  		}
> >  		return count;
> >  	}
> >

-- 

Thanks & Best Regards
Hangbin Liu <liuhangbin@gmail.com>

  reply	other threads:[~2014-05-15 11:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-15  9:46 [PATCH net 1/3] pktgen: should not turn off vlan when we disable svlan Hangbin Liu
2014-05-15  9:46 ` [PATCH net 2/3] pktgen: give user result when disable vlan/svlan Hangbin Liu
2014-05-15 10:00   ` Daniel Borkmann
2014-05-15 11:05     ` Hangbin Liu [this message]
2014-05-15 14:12       ` Hangbin Liu
2014-05-15  9:46 ` [PATCH net 3/3] pktgen: disable IPv6 when we want to use IPv4 Hangbin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140515110556.GO25631@localhost.localdomain \
    --to=liuhangbin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=francesco.fondelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).