linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fred Klassen <fklassen@appneta.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Shuah Khan <shuah@kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-kselftest@vger.kernel.org,
	Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next v2 1/3] net/udpgso_bench_tx: options to exercise TX CMSG
Date: Thu, 13 Jun 2019 16:17:16 -0700	[thread overview]
Message-ID: <361B0BB3-0351-4F97-9BAD-9E37DCCFAE2F@appneta.com> (raw)
In-Reply-To: <CAF=yD-KcA5NZ2_tp3zaxW5sbf75a17DLX+VR9hyZo7MTcYAxiw@mail.gmail.com>

> On May 28, 2019, at 2:35 PM, Willem de Bruijn <willemdebruijn.kernel@gmail.com> wrote:
>> -static void flush_zerocopy(int fd)
>> +static void flush_cmsg(struct cmsghdr *cmsg)
>> {
>> -       struct msghdr msg = {0};        /* flush */
>> +       switch (cmsg->cmsg_level) {
>> +       case SOL_SOCKET:
>> +               if (cmsg->cmsg_type == SO_TIMESTAMPING) {
>> +                       int i;
>> +
>> +                       i = (cfg_tx_ts == SOF_TIMESTAMPING_TX_HARDWARE) ? 2 : 0;
>> +                       struct scm_timestamping *tss;
> 
> Please don't mix declarations and code

Fixing this as well as other declarations for v3.

>> +
>> +                       tss = (struct scm_timestamping *)CMSG_DATA(cmsg);
>> +                       if (tss->ts[i].tv_sec == 0)
>> +                               stat_tx_ts_errors++;
>> +               } else {
>> +                       error(1, 0,
>> +                             "unknown SOL_SOCKET cmsg type=%u level=%u\n",
>> +                             cmsg->cmsg_type, cmsg->cmsg_level);
> 
> Technically, no need to repeat cmsg_level


Will fix all 3 similar messages

>> +               }
>> +               break;
>> +       case SOL_IP:
>> +       case SOL_IPV6:
>> +               switch (cmsg->cmsg_type) {
>> +               case IP_RECVERR:
>> +               case IPV6_RECVERR:
>> +               {
>> +                       struct sock_extended_err *err;
>> +
>> +                       err = (struct sock_extended_err *)CMSG_DATA(cmsg);
>> +                       switch (err->ee_origin) {
>> +                       case SO_EE_ORIGIN_TIMESTAMPING:
>> +                               // Got a TX timestamp from error queue
>> +                               stat_tx_ts++;
>> +                               break;
>> +                       case SO_EE_ORIGIN_ICMP:
>> +                       case SO_EE_ORIGIN_ICMP6:
>> +                               if (cfg_verbose)
>> +                                       fprintf(stderr,
>> +                                               "received ICMP error: type=%u, code=%u\n",
>> +                                               err->ee_type, err->ee_code);
>> +                               break;
>> +                       case SO_EE_ORIGIN_ZEROCOPY:
>> +                       {
>> +                               __u32 lo = err->ee_info;
>> +                               __u32 hi = err->ee_data;
>> +
>> +                               if (hi == lo - 1) {
>> +                                       // TX was aborted
> 
> where does this come from?

This check can be removed. In sock_zerocopy_callback() this
check was intended to cover the condition where len == 0,
however it appears that it is impossible.

	/* if !len, there was only 1 call, and it was aborted
	 * so do not queue a completion notification
	 */

	if (!uarg->len || sock_flag(sk, SOCK_DEAD))
		goto release;

	len = uarg->len;
	lo = uarg->id;
	hi = uarg->id + len - 1;


> 
>> +                                       stat_zcopy_errors++;
>> +                                       if (cfg_verbose)
>> +                                               fprintf(stderr,
>> +                                                       "Zerocopy TX aborted: lo=%u hi=%u\n",
>> +                                                       lo, hi);
>> +                               } else if (hi == lo) {
> 
> technically, no need to special case
> 

Removed

>> +                                       // single ID acknowledged
>> +                                       stat_zcopies++;
>> +                               } else {
>> +                                       // range of IDs acknowledged
>> +                                       stat_zcopies += hi - lo + 1;
>> +                               }
>> +                               break;
> 
>> +static void set_tx_timestamping(int fd)
>> +{
>> +       int val = SOF_TIMESTAMPING_OPT_CMSG | SOF_TIMESTAMPING_OPT_ID;
> 
> Could consider adding SOF_TIMESTAMPING_OPT_TSONLY to not have to deal
> with a data buffer on recv from errqueue.

Will add and modify code appropriately for v3.


  reply	other threads:[~2019-06-13 23:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28 18:47 [PATCH net-next v2 0/3] UDP GSO audit tests Fred Klassen
2019-05-28 18:47 ` [PATCH net-next v2 1/3] net/udpgso_bench_tx: options to exercise TX CMSG Fred Klassen
2019-05-28 21:35   ` Willem de Bruijn
2019-06-13 23:17     ` Fred Klassen [this message]
2019-05-28 21:36   ` Willem de Bruijn
2019-05-28 18:47 ` [PATCH net-next v2 2/3] net/udpgso_bench.sh add UDP GSO audit tests Fred Klassen
2019-05-28 20:09   ` Willem de Bruijn
2019-05-28 18:47 ` [PATCH net-next v2 3/3] net/udpgso_bench.sh test fails on error Fred Klassen
2019-05-28 20:08   ` Willem de Bruijn

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=361B0BB3-0351-4F97-9BAD-9E37DCCFAE2F@appneta.com \
    --to=fklassen@appneta.com \
    --cc=davem@davemloft.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=yoshfuji@linux-ipv6.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).