svn commit: r213942 - projects/ofed/head/sys/ofed/drivers/infiniband/ulp/ipoib

Jeff Roberson jeff at FreeBSD.org
Sun Oct 17 00:15:12 UTC 2010


Author: jeff
Date: Sun Oct 17 00:15:12 2010
New Revision: 213942
URL: http://svn.freebsd.org/changeset/base/213942

Log:
   - Enable ip/tcp/udp checksum offload.
   - Bypass arpresolve() for multicast addresses.
  
  Sponsored by:	Isilon Systems, iX Systems, and Panasas.

Modified:
  projects/ofed/head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c
  projects/ofed/head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c	Sun Oct 17 00:14:41 2010	(r213941)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c	Sun Oct 17 00:15:12 2010	(r213942)
@@ -181,7 +181,8 @@ static int ipoib_ib_post_receives(struct
 	return 0;
 }
 
-static void ipoib_ib_handle_rx_wc(struct ifnet *dev, struct ib_wc *wc)
+static void
+ipoib_ib_handle_rx_wc(struct ifnet *dev, struct ib_wc *wc)
 {
 	struct ipoib_dev_priv *priv = dev->if_softc;
 	unsigned int wr_id = wc->wr_id & ~IPOIB_OP_RECV;
@@ -242,10 +243,10 @@ static void ipoib_ib_handle_rx_wc(struct
 	m_adj(mb, sizeof(struct ib_grh) - INFINIBAND_ALEN);
 	eh = mtod(mb, struct ipoib_header *);
 	bzero(eh->hwaddr, 4);	/* Zero the queue pair, only dgid is in grh */
-/* XXX
+
 	if (test_bit(IPOIB_FLAG_CSUM, &priv->flags) && likely(wc->csum_ok))
-		mb->ip_summed = CHECKSUM_UNNECESSARY;
-*/
+		mb->m_pkthdr.csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID;
+
 	dev->if_input(dev, mb);
 
 repost:
@@ -498,12 +499,10 @@ ipoib_send(struct ifnet *dev, struct mbu
 		return;
 	}
 
-/* XXX NO checksum offload yet.
-	if (mb->ip_summed == CHECKSUM_PARTIAL)
+	if (mb->m_pkthdr.csum_flags & (CSUM_IP|CSUM_TCP|CSUM_UDP))
 		priv->tx_wr.send_flags |= IB_SEND_IP_CSUM;
 	else
 		priv->tx_wr.send_flags &= ~IB_SEND_IP_CSUM;
-*/
 
 	if (++priv->tx_outstanding == ipoib_sendq_size) {
 		ipoib_dbg(priv, "TX ring full, stopping kernel net queue\n");

Modified: projects/ofed/head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
==============================================================================
--- projects/ofed/head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c	Sun Oct 17 00:14:41 2010	(r213941)
+++ projects/ofed/head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c	Sun Oct 17 00:15:12 2010	(r213942)
@@ -904,14 +904,18 @@ ipoib_set_dev_features(struct ipoib_dev_
 
 	kfree(device_attr);
 
-#if 0 /* XXX */
+	priv->dev->if_hwassist = 0;
+	priv->dev->if_capabilities = 0;
+
 	if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) {
 		set_bit(IPOIB_FLAG_CSUM, &priv->flags);
-		priv->dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
+		priv->dev->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP;
+		priv->dev->if_capabilities = IFCAP_HWCSUM;
 	}
 
+#if 0
 	if (priv->dev->features & NETIF_F_SG && priv->hca_caps & IB_DEVICE_UD_TSO)
-		priv->dev->features |= NETIF_F_TSO;
+		priv->dev->if_capabilities |= IFCAP_TSO4 | CSUM_TSO;
 #endif
 
 	return 0;
@@ -1160,6 +1164,8 @@ ipoib_output(struct ifnet *ifp, struct m
 	case AF_INET:
 		if (lle != NULL && (lle->la_flags & LLE_VALID))
 			memcpy(edst, &lle->ll_addr.mac8, sizeof(edst));
+		else if (m->m_flags & M_MCAST)
+			ip_ib_mc_map(((struct sockaddr_in *)dst)->sin_addr.s_addr, ifp->if_broadcastaddr, edst);
 		else
 			error = arpresolve(ifp, rt0, m, dst, edst, &lle);
 		if (error)
@@ -1196,6 +1202,8 @@ ipoib_output(struct ifnet *ifp, struct m
 	case AF_INET6:
 		if (lle != NULL && (lle->la_flags & LLE_VALID))
 			memcpy(edst, &lle->ll_addr.mac8, sizeof(edst));
+		else if (m->m_flags & M_MCAST)
+			ipv6_ib_mc_map(&((struct sockaddr_in6 *)dst)->sin6_addr, ifp->if_broadcastaddr, edst);
 		else
 			error = nd6_storelladdr(ifp, m, dst, (u_char *)edst, &lle);
 		if (error)


More information about the svn-src-projects mailing list