Skip to content

Commit e82f2e3

Browse files
braunudavem330
authored andcommitted
net/smc: optimize consumer cursor updates
The SMC protocol requires to send a separate consumer cursor update, if it cannot be piggybacked to updates of the producer cursor. Currently the decision to send a separate consumer cursor update just considers the amount of data already received by the socket program. It does not consider the amount of data already arrived, but not yet consumed by the receiver. Basing the decision on the difference between already confirmed and already arrived data (instead of difference between already confirmed and already consumed data), may lead to a somewhat earlier consumer cursor update send in fast unidirectional traffic scenarios, and thus to better throughput. Signed-off-by: Ursula Braun <ubraun@linux.ibm.com> Suggested-by: Thomas Richter <tmricht@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0afff91 commit e82f2e3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

net/smc/smc_tx.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,8 @@ void smc_tx_work(struct work_struct *work)
495495

496496
void smc_tx_consumer_update(struct smc_connection *conn, bool force)
497497
{
498-
union smc_host_cursor cfed, cons;
498+
union smc_host_cursor cfed, cons, prod;
499+
int sender_free = conn->rmb_desc->len;
499500
int to_confirm;
500501

501502
smc_curs_write(&cons,
@@ -505,11 +506,18 @@ void smc_tx_consumer_update(struct smc_connection *conn, bool force)
505506
smc_curs_read(&conn->rx_curs_confirmed, conn),
506507
conn);
507508
to_confirm = smc_curs_diff(conn->rmb_desc->len, &cfed, &cons);
509+
if (to_confirm > conn->rmbe_update_limit) {
510+
smc_curs_write(&prod,
511+
smc_curs_read(&conn->local_rx_ctrl.prod, conn),
512+
conn);
513+
sender_free = conn->rmb_desc->len -
514+
smc_curs_diff(conn->rmb_desc->len, &prod, &cfed);
515+
}
508516

509517
if (conn->local_rx_ctrl.prod_flags.cons_curs_upd_req ||
510518
force ||
511519
((to_confirm > conn->rmbe_update_limit) &&
512-
((to_confirm > (conn->rmb_desc->len / 2)) ||
520+
((sender_free <= (conn->rmb_desc->len / 2)) ||
513521
conn->local_rx_ctrl.prod_flags.write_blocked))) {
514522
if ((smc_cdc_get_slot_and_msg_send(conn) < 0) &&
515523
conn->alert_token_local) { /* connection healthy */

0 commit comments

Comments
 (0)