|
@@ -1185,9 +1185,8 @@ out:
|
|
|
|
|
|
static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
|
|
|
{
|
|
|
- unsigned long now = jiffies;
|
|
|
- unsigned long next_credit =
|
|
|
- vif->credit_timeout.expires +
|
|
|
+ u64 now = get_jiffies_64();
|
|
|
+ u64 next_credit = vif->credit_window_start +
|
|
|
msecs_to_jiffies(vif->credit_usec / 1000);
|
|
|
|
|
|
/* Timer could already be pending in rare cases. */
|
|
@@ -1195,8 +1194,8 @@ static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
|
|
|
return true;
|
|
|
|
|
|
/* Passed the point where we can replenish credit? */
|
|
|
- if (time_after_eq(now, next_credit)) {
|
|
|
- vif->credit_timeout.expires = now;
|
|
|
+ if (time_after_eq64(now, next_credit)) {
|
|
|
+ vif->credit_window_start = now;
|
|
|
tx_add_credit(vif);
|
|
|
}
|
|
|
|
|
@@ -1208,6 +1207,7 @@ static bool tx_credit_exceeded(struct xenvif *vif, unsigned size)
|
|
|
tx_credit_callback;
|
|
|
mod_timer(&vif->credit_timeout,
|
|
|
next_credit);
|
|
|
+ vif->credit_window_start = next_credit;
|
|
|
|
|
|
return true;
|
|
|
}
|