net/smc: reduce amount of status updates to peer
authorKarsten Graul <kgraul@linux.ibm.com>
Tue, 12 Feb 2019 15:29:53 +0000 (16:29 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Feb 2019 16:59:45 +0000 (11:59 -0500)
In smc_cdc_msg_recv_action() the received cdc message is evaluated.
To reduce the number of messaged triggered by this evaluation the logic
is streamlined. For the write_blocked condition we do not need to send
a response immediately. The remaining conditions can be put together
into one if clause.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_cdc.c

index 780b36c6929267006de7ca3403c6f48047b30435..28bbdb04bc35d09b50c9a18b76c5e7326048b550 100644 (file)
@@ -273,24 +273,18 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc,
                smp_mb__after_atomic();
                smc->sk.sk_data_ready(&smc->sk);
        } else {
-               if (conn->local_rx_ctrl.prod_flags.write_blocked ||
-                   conn->local_rx_ctrl.prod_flags.cons_curs_upd_req ||
-                   conn->local_rx_ctrl.prod_flags.urg_data_pending) {
-                       if (conn->local_rx_ctrl.prod_flags.urg_data_pending)
-                               conn->urg_state = SMC_URG_NOTYET;
-                       /* force immediate tx of current consumer cursor, but
-                        * under send_lock to guarantee arrival in seqno-order
-                        */
-                       if (smc->sk.sk_state != SMC_INIT)
-                               smc_tx_sndbuf_nonempty(conn);
-               }
+               if (conn->local_rx_ctrl.prod_flags.write_blocked)
+                       smc->sk.sk_data_ready(&smc->sk);
+               if (conn->local_rx_ctrl.prod_flags.urg_data_pending)
+                       conn->urg_state = SMC_URG_NOTYET;
        }
 
-       /* piggy backed tx info */
        /* trigger sndbuf consumer: RDMA write into peer RMBE and CDC */
-       if (diff_cons && smc_tx_prepared_sends(conn)) {
+       if ((diff_cons && smc_tx_prepared_sends(conn)) ||
+           conn->local_rx_ctrl.prod_flags.cons_curs_upd_req ||
+           conn->local_rx_ctrl.prod_flags.urg_data_pending)
                smc_tx_sndbuf_nonempty(conn);
-       }
+
        if (diff_cons && conn->urg_tx_pend &&
            atomic_read(&conn->peer_rmbe_space) == conn->peer_rmbe_size) {
                /* urg data confirmed by peer, indicate we're ready for more */