There are multiple ways that group formation can happen. They are
- P2P Negotiation Method (Standard Method)
- P2P Autonomous Group Formation.
- P2P Persistent Group Formation.
In this post , I will be writing about P2P group formation using Negotiation Method.
P2P Negotiation Method (Standard Method)
Observe the below flow chart for P2P Negotiation Method. Devices has to go through multiple phases to form a group.
Below are the Phases involved in Group Formation using Negotiation Method.
- P2P Device discovery
- Optional Service Discovery
- Group Owner Negotiation
- Phase1 and Phase 2 of WPS Provisioning

From the above flow chart, we can see that device discovery and optional service discovery is happening. Please read the below posts to know about how the device discovery is going to happen for the P2P devices.
Observe the below image to better understand the phases of P2P Negotiation Method.

Section 1 – P2P Device and Service Discovery
I have already written about P2P Device Discovery and service discovery procedures in the earlier posts. Have a look at them using the below links.
Click the below link to know about Device discovery procedure in P2P.
https://praneethwifi.wordpress.com/2019/10/26/p2p-device-discovery/
Click the below to know about Service discovery Procedure in P2P.
https://praneethwifi.wordpress.com/2019/10/27/p2p-service-discovery/
Section 2 – Group owner Negotiation
When the P2P Devices arrive on a common channel and begin Group Owner Negotiation, they shall stay on that channel until Group Owner Negotiation completes. Group Owner Negotiation is a three way frame exchange used to agree which P2P Device shall become P2P Group Owner and to agree on characteristics of the P2P Group. Observe the below frame exchange for GO Negotiation.

In the Above frame exchange , Device1 has sent the GO Negotiation request to the Device2. The purpose of the frame exchange to decide the GO. To decide the group owner we do have intent values which are from 0 to 15. Based on the highest intent value Device will become GO. If Both the devices are sending with the same intent value then the tie breaker bit comes in to the picture. This tie breaker bit will be either 0 or 1. Devices will select the tie breaker bit randomly.
For Example , if device 1 has selected the intent value as 5, and tie breaker bit as 0 in the “GO Negotiation Request”, Device 2 also selected the intent value as 5, but the device2 will see the tie breaker bit set by Device1, and it toggles that bit to 1 and sends the “GO Negoation Repsonse” . If device1 is sending the tie breaker bit as 1, device 2 will send by toggling the tie breaker bit to 0. This tie breaker will come in to the picture only when both the devices are sending with the same intent values.
To allow for P2P Device configuration, P2P Devices may delay starting the Provisioning phase until the expiration of the maximum of the P2P Group Owners GO Configuration Time and the P2P Clients Client Configuration Time from the respective Configuration Timeout attributes exchanged during Group Owner Negotiation.
see the below capture to observe the behavior.

Now lets open the GO negotiation Request Frame. In the below capture observe that Device1 has selected the Intent value as 10 , and selected random tie breaker bit as 0.

Lets open the GO Negotiation response frame from the device2. Now observe that Device 2 has selected the Group owner intent as 11 , and it toggles the tie breaker bit set by Device 1, so the Device 2 will set the tie breaker bit as 1 as shown in the below sniffer capture.

Now the Device1 will send the GO Negotiation confirmation, and the device 2 will become the group owner because of the highest intent value . See the below capture.

As soon as the group owner negotiation is successful , now the GO will start sending beacons. Observe the flow from the Figure 1. See the below capture to check the GO sending the beacon as soon as negotiation is completed.
I have filtered only the required frames from the capture.

P2P Negotiation Response Codes
Same Intent value from the Both the Peers
In this Negotiation phase both the devices can select same intent value, but the GO will be decided based on the Tie breaker bit. Observe the below capture to check when both the devices are sending the same intent value. As an example Observe the below Negotiation Request from the Device1, sending the Intent value as 4 and tie breaker bit as 0.

Observe the below Negotiation Response from the Device2, sending the Intent value as 4 and tie breaker bit as 1. Both the devices are sending the same intent value , now the group formation will be based on the tie breaker bit. The device 2 has sent the tie breaker bit as 1, so the device 2 will become the Group owner now.

See the Negotiation confirmation from the Peer 1

Below are the possible Negotiation response codes. I tried to test as many response codes as possible, I have attached the sniffer captures for the response codes that i was able to test.

Intent value 15 from both the Peers
If both the peers are sending the P2P intent value is 15, then there will not be any group formation happening as per the specification. Observe the status code:9 in the above Figure 4.
See the sniffer capture when both the devices are sending the intent values as 15. Device 1 is sending the intent value as 15 in the Negotiation request frame in the below capture.

Observe the below capture when the other peer is also sending the intent value as 15, and observe the status code: 9 shown in the capture. P2P group formation fails if both the devices are sending intent values as 15, tie breaker concept does not come in to the picture here as per the Specification.

See the below flow diagram to see the flow chart of the P2P GO negotiation.

No Common channels
Observe the status code 7, when peer 1 tries to connect on some channel and peer 2 tries to connect to the peer 1 in some other channel.
Observe the Negotiation request from the peer 1.

Observe the GO Negotiation response from the Peer 2 and observe the status code 7.

Observe the status code as 11 , when the peer devices tries to reject the connection from the other peer. See the sniffer capture below to check the flow.
Check the GO negotiation request from the peer 1.

Observe the Negotiation response from the peer 2 , when it rejects the connection from the peer 1.

See the status code 1 , when the peer 1 tries to connect to the peer2 , but the peer 2 does not give any response.
See the below Go negotiation Request frame capture from peer 1.

If the Peer 2 does not respond to the Negotiation request then observe the Response code in the GO Negotiation response from the peer 2 . You can see this frame exchange in the Figure 1 flow chart.

As soon as Group Negotiation phase is successful the GO will start sending the beacons. Observe the Figure 1 and Figure 2. And At this point Group Owner will transmit the beacon saying P2P Group Formation bit as 1 in the P2P capability attribute (check the Figure 1 Flow chart beacon immediately after the Negotiation phase). Observe the below capture to see the beacon sent by the GO , as soon as GO negotiation is completed. I have filtered only the required frames.

Now open the beacon frame sent by the GO immediately after the Group Owner negotiation and observe the P2P Capability attribute.

The Group Formation bit in the P2P Capability Attribute will be set to 0, as soon as the Group formation is completed. We can see that beacon once the group formation is successful.
In the next post we will see about the Phase-1 and Phase-2 of the Group Formation Procedure.