* Hamilton backoff function. Returns 1 if we should backoff or 0 otherwise. */
| 104 | * Hamilton backoff function. Returns 1 if we should backoff or 0 otherwise. |
| 105 | */ |
| 106 | static __inline int |
| 107 | should_backoff(int qdly, int maxqdly) |
| 108 | { |
| 109 | unsigned long p; |
| 110 | |
| 111 | if (qdly < V_hd_qthresh) { |
| 112 | p = (((RANDOM_MAX / 100) * V_hd_pmax) / |
| 113 | (V_hd_qthresh - V_hd_qmin)) * (qdly - V_hd_qmin); |
| 114 | } else { |
| 115 | if (qdly > V_hd_qthresh) |
| 116 | p = (((RANDOM_MAX / 100) * V_hd_pmax) / |
| 117 | (maxqdly - V_hd_qthresh)) * (maxqdly - qdly); |
| 118 | else |
| 119 | p = (RANDOM_MAX / 100) * V_hd_pmax; |
| 120 | } |
| 121 | |
| 122 | return (random() < p); |
| 123 | } |
| 124 | |
| 125 | /* |
| 126 | * If the ack type is CC_ACK, and the inferred queueing delay is greater than |
no test coverage detected