* [RFC PATCH 0/2] net: netlink: full range policy improvements
@ 2023-02-24 12:45 Johannes Berg
2023-02-24 12:45 ` [RFC PATCH 1/2] net: netlink: make full range policy macros nicer Johannes Berg
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Johannes Berg @ 2023-02-24 12:45 UTC (permalink / raw)
To: linux-wireless, netdev
Hi,
Sending this as an RFC since we're in the middle of the merge window,
and patches depend on an nl80211 patch that isn't in the tree yet.
But I think it's worthwhile doing this later.
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFC PATCH 1/2] net: netlink: make full range policy macros nicer
2023-02-24 12:45 [RFC PATCH 0/2] net: netlink: full range policy improvements Johannes Berg
@ 2023-02-24 12:45 ` Johannes Berg
2023-02-24 12:45 ` [RFC PATCH 2/2] net: netlink: constify full range pointers Johannes Berg
2023-02-24 18:55 ` [RFC PATCH 0/2] net: netlink: full range policy improvements Jakub Kicinski
2 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2023-02-24 12:45 UTC (permalink / raw)
To: linux-wireless, netdev; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
Since these macros are used for variable initializers
there's really no way to have a non-constant pointer,
so move the required & into the macros.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/net/netlink.h | 4 ++--
net/ipv6/ioam6_iptunnel.c | 4 ++--
net/wireless/nl80211.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/net/netlink.h b/include/net/netlink.h
index b12cd957abb4..52dedc8bfedd 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -415,13 +415,13 @@ struct nla_policy {
#define NLA_POLICY_FULL_RANGE(tp, _range) { \
.type = NLA_ENSURE_UINT_OR_BINARY_TYPE(tp), \
.validation_type = NLA_VALIDATE_RANGE_PTR, \
- .range = _range, \
+ .range = &(_range), \
}
#define NLA_POLICY_FULL_RANGE_SIGNED(tp, _range) { \
.type = NLA_ENSURE_SINT_TYPE(tp), \
.validation_type = NLA_VALIDATE_RANGE_PTR, \
- .range_signed = _range, \
+ .range_signed = &(_range), \
}
#define NLA_POLICY_MIN(tp, _min) { \
diff --git a/net/ipv6/ioam6_iptunnel.c b/net/ipv6/ioam6_iptunnel.c
index f6f5b83dd954..790a40e2497d 100644
--- a/net/ipv6/ioam6_iptunnel.c
+++ b/net/ipv6/ioam6_iptunnel.c
@@ -67,8 +67,8 @@ static struct ioam6_trace_hdr *ioam6_lwt_trace(struct lwtunnel_state *lwt)
}
static const struct nla_policy ioam6_iptunnel_policy[IOAM6_IPTUNNEL_MAX + 1] = {
- [IOAM6_IPTUNNEL_FREQ_K] = NLA_POLICY_FULL_RANGE(NLA_U32, &freq_range),
- [IOAM6_IPTUNNEL_FREQ_N] = NLA_POLICY_FULL_RANGE(NLA_U32, &freq_range),
+ [IOAM6_IPTUNNEL_FREQ_K] = NLA_POLICY_FULL_RANGE(NLA_U32, freq_range),
+ [IOAM6_IPTUNNEL_FREQ_N] = NLA_POLICY_FULL_RANGE(NLA_U32, freq_range),
[IOAM6_IPTUNNEL_MODE] = NLA_POLICY_RANGE(NLA_U8,
IOAM6_IPTUNNEL_MODE_MIN,
IOAM6_IPTUNNEL_MODE_MAX),
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 1c3b9a305f42..fbea0e786b21 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -811,7 +811,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
[NL80211_ATTR_MAX_NUM_AKM_SUITES] = { .type = NLA_REJECT },
[NL80211_ATTR_PUNCT_BITMAP] =
- NLA_POLICY_FULL_RANGE(NLA_U32, &nl80211_punct_bitmap_range),
+ NLA_POLICY_FULL_RANGE(NLA_U32, nl80211_punct_bitmap_range),
};
/* policy for the key attributes */
--
2.39.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [RFC PATCH 2/2] net: netlink: constify full range pointers
2023-02-24 12:45 [RFC PATCH 0/2] net: netlink: full range policy improvements Johannes Berg
2023-02-24 12:45 ` [RFC PATCH 1/2] net: netlink: make full range policy macros nicer Johannes Berg
@ 2023-02-24 12:45 ` Johannes Berg
2023-02-24 18:55 ` [RFC PATCH 0/2] net: netlink: full range policy improvements Jakub Kicinski
2 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2023-02-24 12:45 UTC (permalink / raw)
To: linux-wireless, netdev; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
These pointers (and with them variables they point to)
really can be const, do that.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/net/netlink.h | 4 ++--
net/ipv6/ioam6_iptunnel.c | 2 +-
net/wireless/nl80211.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 52dedc8bfedd..6a4d6aae76bd 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -351,8 +351,8 @@ struct nla_policy {
const u32 mask;
const char *reject_message;
const struct nla_policy *nested_policy;
- struct netlink_range_validation *range;
- struct netlink_range_validation_signed *range_signed;
+ const struct netlink_range_validation *range;
+ const struct netlink_range_validation_signed *range_signed;
struct {
s16 min, max;
};
diff --git a/net/ipv6/ioam6_iptunnel.c b/net/ipv6/ioam6_iptunnel.c
index 790a40e2497d..dd464d915ab8 100644
--- a/net/ipv6/ioam6_iptunnel.c
+++ b/net/ipv6/ioam6_iptunnel.c
@@ -46,7 +46,7 @@ struct ioam6_lwt {
struct ioam6_lwt_encap tuninfo;
};
-static struct netlink_range_validation freq_range = {
+static const struct netlink_range_validation freq_range = {
.min = IOAM6_IPTUNNEL_FREQ_MIN,
.max = IOAM6_IPTUNNEL_FREQ_MAX,
};
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index fbea0e786b21..ae35b23fac73 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -462,7 +462,7 @@ nl80211_sta_wme_policy[NL80211_STA_WME_MAX + 1] = {
[NL80211_STA_WME_MAX_SP] = { .type = NLA_U8 },
};
-static struct netlink_range_validation nl80211_punct_bitmap_range = {
+static const struct netlink_range_validation nl80211_punct_bitmap_range = {
.min = 0,
.max = 0xffff,
};
--
2.39.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [RFC PATCH 0/2] net: netlink: full range policy improvements
2023-02-24 12:45 [RFC PATCH 0/2] net: netlink: full range policy improvements Johannes Berg
2023-02-24 12:45 ` [RFC PATCH 1/2] net: netlink: make full range policy macros nicer Johannes Berg
2023-02-24 12:45 ` [RFC PATCH 2/2] net: netlink: constify full range pointers Johannes Berg
@ 2023-02-24 18:55 ` Jakub Kicinski
2023-02-24 20:00 ` Jacob Keller
2 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2023-02-24 18:55 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, netdev
On Fri, 24 Feb 2023 13:45:51 +0100 Johannes Berg wrote:
> Sending this as an RFC since we're in the middle of the merge window,
> and patches depend on an nl80211 patch that isn't in the tree yet.
>
> But I think it's worthwhile doing this later.
LGTM, FWIW!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC PATCH 0/2] net: netlink: full range policy improvements
2023-02-24 18:55 ` [RFC PATCH 0/2] net: netlink: full range policy improvements Jakub Kicinski
@ 2023-02-24 20:00 ` Jacob Keller
0 siblings, 0 replies; 5+ messages in thread
From: Jacob Keller @ 2023-02-24 20:00 UTC (permalink / raw)
To: Jakub Kicinski, Johannes Berg; +Cc: linux-wireless, netdev
On 2/24/2023 10:55 AM, Jakub Kicinski wrote:
> On Fri, 24 Feb 2023 13:45:51 +0100 Johannes Berg wrote:
>> Sending this as an RFC since we're in the middle of the merge window,
>> and patches depend on an nl80211 patch that isn't in the tree yet.
>>
>> But I think it's worthwhile doing this later.
>
> LGTM, FWIW!
Same here.
Thanks,
Jake
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-02-24 20:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-24 12:45 [RFC PATCH 0/2] net: netlink: full range policy improvements Johannes Berg
2023-02-24 12:45 ` [RFC PATCH 1/2] net: netlink: make full range policy macros nicer Johannes Berg
2023-02-24 12:45 ` [RFC PATCH 2/2] net: netlink: constify full range pointers Johannes Berg
2023-02-24 18:55 ` [RFC PATCH 0/2] net: netlink: full range policy improvements Jakub Kicinski
2023-02-24 20:00 ` Jacob Keller
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).