From 9b50746f50ec3cb3a58768c24df18f82e280c545 Mon Sep 17 00:00:00 2001 From: Sreeramya Soratkal Date: Tue, 4 May 2021 12:29:44 +0530 Subject: [PATCH] P2P: Introduce 6 GHz band capability bit in P2P Device Capability Introduce P2P 6 GHz band capable information in Device Capability Bitmap of P2P Capability sub-attribute. Signed-off-by: Sreeramya Soratkal --- src/common/ieee802_11_defs.h | 1 + src/p2p/p2p.c | 30 ++++++++++++++++++++++++++++++ src/p2p/p2p.h | 4 ++++ src/p2p/p2p_i.h | 1 + 4 files changed, 36 insertions(+) diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 7d2f36b8f..519a13b1d 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -1657,6 +1657,7 @@ enum p2p_attr_id { #define P2P_DEV_CAPAB_INFRA_MANAGED BIT(3) #define P2P_DEV_CAPAB_DEVICE_LIMIT BIT(4) #define P2P_DEV_CAPAB_INVITATION_PROCEDURE BIT(5) +#define P2P_DEV_CAPAB_6GHZ_BAND_CAPABLE BIT(6) /* P2P Capability - Group Capability bitmap */ #define P2P_GROUP_CAPAB_GROUP_OWNER BIT(0) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 1aa98f1a8..a5a04e377 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -5575,3 +5575,33 @@ struct wpabuf * p2p_build_probe_resp_template(struct p2p_data *p2p, return buf; } + + +bool p2p_is_peer_6ghz_capab(struct p2p_data *p2p, const u8 *addr) +{ + struct p2p_device *dev; + + dev = p2p_get_device(p2p, addr); + if (!dev) + return false; + + return !!(dev->info.dev_capab & P2P_DEV_CAPAB_6GHZ_BAND_CAPABLE); +} + + +void p2p_set_6ghz_dev_capab(struct p2p_data *p2p, bool allow_6ghz) +{ + p2p->p2p_6ghz_capable = allow_6ghz; + p2p_dbg(p2p, "Set 6 GHz capability to %d", allow_6ghz); + + if (allow_6ghz) + p2p->dev_capab |= P2P_DEV_CAPAB_6GHZ_BAND_CAPABLE; + else + p2p->dev_capab &= ~P2P_DEV_CAPAB_6GHZ_BAND_CAPABLE; +} + + +bool is_p2p_6ghz_capable(struct p2p_data *p2p) +{ + return p2p->p2p_6ghz_capable; +} diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 762bd40be..0bc2e606f 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -2411,4 +2411,8 @@ int p2p_group_get_common_freqs(struct p2p_group *group, int *common_freqs, struct wpabuf * p2p_build_probe_resp_template(struct p2p_data *p2p, unsigned int freq); +void p2p_set_6ghz_dev_capab(struct p2p_data *p2p, bool allow_6ghz); +bool is_p2p_6ghz_capable(struct p2p_data *p2p); +bool p2p_is_peer_6ghz_capab(struct p2p_data *p2p, const u8 *addr); + #endif /* P2P_H */ diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h index 4195c5f07..b4e3c4401 100644 --- a/src/p2p/p2p_i.h +++ b/src/p2p/p2p_i.h @@ -548,6 +548,7 @@ struct p2p_data { /* Override option for preferred operating channel in GO Negotiation */ u8 override_pref_op_class; u8 override_pref_channel; + bool p2p_6ghz_capable; }; /**