From patchwork Thu Sep 2 23:20:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 151501 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o82NKcaK017473 for ; Thu, 2 Sep 2010 23:20:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755222Ab0IBXUi (ORCPT ); Thu, 2 Sep 2010 19:20:38 -0400 Received: from quartz.orcorp.ca ([139.142.54.143]:55937 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754422Ab0IBXUh (ORCPT ); Thu, 2 Sep 2010 19:20:37 -0400 Received: from [10.0.0.11] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.68) (envelope-from ) id 1OrJ5B-0005Gh-6X; Thu, 02 Sep 2010 17:20:37 -0600 Received: from jgg by jggl.edm.orcorp.ca with local (Exim 4.69) (envelope-from ) id 1OrJ5B-0007iS-55; Thu, 02 Sep 2010 17:20:37 -0600 Date: Thu, 2 Sep 2010 17:20:37 -0600 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org, Roland Dreier Subject: [PATCH] [IPOIB] Do IB path MTU Message-ID: <20100902232037.GX24971@obsidianresearch.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.11 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 02 Sep 2010 23:20:39 +0000 (UTC) diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 753a983..57930a5 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h @@ -362,6 +362,7 @@ struct ipoib_ah { struct list_head list; struct kref ref; unsigned last_send; + unsigned int mtu; }; struct ipoib_path { diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index bb10041..f9c0348 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -1366,15 +1366,22 @@ static void ipoib_cm_skb_reap(struct work_struct *work) struct net_device *dev = priv->dev; struct sk_buff *skb; unsigned long flags; - unsigned mtu = priv->mcast_mtu; + struct ipoib_neigh *neigh; netif_tx_lock_bh(dev); spin_lock_irqsave(&priv->lock, flags); while ((skb = skb_dequeue(&priv->cm.skb_queue))) { + unsigned mtu; spin_unlock_irqrestore(&priv->lock, flags); netif_tx_unlock_bh(dev); + neigh = *to_ipoib_neigh(skb_dst(skb)->neighbour); + if (neigh && neigh->ah) + mtu = neigh->ah->mtu; + else + mtu = priv->mcast_mtu; + if (skb->protocol == htons(ETH_P_IP)) icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_fs.c b/drivers/infiniband/ulp/ipoib/ipoib_fs.c index 86eae22..2232f79 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_fs.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_fs.c @@ -217,9 +217,11 @@ static int ipoib_path_seq_show(struct seq_file *file, void *iter_ptr) seq_printf(file, " DLID: 0x%04x\n" " SL: %12d\n" + " MTU: %11d\n" " rate: %*d%s Gb/sec\n", be16_to_cpu(path.pathrec.dlid), path.pathrec.sl, + path.ah ? path.ah->mtu : 0, 10 - ((rate % 10) ? 2 : 0), rate / 10, rate % 10 ? ".5" : ""); } diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index aa9f9cf..ca48dd9 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -552,12 +552,12 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb, required_mtu = skb->len; } - if (unlikely(required_mtu > priv->mcast_mtu + IPOIB_ENCAP_LEN)) { + if (unlikely(required_mtu > address->mtu + IPOIB_ENCAP_LEN)) { ipoib_warn(priv, "packet len %d (> %d) too long to send, dropping\n", - required_mtu, priv->mcast_mtu + IPOIB_ENCAP_LEN); + required_mtu, address->mtu + IPOIB_ENCAP_LEN); ++dev->stats.tx_dropped; ++dev->stats.tx_errors; - ipoib_cm_skb_too_long(dev, skb, priv->mcast_mtu); + ipoib_cm_skb_too_long(dev, skb, address->mtu); return; } diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index b4b2257..cf182eb 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -433,6 +433,7 @@ static void path_rec_completion(int status, if (ah) { path->pathrec = *pathrec; + ah->mtu = IPOIB_UD_MTU(ib_mtu_enum_to_int(pathrec->mtu)); old_ah = path->ah; path->ah = ah; diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 3871ac6..c77017d 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c @@ -242,15 +242,17 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, if (!ah) { ipoib_warn(priv, "ib_address_create failed\n"); } else { + ah->mtu = IPOIB_UD_MTU(ib_mtu_enum_to_int(mcmember->mtu)); spin_lock_irq(&priv->lock); mcast->ah = ah; spin_unlock_irq(&priv->lock); - ipoib_dbg_mcast(priv, "MGID %pI6 AV %p, LID 0x%04x, SL %d\n", + ipoib_dbg_mcast(priv, "MGID %pI6 AV %p, LID 0x%04x, SL %d, MTU %d\n", mcast->mcmember.mgid.raw, mcast->ah->ah, be16_to_cpu(mcast->mcmember.mlid), - mcast->mcmember.sl); + mcast->mcmember.sl, + ah->mtu); } }