out-of-tree mac80211 driver in a package feed; how to determine mac80211 version

Tim Harvey tharvey at gateworks.com
Fri Jan 31 11:56:01 PST 2025


On Wed, Jan 29, 2025 at 12:14 AM Christian Marangi (Ansuel)
<ansuelsmth at gmail.com> wrote:
>
> Il giorno mer 29 gen 2025 alle ore 01:39 Tim Harvey
> <tharvey at gateworks.com> ha scritto:
> >
> > Greetings,
> >
> > I've got an out-of-tree mac80211 driver [1] that I built in a package
> > feed. The driver has a lot of kernel compatibility defines using
> > KERNEL_VERSION(x,y,z) and LINUX_VERSION_CODE to support various
> > kernels from fairly old up to 6.12. I'm finding that this doesn't
> > quite work for an OpenWrt package as its the mac80211 version that
> > needs to be used for LINUX_VERSION_CODE instead of the kernel being
> > used.
> >
> > Is there a recommendation of how to handle this?
> >
> > Best Regards,
> >
> > Tim
> > [1] https://github.com/Gateworks/gw-openwrt-packages/blob/master/gateworks/nrc7292/Makefile
> >
>
> Hi Tim,
>
> for mac80211, we use the backports project and that follows a
> different version than
> what is used for linux.
> If your intention is to propose this in OpenWrt, ideally all the
> define flag should
> be dropped and produce a more up-to-date driver with maybe 6.12 and 6.6 max.

Hi Ansuel,

Why 6.6? If main is using mac80211 linux-backports of 6.12 wouldn't I
only need to make sure its compatible with 6.12?

The out-of-tree driver I use is used for other kernels not just
OpenWrt so my openwrt package is just a Makefile to build that shared
driver source against OpenWrt. Therefor there are lots of
compatibility defs to handle changes in mac80211 such as:
#if KERNEL_VERSION(6, 7, 0) <= LINUX_VERSION_CODE
static int nrc_post_channel_switch(struct ieee80211_hw *hw, struct
ieee80211_vif *vif, struct ieee80211_bss_conf *conf)
#else
static int nrc_post_channel_switch(struct ieee80211_hw *hw, struct
ieee80211_vif *vif)
#endif

This allows the driver source to be compatible with a range of kernels
as is done in many out-of-tree kernel drivers.

So what I'm trying to do is to understand how to use the same
out-of-tree driver source with OpenWrt but the 'LINUX_VERSION_CODE' is
the kernel version (6.6) which is wrong and needs to be the version of
the mac80211 backport (6.12).

>
> But it really doesn't make sense to have IFDEF to support 2.x or 3.x...

What do you mean by 2.x or 3.x or are you saying it doesn't make sense
to use ifdef's at all? It does require compat ifdefs if I'm not trying
to create multiple driver sources for different kernels.

>
> Also consider that mac80211 backports define have different config flag to
> differentiate from kernel config (CPTCFG prefix)

Interesting... but unfortunately I see nothing in the backports
.config that shows the kernel version the backport is from.

Best Regards,

Tim



More information about the openwrt-devel mailing list