{"id":816163,"url":"http://patchwork.ozlabs.org/api/1.2/patches/816163/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170920115813.63745-9-ubraun@linux.vnet.ibm.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170920115813.63745-9-ubraun@linux.vnet.ibm.com>","list_archive_url":null,"date":"2017-09-20T11:58:11","name":"[net-next,08/10] net/smc: introduce a delay","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"8e61ed283452c4c5978cc6b41c7ff2c305c2d788","submitter":{"id":2266,"url":"http://patchwork.ozlabs.org/api/1.2/people/2266/?format=json","name":"Ursula Braun","email":"ubraun@linux.vnet.ibm.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170920115813.63745-9-ubraun@linux.vnet.ibm.com/mbox/","series":[{"id":4092,"url":"http://patchwork.ozlabs.org/api/1.2/series/4092/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=4092","date":"2017-09-20T11:58:04","name":"net/smc: updates 2017-09-20","version":1,"mbox":"http://patchwork.ozlabs.org/series/4092/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816163/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816163/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xxyv95W2sz9t2Q\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 20 Sep 2017 21:58:45 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751964AbdITL6n (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 20 Sep 2017 07:58:43 -0400","from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34876 \"EHLO\n\tmx0a-001b2d01.pphosted.com\" rhost-flags-OK-OK-OK-FAIL)\n\tby vger.kernel.org with ESMTP id S1751952AbdITL6g (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 20 Sep 2017 07:58:36 -0400","from pps.filterd (m0098414.ppops.net [127.0.0.1])\n\tby mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv8KBsYG8028357\n\tfor <netdev@vger.kernel.org>; Wed, 20 Sep 2017 07:58:36 -0400","from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107])\n\tby mx0b-001b2d01.pphosted.com with ESMTP id 2d3q46b42e-1\n\t(version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT)\n\tfor <netdev@vger.kernel.org>; Wed, 20 Sep 2017 07:58:35 -0400","from localhost\n\tby e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use\n\tOnly! Violators will be prosecuted\n\tfor <netdev@vger.kernel.org> from <ubraun@linux.vnet.ibm.com>;\n\tWed, 20 Sep 2017 12:58:34 +0100","from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195)\n\tby e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP\n\tGateway: Authorized Use Only! Violators will be prosecuted; \n\tWed, 20 Sep 2017 12:58:30 +0100","from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com\n\t[9.149.105.59])\n\tby b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with\n\tESMTP id v8KBwU5Q25231428; Wed, 20 Sep 2017 11:58:30 GMT","from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 0D298A4053;\n\tWed, 20 Sep 2017 12:54:31 +0100 (BST)","from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id B6702A404D;\n\tWed, 20 Sep 2017 12:54:30 +0100 (BST)","from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9])\n\tby d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS;\n\tWed, 20 Sep 2017 12:54:30 +0100 (BST)"],"From":"Ursula Braun <ubraun@linux.vnet.ibm.com>","To":"davem@davemloft.net","Cc":"netdev@vger.kernel.org, linux-rdma@vger.kernel.org,\n\tlinux-s390@vger.kernel.org, jwi@linux.vnet.ibm.com,\n\tschwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,\n\traspl@linux.vnet.ibm.com, ubraun@linux.vnet.ibm.com","Subject":"[PATCH net-next 08/10] net/smc: introduce a delay","Date":"Wed, 20 Sep 2017 13:58:11 +0200","X-Mailer":"git-send-email 2.13.5","In-Reply-To":"<20170920115813.63745-1-ubraun@linux.vnet.ibm.com>","References":"<20170920115813.63745-1-ubraun@linux.vnet.ibm.com>","X-TM-AS-GCONF":"00","x-cbid":"17092011-0040-0000-0000-000003FBA388","X-IBM-AV-DETECTION":"SAVI=unused REMOTE=unused XFE=unused","x-cbparentid":"17092011-0041-0000-0000-0000209CD9AC","Message-Id":"<20170920115813.63745-9-ubraun@linux.vnet.ibm.com>","X-Proofpoint-Virus-Version":"vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-09-20_03:, , signatures=0","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n\tspamscore=0 suspectscore=1\n\tmalwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam\n\tadjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000\n\tdefinitions=main-1709200163","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"The number of outstanding work requests is limited. If all work\nrequests are in use, tx processing is postponed to another scheduling\nof the tx worker. Switch to a delayed worker to have a gap for tx\ncompletion queue events before the next retry.\n\nSigned-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>\n---\n net/smc/smc.h       |  2 +-\n net/smc/smc_close.c | 12 +++++++-----\n net/smc/smc_tx.c    | 12 ++++++++----\n 3 files changed, 16 insertions(+), 10 deletions(-)","diff":"diff --git a/net/smc/smc.h b/net/smc/smc.h\nindex 6e44313e4467..0ccd6fa387ad 100644\n--- a/net/smc/smc.h\n+++ b/net/smc/smc.h\n@@ -149,7 +149,7 @@ struct smc_connection {\n \tatomic_t\t\tsndbuf_space;\t/* remaining space in sndbuf */\n \tu16\t\t\ttx_cdc_seq;\t/* sequence # for CDC send */\n \tspinlock_t\t\tsend_lock;\t/* protect wr_sends */\n-\tstruct work_struct\ttx_work;\t/* retry of smc_cdc_msg_send */\n+\tstruct delayed_work\ttx_work;\t/* retry of smc_cdc_msg_send */\n \n \tstruct smc_host_cdc_msg\tlocal_rx_ctrl;\t/* filled during event_handl.\n \t\t\t\t\t\t * .prod cf. TCP rcv_nxt\ndiff --git a/net/smc/smc_close.c b/net/smc/smc_close.c\nindex 3c2e166b5d22..5201bc103bd8 100644\n--- a/net/smc/smc_close.c\n+++ b/net/smc/smc_close.c\n@@ -208,7 +208,7 @@ int smc_close_active(struct smc_sock *smc)\n \tcase SMC_ACTIVE:\n \t\tsmc_close_stream_wait(smc, timeout);\n \t\trelease_sock(sk);\n-\t\tcancel_work_sync(&conn->tx_work);\n+\t\tcancel_delayed_work_sync(&conn->tx_work);\n \t\tlock_sock(sk);\n \t\tif (sk->sk_state == SMC_ACTIVE) {\n \t\t\t/* send close request */\n@@ -234,7 +234,7 @@ int smc_close_active(struct smc_sock *smc)\n \t\tif (!smc_cdc_rxed_any_close(conn))\n \t\t\tsmc_close_stream_wait(smc, timeout);\n \t\trelease_sock(sk);\n-\t\tcancel_work_sync(&conn->tx_work);\n+\t\tcancel_delayed_work_sync(&conn->tx_work);\n \t\tlock_sock(sk);\n \t\tif (sk->sk_err != ECONNABORTED) {\n \t\t\t/* confirm close from peer */\n@@ -263,7 +263,9 @@ int smc_close_active(struct smc_sock *smc)\n \t\t/* peer sending PeerConnectionClosed will cause transition */\n \t\tbreak;\n \tcase SMC_PROCESSABORT:\n-\t\tcancel_work_sync(&conn->tx_work);\n+\t\trelease_sock(sk);\n+\t\tcancel_delayed_work_sync(&conn->tx_work);\n+\t\tlock_sock(sk);\n \t\tsmc_close_abort(conn);\n \t\tsk->sk_state = SMC_CLOSED;\n \t\tsmc_close_wait_tx_pends(smc);\n@@ -425,7 +427,7 @@ int smc_close_shutdown_write(struct smc_sock *smc)\n \tcase SMC_ACTIVE:\n \t\tsmc_close_stream_wait(smc, timeout);\n \t\trelease_sock(sk);\n-\t\tcancel_work_sync(&conn->tx_work);\n+\t\tcancel_delayed_work_sync(&conn->tx_work);\n \t\tlock_sock(sk);\n \t\t/* send close wr request */\n \t\trc = smc_close_wr(conn);\n@@ -439,7 +441,7 @@ int smc_close_shutdown_write(struct smc_sock *smc)\n \t\tif (!smc_cdc_rxed_any_close(conn))\n \t\t\tsmc_close_stream_wait(smc, timeout);\n \t\trelease_sock(sk);\n-\t\tcancel_work_sync(&conn->tx_work);\n+\t\tcancel_delayed_work_sync(&conn->tx_work);\n \t\tlock_sock(sk);\n \t\t/* confirm close from peer */\n \t\trc = smc_close_wr(conn);\ndiff --git a/net/smc/smc_tx.c b/net/smc/smc_tx.c\nindex 3c656beb8820..3866573288dd 100644\n--- a/net/smc/smc_tx.c\n+++ b/net/smc/smc_tx.c\n@@ -24,6 +24,8 @@\n #include \"smc_cdc.h\"\n #include \"smc_tx.h\"\n \n+#define SMC_TX_WORK_DELAY\tHZ\n+\n /***************************** sndbuf producer *******************************/\n \n /* callback implementation for sk.sk_write_space()\n@@ -406,7 +408,8 @@ int smc_tx_sndbuf_nonempty(struct smc_connection *conn)\n \t\t\t\tgoto out_unlock;\n \t\t\t}\n \t\t\trc = 0;\n-\t\t\tschedule_work(&conn->tx_work);\n+\t\t\tschedule_delayed_work(&conn->tx_work,\n+\t\t\t\t\t      SMC_TX_WORK_DELAY);\n \t\t}\n \t\tgoto out_unlock;\n \t}\n@@ -430,7 +433,7 @@ int smc_tx_sndbuf_nonempty(struct smc_connection *conn)\n  */\n static void smc_tx_work(struct work_struct *work)\n {\n-\tstruct smc_connection *conn = container_of(work,\n+\tstruct smc_connection *conn = container_of(to_delayed_work(work),\n \t\t\t\t\t\t   struct smc_connection,\n \t\t\t\t\t\t   tx_work);\n \tstruct smc_sock *smc = container_of(conn, struct smc_sock, conn);\n@@ -468,7 +471,8 @@ void smc_tx_consumer_update(struct smc_connection *conn)\n \t\tif (!rc)\n \t\t\trc = smc_cdc_msg_send(conn, wr_buf, pend);\n \t\tif (rc < 0) {\n-\t\t\tschedule_work(&conn->tx_work);\n+\t\t\tschedule_delayed_work(&conn->tx_work,\n+\t\t\t\t\t      SMC_TX_WORK_DELAY);\n \t\t\treturn;\n \t\t}\n \t\tsmc_curs_write(&conn->rx_curs_confirmed,\n@@ -487,6 +491,6 @@ void smc_tx_consumer_update(struct smc_connection *conn)\n void smc_tx_init(struct smc_sock *smc)\n {\n \tsmc->sk.sk_write_space = smc_tx_write_space;\n-\tINIT_WORK(&smc->conn.tx_work, smc_tx_work);\n+\tINIT_DELAYED_WORK(&smc->conn.tx_work, smc_tx_work);\n \tspin_lock_init(&smc->conn.send_lock);\n }\n","prefixes":["net-next","08/10"]}