aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorHariprasad S <hariprasad@chelsio.com>2014-09-23 18:23:41 -0400
committerRoland Dreier <roland@purestorage.com>2014-10-14 03:34:08 -0400
commit04524a47c36bc7fc573a4856b4e0fd8cf66c3126 (patch)
tree62c968675e0971f8147d1541a5f129a8db7a978d /drivers/infiniband
parent65d4c01af0f5b394a33848bc27c4331e2959dfd5 (diff)
RDMA/cxgb4: Take IPv6 into account for best_mtu and set_emss
best_mtu and set_emss were not considering ipv6 header for ipv6 case. Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/cxgb4/cm.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index c2fb71c182a8..2ca9ec8d6474 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -236,10 +236,12 @@ static void release_tid(struct c4iw_rdev *rdev, u32 hwtid, struct sk_buff *skb)
236static void set_emss(struct c4iw_ep *ep, u16 opt) 236static void set_emss(struct c4iw_ep *ep, u16 opt)
237{ 237{
238 ep->emss = ep->com.dev->rdev.lldi.mtus[GET_TCPOPT_MSS(opt)] - 238 ep->emss = ep->com.dev->rdev.lldi.mtus[GET_TCPOPT_MSS(opt)] -
239 sizeof(struct iphdr) - sizeof(struct tcphdr); 239 ((AF_INET == ep->com.remote_addr.ss_family) ?
240 sizeof(struct iphdr) : sizeof(struct ipv6hdr)) -
241 sizeof(struct tcphdr);
240 ep->mss = ep->emss; 242 ep->mss = ep->emss;
241 if (GET_TCPOPT_TSTAMP(opt)) 243 if (GET_TCPOPT_TSTAMP(opt))
242 ep->emss -= 12; 244 ep->emss -= round_up(TCPOLEN_TIMESTAMP, 4);
243 if (ep->emss < 128) 245 if (ep->emss < 128)
244 ep->emss = 128; 246 ep->emss = 128;
245 if (ep->emss & 7) 247 if (ep->emss & 7)
@@ -581,11 +583,14 @@ static void c4iw_record_pm_msg(struct c4iw_ep *ep,
581} 583}
582 584
583static void best_mtu(const unsigned short *mtus, unsigned short mtu, 585static void best_mtu(const unsigned short *mtus, unsigned short mtu,
584 unsigned int *idx, int use_ts) 586 unsigned int *idx, int use_ts, int ipv6)
585{ 587{
586 unsigned short hdr_size = sizeof(struct iphdr) + 588 unsigned short hdr_size = (ipv6 ?
589 sizeof(struct ipv6hdr) :
590 sizeof(struct iphdr)) +
587 sizeof(struct tcphdr) + 591 sizeof(struct tcphdr) +
588 (use_ts ? 12 : 0); 592 (use_ts ?
593 round_up(TCPOLEN_TIMESTAMP, 4) : 0);
589 unsigned short data_size = mtu - hdr_size; 594 unsigned short data_size = mtu - hdr_size;
590 595
591 cxgb4_best_aligned_mtu(mtus, hdr_size, data_size, 8, idx); 596 cxgb4_best_aligned_mtu(mtus, hdr_size, data_size, 8, idx);
@@ -634,7 +639,8 @@ static int send_connect(struct c4iw_ep *ep)
634 set_wr_txq(skb, CPL_PRIORITY_SETUP, ep->ctrlq_idx); 639 set_wr_txq(skb, CPL_PRIORITY_SETUP, ep->ctrlq_idx);
635 640
636 best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx, 641 best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx,
637 enable_tcp_timestamps); 642 enable_tcp_timestamps,
643 (AF_INET == ep->com.remote_addr.ss_family) ? 0 : 1);
638 wscale = compute_wscale(rcv_win); 644 wscale = compute_wscale(rcv_win);
639 645
640 /* 646 /*
@@ -1763,7 +1769,8 @@ static void send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
1763 req->tcb.tx_max = (__force __be32) jiffies; 1769 req->tcb.tx_max = (__force __be32) jiffies;
1764 req->tcb.rcv_adv = htons(1); 1770 req->tcb.rcv_adv = htons(1);
1765 best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx, 1771 best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx,
1766 enable_tcp_timestamps); 1772 enable_tcp_timestamps,
1773 (AF_INET == ep->com.remote_addr.ss_family) ? 0 : 1);
1767 wscale = compute_wscale(rcv_win); 1774 wscale = compute_wscale(rcv_win);
1768 1775
1769 /* 1776 /*
@@ -2162,7 +2169,8 @@ static void accept_cr(struct c4iw_ep *ep, struct sk_buff *skb,
2162 ep->hwtid)); 2169 ep->hwtid));
2163 2170
2164 best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx, 2171 best_mtu(ep->com.dev->rdev.lldi.mtus, ep->mtu, &mtu_idx,
2165 enable_tcp_timestamps && req->tcpopt.tstamp); 2172 enable_tcp_timestamps && req->tcpopt.tstamp,
2173 (AF_INET == ep->com.remote_addr.ss_family) ? 0 : 1);
2166 wscale = compute_wscale(rcv_win); 2174 wscale = compute_wscale(rcv_win);
2167 2175
2168 /* 2176 /*