net/smc: get rid of tx_pend waits in socket closing
authorUrsula Braun <ubraun@linux.vnet.ibm.com>
Wed, 24 Jan 2018 09:28:14 +0000 (10:28 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Jan 2018 15:52:57 +0000 (10:52 -0500)
There is no need to wait for confirmation of pending tx requests
for a closing connection, since pending tx slots are dismissed
when finishing a connection.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_cdc.c
net/smc/smc_cdc.h
net/smc/smc_close.c
net/smc/smc_wr.c
net/smc/smc_wr.h

index d4155ff6acde1325e6414761e007e8fc1511af8b..51805334e0013ddfb0062b1e5d5cedc333e2a332 100644 (file)
@@ -57,9 +57,6 @@ static void smc_cdc_tx_handler(struct smc_wr_tx_pend_priv *pnd_snd,
                               cdcpend->conn);
        }
        smc_tx_sndbuf_nonfull(smc);
-       if (smc->sk.sk_state != SMC_ACTIVE)
-               /* wake up smc_close_wait_tx_pends() */
-               smc->sk.sk_state_change(&smc->sk);
        bh_unlock_sock(&smc->sk);
 }
 
@@ -155,14 +152,6 @@ void smc_cdc_tx_dismiss_slots(struct smc_connection *conn)
                                (unsigned long)conn);
 }
 
-bool smc_cdc_tx_has_pending(struct smc_connection *conn)
-{
-       struct smc_link *link = &conn->lgr->lnk[SMC_SINGLE_LINK];
-
-       return smc_wr_tx_has_pending(link, SMC_CDC_MSG_TYPE,
-                                    smc_cdc_tx_filter, (unsigned long)conn);
-}
-
 /********************************* receive ***********************************/
 
 static inline bool smc_cdc_before(u16 seq1, u16 seq2)
index 149ceda1b088e69483b92d338b2f2d5a09674b1c..ab240b37ad11459ba552422e6b87078b358a008c 100644 (file)
@@ -214,7 +214,6 @@ void smc_cdc_tx_dismiss_slots(struct smc_connection *conn);
 int smc_cdc_msg_send(struct smc_connection *conn, struct smc_wr_buf *wr_buf,
                     struct smc_cdc_tx_pend *pend);
 int smc_cdc_get_slot_and_msg_send(struct smc_connection *conn);
-bool smc_cdc_tx_has_pending(struct smc_connection *conn);
 int smc_cdc_init(void) __init;
 
 #endif /* SMC_CDC_H */
index 11793912f001381b5d2d0da27760b72a37fa3786..bc539ccb8fa0dbeb644175d090a877c88b018a66 100644 (file)
@@ -19,8 +19,6 @@
 #include "smc_cdc.h"
 #include "smc_close.h"
 
-#define SMC_CLOSE_WAIT_TX_PENDS_TIME           (5 * HZ)
-
 static void smc_close_cleanup_listen(struct sock *parent)
 {
        struct sock *sk;
@@ -30,26 +28,6 @@ static void smc_close_cleanup_listen(struct sock *parent)
                smc_close_non_accepted(sk);
 }
 
-static void smc_close_wait_tx_pends(struct smc_sock *smc)
-{
-       DEFINE_WAIT_FUNC(wait, woken_wake_function);
-       struct sock *sk = &smc->sk;
-       signed long timeout;
-
-       timeout = SMC_CLOSE_WAIT_TX_PENDS_TIME;
-       add_wait_queue(sk_sleep(sk), &wait);
-       while (!signal_pending(current) && timeout) {
-               int rc;
-
-               rc = sk_wait_event(sk, &timeout,
-                                  !smc_cdc_tx_has_pending(&smc->conn),
-                                  &wait);
-               if (rc)
-                       break;
-       }
-       remove_wait_queue(sk_sleep(sk), &wait);
-}
-
 /* wait for sndbuf data being transmitted */
 static void smc_close_stream_wait(struct smc_sock *smc, long timeout)
 {
@@ -230,7 +208,6 @@ again:
                        rc = smc_close_final(conn);
                }
                sk->sk_state = SMC_CLOSED;
-               smc_close_wait_tx_pends(smc);
                break;
        case SMC_APPCLOSEWAIT1:
        case SMC_APPCLOSEWAIT2:
@@ -251,7 +228,6 @@ again:
                else
                        /* peer has just issued a shutdown write */
                        sk->sk_state = SMC_PEERFINCLOSEWAIT;
-               smc_close_wait_tx_pends(smc);
                break;
        case SMC_PEERCLOSEWAIT1:
        case SMC_PEERCLOSEWAIT2:
@@ -271,7 +247,6 @@ again:
                lock_sock(sk);
                smc_close_abort(conn);
                sk->sk_state = SMC_CLOSED;
-               smc_close_wait_tx_pends(smc);
                break;
        case SMC_PEERABORTWAIT:
        case SMC_CLOSED:
index de4537f66832af7d85b655df6238ae7f3961e1dd..a4477b4a9c180d786a3ce3eabb88a3cd9eabf74e 100644 (file)
@@ -319,24 +319,6 @@ void smc_wr_tx_dismiss_slots(struct smc_link *link, u8 wr_rx_hdr_type,
        }
 }
 
-bool smc_wr_tx_has_pending(struct smc_link *link, u8 wr_rx_hdr_type,
-                          smc_wr_tx_filter filter, unsigned long data)
-{
-       struct smc_wr_tx_pend_priv *tx_pend;
-       struct smc_wr_rx_hdr *wr_rx;
-       int i;
-
-       for_each_set_bit(i, link->wr_tx_mask, link->wr_tx_cnt) {
-               wr_rx = (struct smc_wr_rx_hdr *)&link->wr_rx_bufs[i];
-               if (wr_rx->type != wr_rx_hdr_type)
-                       continue;
-               tx_pend = &link->wr_tx_pends[i].priv;
-               if (filter(tx_pend, data))
-                       return true;
-       }
-       return false;
-}
-
 /****************************** receive queue ********************************/
 
 int smc_wr_rx_register_handler(struct smc_wr_rx_handler *handler)
index 2acf12b060639a409e5d5f0ad98e6d48aeab0da9..ef0c3494c9cb57249444337906fd3cb6f5e62a91 100644 (file)
@@ -93,8 +93,6 @@ int smc_wr_tx_put_slot(struct smc_link *link,
 int smc_wr_tx_send(struct smc_link *link,
                   struct smc_wr_tx_pend_priv *wr_pend_priv);
 void smc_wr_tx_cq_handler(struct ib_cq *ib_cq, void *cq_context);
-bool smc_wr_tx_has_pending(struct smc_link *link, u8 wr_rx_hdr_type,
-                          smc_wr_tx_filter filter, unsigned long data);
 void smc_wr_tx_dismiss_slots(struct smc_link *lnk, u8 wr_rx_hdr_type,
                             smc_wr_tx_filter filter,
                             smc_wr_tx_dismisser dismisser,