Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5272756imb; Thu, 7 Mar 2019 11:38:39 -0800 (PST) X-Google-Smtp-Source: APXvYqy086lG4EkNx4wdV9MSpez6U5P0caX+NoT7eKW0yHd6lJZNBIXeVXoFjT8tUvfs4BbIrYHc X-Received: by 2002:a65:4384:: with SMTP id m4mr12762018pgp.375.1551987519210; Thu, 07 Mar 2019 11:38:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551987519; cv=none; d=google.com; s=arc-20160816; b=hVmigzjTsdjZ6JewP45RXsmWV/X1Cc9mWusGlNotHsD96ZTXxGDIL9qBckNlwtbXqR cgBcIia4WWZcpEMbSLCkVEUQ+31+D+HFAJEmIu8lnni5eSVQjRvDbJRajqSViDz4ESH1 mYPG9NQnyoNqx9AbWnq/TOu8CsYQlBmfEoSYtCmT1og4kNXvY6qfaCttj+RQ15K5z9pU F0fwW6LXXT2iG0ivSALajr6yxesTLun4q+S67w6tfVF++hrfoWhge2iHMuozhpIgvJT7 ayHqr02ItLBatjKGIkVGpFGu/xuYIGDM7rmM6P7ynwTYbS81L0HD6xndxExHRCV2t/NU BGyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=x2ue+ozY2WLuwrtjMSicDXOHqXykid2WfeTA+weyzag=; b=qxm1kCjVpdHsFFqpqB8/oqxBublHsw1Z6dhieH3CmlLBfOzjOjj3YHdwftsDehEHE0 dhfMWA2d/eMLM2kkhMPO2YUZZnPm0+XqhTBn3ri3wowFf++tBKvfrVCZ5Xey+nZQs0Cc gkZv/JPDrvoRCnX9VJj3y60s8FqwbvxwptP3dXa1Fk/q1SnQT4YPBhVz6a9Xsc9HBJlo s0n5gA13clWSGqnfQxnhyxMmQNz20vCGoNNH+If+AV3x95fOpNE6eqKX/4NYJ7qq4Pfo Rjg+vW48/mD15NUywPEvmO6bZ2XErEOUrJ0NDoHhoubMkt/9LgQWu4JviLccV8llKxbs s9Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j8si79531pgq.542.2019.03.07.11.38.23; Thu, 07 Mar 2019 11:38:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726771AbfCGTiA (ORCPT + 99 others); Thu, 7 Mar 2019 14:38:00 -0500 Received: from postout1.mail.lrz.de ([129.187.255.137]:50784 "EHLO postout1.mail.lrz.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726298AbfCGTiA (ORCPT ); Thu, 7 Mar 2019 14:38:00 -0500 X-Greylist: delayed 418 seconds by postgrey-1.27 at vger.kernel.org; Thu, 07 Mar 2019 14:37:57 EST Received: from lxmhs51.srv.lrz.de (localhost [127.0.0.1]) by postout1.mail.lrz.de (Postfix) with ESMTP id 44Fghw5SVGzycg; Thu, 7 Mar 2019 20:30:56 +0100 (CET) X-Virus-Scanned: by amavisd-new at lrz.de in lxmhs51.srv.lrz.de X-Spam-Flag: NO X-Spam-Score: -2.893 X-Spam-Level: X-Spam-Status: No, score=-2.893 tagged_above=-999 required=5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, LRZ_ENVFROM_FROM_ALIGNED_STRICT=0.001, LRZ_ENVFROM_FROM_MATCH=0.001, LRZ_FROM_HOSTED_DOMAIN=0.001, LRZ_FROM_SHORT=0.001, LRZ_HAS_SPF=0.001, LRZ_MSGID_AN_AN=0.001, LRZ_MSGID_NO_FQDN=0.001] autolearn=no autolearn_force=no Received: from postout1.mail.lrz.de ([127.0.0.1]) by lxmhs51.srv.lrz.de (lxmhs51.srv.lrz.de [127.0.0.1]) (amavisd-new, port 20024) with LMTP id nXS6D6YloggW; Thu, 7 Mar 2019 20:30:56 +0100 (CET) Received: from mission-control (unknown [207.180.219.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by postout1.mail.lrz.de (Postfix) with ESMTPSA id 44Fghv1tzczycf; Thu, 7 Mar 2019 20:30:55 +0100 (CET) Date: Thu, 7 Mar 2019 20:30:45 +0100 From: ga58taw@mytum.de To: Kalle Valo Cc: Julius Niedworok , linux-wireless@vger.kernel.org, ga58taw@mytum.de, david@redhat.com, nc@net.in.tum.de, Johannes Berg , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC v2] mac80211: debugfs option to force TX status frames Message-ID: <20190307193045.a7awwn6mycloccq5@mission-control> References: <20190306200206.60916-1-julius.n@gmx.net> <87k1hazo6r.fsf@purkki.adurom.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87k1hazo6r.fsf@purkki.adurom.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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