All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: davem@davemloft.net, Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	Jakub Kicinski <kuba@kernel.org>,
	johannes@sipsolutions.net, alex.aring@gmail.com,
	stefan@datenfreihafen.org, mareklindner@neomailbox.ch,
	sw@simonwunderlich.de, a@unstable.cc,
	linux-wireless@vger.kernel.org, linux-wpan@vger.kernel.org
Subject: Re: [PATCH net-next] net: ifdefy the wireless pointers in struct net_device
Date: Tue, 17 May 2022 13:49:13 +0200	[thread overview]
Message-ID: <2780967.JztxfRx3z1@ripper> (raw)
In-Reply-To: <20220516215638.1787257-1-kuba@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2686 bytes --]

On Monday, 16 May 2022 23:56:38 CEST Jakub Kicinski wrote:
> diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
> index 83fb51b6e299..15d2bb4cd301 100644
> --- a/net/batman-adv/hard-interface.c
> +++ b/net/batman-adv/hard-interface.c
> @@ -307,9 +307,11 @@ static bool batadv_is_cfg80211_netdev(struct net_device *net_device)
>         if (!net_device)
>                 return false;
>  
> +#if IS_ENABLED(CONFIG_WIRELESS)
>         /* cfg80211 drivers have to set ieee80211_ptr */
>         if (net_device->ieee80211_ptr)
>                 return true;
> +#endif
>  
>         return false;
>  }

Acked-by: Sven Eckelmann <sven@narfation.org>


On Tuesday, 17 May 2022 09:48:24 CEST Johannes Berg wrote:
> Something like the patch below might do that, but I haven't carefully
> checked it yet, nor checked if there are any paths in mac80211/drivers
> that might be doing this check - and it looks from Jakub's patch that
> batman code would like to check this too.

Yes, if something like netdev_is_wireless would be available then we could 
change it to:

diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index 35fadb924849..50a53e3364bf 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -294,26 +294,6 @@ static bool batadv_is_wext_netdev(struct net_device *net_device)
 	return false;
 }
 
-/**
- * batadv_is_cfg80211_netdev() - check if the given net_device struct is a
- *  cfg80211 wifi interface
- * @net_device: the device to check
- *
- * Return: true if the net device is a cfg80211 wireless device, false
- *  otherwise.
- */
-static bool batadv_is_cfg80211_netdev(struct net_device *net_device)
-{
-	if (!net_device)
-		return false;
-
-	/* cfg80211 drivers have to set ieee80211_ptr */
-	if (net_device->ieee80211_ptr)
-		return true;
-
-	return false;
-}
-
 /**
  * batadv_wifi_flags_evaluate() - calculate wifi flags for net_device
  * @net_device: the device to check
@@ -328,7 +308,7 @@ static u32 batadv_wifi_flags_evaluate(struct net_device *net_device)
 	if (batadv_is_wext_netdev(net_device))
 		wifi_flags |= BATADV_HARDIF_WIFI_WEXT_DIRECT;
 
-	if (batadv_is_cfg80211_netdev(net_device))
+	if (netdev_is_wireless(net_device))
 		wifi_flags |= BATADV_HARDIF_WIFI_CFG80211_DIRECT;
 
 	real_netdev = batadv_get_real_netdevice(net_device);
@@ -341,7 +321,7 @@ static u32 batadv_wifi_flags_evaluate(struct net_device *net_device)
 	if (batadv_is_wext_netdev(real_netdev))
 		wifi_flags |= BATADV_HARDIF_WIFI_WEXT_INDIRECT;
 
-	if (batadv_is_cfg80211_netdev(real_netdev))
+	if (netdev_is_wireless(real_netdev))
 		wifi_flags |= BATADV_HARDIF_WIFI_CFG80211_INDIRECT;
 
 out:

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2022-05-17 11:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 21:56 [PATCH net-next] net: ifdefy the wireless pointers in struct net_device Jakub Kicinski
2022-05-17  2:12 ` Florian Fainelli
2022-05-17  7:48   ` Johannes Berg
2022-05-17 17:37     ` Jakub Kicinski
2022-05-17 18:16       ` Johannes Berg
2022-05-17 19:33   ` Alexander Aring
2022-05-17 19:49     ` Jakub Kicinski
2022-05-17  4:36 ` Kalle Valo
2022-05-17 17:32   ` Jakub Kicinski
2022-05-17  7:08 ` Stefan Schmidt
2022-05-17  7:51 ` Johannes Berg
2022-05-17 17:44   ` Jakub Kicinski
2022-05-17 18:03     ` Johannes Berg
2022-05-17 11:49 ` Sven Eckelmann [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=2780967.JztxfRx3z1@ripper \
    --to=sven@narfation.org \
    --cc=a@unstable.cc \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=mareklindner@neomailbox.ch \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stefan@datenfreihafen.org \
    --cc=sw@simonwunderlich.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.