All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: linux-kernel@vger.kernel.org
Cc: openib-general@openib.org, netdev@oss.sgi.com
Subject: [PATCH][RFC/v2][15/21] IPoIB IPv4 multicast
Date: Tue, 23 Nov 2004 08:15:52 -0800	[thread overview]
Message-ID: <20041123815.3UphmLcWp4RG6D85@topspin.com> (raw)
In-Reply-To: <20041123815.Irsm0l3oz7MStqls@topspin.com>

Add ip_ib_mc_map() to convert IPv4 multicast addresses to IPoIB
hardware addresses.  Also add <linux/if_infiniband.h> so INFINIBAND_ALEN
has a home.

The mapping for multicast addresses is described in
  http://www.ietf.org/internet-drafts/draft-ietf-ipoib-ip-over-infiniband-07.txt

Signed-off-by: Roland Dreier <roland@topspin.com>


--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-bk/include/linux/if_infiniband.h	2004-11-23 08:10:22.004317841 -0800
@@ -0,0 +1,29 @@
+/*
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available at
+ * <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD
+ * license, available in the LICENSE.TXT file accompanying this
+ * software.  These details are also available at
+ * <http://openib.org/license.html>.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Copyright (c) 2004 Topspin Communications.  All rights reserved.
+ *
+ * $Id$
+ */
+
+#ifndef _LINUX_IF_INFINIBAND_H
+#define _LINUX_IF_INFINIBAND_H
+
+#define INFINIBAND_ALEN		20	/* Octets in IPoIB HW addr	*/
+
+#endif /* _LINUX_IF_INFINIBAND_H */
--- linux-bk.orig/include/net/ip.h	2004-11-23 08:09:44.620829918 -0800
+++ linux-bk/include/net/ip.h	2004-11-23 08:10:22.005317694 -0800
@@ -229,6 +229,39 @@
 	buf[3]=addr&0x7F;
 }
 
+/*
+ *	Map a multicast IP onto multicast MAC for type IP-over-InfiniBand.
+ *	Leave P_Key as 0 to be filled in by driver.
+ */
+
+static inline void ip_ib_mc_map(u32 addr, char *buf)
+{
+	buf[0]  = 0;		/* Reserved */
+	buf[1]  = 0xff;		/* Multicast QPN */
+	buf[2]  = 0xff;
+	buf[3]  = 0xff;
+	addr    = ntohl(addr);
+	buf[4]  = 0xff;
+	buf[5]  = 0x12;		/* link local scope */
+	buf[6]  = 0x40;		/* IPv4 signature */
+	buf[7]  = 0x1b;
+	buf[8]  = 0;		/* P_Key */
+	buf[9]  = 0;
+	buf[10] = 0;
+	buf[11] = 0;
+	buf[12] = 0;
+	buf[13] = 0;
+	buf[14] = 0;
+	buf[15] = 0;
+	buf[19] = addr & 0xff;
+	addr  >>= 8;
+	buf[18] = addr & 0xff;
+	addr  >>= 8;
+	buf[17] = addr & 0xff;
+	addr  >>= 8;
+	buf[16] = addr & 0x0f;
+}
+
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 #include <linux/ipv6.h>
 #endif
--- linux-bk.orig/net/ipv4/arp.c	2004-11-23 08:09:54.024443395 -0800
+++ linux-bk/net/ipv4/arp.c	2004-11-23 08:10:22.005317694 -0800
@@ -213,6 +213,9 @@
 	case ARPHRD_IEEE802_TR:
 		ip_tr_mc_map(addr, haddr);
 		return 0;
+	case ARPHRD_INFINIBAND:
+		ip_ib_mc_map(addr, haddr);
+		return 0;
 	default:
 		if (dir) {
 			memcpy(haddr, dev->broadcast, dev->addr_len);


  reply	other threads:[~2004-11-23 17:19 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-23 16:14 [PATCH][RFC/v2][0/21] Second submission of InfiniBand patches for review Roland Dreier
2004-11-23 16:14 ` [PATCH][RFC/v2][1/21] Add core InfiniBand support (public headers) Roland Dreier
2004-11-23 16:14   ` [PATCH][RFC/v2][2/21] Add core InfiniBand support Roland Dreier
2004-11-23 16:14     ` [PATCH][RFC/v2][3/21] Hook up drivers/infiniband Roland Dreier
2004-11-23 16:14       ` [PATCH][RFC/v2][4/21] Add InfiniBand MAD (management datagram) support (public headers) Roland Dreier
2004-11-23 16:14         ` [PATCH][RFC/v2][5/21] Add InfiniBand MAD (management datagram) support Roland Dreier
2004-11-23 16:14           ` [PATCH][RFC/v2][6/21] Add InfiniBand SA (Subnet Administration) query support Roland Dreier
2004-11-23 16:14             ` [PATCH][RFC/v2][7/21] Add Mellanox HCA low-level driver Roland Dreier
2004-11-23 16:14               ` [PATCH][RFC/v2][8/21] Add Mellanox HCA low-level driver (midlayer interface) Roland Dreier
2004-11-23 16:15                 ` [PATCH][RFC/v2][9/21] Add Mellanox HCA low-level driver (FW commands) Roland Dreier
2004-11-23 16:15                   ` [PATCH][RFC/v2][10/21] Add Mellanox HCA low-level driver (EQ) Roland Dreier
2004-11-23 16:15                     ` [PATCH][RFC/v2][11/21] Add Mellanox HCA low-level driver (initialization) Roland Dreier
2004-11-23 16:15                       ` [PATCH][RFC/v2][12/21] Add Mellanox HCA low-level driver (QP/CQ) Roland Dreier
2004-11-23 16:15                         ` [PATCH][RFC/v2][13/21] Add Mellanox HCA low-level driver (last bits) Roland Dreier
2004-11-23 16:15                           ` [PATCH][RFC/v2][14/21] Add Mellanox HCA low-level driver (MAD) Roland Dreier
2004-11-23 16:15                             ` Roland Dreier [this message]
2004-11-23 16:15                               ` [PATCH][RFC/v2][16/21] IPoIB IPv6 support Roland Dreier
2004-11-23 16:16                                 ` [PATCH][RFC/v2][17/21] Add IPoIB (IP-over-InfiniBand) driver Roland Dreier
2004-11-23 16:16                                   ` [PATCH][RFC/v2][18/21] Add InfiniBand userspace MAD support Roland Dreier
2004-11-23 16:16                                     ` [PATCH][RFC/v2][19/21] Document InfiniBand ioctl use Roland Dreier
2004-11-23 16:16                                       ` [PATCH][RFC/v2][20/21] Add InfiniBand Documentation files Roland Dreier
2004-11-23 16:16                                         ` [PATCH][RFC/v2][21/21] InfiniBand MAINTAINERS entry Roland Dreier
2004-11-23 19:56         ` [PATCH][RFC/v2][4/21] Add InfiniBand MAD (management datagram) support (public headers) Sam Ravnborg
2004-11-23 17:22     ` [PATCH][RFC/v2][2/21] Add core InfiniBand support Greg KH
2004-11-23 17:34       ` Roland Dreier
2004-11-23 23:31       ` Roland Dreier
2004-11-24  0:13     ` Adrian Bunk
2004-11-24  0:24       ` Roland Dreier
2004-11-23 19:53   ` [PATCH][RFC/v2][1/21] Add core InfiniBand support (public headers) Sam Ravnborg
2004-11-24 19:39     ` Roland Dreier

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=20041123815.3UphmLcWp4RG6D85@topspin.com \
    --to=roland@topspin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=openib-general@openib.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 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.