Lines Matching full:we
50 * 1) I think if we are initiating and we already have a connection with
51 * a device that we will still try and connect to it. Fix this.
53 * i) When a connection create is issued, if we already are connected
55 * ii) If we receive an advertisement while initiating and want to send
56 * a connect request to the device, make sure we dont have it.
62 * 2) Make sure we check incoming data packets for size and all that. You
65 * 3) Make sure we are setting the schedule end time properly for both slave
66 * and master. We should just set this to the end of the connection event.
67 * We might want to guarantee a IFS time as well since the next event needs
81 * 7) How does peer address get set if we are using whitelist? Look at filter
87 * purely slave. We can make a union of them.
96 * event, what should we do? Transmit anyway? Not transmit? For now, we just
107 * every time we call ble_ll_conn_next_event in a loop is to do everything by
109 * we could also keep last anchor usecs as a uint32 or something and when we
115 * XXX: How should we deal with a late connection event? We need to determine
116 * what we want to do under the following cases:
120 /* This is a dummy structure we use for the empty PDU */
128 /* We cannot have more than 254 connections given our current implementation */
145 /* Pointer to connection state machine we are trying to create */
223 * Checks to see if we should start a PHY update procedure
225 * If current phy is not one of the preferred we need to start control
228 * XXX: we could also decide to change the PHY if RSSI is really good
229 * and we are currently at 1Mbps or lower data rate and we could use
280 * when we are initiating.
327 /* Set time that we last serviced the schedule */ in ble_ll_conn_is_lru()
365 * NOTE: the ordering of these function calls is important! We have to stop
366 * the PHY and remove the schedule item before we can set the state to
385 * NOTE: the connection state machine may be NULL if we are calling in ble_ll_conn_current_sm_over()
386 * this when we are ending the connection. In that case, there is no in ble_ll_conn_current_sm_over()
590 /* Make sure we always detect invalid sequence below */ in ble_ll_conn_calc_access_addr()
606 /* We have a valid access address */ in ble_ll_conn_calc_access_addr()
622 we just calculate */ in ble_ll_conn_remapped_channel()
643 /* we should never reach here */ in ble_ll_conn_remapped_channel()
774 * Called when we are in the connection state and the wait for response timer
932 * earlier). This API is called when determining at what time we should end
935 * in the scheduler list! Thus, we need to calculate the time at which the
956 /* NOTE: We dont care if this time is tick short. */ in ble_ll_conn_get_next_sched_time()
987 * Send Long term key request event to host. If masked, we need to in ble_ll_conn_chk_csm_flags()
1002 * 2) We successfully sent the reject reason. in ble_ll_conn_chk_csm_flags()
1018 /* Check if we need to send PHY update complete event */ in ble_ll_conn_chk_csm_flags()
1030 * Called when we want to send a data channel pdu inside a connection event.
1103 * We need to check if we are retrying a pdu or if there is a pdu on in ble_ll_conn_tx_data_pdu()
1113 * If we dont have a pdu we have previously transmitted, take it off in ble_ll_conn_tx_data_pdu()
1124 * If we are encrypting, we are only allowed to send certain in ble_ll_conn_tx_data_pdu()
1134 * We will allow a next packet if it itself is allowed or we are in ble_ll_conn_tx_data_pdu()
1135 * a slave and we are sending the START_ENC_RSP. The master has in ble_ll_conn_tx_data_pdu()
1151 * We dequeued new packet for transmission so need to calculate payload in ble_ll_conn_tx_data_pdu()
1152 * length we can send over current PHY. Effectively, this determines in ble_ll_conn_tx_data_pdu()
1175 /* We will allow a next packet if it itself is allowed */ in ble_ll_conn_tx_data_pdu()
1190 /* We will allow a next packet if it itself is allowed */ in ble_ll_conn_tx_data_pdu()
1200 * Set the more data data flag if we have more data to send and we in ble_ll_conn_tx_data_pdu()
1209 limitations if we have started update */ in ble_ll_conn_tx_data_pdu()
1212 * Dont bother to set the MD bit if we cannot do the following: in ble_ll_conn_tx_data_pdu()
1236 * now. This is not the most accurate especially if we have in ble_ll_conn_tx_data_pdu()
1237 * received a frame and we are replying to it. in ble_ll_conn_tx_data_pdu()
1259 /* If we send an empty PDU we need to initialize the header */ in ble_ll_conn_tx_data_pdu()
1263 * This looks strange, but we dont use the data pointer in the mbuf in ble_ll_conn_tx_data_pdu()
1264 * when we have an empty pdu. in ble_ll_conn_tx_data_pdu()
1280 /* If we have more data, set the bit */ in ble_ll_conn_tx_data_pdu()
1294 * If we are a slave, check to see if this transmission will end the in ble_ll_conn_tx_data_pdu()
1295 * connection event. We will end the connection event if we have in ble_ll_conn_tx_data_pdu()
1296 * received a valid frame with the more data bit set to 0 and we dont in ble_ll_conn_tx_data_pdu()
1299 * XXX: for a slave, we dont check to see if we can: in ble_ll_conn_tx_data_pdu()
1303 * We could do this. Now, we just keep going and hope that we dont in ble_ll_conn_tx_data_pdu()
1311 /* We will end the connection event */ in ble_ll_conn_tx_data_pdu()
1348 * we receive encrypted in ble_ll_conn_tx_data_pdu()
1442 /* XXX: note that we can extend end time here if we want. Look at this */ in ble_ll_conn_event_start_cb()
1513 /* End the connection event as we have no more buffers */ in ble_ll_conn_event_start_cb()
1524 * Set the wait for response time. The anchor point is when we in ble_ll_conn_event_start_cb()
1525 * expect the master to start transmitting. Worst-case, we expect in ble_ll_conn_event_start_cb()
1534 * For the 32 kHz crystal, the amount of usecs we have to wait in ble_ll_conn_event_start_cb()
1535 * is not from the anchor point; we have to account for the time in ble_ll_conn_event_start_cb()
1537 * time we start before the anchor point is this: in ble_ll_conn_event_start_cb()
1539 * -> up to one 32 kHz tick since we discard remainder. in ble_ll_conn_event_start_cb()
1543 * 1) the 61 we add is for the two ticks mentioned above. in ble_ll_conn_event_start_cb()
1562 /* Set time that we last serviced the schedule */ in ble_ll_conn_event_start_cb()
1569 * connection event. This will always return 'true' if we are a slave. If we
1570 * are a master, we must be able to send the next fragment and get a minimum
1617 limitations if we have started update */ in ble_ll_conn_can_send_next_pdu()
1626 /* We will send empty pdu (just a LL header) */ in ble_ll_conn_can_send_next_pdu()
1645 * payload timeout expires, we should
1705 * XXX: for now, we need twice the transmit window as our calculations in ble_ll_conn_master_common_init()
2139 * If we have features and there's pending HCI command, send an event before in ble_ll_conn_end()
2158 * We need to send a disconnection complete event. Connection Complete for in ble_ll_conn_end()
2163 * received and we should not send an event. in ble_ll_conn_end()
2208 * TERMINATE_IND sent as a Slave. Since we are here it means we are still waiting for ACK. in ble_ll_conn_next_event()
2209 * Make sure we catch it in next connection event. in ble_ll_conn_next_event()
2215 * XXX: TODO Probably want to add checks to see if we need to start in ble_ll_conn_next_event()
2221 * XXX TODO: I think this is technically incorrect. We can allow slave in ble_ll_conn_next_event()
2222 * latency if we are doing one of these updates as long as we in ble_ll_conn_next_event()
2226 /* Set event counter to the next connection event that we will tx/rx in */ in ble_ll_conn_next_event()
2241 /* We can use pre-calculated values for one interval if latency is 1. */ in ble_ll_conn_next_event()
2258 * is now equal to the instant, we need to adjust the start of the in ble_ll_conn_next_event()
2259 * connection by the the transmit window offset. We also copy in the in ble_ll_conn_next_event()
2265 /* Set flag so we send connection update event */ in ble_ll_conn_next_event()
2304 * If there is a channel map request pending and we have reached the in ble_ll_conn_next_event()
2306 * If we received a channel map update with an instant equal to the event in ble_ll_conn_next_event()
2307 * counter, when we get here the event counter has already been in ble_ll_conn_next_event()
2308 * incremented by 1. That is why we do a signed comparison and change to in ble_ll_conn_next_event()
2316 * the queue of the master. This means that we never successfully in ble_ll_conn_next_event()
2328 check to make sure we dont have to restart! */ in ble_ll_conn_next_event()
2362 * If we are trying to terminate connection, check if next wake time is in ble_ll_conn_next_event()
2364 * connection as we will time out anyway. in ble_ll_conn_next_event()
2373 * Calculate ce end time. For a slave, we need to add window widening and in ble_ll_conn_next_event()
2374 * the transmit window if we still have one. in ble_ll_conn_next_event()
2420 /* XXX: TODO this assumes we received in 1M phy */ in ble_ll_conn_created()
2432 * Set the last rxd pdu time since this is where we want to start the in ble_ll_conn_created()
2445 * With a 32.768 kHz crystal we dont care about the remaining usecs in ble_ll_conn_created()
2509 * If we have default phy preferences and they are different than in ble_ll_conn_created()
2513 * XXX: should we attempt to start this without knowing if in ble_ll_conn_created()
2532 * XXX we do this only as a master as it was observed that sending in ble_ll_conn_created()
2567 /* Check if we need to resume scanning */ in ble_ll_conn_event_end()
2574 /* If we have transmitted the terminate IND successfully, we are done */ in ble_ll_conn_event_end()
2594 * If we have received a packet, we can set the current transmit window in ble_ll_conn_event_end()
2595 * usecs to 0 since we dont need to listen in the transmit window. in ble_ll_conn_event_end()
2603 * If we are encrypted and have passed the authenticated payload timeout in ble_ll_conn_event_end()
2604 * we need to send an event to tell the host. Unfortunately, I think we in ble_ll_conn_event_end()
2605 * need one of these per connection and we have to set this timer in ble_ll_conn_event_end()
2606 * fairly accurately. So we need to another event in the connection. in ble_ll_conn_event_end()
2610 * and we send the autheticated payload timeout event. Note that this timer in ble_ll_conn_event_end()
2626 /* See if we need to start any control procedures */ in ble_ll_conn_event_end()
2632 /* XXX: I think all this fine for when we do connection updates, but in ble_ll_conn_event_end()
2633 we may want to force the first event to be scheduled. Not sure */ in ble_ll_conn_event_end()
2644 * the specification. We check the supervision timer at connection event in ble_ll_conn_event_end()
2646 * timeout we end the connection here. I guess this goes against the spec in ble_ll_conn_event_end()
2648 * 1) We are actually causing a supervision timeout before the time in ble_ll_conn_event_end()
2650 * timeout would have expired before we could possibly receive a packet. in ble_ll_conn_event_end()
2651 * 2) We may end the supervision timeout a bit later than specified as in ble_ll_conn_event_end()
2652 * we only check this at event end and a bad CRC could cause us to continue in ble_ll_conn_event_end()
2671 /* If we have completed packets, send an event */ in ble_ll_conn_event_end()
2674 /* If we have features and there's pending HCI command, send an event */ in ble_ll_conn_event_end()
2684 * advertiser we are going to send connect request to.
2755 * If peer in on resolving list, we use RPA generated with Local IRK in ble_ll_conn_req_pdu_update()
2756 * from resolving list entry. In other case, we need to use our identity in ble_ll_conn_req_pdu_update()
2900 /* XXX: TODO: assume we are already on correct phy */ in ble_ll_conn_request_send()
2915 * event. This generally should not happen, but if it does we stop the
2966 /* Get the connection state machine we are trying to create */ in ble_ll_init_rx_pkt_in()
2983 /* Just continue scanning. We are waiting for AUX */ in ble_ll_init_rx_pkt_in()
3001 /* If we have sent a connect request, we need to enter CONNECTION state */ in ble_ll_init_rx_pkt_in()
3003 /* Set address of advertiser to which we are connecting. */ in ble_ll_init_rx_pkt_in()
3016 * Did we resolve this address? If so, set correct peer address in ble_ll_init_rx_pkt_in()
3048 /* For AUX Connect CSA2 is mandatory. Otherwise we need to check bit in ble_ll_init_rx_pkt_in()
3077 * Called when a receive PDU has started and we are in the initiating state.
3085 * 0: we will not attempt to reply to this frame
3086 * 1: we may send a response to this frame.
3138 /* We need CSA2 bit only for legacy connect */ in ble_ll_conn_req_pdu_make()
3150 /* Skip inita and adva advertiser's address as we dont know that yet */ in ble_ll_conn_req_pdu_make()
3168 * Called when a receive PDU has ended and we are in the initiating state.
3231 /* Invalid packet - make sure we do not wait for AUX_CONNECT_RSP */ in ble_ll_init_rx_isr_end()
3240 /* If we sent AUX_CONNECT_REQ, we only expect AUX_CONNECT_RSP here */ in ble_ll_init_rx_isr_end()
3330 /* Should we send a connect request? */ in ble_ll_init_rx_isr_end()
3358 * If the InitA is a RPA, we must see if it resolves based on the in ble_ll_init_rx_isr_end()
3379 /* If resolving is off and InitA is RPA we reject advertising */ in ble_ll_init_rx_isr_end()
3384 /* Let's see if we have IRK with that peer.*/ in ble_ll_init_rx_isr_end()
3397 * If the InitA is a RPA, we must see if it resolves based on the in ble_ll_init_rx_isr_end()
3421 /* For CONNECT_IND we don't go into RX state */ in ble_ll_init_rx_isr_end()
3425 /* Check if we should send AUX_CONNECT_REQ and wait for AUX_CONNECT_RSP */ in ble_ll_init_rx_isr_end()
3471 /* Keep aux data until we get scan response */ in ble_ll_init_rx_isr_end()
3488 * We have to restart receive if we cant hand up pdu. We return 0 so that in ble_ll_init_rx_isr_end()
3494 * XXX: possible allocate the PDU when we start initiating? in ble_ll_init_rx_isr_end()
3495 * I cannot say I like this solution, but if we cannot allocate a PDU in ble_ll_init_rx_isr_end()
3496 * to hand up to the LL, we need to remove the connection we just in ble_ll_init_rx_isr_end()
3543 /* Check if we need to resume scanning */ in ble_ll_conn_timeout()
3566 * Disable wait for response timer since we receive a response. We dont in ble_ll_conn_rx_isr_start()
3567 * care if this is the response we were waiting for or not; the code in ble_ll_conn_rx_isr_start()
3586 /* Set flag denoting we have received a packet in connection event */ in ble_ll_conn_rx_isr_start()
3625 /* We better have a connection state machine */ in ble_ll_conn_rx_data_pdu()
3662 * Reset authenticated payload timeout if valid MIC. NOTE: we dont in ble_ll_conn_rx_data_pdu()
3676 * If we are a slave, we can only start to use slave latency in ble_ll_conn_rx_data_pdu()
3677 * once we have received a NESN of 1 from the master in ble_ll_conn_rx_data_pdu()
3701 * XXX: should we check to see if we are in a state where we in ble_ll_conn_rx_data_pdu()
3733 /* NOTE: we dont free the mbuf since we handed it off! */ in ble_ll_conn_rx_data_pdu()
3788 * We need to attempt to allocate a buffer here. The reason we do this in ble_ll_conn_rx_isr_end()
3789 * now is that we should not ack the packet if we have no receive in ble_ll_conn_rx_isr_end()
3790 * buffers available. We want to free up our transmit PDU if it was in ble_ll_conn_rx_isr_end()
3791 * acked, but we should not ack the received frame if we cant hand it up. in ble_ll_conn_rx_isr_end()
3792 * NOTE: we hand up empty pdu's to the LL task! in ble_ll_conn_rx_isr_end()
3797 * We should have a current connection state machine. If we dont, we just in ble_ll_conn_rx_isr_end()
3809 * but for the 32768 crystal we add the time it takes to send the packet in ble_ll_conn_rx_isr_end()
3823 * received PDU does not pass the CRC check. If we receive two consecutive in ble_ll_conn_rx_isr_end()
3824 * CRC errors we end the conection event. in ble_ll_conn_rx_isr_end()
3829 * one we will end the connection event. in ble_ll_conn_rx_isr_end()
3851 * Check for valid LLID before proceeding. We have seen some weird in ble_ll_conn_rx_isr_end()
3852 * things with the PHY where the CRC is OK but we dont have a valid in ble_ll_conn_rx_isr_end()
3853 * LLID. This should really never happen but if it does we will just in ble_ll_conn_rx_isr_end()
3889 * is acknowledged. Otherwise we need to resend this PDU. in ble_ll_conn_rx_isr_end()
3895 /* We did not get an ACK. Must retry the PDU */ in ble_ll_conn_rx_isr_end()
3902 /* If we transmitted the empty pdu, clear flag */ in ble_ll_conn_rx_isr_end()
3909 * Determine if we should remove packet from queue or if there in ble_ll_conn_rx_isr_end()
3926 /* Means we transmitted a TERMINATE_IND */ in ble_ll_conn_rx_isr_end()
3967 /* Should we continue connection event? */ in ble_ll_conn_rx_isr_end()
3968 /* If this is a TERMINATE_IND, we have to reply */ in ble_ll_conn_rx_isr_end()
3970 /* If we received a terminate IND, we must set some flags */ in ble_ll_conn_rx_isr_end()
4060 * If this is one of the following types we need to insert it at in ble_ll_conn_enqueue_pkt()
4080 /* If encryption has been paused, we don't want to send any packets from the in ble_ll_conn_enqueue_pkt()
4124 /* See if we have an active matching connection handle */ in ble_ll_conn_tx_pkt_in()
4149 * Called to set the global channel mask that we use for all connections.
4181 * us. This will start a connection in the slave role assuming that we dont
4202 /* Ignore the connection request if we are already connected*/ in ble_ll_conn_slave_start()
4270 /* Set the address of device that we are connecting with */ in ble_ll_conn_slave_start()
4285 /* Use the same PHY as we received CONNECT_REQ on */ in ble_ll_conn_slave_start()
4342 /* Reset connection we are attempting to create */ in ble_ll_conn_module_reset()
4409 * the specification allows a handle of zero; we just avoid using it. in ble_ll_conn_module_init()