diff options
Diffstat (limited to 'net/rds/iw_send.c')
-rw-r--r-- | net/rds/iw_send.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/rds/iw_send.c b/net/rds/iw_send.c index 626290bc7e97..44a6a0551f28 100644 --- a/net/rds/iw_send.c +++ b/net/rds/iw_send.c | |||
@@ -347,7 +347,7 @@ void rds_iw_send_cq_comp_handler(struct ib_cq *cq, void *context) | |||
347 | * and using atomic_cmpxchg when updating the two counters. | 347 | * and using atomic_cmpxchg when updating the two counters. |
348 | */ | 348 | */ |
349 | int rds_iw_send_grab_credits(struct rds_iw_connection *ic, | 349 | int rds_iw_send_grab_credits(struct rds_iw_connection *ic, |
350 | u32 wanted, u32 *adv_credits, int need_posted) | 350 | u32 wanted, u32 *adv_credits, int need_posted, int max_posted) |
351 | { | 351 | { |
352 | unsigned int avail, posted, got = 0, advertise; | 352 | unsigned int avail, posted, got = 0, advertise; |
353 | long oldval, newval; | 353 | long oldval, newval; |
@@ -387,7 +387,7 @@ try_again: | |||
387 | * available. | 387 | * available. |
388 | */ | 388 | */ |
389 | if (posted && (got || need_posted)) { | 389 | if (posted && (got || need_posted)) { |
390 | advertise = min_t(unsigned int, posted, RDS_MAX_ADV_CREDIT); | 390 | advertise = min_t(unsigned int, posted, max_posted); |
391 | newval -= IB_SET_POST_CREDITS(advertise); | 391 | newval -= IB_SET_POST_CREDITS(advertise); |
392 | } | 392 | } |
393 | 393 | ||
@@ -541,7 +541,7 @@ int rds_iw_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
541 | 541 | ||
542 | credit_alloc = work_alloc; | 542 | credit_alloc = work_alloc; |
543 | if (ic->i_flowctl) { | 543 | if (ic->i_flowctl) { |
544 | credit_alloc = rds_iw_send_grab_credits(ic, work_alloc, &posted, 0); | 544 | credit_alloc = rds_iw_send_grab_credits(ic, work_alloc, &posted, 0, RDS_MAX_ADV_CREDIT); |
545 | adv_credits += posted; | 545 | adv_credits += posted; |
546 | if (credit_alloc < work_alloc) { | 546 | if (credit_alloc < work_alloc) { |
547 | rds_iw_ring_unalloc(&ic->i_send_ring, work_alloc - credit_alloc); | 547 | rds_iw_ring_unalloc(&ic->i_send_ring, work_alloc - credit_alloc); |
@@ -614,7 +614,7 @@ int rds_iw_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
614 | /* | 614 | /* |
615 | * Update adv_credits since we reset the ACK_REQUIRED bit. | 615 | * Update adv_credits since we reset the ACK_REQUIRED bit. |
616 | */ | 616 | */ |
617 | rds_iw_send_grab_credits(ic, 0, &posted, 1); | 617 | rds_iw_send_grab_credits(ic, 0, &posted, 1, RDS_MAX_ADV_CREDIT - adv_credits); |
618 | adv_credits += posted; | 618 | adv_credits += posted; |
619 | BUG_ON(adv_credits > 255); | 619 | BUG_ON(adv_credits > 255); |
620 | } else if (ic->i_rm != rm) | 620 | } else if (ic->i_rm != rm) |