dt-bindings: document common IEEE 802.11 frequency properties
Subsystems (3)
PATCH 1/2 dt-bindings: document common IEEE 802.11 frequency properties
From: Rafał Miłecki <[email protected]>
This new file should be used for properties handled at higher level and so usable with all drivers.
--- .../devicetree/bindings/net/wireless/ieee80211.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/ieee80211.txt
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +16 -0
@@ -0,0 +1,16 @@ +Common IEEE 802.11 properties + +This provides documentation of common properties that are handled by a proper +net layer and don't require extra driver code. + +Optional properties: + - ieee80211-min-center-freq : minimal supported frequency in KHz + - ieee80211-max-center-freq : maximal supported frequency in KHz + +Example: + +pcie@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-min-center-freq = <2437000>; + ieee80211-max-center-freq = <2457000>; +};
Signature · 6 lines
2.10.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/2 cfg80211: reg: support ieee80211-(min|max)-center-freq DT properties
In reply to a message not in the archiveFrom: Rafał Miłecki <[email protected]>
They allow specifying hardware limitations of supported channels. This may be useful for specifying single band devices or devices that support only some part of the whole band.
E.g. some tri-band routers have separated radios for lower and higher part of 5 GHz band.
--- net/wireless/reg.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
net/wireless/reg.c +34 -0
@@ -1123,6 +1123,26 @@ const char *reg_initiator_name(enum nl80211_reg_initiator initiator) }EXPORT_SYMBOL (reg_initiator_name); +static bool reg_center_freq_of_valid (struct wiphy *wiphy, +struct ieee80211_channel *chan) +{ +struct device_node *np =wiphy_dev (wiphy)->of_node; +u32 val; + +if (!np) +return true; + +if (!of_property_read_u32 (np,"ieee80211-min-center-freq" , &val) && + chan->center_freq <KHZ_TO_MHZ (val)) +return false; + +if (!of_property_read_u32 (np,"ieee80211-max-center-freq" , &val) && + chan->center_freq >KHZ_TO_MHZ (val)) +return false; + +return true; +} +static uint32_t reg_rule_to_chan_bw_flags (const struct ieee80211_regdomain *regd,const struct ieee80211_reg_rule *reg_rule,const struct ieee80211_channel *chan)
@@ -1209,6 +1229,13 @@ static void handle_channel(struct wiphy *wiphy,return ; } +if (!reg_center_freq_of_valid (wiphy, chan)) { +pr_debug ("Disabling freq %d MHz as it's out of OF limits\n" , + chan->center_freq); + chan->flags |=IEEE80211_CHAN_DISABLED ; +return ; + } + regd =reg_get_regdomain (wiphy); power_rule = ®_rule->power_rule;
@@ -1741,6 +1768,13 @@ static void handle_channel_custom(struct wiphy *wiphy,return ; } +if (!reg_center_freq_of_valid (wiphy, chan)) { +pr_debug ("Disabling freq %d MHz as it's out of OF limits\n" , + chan->center_freq); + chan->flags |=IEEE80211_CHAN_DISABLED ; +return ; + } + power_rule = ®_rule->power_rule; bw_flags =reg_rule_to_chan_bw_flags (regd, reg_rule, chan);
Signature · 1 line
2.10.1
Quoted 17 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This new file should be used for properties handled at higher level and so usable with all drivers.
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/net/wireless/ieee80211.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/ieee80211.txtDocumentation/devicetree/bindings/net/wireless/ieee80211.txt new file +0
-0
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +4
-0@@ -0,0 +1,16 @@ +Common IEEE 802.11 properties + +This provides documentation of common properties that are handled by a proper +net layer and don't require extra driver code.
Please do not make any assumptions on how DT properties are handled nor by what. Just state that these properties apply to all wireless devices and are applicable to device specific bindings.
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 16
Quoted 11 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +11
-0+Optional properties: + - ieee80211-min-center-freq : minimal supported frequency in KHz + - ieee80211-max-center-freq : maximal supported frequency in KHz + +Example: + +pcie@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-min-center-freq = <2437000>; + ieee80211-max-center-freq = <2457000>; +};
Is this the proper level to define it. I was expecting a child node of the pci(e) controller. Maybe I am misreading the example.
Regards,
Quoted 12 lines · Arend van Spriel
Quoted 11 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This new file should be used for properties handled at higher level and so usable with all drivers.
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/net/wireless/ieee80211.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/ieee80211.txt
Quoted 14 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 4
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +4
-0@@ -0,0 +1,16 @@ +Common IEEE 802.11 properties + +This provides documentation of common properties that are handled by a proper +net layer and don't require extra driver code.Please do not make any assumptions on how DT properties are handled nor by what. Just state that these properties apply to all wireless devices and are applicable to device specific bindings.
OK, I'll try to improve this description.
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +6
-0+Optional properties: + - ieee80211-min-center-freq : minimal supported frequency in KHz + - ieee80211-max-center-freq : maximal supported frequency in KHz + +Example: +
Quoted 8 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 16
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +5
-0+pcie@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-min-center-freq = <2437000>; + ieee80211-max-center-freq = <2457000>; +};Is this the proper level to define it. I was expecting a child node of the pci(e) controller. Maybe I am misreading the example.
This is device node, not a controller node (and yes, it's complete node). You just need to add such a node inside the controller one.
It doesn't seem to be clearly documented, but you can see it in examples in:Documentation/devicetree/bindings/pci/mvebu-pci.txt Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt Documentation/devicetree/bindings/pci/pci-rcar-gen2.txt
The assignment is done inpci_scan_device -> pci_set_of_node -> of_pci_find_child_device (so this isn't controller specific thing).
Signature · 5 lines
Rafał -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 47 lines · Rafał Miłecki
Quoted 12 lines · Arend van Spriel
Quoted 11 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This new file should be used for properties handled at higher level and so usable with all drivers.
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/net/wireless/ieee80211.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/ieee80211.txtQuoted 14 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 4
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +4
-0@@ -0,0 +1,16 @@ +Common IEEE 802.11 properties + +This provides documentation of common properties that are handled by a proper +net layer and don't require extra driver code.Please do not make any assumptions on how DT properties are handled nor by what. Just state that these properties apply to all wireless devices and are applicable to device specific bindings.
OK, I'll try to improve this description.
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +6
-0+Optional properties: + - ieee80211-min-center-freq : minimal supported frequency in KHz + - ieee80211-max-center-freq : maximal supported frequency in KHz + +Example: +Quoted 8 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 16
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +5
-0+pcie@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-min-center-freq = <2437000>; + ieee80211-max-center-freq = <2457000>; +};Is this the proper level to define it. I was expecting a child node of the pci(e) controller. Maybe I am misreading the example.
Quoted 2 lines
This is device node, not a controller node (and yes, it's complete node). You just need to add such a node inside the controller one.
you should name the node wifi@0,0 instead. I revised my ath9k OF binding documentation due to similar concerns (and after seeing the result I must admit that they were right). you can have a look at the result here: [0]
apart from that: thanks for the patch, I will try this as soon as possible!
Regards,
Martin
Quoted 48 lines · Martin Blumenstingl
Quoted 47 lines · Rafał Miłecki
Quoted 12 lines · Arend van Spriel
Quoted 11 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This new file should be used for properties handled at higher level and so usable with all drivers.
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/net/wireless/ieee80211.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/ieee80211.txtQuoted 14 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 4
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +4
-0@@ -0,0 +1,16 @@ +Common IEEE 802.11 properties + +This provides documentation of common properties that are handled by a proper +net layer and don't require extra driver code.Please do not make any assumptions on how DT properties are handled nor by what. Just state that these properties apply to all wireless devices and are applicable to device specific bindings.
OK, I'll try to improve this description.
Quoted 14 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 15
Quoted 11 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +11
-0+Optional properties: + - ieee80211-min-center-freq : minimal supported frequency in KHz + - ieee80211-max-center-freq : maximal supported frequency in KHz + +Example: + +pcie@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-min-center-freq = <2437000>; + ieee80211-max-center-freq = <2457000>; +};Is this the proper level to define it. I was expecting a child node of the pci(e) controller. Maybe I am misreading the example.
Quoted 6 lines
Quoted 2 lines
This is device node, not a controller node (and yes, it's complete node). You just need to add such a node inside the controller one.
you should name the node wifi@0,0 instead. I revised my ath9k OF binding documentation due to similar concerns (and after seeing the result I must admit that they were right). you can have a look at the result here: [0]
Thanks for your comment, I'm far from considering myself DT expert, so I often need help with such things, I'll change this in V2.
Signature · 1 line
Rafał
Re: [PATCH 2/2] cfg80211: reg: support ieee80211-(min|max)-center-freq DT properties
In reply to a message not in the archiveQuoted 27 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
They allow specifying hardware limitations of supported channels. This may be useful for specifying single band devices or devices that support only some part of the whole band.
E.g. some tri-band routers have separated radios for lower and higher part of 5 GHz band.Signed-off-by Rafał Miłecki <[email protected]>--- net/wireless/reg.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)net/wireless/reg.c +6
-0@@ -1123,6 +1123,26 @@ const char *reg_initiator_name(enum nl80211_reg_initiator initiator) }EXPORT_SYMBOL (reg_initiator_name); +static bool reg_center_freq_of_valid (struct wiphy *wiphy, +struct ieee80211_channel *chan) +{ +struct device_node *np =wiphy_dev (wiphy)->of_node; +u32 val; +
net/wireless/reg.c const char *reg_initiator_name(enum nl80211_reg_initiator initiator) · line 1141
Quoted 10 lines
net/wireless/reg.c +10
-0+if (!np) +return true; + +if (!of_property_read_u32 (np,"ieee80211-min-center-freq" , &val) && + chan->center_freq <KHZ_TO_MHZ (val)) +return false; + +if (!of_property_read_u32 (np,"ieee80211-max-center-freq" , &val) && + chan->center_freq >KHZ_TO_MHZ (val)) +return false;
I suspect these functions rely on CONFIG_OF. So might not build for !CONFIG_OF.
Regards,
Arend
Re: [PATCH 2/2] cfg80211: reg: support ieee80211-(min|max)-center-freq DT properties
In reply to a message not in the archiveQuoted 33 lines · Arend van Spriel
Quoted 32 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
They allow specifying hardware limitations of supported channels. This may be useful for specifying single band devices or devices that support only some part of the whole band.
E.g. some tri-band routers have separated radios for lower and higher part of 5 GHz band.Signed-off-by Rafał Miłecki <[email protected]>--- net/wireless/reg.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)net/wireless/reg.c +11
-0@@ -1123,6 +1123,26 @@ const char *reg_initiator_name(enum nl80211_reg_initiator initiator) }EXPORT_SYMBOL (reg_initiator_name); +static bool reg_center_freq_of_valid (struct wiphy *wiphy, +struct ieee80211_channel *chan) +{ +struct device_node *np =wiphy_dev (wiphy)->of_node; +u32 val; + +if (!np) +return true; + +if (!of_property_read_u32 (np,"ieee80211-min-center-freq" , &val) && + chan->center_freq <KHZ_TO_MHZ (val))
Quoted 8 lines
net/wireless/reg.c const char *reg_initiator_name(enum nl80211_reg_initiator initiator) · line 1141
Quoted 5 lines
net/wireless/reg.c +5
-0+return false; + +if (!of_property_read_u32 (np,"ieee80211-max-center-freq" , &val) && + chan->center_freq >KHZ_TO_MHZ (val)) +return false;I suspect these functions rely on
CONFIG_OF. So might not build for !CONFIG_OF.
I compiled it with
# CONFIG_OF is not set
Can you test it and provide a non-working config if you see a compilation error, please?
Signature · 1 line
Rafał
Re: [PATCH 2/2] cfg80211: reg: support ieee80211-(min|max)-center-freq DT properties
In reply to a message not in the archiveQuoted 44 lines · Rafał Miłecki
Quoted 33 lines · Arend van Spriel
Quoted 32 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
They allow specifying hardware limitations of supported channels. This may be useful for specifying single band devices or devices that support only some part of the whole band.
E.g. some tri-band routers have separated radios for lower and higher part of 5 GHz band.Signed-off-by Rafał Miłecki <[email protected]>--- net/wireless/reg.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)net/wireless/reg.c +11
-0@@ -1123,6 +1123,26 @@ const char *reg_initiator_name(enum nl80211_reg_initiator initiator) }EXPORT_SYMBOL (reg_initiator_name); +static bool reg_center_freq_of_valid (struct wiphy *wiphy, +struct ieee80211_channel *chan) +{ +struct device_node *np =wiphy_dev (wiphy)->of_node; +u32 val; + +if (!np) +return true; + +if (!of_property_read_u32 (np,"ieee80211-min-center-freq" , &val) && + chan->center_freq <KHZ_TO_MHZ (val))Quoted 8 lines
net/wireless/reg.c const char *reg_initiator_name(enum nl80211_reg_initiator initiator) · line 1141
Quoted 5 lines
net/wireless/reg.c +5
-0+return false; + +if (!of_property_read_u32 (np,"ieee80211-max-center-freq" , &val) && + chan->center_freq >KHZ_TO_MHZ (val)) +return false;I suspect these functions rely on
CONFIG_OF. So might not build for !CONFIG_OF.
Quoted 5 lines
I compiled it with
#CONFIG_OFis not setCan you test it and provide a non-working config if you see a compilation error, please?
include/linux/of.h provides a lot of dummy static inline functions if CONFIG_OF is not used (they also allow compiler to drop most of the code).
Signature · 1 line
Rafał
Quoted 22 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This new file should be used for properties handled at higher level and so usable with all drivers.
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/net/wireless/ieee80211.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/ieee80211.txtDocumentation/devicetree/bindings/net/wireless/ieee80211.txt new file +5
-0@@ -0,0 +1,16 @@ +Common IEEE 802.11 properties + +This provides documentation of common properties that are handled by a proper +net layer and don't require extra driver code. +
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 15
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +10
-0+Optional properties: + - ieee80211-min-center-freq : minimal supported frequency in KHz + - ieee80211-max-center-freq : maximal supported frequency in KHz + +Example: + +pcie@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-min-center-freq = <2437000>; + ieee80211-max-center-freq = <2457000>;
I'm not sure that's the best way to deal with enabling/disabling bands. If we get more bands in the future, there might be unsupported ones in the middle, which min/max won't cover.
- Felix
Quoted 28 lines · Felix Fietkau
Quoted 27 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This new file should be used for properties handled at higher level and so usable with all drivers.
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/net/wireless/ieee80211.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/ieee80211.txtDocumentation/devicetree/bindings/net/wireless/ieee80211.txt new file +10
-0@@ -0,0 +1,16 @@ +Common IEEE 802.11 properties + +This provides documentation of common properties that are handled by a proper +net layer and don't require extra driver code. + +Optional properties: + - ieee80211-min-center-freq : minimal supported frequency in KHz + - ieee80211-max-center-freq : maximal supported frequency in KHz + +Example:
Quoted 8 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 15
Quoted 5 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +5
-0+ +pcie@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-min-center-freq = <2437000>; + ieee80211-max-center-freq = <2457000>;I'm not sure that's the best way to deal with enabling/disabling bands. If we get more bands in the future, there might be unsupported ones in the middle, which min/max won't cover.
Maybe we could try specifying list of ranges? E.g. ieee80211-center-frequencies = <2412000 2422000
2442000 2452>;
or
ieee80211-center-frequencies = <2412000 2422000>,
<2442000 2452>;for device supporting channels 1, 2, 3, 7, 8, 9?
Signature · 5 lines
Rafał -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] cfg80211: reg: support ieee80211-(min|max)-center-freq DT properties
In reply to a message not in the archiveQuoted 48 lines · Rafał Miłecki
Quoted 47 lines · Rafał Miłecki
Quoted 33 lines · Arend van Spriel
Quoted 32 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
They allow specifying hardware limitations of supported channels. This may be useful for specifying single band devices or devices that support only some part of the whole band.
E.g. some tri-band routers have separated radios for lower and higher part of 5 GHz band.Signed-off-by Rafał Miłecki <[email protected]>--- net/wireless/reg.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)net/wireless/reg.c +11
-0@@ -1123,6 +1123,26 @@ const char *reg_initiator_name(enum nl80211_reg_initiator initiator) }EXPORT_SYMBOL (reg_initiator_name); +static bool reg_center_freq_of_valid (struct wiphy *wiphy, +struct ieee80211_channel *chan) +{ +struct device_node *np =wiphy_dev (wiphy)->of_node; +u32 val; + +if (!np) +return true; + +if (!of_property_read_u32 (np,"ieee80211-min-center-freq" , &val) && + chan->center_freq <KHZ_TO_MHZ (val))Quoted 8 lines
net/wireless/reg.c const char *reg_initiator_name(enum nl80211_reg_initiator initiator) · line 1141
Quoted 5 lines
net/wireless/reg.c +5
-0+return false; + +if (!of_property_read_u32 (np,"ieee80211-max-center-freq" , &val) && + chan->center_freq >KHZ_TO_MHZ (val)) +return false;I suspect these functions rely on
CONFIG_OF. So might not build for !CONFIG_OF.I compiled it with
#CONFIG_OFis not set
Quoted 6 lines
Quoted 2 lines
Can you test it and provide a non-working config if you see a compilation error, please?
include/linux/of.hprovides a lot of dummy static inline functions ifCONFIG_OFis not used (they also allow compiler to drop most of the code).
of_propeirty_read_u32 is static inline in of.h calling of_property_read_u32_array, which has a dummy variant in of.h returning -ENOSYS so -38. Pretty sure that is not what you want. At least it does not allow the compiler to drop any code so probably better to do:
if (!IS_ENABLED(CONFIG_OF) || !np)
return true;
So with this patch you change the channel to DISABLED. I am not very familiar with reg.c so do you know if this is done before or after calling regulatory notifier in the driver. brcmfmac will enable channels querying the device upon regulatory notifier call, which may undo the behavior introduced by your patch.
Regards,
Arend
Re: [PATCH 2/2] cfg80211: reg: support ieee80211-(min|max)-center-freq DT properties
In reply to a message not in the archiveQuoted 56 lines · Arend van Spriel
Quoted 48 lines · Rafał Miłecki
Quoted 47 lines · Rafał Miłecki
Quoted 33 lines · Arend van Spriel
Quoted 32 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
They allow specifying hardware limitations of supported channels. This may be useful for specifying single band devices or devices that support only some part of the whole band.
E.g. some tri-band routers have separated radios for lower and higher part of 5 GHz band.Signed-off-by Rafał Miłecki <[email protected]>--- net/wireless/reg.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)net/wireless/reg.c +11
-0@@ -1123,6 +1123,26 @@ const char *reg_initiator_name(enum nl80211_reg_initiator initiator) }EXPORT_SYMBOL (reg_initiator_name); +static bool reg_center_freq_of_valid (struct wiphy *wiphy, +struct ieee80211_channel *chan) +{ +struct device_node *np =wiphy_dev (wiphy)->of_node; +u32 val; + +if (!np) +return true; + +if (!of_property_read_u32 (np,"ieee80211-min-center-freq" , &val) && + chan->center_freq <KHZ_TO_MHZ (val))Quoted 8 lines
net/wireless/reg.c const char *reg_initiator_name(enum nl80211_reg_initiator initiator) · line 1141
Quoted 5 lines
net/wireless/reg.c +5
-0+return false; + +if (!of_property_read_u32 (np,"ieee80211-max-center-freq" , &val) && + chan->center_freq >KHZ_TO_MHZ (val)) +return false;I suspect these functions rely on
CONFIG_OF. So might not build for !CONFIG_OF.I compiled it with
#CONFIG_OFis not setQuoted 6 lines
Quoted 2 lines
Can you test it and provide a non-working config if you see a compilation error, please?
include/linux/of.hprovides a lot of dummy static inline functions ifCONFIG_OFis not used (they also allow compiler to drop most of the code).
Quoted 7 lines
of_propeirty_read_u32is static inline inof.hcallingof_property_read_u32_array, which has a dummy variant inof.hreturning-ENOSYSso -38. Pretty sure that is not what you want. At least it does not allow the compiler to drop any code so probably better to do:if (!IS_ENABLED(CONFIG_OF) || !np)
return true;
Please verify that using a compiler. If there is a problem I'll be happy to work on it, but I need a proof it exists.
If compilers sees a:
if (!-ENOSYS && chan->center_freq < KHZ_TO_MHZ(val)) condition, it's pretty clear it can be dropped. With both conditional blocks dropped function always returns "true" and... can be dropped.
Let me see if I can convince you with the following test:
$ grep -m 1 CONFIG_OF .config # CONFIG_OF is not set $ objdump --syms net/wireless/reg.o | grep -c reg_center_freq_of_valid 0
$ grep -m 1 CONFIG_OF .config CONFIG_OF=y $ objdump --syms net/wireless/reg.o | grep -c reg_center_freq_of_valid 1
Quoted 5 lines
So with this patch you change the channel to DISABLED. I am not very familiar with
reg.cso do you know if this is done before or after calling regulatory notifier in the driver. brcmfmac will enable channels querying the device upon regulatory notifier call, which may undo the behavior introduced by your patch.
I'm not regulatory export, so I hope someone will review this patch. So far I can say it works for me after trying it on SR400ac with BCM43602.
ieee80211-min-center-freq = <2437000>;
[ 11.986941] cfg80211: Disabling freq 2412 MHz as it's out of OF limits [ 12.000466] cfg80211: Disabling freq 2417 MHz as it's out of OF limits [ 12.013984] cfg80211: Disabling freq 2422 MHz as it's out of OF limits [ 12.027497] cfg80211: Disabling freq 2427 MHz as it's out of OF limits [ 12.041012] cfg80211: Disabling freq 2432 MHz as it's out of OF limits
root@lede:/# iw phy phy0 channels
Band 1:
* 2412 MHz [1] (disabled)
* 2417 MHz [2] (disabled)
* 2422 MHz [3] (disabled)
* 2427 MHz [4] (disabled)
* 2432 MHz [5] (disabled)
* 2437 MHz [6]
Maximum TX power: 20.0 dBm
Channel widths: 20MHz HT40- HT40+
* 2442 MHz [7]
Maximum TX power: 20.0 dBm
Channel widths: 20MHz HT40- HT40+
* 2447 MHz [8]
Maximum TX power: 20.0 dBm
Channel widths: 20MHz HT40-
* 2452 MHz [9]
Maximum TX power: 20.0 dBm
Channel widths: 20MHz HT40-
* 2457 MHz [10]
Maximum TX power: 20.0 dBm
Channel widths: 20MHz HT40-
* 2462 MHz [11]
Maximum TX power: 20.0 dBm
Channel widths: 20MHz HT40-
* 2467 MHz [12] (disabled)
* 2472 MHz [13] (disabled)
* 2484 MHz [14] (disabled)Signature · 5 lines
Rafał -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] cfg80211: reg: support ieee80211-(min|max)-center-freq DT properties
In reply to a message not in the archiveQuoted 63 lines · Rafał Miłecki
Quoted 61 lines · Arend van Spriel
Quoted 48 lines · Rafał Miłecki
Quoted 47 lines · Rafał Miłecki
Quoted 33 lines · Arend van Spriel
Quoted 32 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
They allow specifying hardware limitations of supported channels. This may be useful for specifying single band devices or devices that support only some part of the whole band.
E.g. some tri-band routers have separated radios for lower and higher part of 5 GHz band.Signed-off-by Rafał Miłecki <[email protected]>--- net/wireless/reg.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)net/wireless/reg.c +11
-0@@ -1123,6 +1123,26 @@ const char *reg_initiator_name(enum nl80211_reg_initiator initiator) }EXPORT_SYMBOL (reg_initiator_name); +static bool reg_center_freq_of_valid (struct wiphy *wiphy, +struct ieee80211_channel *chan) +{ +struct device_node *np =wiphy_dev (wiphy)->of_node; +u32 val; + +if (!np) +return true; + +if (!of_property_read_u32 (np,"ieee80211-min-center-freq" , &val) && + chan->center_freq <KHZ_TO_MHZ (val))Quoted 8 lines
net/wireless/reg.c const char *reg_initiator_name(enum nl80211_reg_initiator initiator) · line 1141
Quoted 5 lines
net/wireless/reg.c +5
-0+return false; + +if (!of_property_read_u32 (np,"ieee80211-max-center-freq" , &val) && + chan->center_freq >KHZ_TO_MHZ (val)) +return false;I suspect these functions rely on
CONFIG_OF. So might not build for !CONFIG_OF.I compiled it with
#CONFIG_OFis not setQuoted 6 lines
Quoted 2 lines
Can you test it and provide a non-working config if you see a compilation error, please?
include/linux/of.hprovides a lot of dummy static inline functions ifCONFIG_OFis not used (they also allow compiler to drop most of the code).
of_propeirty_read_u32is static inline inof.hcallingof_property_read_u32_array, which has a dummy variant inof.hreturning-ENOSYSso -38. Pretty sure that is not what you want. At least it does not allow the compiler to drop any code so probably better to do:
Quoted 5 lines
Quoted 2 lines
if (!IS_ENABLED(CONFIG_OF) || !np)
return true;Please verify that using a compiler. If there is a problem I'll be happy to work on it, but I need a proof it exists.
I am on vacation right now so not having much more than email and web browser to use as review reference.
Quoted 6 lines
If compilers sees a:
if (!-ENOSYS &&chan->center_freq<KHZ_TO_MHZ(val)) condition, it's pretty clear it can be dropped. With both conditional blocks dropped function always returns "true" and... can be dropped.Let me see if I can convince you with the following test:
No need to convince me. I made a mistake reviewing the code. Thanks for clarifying it.
Quoted 17 lines
$ grep -m 1 CONFIG_OF .config # CONFIG_OF is not set $ objdump --syms net/wireless/reg.o | grep -c reg_center_freq_of_valid 0$ grep -m 1 CONFIG_OF .config CONFIG_OF=y $ objdump --syms net/wireless/reg.o | grep -c reg_center_freq_of_valid 1Quoted 5 lines
So with this patch you change the channel to DISABLED. I am not very familiar with
reg.cso do you know if this is done before or after calling regulatory notifier in the driver. brcmfmac will enable channels querying the device upon regulatory notifier call, which may undo the behavior introduced by your patch.
Quoted 3 lines
I'm not regulatory export, so I hope someone will review this patch. So far I can say it works for me after trying it on SR400ac with BCM43602.
But you probably do not have a mapping table for mapping country code received in notifier to firmware regulatory code/revision. Only if you have that, brcmfmac will update the channels in the bands.
Giving this some more consideration I am not sure if this is the proper place to handle this. ieee80211-(min|max)-center-freq is platform specific configuration allowing multiple cards to be used in different (sub)bands. This has nothing to do with regulatory. So probably better to move it to core.c or chan.c.
Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] cfg80211: reg: support ieee80211-(min|max)-center-freq DT properties
In reply to a message not in the archiveQuoted 100 lines · Arend van Spriel
Quoted 63 lines · Rafał Miłecki
Quoted 61 lines · Arend van Spriel
Quoted 48 lines · Rafał Miłecki
Quoted 47 lines · Rafał Miłecki
Quoted 33 lines · Arend van Spriel
Quoted 32 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
They allow specifying hardware limitations of supported channels. This may be useful for specifying single band devices or devices that support only some part of the whole band.
E.g. some tri-band routers have separated radios for lower and higher part of 5 GHz band.Signed-off-by Rafał Miłecki <[email protected]>--- net/wireless/reg.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)net/wireless/reg.c +11
-0@@ -1123,6 +1123,26 @@ const char *reg_initiator_name(enum nl80211_reg_initiator initiator) }EXPORT_SYMBOL (reg_initiator_name); +static bool reg_center_freq_of_valid (struct wiphy *wiphy, +struct ieee80211_channel *chan) +{ +struct device_node *np =wiphy_dev (wiphy)->of_node; +u32 val; + +if (!np) +return true; + +if (!of_property_read_u32 (np,"ieee80211-min-center-freq" , &val) && + chan->center_freq <KHZ_TO_MHZ (val))Quoted 8 lines
net/wireless/reg.c const char *reg_initiator_name(enum nl80211_reg_initiator initiator) · line 1141
Quoted 5 lines
net/wireless/reg.c +5
-0+return false; + +if (!of_property_read_u32 (np,"ieee80211-max-center-freq" , &val) && + chan->center_freq >KHZ_TO_MHZ (val)) +return false;I suspect these functions rely on
CONFIG_OF. So might not build for !CONFIG_OF.I compiled it with
#CONFIG_OFis not setQuoted 6 lines
Quoted 2 lines
Can you test it and provide a non-working config if you see a compilation error, please?
include/linux/of.hprovides a lot of dummy static inline functions ifCONFIG_OFis not used (they also allow compiler to drop most of the code).
of_propeirty_read_u32is static inline inof.hcallingof_property_read_u32_array, which has a dummy variant inof.hreturning-ENOSYSso -38. Pretty sure that is not what you want. At least it does not allow the compiler to drop any code so probably better to do:Quoted 5 lines
Quoted 2 lines
if (!IS_ENABLED(CONFIG_OF) || !np)
return true;Please verify that using a compiler. If there is a problem I'll be happy to work on it, but I need a proof it exists.
I am on vacation right now so not having much more than email and web browser to use as review reference.
Quoted 6 lines
If compilers sees a:
if (!-ENOSYS &&chan->center_freq<KHZ_TO_MHZ(val)) condition, it's pretty clear it can be dropped. With both conditional blocks dropped function always returns "true" and... can be dropped.Let me see if I can convince you with the following test:
No need to convince me. I made a mistake reviewing the code. Thanks for clarifying it.
Quoted 17 lines
$ grep -m 1 CONFIG_OF .config # CONFIG_OF is not set $ objdump --syms net/wireless/reg.o | grep -c reg_center_freq_of_valid 0$ grep -m 1 CONFIG_OF .config CONFIG_OF=y $ objdump --syms net/wireless/reg.o | grep -c reg_center_freq_of_valid 1Quoted 5 lines
So with this patch you change the channel to DISABLED. I am not very familiar with
reg.cso do you know if this is done before or after calling regulatory notifier in the driver. brcmfmac will enable channels querying the device upon regulatory notifier call, which may undo the behavior introduced by your patch.
Quoted 7 lines
Quoted 3 lines
I'm not regulatory export, so I hope someone will review this patch. So far I can say it works for me after trying it on SR400ac with BCM43602.
But you probably do not have a mapping table for mapping country code received in notifier to firmware regulatory code/revision. Only if you have that, brcmfmac will update the channels in the bands.
Thanks, I'll redo my tests.
Quoted 5 lines
Giving this some more consideration I am not sure if this is the proper place to handle this. ieee80211-(min|max)-center-freq is platform specific configuration allowing multiple cards to be used in different (sub)bands. This has nothing to do with regulatory. So probably better to move it to
core.corchan.c.
I can see point in this, I'll see if I can put this code in a more proper place. Thanks for your comment!
Signature · 5 lines
Rafał -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This new file should be used for properties handled at higher level and so usable with all drivers.
Why is this needed? Where would this data normally come from?
Quoted 12 lines
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/net/wireless/ieee80211.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/ieee80211.txtDocumentation/devicetree/bindings/net/wireless/ieee80211.txt new file +0
-0
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 4
Quoted 4 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +4
-0@@ -0,0 +1,16 @@ +Common IEEE 802.11 properties + +This provides documentation of common properties that are handled by a proper +net layer and don't require extra driver code.
Not relavent to a binding. Bindings describe h/w.
Quoted 19 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +12
-0+ +Optional properties: + - ieee80211-min-center-freq : minimal supported frequency in KHz + - ieee80211-max-center-freq : maximal supported frequency in KHz + +Example: + +pcie@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-min-center-freq = <2437000>; + ieee80211-max-center-freq = <2457000>; +};Signature · 6 lines
2.10.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Rob Herring
Quoted 4 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This new file should be used for properties handled at higher level and so usable with all drivers.
Why is this needed? Where would this data normally come from?
Vendors limit choice of channels at their web user interface level. I want to do better and report proper channels directly at kernel level instead of masking them in every possible configuration tool.
Quoted 6 lines
Quoted 6 lines
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/net/wireless/ieee80211.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/wireless/ieee80211.txt
Quoted 12 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt line 4
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/ieee80211.txt new file +4
-0@@ -0,0 +1,16 @@ +Common IEEE 802.11 properties + +This provides documentation of common properties that are handled by a proper +net layer and don't require extra driver code.Not relavent to a binding. Bindings describe h/w.
Yes, Arend pointed it to me and I improved this Documentation file in further versions. Could you review V4, please?
https://patchwork.kernel.org/patch/9494713/
Signature · 1 line
Rafał
Quoted 4 lines · Rafał Miłecki
Quoted 3 lines · Rob Herring
Quoted 2 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
This new file should be used for properties handled at higher level and so usable with all drivers.
Why is this needed? Where would this data normally come from?
Vendors limit choice of channels at their web user interface level. I want to do better and report proper channels directly at kernel level instead of masking them in every possible configuration tool.
Why do vendors limit the channels? Is it because of a hardware limitation (antenna does not support, or not calibrated, for a certain band etc) or something else?
Signature · 1 line
Kalle Valo
Quoted 11 lines · Kalle Valo
Quoted 9 lines · Rafał Miłecki
Quoted 7 lines · Rob Herring
Quoted 4 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This new file should be used for properties handled at higher level and so usable with all drivers.
Why is this needed? Where would this data normally come from?
Quoted 7 lines
Quoted 3 lines
Vendors limit choice of channels at their web user interface level. I want to do better and report proper channels directly at kernel level instead of masking them in every possible configuration tool.
Why do vendors limit the channels? Is it because of a hardware limitation (antenna does not support, or not calibrated, for a certain band etc) or something else?
Please review & comment on the latest version, currently V5:
https://patchwork.kernel.org/patch/9495795/
"This can be used to specify extra hardware limitations caused by e.g. used antennas or power amplifiers."
Signature · 1 line
Rafał
Quoted 16 lines · Rafał Miłecki
Quoted 15 lines · Kalle Valo
Quoted 12 lines · Rafał Miłecki
Quoted 7 lines · Rob Herring
Quoted 4 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This new file should be used for properties handled at higher level and so usable with all drivers.
Why is this needed? Where would this data normally come from?
Vendors limit choice of channels at their web user interface level. I want to do better and report proper channels directly at kernel level instead of masking them in every possible configuration tool.
Quoted 8 lines
Quoted 3 lines
Why do vendors limit the channels? Is it because of a hardware limitation (antenna does not support, or not calibrated, for a certain band etc) or something else?
Please review & comment on the latest version, currently V5:
https://patchwork.kernel.org/patch/9495795/
"This can be used to specify extra hardware limitations caused by e.g. used antennas or power amplifiers."
Just to be clear, it is does not need to be a hardware limitation, but simply a way to assure that multiple wlan radios are not interfering with each other and crank up the total bandwidth that vendors can put on their box.
Regards,
Arend