From: "Steve Wise" <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
To: "'David Miller'" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: <hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>,
<netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
<roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>,
<dm-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>,
<leedom-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>,
<santosh-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>,
<kumaras-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>,
<nirranjan-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
Subject: RE: [PATCHv6 net-next 20/31] iw_cxgb4: adjust tcp snd/rcv window based on link speed
Date: Wed, 12 Mar 2014 16:29:27 -0500 [thread overview]
Message-ID: <008d01cf3e3a$257edc90$707c95b0$@opengridcomputing.com> (raw)
In-Reply-To: <20140312.162348.2225551653125401290.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> >> You can just use the TCP settings the kernel already provides for
> >> the real TCP stack.
> >
> > Do you mean use sysctl_tcp_*mem, sysctl_tcp_timestamps, sysctl_tcp_window_scaling,
etc?
> > I'll look into this.
>
> And the socket memory limits, which we use to compute default window
> sizes.
How's this look (compile-tested only)? Note I had to export some of the tcp limits.
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index e2fe4a2..ff95fa3 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -81,19 +81,6 @@ int c4iw_max_read_depth = 8;
module_param(c4iw_max_read_depth, int, 0644);
MODULE_PARM_DESC(c4iw_max_read_depth, "Per-connection max ORD/IRD (default=8)");
-static int enable_tcp_timestamps;
-module_param(enable_tcp_timestamps, int, 0644);
-MODULE_PARM_DESC(enable_tcp_timestamps, "Enable tcp timestamps (default=0)");
-
-static int enable_tcp_sack;
-module_param(enable_tcp_sack, int, 0644);
-MODULE_PARM_DESC(enable_tcp_sack, "Enable tcp SACK (default=0)");
-
-static int enable_tcp_window_scaling = 1;
-module_param(enable_tcp_window_scaling, int, 0644);
-MODULE_PARM_DESC(enable_tcp_window_scaling,
- "Enable tcp window scaling (default=1)");
-
int c4iw_debug;
module_param(c4iw_debug, int, 0644);
MODULE_PARM_DESC(c4iw_debug, "Enable debug logging (default=0)");
@@ -126,19 +113,6 @@ static int crc_enabled = 1;
module_param(crc_enabled, int, 0644);
MODULE_PARM_DESC(crc_enabled, "Enable MPA CRC (default(1)=enabled)");
-static int rcv_win = 256 * 1024;
-module_param(rcv_win, int, 0644);
-MODULE_PARM_DESC(rcv_win, "TCP receive window in bytes (default=256KB)");
-
-static int snd_win = 128 * 1024;
-module_param(snd_win, int, 0644);
-MODULE_PARM_DESC(snd_win, "TCP send window in bytes (default=128KB)");
-
-static int adjust_win = 1;
-module_param(adjust_win, int, 0644);
-MODULE_PARM_DESC(adjust_win,
- "Adjust TCP window based on link speed (default=1)");
-
static struct workqueue_struct *workq;
static struct sk_buff_head rxq;
@@ -572,7 +546,7 @@ static int send_connect(struct c4iw_ep *ep)
set_wr_txq(skb, CPL_PRIORITY_SETUP, ep->ctrlq_idx);
cxgb4_best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx);
- wscale = compute_wscale(rcv_win);
+ wscale = compute_wscale(ep->rcv_win);
/*
* Specify the largest window that will fit in opt0. The
@@ -596,11 +570,11 @@ static int send_connect(struct c4iw_ep *ep)
opt2 = RX_CHANNEL(0) |
CCTRL_ECN(enable_ecn) |
RSS_QUEUE_VALID | RSS_QUEUE(ep->rss_qid);
- if (enable_tcp_timestamps)
+ if (sysctl_tcp_timestamps)
opt2 |= TSTAMPS_EN(1);
- if (enable_tcp_sack)
+ if (sysctl_tcp_sack)
opt2 |= SACK_EN(1);
- if (wscale && enable_tcp_window_scaling)
+ if (wscale && sysctl_tcp_window_scaling)
opt2 |= WND_SCALE_EN(1);
t4_set_arp_err_handler(skb, NULL, act_open_req_arp_failure);
@@ -1652,7 +1626,7 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int
atid)
req->tcb.tx_max = (__force __be32) jiffies;
req->tcb.rcv_adv = htons(1);
cxgb4_best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx);
- wscale = compute_wscale(rcv_win);
+ wscale = compute_wscale(ep->rcv_win);
/*
* Specify the largest window that will fit in opt0. The
@@ -1679,11 +1653,11 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int
atid)
RX_CHANNEL(0) |
CCTRL_ECN(enable_ecn) |
RSS_QUEUE_VALID | RSS_QUEUE(ep->rss_qid));
- if (enable_tcp_timestamps)
+ if (sysctl_tcp_timestamps)
req->tcb.opt2 |= (__force __be32) TSTAMPS_EN(1);
- if (enable_tcp_sack)
+ if (sysctl_tcp_sack)
req->tcb.opt2 |= (__force __be32) SACK_EN(1);
- if (wscale && enable_tcp_window_scaling)
+ if (wscale && sysctl_tcp_window_scaling)
req->tcb.opt2 |= (__force __be32) WND_SCALE_EN(1);
req->tcb.opt0 = cpu_to_be64((__force u64) req->tcb.opt0);
req->tcb.opt2 = cpu_to_be32((__force u32) req->tcb.opt2);
@@ -1712,11 +1686,14 @@ static int is_neg_adv(unsigned int status)
static void set_tcp_window(struct c4iw_ep *ep, struct port_info *pi)
{
+ u32 snd_win = max_t(u32, sysctl_tcp_rmem[2], sysctl_rmem_max);
+ u32 rcv_win = max_t(u32, sysctl_tcp_wmem[2], sysctl_wmem_max);
+
ep->snd_win = snd_win;
ep->rcv_win = rcv_win;
- if (adjust_win && pi->link_cfg.speed == 40000) {
- ep->snd_win *= 4;
- ep->rcv_win *= 4;
+ if (pi->link_cfg.speed == 40000) {
+ ep->snd_win = min_t(u32, ep->snd_win * 4, snd_win);
+ ep->rcv_win = min_t(u32, ep->rcv_win * 4, rcv_win);
}
PDBG("%s snd_win %d rcv_win %d\n", __func__, ep->snd_win, ep->rcv_win);
}
@@ -2026,7 +2003,7 @@ static void accept_cr(struct c4iw_ep *ep, struct sk_buff *skb,
skb_trim(skb, sizeof(*rpl));
skb_get(skb);
cxgb4_best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx);
- wscale = compute_wscale(rcv_win);
+ wscale = compute_wscale(ep->rcv_win);
/*
* Specify the largest window that will fit in opt0. The
@@ -2049,11 +2026,11 @@ static void accept_cr(struct c4iw_ep *ep, struct sk_buff *skb,
opt2 = RX_CHANNEL(0) |
RSS_QUEUE_VALID | RSS_QUEUE(ep->rss_qid);
- if (enable_tcp_timestamps && req->tcpopt.tstamp)
+ if (sysctl_tcp_timestamps && req->tcpopt.tstamp)
opt2 |= TSTAMPS_EN(1);
- if (enable_tcp_sack && req->tcpopt.sack)
+ if (sysctl_tcp_sack && req->tcpopt.sack)
opt2 |= SACK_EN(1);
- if (wscale && enable_tcp_window_scaling)
+ if (wscale && sysctl_tcp_window_scaling)
opt2 |= WND_SCALE_EN(1);
if (enable_ecn) {
const struct tcphdr *tcph;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 227cba7..65ed4e8 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -76,8 +76,11 @@
#include <net/netdma.h>
int sysctl_tcp_timestamps __read_mostly = 1;
+EXPORT_SYMBOL(sysctl_tcp_timestamps);
int sysctl_tcp_window_scaling __read_mostly = 1;
+EXPORT_SYMBOL(sysctl_tcp_window_scaling);
int sysctl_tcp_sack __read_mostly = 1;
+EXPORT_SYMBOL(sysctl_tcp_sack);
int sysctl_tcp_fack __read_mostly = 1;
int sysctl_tcp_reordering __read_mostly = TCP_FASTRETRANS_THRESH;
EXPORT_SYMBOL(sysctl_tcp_reordering);
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-03-12 21:29 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-12 15:50 [PATCHv6 net-next 00/31] Misc. fixes for cxgb4 and iw_cxgb4 Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 01/31] cxgb4: Fix some small bugs in t4_sge_init_soft() when our Page Size is 64KB Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 02/31] cxgb4: Add code to dump SGE registers when hitting idma hangs Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 03/31] cxgb4: Rectify emitting messages about SGE Ingress DMA channels being potentially stuck Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 04/31] cxgb4: Updates for T5 SGE's Egress Congestion Threshold Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 05/31] cxgb4: Calculate len properly for LSO path Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 06/31] iw_cxgb4: cap CQ size at T4_MAX_IQ_SIZE Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 07/31] iw_cxgb4: Allow loopback connections Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 08/31] iw_cxgb4: release neigh entry Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 09/31] iw_cxgb4: Treat CPL_ERR_KEEPALV_NEG_ADVICE as negative advice Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 10/31] cxgb4/iw_cxgb4: Doorbell Drop Avoidance Bug Fixes Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 11/31] iw_cxgb4: use the BAR2/WC path for kernel QPs and T5 devices Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 12/31] iw_cxgb4: Fix incorrect BUG_ON conditions Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 13/31] iw_cxgb4: Mind the sq_sig_all/sq_sig_type QP attributes Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 14/31] iw_cxgb4: default peer2peer mode to 1 Hariprasad Shenai
[not found] ` <1394639446-6504-1-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
2014-03-12 15:50 ` [PATCHv6 net-next 15/31] iw_cxgb4: save the correct map length for fast_reg_page_lists Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 20/31] iw_cxgb4: adjust tcp snd/rcv window based on link speed Hariprasad Shenai
[not found] ` <1394639446-6504-21-git-send-email-hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
2014-03-12 19:50 ` David Miller
[not found] ` <20140312.155017.118512327402563943.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2014-03-12 20:08 ` Steve Wise
2014-03-12 20:23 ` David Miller
[not found] ` <20140312.162348.2225551653125401290.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2014-03-12 21:29 ` Steve Wise [this message]
2014-03-12 22:12 ` David Miller
[not found] ` <20140312.181245.1921772176964395946.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2014-03-12 22:57 ` Steve Wise
2014-03-12 15:50 ` [PATCHv6 net-next 21/31] iw_cxgb4: update snd_seq when sending MPA messages Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 29/31] iw_cxgb4: minor fixes Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 31/31] iw_cxgb4: Use pr_warn_ratelimited Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 16/31] iw_cxgb4: don't leak skb in c4iw_uld_rx_handler() Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 17/31] iw_cxgb4: fix possible memory leak in RX_PKT processing Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 18/31] iw_cxgb4: ignore read reponse type 1 CQEs Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 19/31] iw_cxgb4: connect_request_upcall fixes Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 22/31] iw_cxgb4: lock around accept/reject downcalls Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 23/31] iw_cxgb4: drop RX_DATA packets if the endpoint is gone Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 24/31] iw_cxgb4: rx_data() needs to hold the ep mutex Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 25/31] iw_cxgb4: endpoint timeout fixes Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 26/31] iw_cxgb4: rmb() after reading valid gen bit Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 27/31] iw_cxgb4: wc_wmb() needed after DB writes Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 28/31] iw_cxgb4: SQ flush fix Hariprasad Shenai
2014-03-12 15:50 ` [PATCHv6 net-next 30/31] iw_cxgb4: Max fastreg depth depends on DSGL support Hariprasad Shenai
2014-03-12 19:51 ` [PATCHv6 net-next 00/31] Misc. fixes for cxgb4 and iw_cxgb4 David Miller
[not found] ` <20140312.155125.1045693666130935765.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2014-03-12 19:57 ` Steve Wise
2014-03-12 23:48 ` Casey Leedom
[not found] ` <03F31BF5-3DB6-4199-8DAB-A97BFB35D35F@chelsio.com>
[not found] ` <03F31BF5-3DB6-4199-8DAB-A97BFB35D35F-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
2014-03-12 23:52 ` David Miller
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='008d01cf3e3a$257edc90$707c95b0$@opengridcomputing.com' \
--to=swise-7bpotxp6k4+p2yhjcf5u+vpxobypeauw@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=dm-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
--cc=hariprasad-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
--cc=kumaras-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
--cc=leedom-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nirranjan-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
--cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
--cc=santosh-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).