netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <weiyang@linux.vnet.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: weiyang@linux.vnet.ibm.com, fan.du@windriver.com, netdev@vger.kernel.org
Subject: Re: [Patch net-next] pktgen: small code cleanup
Date: Fri, 4 Apr 2014 21:29:51 +0800	[thread overview]
Message-ID: <20140404132951.GA5969@richard> (raw)
In-Reply-To: <20140403.133525.1594438930436435429.davem@davemloft.net>

On Thu, Apr 03, 2014 at 01:35:25PM -0400, David Miller wrote:
>From: Wei Yang <weiyang@linux.vnet.ibm.com>
>Date: Wed,  2 Apr 2014 16:24:51 +0800
>
>> Print the warning when the format is not correct.
>> 
>> Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
>> ---
>>  net/core/pktgen.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
>> index fdac61c..89d33c2 100644
>> --- a/net/core/pktgen.c
>> +++ b/net/core/pktgen.c
>> @@ -1767,7 +1767,7 @@ static ssize_t pktgen_thread_write(struct file *file,
>>  	char *pg_result;
>>  
>>  	if (count < 1) {
>> -		//      sprintf(pg_result, "Wrong command format");
>> +		pr_warn("WARNING: Wrong command format in %s\n", __func__);
>>  		return -EINVAL;
>>  	}
>>  
>
>I don't think a kernel log message is appropriate.
>
>The intention, as per the comment protected code, was to make this
>error message show up in show_results()'s output.

Agree, I guess the author originally intended to put this warning and shows in
show_results(). While since there is a chance that at this moment that the
pktgen_thread doesn't exist, then can't put into the results.

I did a search and try to find who introduce this code. Finally found this
commit 
        e051211 [NET]: pktgen update
in git repo:
        git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git

Unfortunately, this looks like a typo and author forgot to remove it.

At the mean time, I found in proc_if_write(), it print a kernel log message
when the format is not correct. From this log, it shows originally it tried to
save the warning message in the "reslut", but I don't know why it change to
just print a kernel log.

This code is preserved till now in pktgen_if_write(). Actually, I think in
this place we could save it in the pg_result.

So, my suggestion is:
1. in pktgen_thread_write(), remove the code which is commented out
2. in pktgen_if_write(), save warning message in pg_result

Hope my understanding is correct, if not, please let me know :-)

>
>I'm not applying this, sorry.

-- 
Richard Yang
Help you, Help me

      reply	other threads:[~2014-04-04 13:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02  8:24 [Patch net-next] pktgen: small code cleanup Wei Yang
2014-04-03 17:35 ` David Miller
2014-04-04 13:29   ` Wei Yang [this message]

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=20140404132951.GA5969@richard \
    --to=weiyang@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=fan.du@windriver.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).