From: Eric Dumazet <eric.dumazet@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>,
John Ogness <john.ogness@linutronix.de>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>,
"Nicholas A. Bellinger" <nab@linux-iscsi.org>,
target-devel <target-devel@vger.kernel.org>,
Linux Network Development <netdev@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
thomas@glanzmann.de
Subject: [PATCH] This extends tx_data and and iscsit_do_tx_data with the additional parameter flags and avoids sending multiple TCP packets in iscsit_fe_sendpage_sg
Date: Sun, 9 Feb 2014 08:42:27 +0100 [thread overview]
Message-ID: <20140209074227.GA8219@glanzmann.de> (raw)
In-Reply-To: <20140209074027.GA8105@glanzmann.de>
The new infrastructure is used in iscsit_fe_sendpage_sg to avoid sending three
TCP packets instead of one by settings the MSG_MORE when calling kernel_sendmsg
via the wrapper functions tx_data and iscsit_do_tx_data. This reduces the TCP
overhead by sending the same data in less TCP packets and minimized the TCP RTP
when TCP auto corking is enabled. When creating a 500 GB VMFS filesystem the
filesystem is created in 3 seconds instead of 4 seconds.
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
X-tested-by: Thomas Glanzmann <thomas@glanzmann.de>
---
drivers/target/iscsi/iscsi_target_parameters.c | 2 +-
drivers/target/iscsi/iscsi_target_util.c | 23 ++++++++++++-----------
drivers/target/iscsi/iscsi_target_util.h | 2 +-
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c
index 4d2e23f..b802392 100644
--- a/drivers/target/iscsi/iscsi_target_parameters.c
+++ b/drivers/target/iscsi/iscsi_target_parameters.c
@@ -79,7 +79,7 @@ int iscsi_login_tx_data(
*/
conn->if_marker += length;
- tx_sent = tx_data(conn, &iov[0], iov_cnt, length);
+ tx_sent = tx_data(conn, &iov[0], iov_cnt, length, 0);
if (tx_sent != length) {
pr_err("tx_data returned %d, expecting %d.\n",
tx_sent, length);
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
index e655b04..887fabb 100644
--- a/drivers/target/iscsi/iscsi_target_util.c
+++ b/drivers/target/iscsi/iscsi_target_util.c
@@ -1168,7 +1168,7 @@ send_data:
iov_count = cmd->iov_misc_count;
}
- tx_sent = tx_data(conn, &iov[0], iov_count, tx_size);
+ tx_sent = tx_data(conn, &iov[0], iov_count, tx_size, 0);
if (tx_size != tx_sent) {
if (tx_sent == -EAGAIN) {
pr_err("tx_data() returned -EAGAIN\n");
@@ -1199,7 +1199,8 @@ send_hdr:
iov.iov_base = cmd->pdu;
iov.iov_len = tx_hdr_size;
- tx_sent = tx_data(conn, &iov, 1, tx_hdr_size);
+ data_len = cmd->tx_size - tx_hdr_size - cmd->padding;
+ tx_sent = tx_data(conn, &iov, 1, tx_hdr_size, data_len ? MSG_MORE : 0);
if (tx_hdr_size != tx_sent) {
if (tx_sent == -EAGAIN) {
pr_err("tx_data() returned -EAGAIN\n");
@@ -1208,7 +1209,6 @@ send_hdr:
return -1;
}
- data_len = cmd->tx_size - tx_hdr_size - cmd->padding;
/*
* Set iov_off used by padding and data digest tx_data() calls below
* in order to determine proper offset into cmd->iov_data[]
@@ -1252,7 +1252,8 @@ send_padding:
if (cmd->padding) {
struct kvec *iov_p = &cmd->iov_data[iov_off++];
- tx_sent = tx_data(conn, iov_p, 1, cmd->padding);
+ tx_sent = tx_data(conn, iov_p, 1, cmd->padding,
+ conn->conn_ops->DataDigest ? MSG_MORE : 0);
if (cmd->padding != tx_sent) {
if (tx_sent == -EAGAIN) {
pr_err("tx_data() returned -EAGAIN\n");
@@ -1266,7 +1267,7 @@ send_datacrc:
if (conn->conn_ops->DataDigest) {
struct kvec *iov_d = &cmd->iov_data[iov_off];
- tx_sent = tx_data(conn, iov_d, 1, ISCSI_CRC_LEN);
+ tx_sent = tx_data(conn, iov_d, 1, ISCSI_CRC_LEN, 0);
if (ISCSI_CRC_LEN != tx_sent) {
if (tx_sent == -EAGAIN) {
pr_err("tx_data() returned -EAGAIN\n");
@@ -1352,11 +1353,12 @@ static int iscsit_do_rx_data(
static int iscsit_do_tx_data(
struct iscsi_conn *conn,
- struct iscsi_data_count *count)
+ struct iscsi_data_count *count,
+ int flags)
{
int data = count->data_length, total_tx = 0, tx_loop = 0, iov_len;
struct kvec *iov_p;
- struct msghdr msg;
+ struct msghdr msg = { .msg_flags = flags };
if (!conn || !conn->sock || !conn->conn_ops)
return -1;
@@ -1366,8 +1368,6 @@ static int iscsit_do_tx_data(
return -1;
}
- memset(&msg, 0, sizeof(struct msghdr));
-
iov_p = count->iov;
iov_len = count->iov_count;
@@ -1411,7 +1411,8 @@ int tx_data(
struct iscsi_conn *conn,
struct kvec *iov,
int iov_count,
- int data)
+ int data,
+ int flags)
{
struct iscsi_data_count c;
@@ -1424,7 +1425,7 @@ int tx_data(
c.data_length = data;
c.type = ISCSI_TX_DATA;
- return iscsit_do_tx_data(conn, &c);
+ return iscsit_do_tx_data(conn, &c, flags);
}
void iscsit_collect_login_stats(
diff --git a/drivers/target/iscsi/iscsi_target_util.h b/drivers/target/iscsi/iscsi_target_util.h
index 561a424..1b6b336 100644
--- a/drivers/target/iscsi/iscsi_target_util.h
+++ b/drivers/target/iscsi/iscsi_target_util.h
@@ -54,7 +54,7 @@ extern int iscsit_print_dev_to_proc(char *, char **, off_t, int);
extern int iscsit_print_sessions_to_proc(char *, char **, off_t, int);
extern int iscsit_print_tpg_to_proc(char *, char **, off_t, int);
extern int rx_data(struct iscsi_conn *, struct kvec *, int, int);
-extern int tx_data(struct iscsi_conn *, struct kvec *, int, int);
+extern int tx_data(struct iscsi_conn *, struct kvec *, int, int, int);
extern void iscsit_collect_login_stats(struct iscsi_conn *, u8, u8);
extern struct iscsi_tiqn *iscsit_snmp_get_tiqn(struct iscsi_conn *);
--
1.7.10.4
next prev parent reply other threads:[~2014-02-09 7:42 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20140206153640.GB4103@glanzmann.de>
[not found] ` <1391727771.14985.41.camel@haakon3.risingtidesystems.com>
[not found] ` <20140207051500.GB10916@glanzmann.de>
[not found] ` <20140207075536.GB17815@glanzmann.de>
[not found] ` <1391801597.1155.28.camel@haakon3.risingtidesystems.com>
[not found] ` <20140207205142.GA8609@glanzmann.de>
2014-02-08 9:18 ` REGRESSION f54b311142a92ea2e42598e347b84e1655caf8e3 tcp auto corking slows down iSCSI file system creation by factor of 70 [WAS: 4 TB VMFS creation takes 15 minutes vs 26 seconds] Thomas Glanzmann
2014-02-08 9:19 ` [PATCH] tcp: disable auto corking by default Thomas Glanzmann
2014-02-08 15:04 ` Eric Dumazet
2014-02-08 16:55 ` Thomas Glanzmann
2014-02-08 17:12 ` Eric Dumazet
2014-02-08 17:20 ` Thomas Glanzmann
2014-02-08 9:23 ` REGRESSION f54b311142a92ea2e42598e347b84e1655caf8e3 tcp auto corking slows down iSCSI file system creation by factor of 70 [WAS: 4 TB VMFS creation takes 15 minutes vs 26 seconds] Thomas Glanzmann
2014-02-08 9:38 ` Thomas Glanzmann
2014-02-08 9:38 ` Thomas Glanzmann
2014-02-08 13:14 ` Eric Dumazet
2014-02-08 13:33 ` Eric Dumazet
2014-02-08 13:38 ` Thomas Glanzmann
2014-02-08 13:50 ` Eric Dumazet
2014-02-08 14:13 ` Eric Dumazet
2014-02-08 14:19 ` Thomas Glanzmann
2014-02-08 14:30 ` Eric Dumazet
2014-02-08 15:00 ` Thomas Glanzmann
2014-02-08 15:06 ` Eric Dumazet
2014-02-08 16:57 ` Thomas Glanzmann
2014-02-08 17:08 ` Eric Dumazet
2014-02-08 17:15 ` Thomas Glanzmann
2014-02-08 19:12 ` Eric Dumazet
2014-02-08 21:36 ` Thomas Glanzmann
2014-02-09 0:15 ` Eric Dumazet
2014-02-09 7:45 ` Thomas Glanzmann
2014-02-09 7:40 ` RFC: Set MSG_MORE in iscsit_fe_sendpage_sg to avoid sending multiple TCP packets instead of one Thomas Glanzmann
2014-02-09 7:42 ` Eric Dumazet [this message]
2014-02-09 12:30 ` [PATCH] This extends tx_data and and iscsit_do_tx_data with the additional parameter flags and avoids sending multiple TCP packets in iscsit_fe_sendpage_sg Eric Dumazet
2014-02-09 15:07 ` Thomas Glanzmann
2014-02-10 18:58 ` Nicholas A. Bellinger
2014-02-10 20:56 ` Thomas Glanzmann
2014-02-10 21:01 ` Eric Dumazet
2014-02-10 21:09 ` Eric Dumazet
2014-02-10 21:13 ` Thomas Glanzmann
2014-02-10 21:14 ` Thomas Glanzmann
2014-02-08 13:37 ` REGRESSION f54b311142a92ea2e42598e347b84e1655caf8e3 tcp auto corking slows down iSCSI file system creation by factor of 70 [WAS: 4 TB VMFS creation takes 15 minutes vs 26 seconds] Thomas Glanzmann
2014-02-08 13:53 ` Eric Dumazet
2014-02-08 13:58 ` Thomas Glanzmann
2014-02-08 14:09 ` Eric Dumazet
2014-02-08 14:12 ` Thomas Glanzmann
2014-02-17 14:08 ` Thomas Glanzmann
2014-02-17 15:26 ` Eric Dumazet
2014-02-17 15:32 ` Thomas Glanzmann
2014-02-17 15:46 ` Eric Dumazet
2014-02-17 15:46 ` Thomas Glanzmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140209074227.GA8219@glanzmann.de \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=netdev@vger.kernel.org \
--cc=target-devel@vger.kernel.org \
--cc=thomas@glanzmann.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.