linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ga58taw@mytum.de
To: Kalle Valo <kvalo@codeaurora.org>
Cc: Julius Niedworok <julius.n@gmx.net>,
	linux-wireless@vger.kernel.org, ga58taw@mytum.de,
	david@redhat.com, nc@net.in.tum.de,
	Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC v2] mac80211: debugfs option to force TX status frames
Date: Thu, 7 Mar 2019 20:30:45 +0100	[thread overview]
Message-ID: <20190307193045.a7awwn6mycloccq5@mission-control> (raw)
In-Reply-To: <87k1hazo6r.fsf@purkki.adurom.net>

On Thu, Mar 07, 2019 at 05:42:04PM +0200, Kalle Valo wrote:
> > +   len = scnprintf(buf, sizeof(buf), "%d\n", (int)local->force_tx_status);
>
> I wonder about the cast, is it guaranteed that a bool is always of the
> same size as an int?

Why is this a problem? If a bool is smaller than an int, the compiler
emits code that will prepend the value of force_tx_status with zeros. If
it is larger than an int the compiler emits code that will truncate
force_tx_status to sizeof(int) bytes. So it doesn't matter how large bool
and/or int are, the code always prints '0' or '1' depending on the value
of force_tx_status.

> > --- a/net/mac80211/tx.c
> > +++ b/net/mac80211/tx.c
> > @@ -2463,6 +2463,11 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
> >     if (IS_ERR(sta))
> >             sta = NULL;
> >
> > +#ifdef CONFIG_MAC80211_DEBUGFS
> > +           if (local->force_tx_status)
> > +                   info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
> > +#endif
> > +
> >     /* convert Ethernet header to proper 802.11 header (based on
> >      * operation mode) */
> >     ethertype = (skb->data[12] << 8) | skb->data[13];
> > @@ -3468,6 +3473,11 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
> >                   (tid_tx ? IEEE80211_TX_CTL_AMPDU : 0);
> >     info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT;
> >
> > +#ifdef CONFIG_MAC80211_DEBUGFS
> > +           if (local->force_tx_status)
> > +                   info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
> > +#endif
>
> IMHO the ifdefs look pointless just to save four bytes. I would move
> force_tx_status outside of ifdef in the struct so that the actual code
> doesn't have ugly ifdefs.

I don't think ifdefs are ugly in this case. They clearly indicate that the
code belongs to the debugfs implementation of mac80211. In addition, when
we remove the ifdefs, code that only belongs to the debugfs implementation
of mac80211 is always included in the kernel (even when the config
option is turned off!) which, I think, is much more ugly than the ifdefs.

Thanks for your comments and ideas.

Charlie

  reply	other threads:[~2019-03-07 19:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26  9:40 [PATCH RFC] mac80211: Use IFF_ECHO to force delivery of tx_status frames Julius Niedworok
2019-02-26 11:04 ` Oliver Hartkopp
2019-02-26 13:13   ` Julius Niedworok
2019-02-26 13:33     ` Johannes Berg
2019-02-28  9:05       ` Julius Niedworok
2019-03-01  8:32         ` Johannes Berg
2019-03-02 15:16           ` Julius Niedworok
2019-03-06 20:02           ` [PATCH RFC v2] mac80211: debugfs option to force TX status frames Julius Niedworok
2019-03-07 15:42             ` Kalle Valo
2019-03-07 19:30               ` ga58taw [this message]
2019-03-11 14:03                 ` Kalle Valo
2019-03-11 14:52                   ` Jeremy Sowden
2019-03-19 15:07                     ` Julius Niedworok
2019-03-20 12:13                       ` Jeremy Sowden
2019-03-28 20:01           ` [PATCH v3] " Julius Niedworok

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=20190307193045.a7awwn6mycloccq5@mission-control \
    --to=ga58taw@mytum.de \
    --cc=davem@davemloft.net \
    --cc=david@redhat.com \
    --cc=johannes@sipsolutions.net \
    --cc=julius.n@gmx.net \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nc@net.in.tum.de \
    --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).