Lines Matching full:we

32 /* If we get a NAK, wait this long before retrying */
121 * @num_bits: The number of bits we need per period we want to reserve
123 * @interval: How often we need to be scheduled for the reservation this
127 * the interval or we return failure right away.
128 * @only_one_period: Normally we'll allow picking a start anywhere within the
129 * first interval, since we can still make all repetition
131 * here then we'll return failure if we can't fit within
134 * The idea here is that we want to schedule time for repeating events that all
139 * To keep things "simple", we'll represent our schedule with a bitmap that
141 * but does mean that we need to handle things specially (and non-ideally) if
143 * intervals that we're trying to schedule.
145 * Here's an explanation of the scheme we'll implement, assuming 8 periods.
146 * - If interval is 1, we need to take up space in each of the 8
147 * periods we're scheduling. Easy.
148 * - If interval is 2, we need to take up space in half of the
150 * - If interval is 3, we actually need to fall back to interval 1.
151 * Why? Because we might need time in any period. AKA for the
152 * first 8 periods, we'll be in slot 0, 3, 6. Then we'll be
153 * in slot 1, 4, 7. Then we'll be in 2, 5. Then we'll be back to
154 * 0, 3, and 6. Since we could be in any frame we need to reserve
156 * if we were instead scheduling 8 * 3 = 24 we'd do much better, but
157 * then we need more memory and time to do scheduling.
159 * - If interval is 5, we again need interval 1. The schedule will be
161 * - If interval is 6, we need interval 2. 0, 6, 4, 2.
162 * - If interval is 7, we need interval 1.
163 * - If interval is 8, we need interval 8.
165 * If you do the math, you'll see that we need to pretend that interval is
221 /* If start has gotten us past interval then we can't schedule */ in pmap_schedule()
233 * We'll try to pick the first repetition, then see if that time in pmap_schedule()
235 * we'll adjust the start time for the next search of the first in pmap_schedule()
249 * We should get start >= end if we fail. We might be in pmap_schedule()
258 /* At this point we have a valid point for first one */ in pmap_schedule()
269 /* We got the right place, continue checking */ in pmap_schedule()
284 /* If didn't exit the for loop with a break, we have success */ in pmap_schedule()
338 * We'll always get the periodic map out of our TT. Note that even if we're
340 * a TT is allocated for us, so we'll use it. If that ever changes we can
457 * If we don't have tracing turned on, don't run unless the special in dwc2_qh_schedule_print()
508 * @search_slice: We'll start trying to schedule at the passed slice.
514 * Normally we schedule low speed devices on the map associated with the TT.
530 * parameters. Note that we use the "device_interval" here since in dwc2_ls_pmap_schedule()
531 * we want the low speed interval and the only way we'd be in this in dwc2_ls_pmap_schedule()
534 * If we happen to be doing low speed and high speed scheduling for the in dwc2_ls_pmap_schedule()
535 * same transaction (AKA we have a split) we always do low speed first. in dwc2_ls_pmap_schedule()
536 * That means we can always pass "false" for only_one_period (that in dwc2_ls_pmap_schedule()
537 * parameters is only useful when we're trying to get one schedule to in dwc2_ls_pmap_schedule()
538 * match what we already planned in the other schedule). in dwc2_ls_pmap_schedule()
577 * We'll start looking in qh->hs_transfers[index].start_schedule_us. We'll
578 * update this with the result upon success. We also use the duration from
583 * @only_one_period: If true we will limit ourselves to just looking at
584 * one period (aka one 100us chunk). This is used if we have
587 * @index: The index into qh->hs_transfers that we're working with.
632 * This is the most complicated thing in USB. We have to find matching time
658 * We always try to find space in the low speed schedule first, then in dwc2_uframe_schedule_split()
659 * try to find high speed time that matches. If we don't, we'll bump in dwc2_uframe_schedule_split()
660 * up the place we start searching in the low speed schedule and try in dwc2_uframe_schedule_split()
661 * again. To start we'll look right at the beginning of the low speed in dwc2_uframe_schedule_split()
665 * We may eventually want to try to avoid this by either considering in dwc2_uframe_schedule_split()
686 * If we got an error here there's no other magic we in dwc2_uframe_schedule_split()
688 * helpful to redo things if we got a low speed slot in dwc2_uframe_schedule_split()
709 * If we were going to start in uframe 7 then we would need to in dwc2_uframe_schedule_split()
737 * For ISOC out we might need to do: in dwc2_uframe_schedule_split()
743 * For INTERRUPT in we might need to do: in dwc2_uframe_schedule_split()
749 * For INTERRUPT out we might need to do: in dwc2_uframe_schedule_split()
786 * the above cases. Until it's fixed we just won't be able in dwc2_uframe_schedule_split()
895 /* If we scheduled all w/out breaking out then we're all good */ in dwc2_uframe_schedule_split()
931 /* We'll have one transfer; init start to 0 before calling scheduler */ in dwc2_uframe_schedule_hs()
1008 * Takes a qh that has already been scheduled (which means we know we have the
1013 * running. It just picks the next frame that we can fit into without any
1035 * We wouldn't want to start any earlier than the next frame just in in dwc2_pick_first_frame()
1036 * case the frame number ticks as we're doing this calculation. in dwc2_pick_first_frame()
1038 * NOTE: if we could quantify how long till we actually get scheduled in dwc2_pick_first_frame()
1039 * we might be able to avoid the "+ 1" by looking at the upper part of in dwc2_pick_first_frame()
1040 * HFNUM (the FRREM field). For now we'll just use the + 1 though. in dwc2_pick_first_frame()
1055 * We're either at high speed or we're doing a split (which in dwc2_pick_first_frame()
1056 * means we're talking high speed to a hub). In any case in dwc2_pick_first_frame()
1085 * We know interval must divide (HFNUM_MAX_FRNUM + 1) now that we've in dwc2_pick_first_frame()
1089 * After this we might be before earliest_frame, but don't worry, in dwc2_pick_first_frame()
1090 * we'll fix it... in dwc2_pick_first_frame()
1095 * Actually choose to start at the frame number we've been in dwc2_pick_first_frame()
1102 * We actually need 1 frame before since the next_active_frame is in dwc2_pick_first_frame()
1103 * the frame number we'll be put on the ready list and we won't be on in dwc2_pick_first_frame()
1109 * By now we might actually be before the earliest_frame. Let's move in dwc2_pick_first_frame()
1110 * up intervals until we're not. in dwc2_pick_first_frame()
1187 /* No more unreserve pending--we're doing it */ in dwc2_do_unreserve()
1208 * "Reserved Bandwidth Transfers"), we need to keep a reservation active as
1209 * long as a device driver keeps submitting. Since we're using HCD_BH to give
1210 * back the URB we need to give the driver a little bit of time before we
1223 * Wait for the lock, or for us to be scheduled again. We in dwc2_unreserve_timer_fn()
1225 * - We started executing but didn't get the lock yet. in dwc2_unreserve_timer_fn()
1227 * because we already started executing. in dwc2_unreserve_timer_fn()
1238 * - We started executing but didn't get the lock yet. in dwc2_unreserve_timer_fn()
1240 * because we already started executing. in dwc2_unreserve_timer_fn()
1242 * We can't put this in the loop above because unreserve_pending needs in dwc2_unreserve_timer_fn()
1243 * to be accessed under lock, so we can only check it once we got the in dwc2_unreserve_timer_fn()
1311 * valid. Unreserve might still be pending even if we didn't cancel if in dwc2_schedule_periodic()
1322 * is still good. Note: we could also try to use the similar in dwc2_schedule_periodic()
1324 * tightly and we might need to hurry and queue things up. in dwc2_schedule_periodic()
1365 * We should never already be scheduled since dwc2_schedule_periodic() in dwc2_deschedule_periodic()
1369 * We add + 1 to the timer to guarantee that at least 1 jiffy has in dwc2_deschedule_periodic()
1370 * passed (otherwise if the jiffy counter might tick right after we in dwc2_deschedule_periodic()
1371 * read it and we'll get no delay). in dwc2_deschedule_periodic()
1388 * That means that when we encounter a NAK we're supposed to retry.
1390 * ...but if we retry right away (from the interrupt handler that saw the NAK)
1391 * then we can end up with an interrupt storm (if the other side keeps NAKing
1396 * ...so instead of retrying right away in the case of a NAK we'll set a timer
1413 * We'll set wait_timer_cancel to true if we want to cancel this in dwc2_wait_timer_fn()
1499 * Schedule low speed if we're running the host in low or in dwc2_qh_init()
1500 * full speed OR if we've got a "TT" to deal with to access this in dwc2_qh_init()
1507 /* We won't know num transfers until we schedule */ in dwc2_qh_init()
1515 /* We'll schedule later when we have something to do */ in dwc2_qh_init()
1627 * We don't have the lock so we can safely wait until the wait timer in dwc2_hcd_qh_free()
1628 * finishes. Of course, at this point in time we'd better have set in dwc2_hcd_qh_free()
1630 * won't do anything anyway, but we want it to finish before we free in dwc2_hcd_qh_free()
1744 * Periodic splits are single low/full speed transfers that we end up splitting
1746 * frame but might be split over several microframes (125 us each). We to put
1755 * Return: number missed by (or 0 if we didn't miss).
1782 * be 1 frame _before_ when we want to be scheduled. If we're 1 frame in dwc2_next_for_periodic_split()
1785 * It's _not_ OK, however, if we're more than one frame past. in dwc2_next_for_periodic_split()
1789 * OOPS, we missed. That's actually pretty bad since in dwc2_next_for_periodic_split()
1807 * Since we _always_ keep start_active_frame as the start of the previous
1808 * transfer this is normally pretty easy: we just add our interval to
1809 * start_active_frame and we've got our answer.
1811 * The tricks come into play if we miss. In that case we'll look for the next
1812 * slot we can fit into.
1818 * Return: number missed by (or 0 if we didn't miss).
1832 * with if we just incremented by a really large intervals since the in dwc2_next_periodic_start()
1833 * frame counter only goes to 0x3fff. It's terribly unlikely that we in dwc2_next_periodic_start()
1834 * will have missed in this case anyway. Just go to exit. If we want in dwc2_next_periodic_start()
1835 * to try to do better we'll need to keep track of a bigger counter in dwc2_next_periodic_start()
1845 * - We compare against prev_frame_number since start_active_frame in dwc2_next_periodic_start()
1846 * and next_active_frame are always 1 frame before we want things in dwc2_next_periodic_start()
1847 * to be active and we assume we can still get scheduled in the in dwc2_next_periodic_start()
1850 * next_active_frame if we got an EO MISS (even_odd miss) which in dwc2_next_periodic_start()
1851 * basically means that we detected there wasn't enough time for in dwc2_next_periodic_start()
1853 * at the last second. We want to make sure we don't schedule in dwc2_next_periodic_start()
1856 * we do two transfers in the same frame. in dwc2_next_periodic_start()
1863 * time. We can help with the dwc2 parts of this, but it's hard to in dwc2_next_periodic_start()
1865 * we have to be robust to some misses. in dwc2_next_periodic_start()
1932 * means we don't actually know if we've already handled the SOF in dwc2_hcd_qh_deactivate()
1958 * Note: we purposely use the frame_number from the "hsotg" structure in dwc2_hcd_qh_deactivate()
1959 * since we know SOF interrupt will handle future frames. in dwc2_hcd_qh_deactivate()