In S1G, a STA distributes a Response Indication (RI) to protect the frame expected at SIFS after the eliciting frame. Introduce a userspace configurable selector for the expected response frame type (i.e., Block Ack, NDP, or no response) after transmitting certain S1G frames. Signed-off-by: Ria Thomas --- include/net/cfg80211.h | 2 ++ include/uapi/linux/nl80211.h | 14 ++++++++++++++ net/wireless/nl80211.c | 24 ++++++++++++++++++++++++ net/wireless/rdev-ops.h | 14 ++++++++++++++ net/wireless/trace.h | 18 ++++++++++++++++++ 5 files changed, 72 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 899f267b7cf9..cd82f1801b2c 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5210,6 +5210,8 @@ struct cfg80211_ops { struct cfg80211_ml_reconf_req *req); int (*set_epcs)(struct wiphy *wiphy, struct net_device *dev, bool val); + int (*set_s1g_ri)(struct wiphy *wiphy, struct net_device *dev, + u8 val); }; /* diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 8134f10e4e6c..4ca86c1fd361 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -1361,6 +1361,10 @@ * user space that the NAN new cluster has been joined. The cluster ID is * indicated by %NL80211_ATTR_MAC. * + * @NL80211_CMD_SET_S1G_RI: This command is used to enable and set the + * response indication type for an S1G station. The frame type is + * indicated by %NL80211_ATTR_S1G_RI_FRAME_TYPE. + * * @NL80211_CMD_MAX: highest used command number * @__NL80211_CMD_AFTER_LAST: internal use */ @@ -1624,6 +1628,8 @@ enum nl80211_commands { NL80211_CMD_NAN_NEXT_DW_NOTIFICATION, NL80211_CMD_NAN_CLUSTER_JOINED, + NL80211_CMD_SET_S1G_RI, + /* add new commands above here */ /* used to define NL80211_CMD_MAX below */ @@ -2973,6 +2979,12 @@ enum nl80211_commands { * primary channel is 2 MHz wide, and the control channel designates * the 1 MHz primary subchannel within that 2 MHz primary. * + * @NL80211_ATTR_S1G_RI_FRAME_TYPE: (u8) Integer attibute used with + * %NL80211_CMD_SET_S1G_RI that represents the RID + * (Response Indication Deferral) information distributed by + * an S1G STA in order to protect the response frame, which is + * expected a SIFS time after the frame that elicits that response. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -3541,6 +3553,8 @@ enum nl80211_attrs { NL80211_ATTR_S1G_PRIMARY_2MHZ, + NL80211_ATTR_S1G_RI_FRAME_TYPE, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c961cd42a832..315e17997cb6 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -932,6 +932,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { NLA_POLICY_NESTED(nl80211_s1g_short_beacon), [NL80211_ATTR_BSS_PARAM] = { .type = NLA_FLAG }, [NL80211_ATTR_S1G_PRIMARY_2MHZ] = { .type = NLA_FLAG }, + [NL80211_ATTR_S1G_RI_FRAME_TYPE] = { .type = NLA_U8 }, }; /* policy for the key attributes */ @@ -17826,6 +17827,23 @@ nl80211_epcs_cfg(struct sk_buff *skb, struct genl_info *info) return rdev_set_epcs(rdev, dev, val); } +static int nl80211_set_s1g_ri(struct sk_buff *skb, struct genl_info *info) +{ + struct cfg80211_registered_device *rdev = info->user_ptr[0]; + struct net_device *dev = info->user_ptr[1]; + u8 val; + + if (!rdev->ops->set_s1g_ri) + return -EOPNOTSUPP; + + if (!info->attrs[NL80211_ATTR_S1G_RI_FRAME_TYPE]) + return -EINVAL; + + val = nla_get_u8(info->attrs[NL80211_ATTR_S1G_RI_FRAME_TYPE]); + + return rdev_set_s1g_ri(rdev, dev, val); +} + #define NL80211_FLAG_NEED_WIPHY 0x01 #define NL80211_FLAG_NEED_NETDEV 0x02 #define NL80211_FLAG_NEED_RTNL 0x04 @@ -19031,6 +19049,12 @@ static const struct genl_small_ops nl80211_small_ops[] = { .flags = GENL_UNS_ADMIN_PERM, .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP), }, + { + .cmd = NL80211_CMD_SET_S1G_RI, + .doit = nl80211_set_s1g_ri, + .flags = GENL_UNS_ADMIN_PERM, + .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP), + }, }; static struct genl_family nl80211_fam __ro_after_init = { diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h index ac6884bacf3f..d29a4d55f860 100644 --- a/net/wireless/rdev-ops.h +++ b/net/wireless/rdev-ops.h @@ -1584,4 +1584,18 @@ rdev_set_epcs(struct cfg80211_registered_device *rdev, return ret; } +static inline int +rdev_set_s1g_ri(struct cfg80211_registered_device *rdev, + struct net_device *dev, u8 val) +{ + struct wiphy *wiphy = &rdev->wiphy; + int ret = -EOPNOTSUPP; + + trace_rdev_set_s1g_ri(wiphy, dev, val); + ret = rdev->ops->set_s1g_ri(wiphy, dev, val); + trace_rdev_return_int(wiphy, ret); + + return ret; +} + #endif /* __CFG80211_RDEV_OPS */ diff --git a/net/wireless/trace.h b/net/wireless/trace.h index 2b71f1d867a0..ec200e94e9a6 100644 --- a/net/wireless/trace.h +++ b/net/wireless/trace.h @@ -3122,6 +3122,24 @@ TRACE_EVENT(rdev_set_epcs, WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->val) ); +TRACE_EVENT(rdev_set_s1g_ri, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, + u8 val), + TP_ARGS(wiphy, netdev, val), + TP_STRUCT__entry( + WIPHY_ENTRY + NETDEV_ENTRY + __field(u8, val) + ), + TP_fast_assign( + WIPHY_ASSIGN; + NETDEV_ASSIGN; + __entry->val = val; + ), + TP_printk(WIPHY_PR_FMT ", " NETDEV_PR_FMT ", ri=%u", + WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->val) +); + /************************************************************* * cfg80211 exported functions traces * *************************************************************/ -- 2.25.1