Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27b678dd authored by Bryan O'Sullivan's avatar Bryan O'Sullivan Committed by Linus Torvalds
Browse files

[PATCH] IB/ipath: namespace cleanup: replace ips with ipath



Remove ips namespace from infinipath drivers.  This renames ips_common.h to
ipath_common.h.  Definitions, data structures, etc.  that were not used by
kernel modules have moved to user-only headers.  All names including ips have
been renamed to ipath.  Some names have had an ipath prefix added.

Signed-off-by: default avatarChristian Bell <christian.bell@qlogic.com>
Signed-off-by: default avatarBryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 357b552f
Loading
Loading
Loading
Loading
+114 −9
Original line number Original line Diff line number Diff line
@@ -39,7 +39,8 @@
 * to communicate between kernel and user code.
 * to communicate between kernel and user code.
 */
 */


/* This is the IEEE-assigned OUI for QLogic, Inc. InfiniPath */

/* This is the IEEE-assigned OUI for QLogic Inc. InfiniPath */
#define IPATH_SRC_OUI_1 0x00
#define IPATH_SRC_OUI_1 0x00
#define IPATH_SRC_OUI_2 0x11
#define IPATH_SRC_OUI_2 0x11
#define IPATH_SRC_OUI_3 0x75
#define IPATH_SRC_OUI_3 0x75
@@ -343,9 +344,9 @@ struct ipath_base_info {
/*
/*
 * Similarly, this is the kernel version going back to the user.  It's
 * Similarly, this is the kernel version going back to the user.  It's
 * slightly different, in that we want to tell if the driver was built as
 * slightly different, in that we want to tell if the driver was built as
 * part of a QLogic release, or from the driver from OpenIB, kernel.org,
 * part of a QLogic release, or from the driver from openfabrics.org,
 * or a standard distribution, for support reasons.  The high bit is 0 for
 * kernel.org, or a standard distribution, for support reasons.
 * non-QLogic, and 1 for QLogic-built/supplied.
 * The high bit is 0 for non-QLogic and 1 for QLogic-built/supplied.
 *
 *
 * It's returned by the driver to the user code during initialization in the
 * It's returned by the driver to the user code during initialization in the
 * spi_sw_version field of ipath_base_info, so the user code can in turn
 * spi_sw_version field of ipath_base_info, so the user code can in turn
@@ -600,14 +601,118 @@ struct infinipath_counters {
#define INFINIPATH_KPF_INTR 0x1
#define INFINIPATH_KPF_INTR 0x1


/* SendPIO per-buffer control */
/* SendPIO per-buffer control */
#define INFINIPATH_SP_LENGTHP1_MASK 0x3FF
#define INFINIPATH_SP_TEST    0x40
#define INFINIPATH_SP_LENGTHP1_SHIFT 0
#define INFINIPATH_SP_TESTEBP 0x20
#define INFINIPATH_SP_INTR    0x80000000
#define INFINIPATH_SP_TEST    0x40000000
#define INFINIPATH_SP_TESTEBP 0x20000000


/* SendPIOAvail bits */
/* SendPIOAvail bits */
#define INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT 1
#define INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT 1
#define INFINIPATH_SENDPIOAVAIL_CHECK_SHIFT 0
#define INFINIPATH_SENDPIOAVAIL_CHECK_SHIFT 0


/* infinipath header format */
struct ipath_header {
	/*
	 * Version - 4 bits, Port - 4 bits, TID - 10 bits and Offset -
	 * 14 bits before ECO change ~28 Dec 03.  After that, Vers 4,
	 * Port 3, TID 11, offset 14.
	 */
	__le32 ver_port_tid_offset;
	__le16 chksum;
	__le16 pkt_flags;
};

/* infinipath user message header format.
 * This structure contains the first 4 fields common to all protocols
 * that employ infinipath.
 */
struct ipath_message_header {
	__be16 lrh[4];
	__be32 bth[3];
	/* fields below this point are in host byte order */
	struct ipath_header iph;
	__u8 sub_opcode;
};

/* infinipath ethernet header format */
struct ether_header {
	__be16 lrh[4];
	__be32 bth[3];
	struct ipath_header iph;
	__u8 sub_opcode;
	__u8 cmd;
	__be16 lid;
	__u16 mac[3];
	__u8 frag_num;
	__u8 seq_num;
	__le32 len;
	/* MUST be of word size due to PIO write requirements */
	__le32 csum;
	__le16 csum_offset;
	__le16 flags;
	__u16 first_2_bytes;
	__u8 unused[2];		/* currently unused */
};


/* IB - LRH header consts */
#define IPATH_LRH_GRH 0x0003	/* 1. word of IB LRH - next header: GRH */
#define IPATH_LRH_BTH 0x0002	/* 1. word of IB LRH - next header: BTH */

/* misc. */
#define SIZE_OF_CRC 1

#define IPATH_DEFAULT_P_KEY 0xFFFF
#define IPATH_PERMISSIVE_LID 0xFFFF
#define IPATH_AETH_CREDIT_SHIFT 24
#define IPATH_AETH_CREDIT_MASK 0x1F
#define IPATH_AETH_CREDIT_INVAL 0x1F
#define IPATH_PSN_MASK 0xFFFFFF
#define IPATH_MSN_MASK 0xFFFFFF
#define IPATH_QPN_MASK 0xFFFFFF
#define IPATH_MULTICAST_LID_BASE 0xC000
#define IPATH_MULTICAST_QPN 0xFFFFFF

/* Receive Header Queue: receive type (from infinipath) */
#define RCVHQ_RCV_TYPE_EXPECTED  0
#define RCVHQ_RCV_TYPE_EAGER     1
#define RCVHQ_RCV_TYPE_NON_KD    2
#define RCVHQ_RCV_TYPE_ERROR     3


/* sub OpCodes - ith4x  */
#define IPATH_ITH4X_OPCODE_ENCAP 0x81
#define IPATH_ITH4X_OPCODE_LID_ARP 0x82

#define IPATH_HEADER_QUEUE_WORDS 9

/* functions for extracting fields from rcvhdrq entries for the driver.
 */
static inline __u32 ipath_hdrget_err_flags(const __le32 * rbuf)
{
	return __le32_to_cpu(rbuf[1]);
}

static inline __u32 ipath_hdrget_rcv_type(const __le32 * rbuf)
{
	return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_RCVTYPE_SHIFT)
	    & INFINIPATH_RHF_RCVTYPE_MASK;
}

static inline __u32 ipath_hdrget_length_in_bytes(const __le32 * rbuf)
{
	return ((__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_LENGTH_SHIFT)
		& INFINIPATH_RHF_LENGTH_MASK) << 2;
}

static inline __u32 ipath_hdrget_index(const __le32 * rbuf)
{
	return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_EGRINDEX_SHIFT)
	    & INFINIPATH_RHF_EGRINDEX_MASK;
}

static inline __u32 ipath_hdrget_ipath_ver(__le32 hdrword)
{
	return (__le32_to_cpu(hdrword) >> INFINIPATH_I_VERS_SHIFT)
	    & INFINIPATH_I_VERS_MASK;
}

#endif				/* _IPATH_COMMON_H */
#endif				/* _IPATH_COMMON_H */
+1 −2
Original line number Original line Diff line number Diff line
@@ -44,10 +44,9 @@
#include <linux/pci.h>
#include <linux/pci.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>


#include "ipath_common.h"
#include "ipath_kernel.h"
#include "ipath_kernel.h"
#include "ips_common.h"
#include "ipath_layer.h"
#include "ipath_layer.h"
#include "ipath_common.h"


int ipath_diag_inuse;
int ipath_diag_inuse;
static int diag_set_link;
static int diag_set_link;
+12 −11
Original line number Original line Diff line number Diff line
@@ -39,8 +39,8 @@
#include <linux/vmalloc.h>
#include <linux/vmalloc.h>


#include "ipath_kernel.h"
#include "ipath_kernel.h"
#include "ips_common.h"
#include "ipath_layer.h"
#include "ipath_layer.h"
#include "ipath_common.h"


static void ipath_update_pio_bufs(struct ipath_devdata *);
static void ipath_update_pio_bufs(struct ipath_devdata *);


@@ -823,7 +823,8 @@ static void ipath_rcv_layer(struct ipath_devdata *dd, u32 etail,
	u8 pad, *bthbytes;
	u8 pad, *bthbytes;
	struct sk_buff *skb, *nskb;
	struct sk_buff *skb, *nskb;


	if (dd->ipath_port0_skbs && hdr->sub_opcode == OPCODE_ENCAP) {
	if (dd->ipath_port0_skbs &&
			hdr->sub_opcode == IPATH_ITH4X_OPCODE_ENCAP) {
		/*
		/*
		 * Allocate a new sk_buff to replace the one we give
		 * Allocate a new sk_buff to replace the one we give
		 * to the network stack.
		 * to the network stack.
@@ -854,7 +855,7 @@ static void ipath_rcv_layer(struct ipath_devdata *dd, u32 etail,
		/* another ether packet received */
		/* another ether packet received */
		ipath_stats.sps_ether_rpkts++;
		ipath_stats.sps_ether_rpkts++;
	}
	}
	else if (hdr->sub_opcode == OPCODE_LID_ARP)
	else if (hdr->sub_opcode == IPATH_ITH4X_OPCODE_LID_ARP)
		__ipath_layer_rcv_lid(dd, hdr);
		__ipath_layer_rcv_lid(dd, hdr);
}
}


@@ -871,7 +872,7 @@ void ipath_kreceive(struct ipath_devdata *dd)
	const u32 rsize = dd->ipath_rcvhdrentsize;	/* words */
	const u32 rsize = dd->ipath_rcvhdrentsize;	/* words */
	const u32 maxcnt = dd->ipath_rcvhdrcnt * rsize;	/* words */
	const u32 maxcnt = dd->ipath_rcvhdrcnt * rsize;	/* words */
	u32 etail = -1, l, hdrqtail;
	u32 etail = -1, l, hdrqtail;
	struct ips_message_header *hdr;
	struct ipath_message_header *hdr;
	u32 eflags, i, etype, tlen, pkttot = 0, updegr=0, reloop=0;
	u32 eflags, i, etype, tlen, pkttot = 0, updegr=0, reloop=0;
	static u64 totcalls;	/* stats, may eventually remove */
	static u64 totcalls;	/* stats, may eventually remove */
	char emsg[128];
	char emsg[128];
@@ -897,7 +898,7 @@ void ipath_kreceive(struct ipath_devdata *dd)
		u8 *bthbytes;
		u8 *bthbytes;


		rc = (u64 *) (dd->ipath_pd[0]->port_rcvhdrq + (l << 2));
		rc = (u64 *) (dd->ipath_pd[0]->port_rcvhdrq + (l << 2));
		hdr = (struct ips_message_header *)&rc[1];
		hdr = (struct ipath_message_header *)&rc[1];
		/*
		/*
		 * could make a network order version of IPATH_KD_QP, and
		 * could make a network order version of IPATH_KD_QP, and
		 * do the obvious shift before masking to speed this up.
		 * do the obvious shift before masking to speed this up.
@@ -905,10 +906,10 @@ void ipath_kreceive(struct ipath_devdata *dd)
		qp = ntohl(hdr->bth[1]) & 0xffffff;
		qp = ntohl(hdr->bth[1]) & 0xffffff;
		bthbytes = (u8 *) hdr->bth;
		bthbytes = (u8 *) hdr->bth;


		eflags = ips_get_hdr_err_flags((__le32 *) rc);
		eflags = ipath_hdrget_err_flags((__le32 *) rc);
		etype = ips_get_rcv_type((__le32 *) rc);
		etype = ipath_hdrget_rcv_type((__le32 *) rc);
		/* total length */
		/* total length */
		tlen = ips_get_length_in_bytes((__le32 *) rc);
		tlen = ipath_hdrget_length_in_bytes((__le32 *) rc);
		ebuf = NULL;
		ebuf = NULL;
		if (etype != RCVHQ_RCV_TYPE_EXPECTED) {
		if (etype != RCVHQ_RCV_TYPE_EXPECTED) {
			/*
			/*
@@ -918,7 +919,7 @@ void ipath_kreceive(struct ipath_devdata *dd)
			 * set ebuf (so we try to copy data) unless the
			 * set ebuf (so we try to copy data) unless the
			 * length requires it.
			 * length requires it.
			 */
			 */
			etail = ips_get_index((__le32 *) rc);
			etail = ipath_hdrget_index((__le32 *) rc);
			if (tlen > sizeof(*hdr) ||
			if (tlen > sizeof(*hdr) ||
			    etype == RCVHQ_RCV_TYPE_NON_KD)
			    etype == RCVHQ_RCV_TYPE_NON_KD)
				ebuf = ipath_get_egrbuf(dd, etail, 0);
				ebuf = ipath_get_egrbuf(dd, etail, 0);
@@ -930,7 +931,7 @@ void ipath_kreceive(struct ipath_devdata *dd)
		 */
		 */


		if (etype != RCVHQ_RCV_TYPE_NON_KD && etype !=
		if (etype != RCVHQ_RCV_TYPE_NON_KD && etype !=
		    RCVHQ_RCV_TYPE_ERROR && ips_get_ipath_ver(
		    RCVHQ_RCV_TYPE_ERROR && ipath_hdrget_ipath_ver(
			    hdr->iph.ver_port_tid_offset) !=
			    hdr->iph.ver_port_tid_offset) !=
		    IPS_PROTO_VERSION) {
		    IPS_PROTO_VERSION) {
			ipath_cdbg(PKT, "Bad InfiniPath protocol version "
			ipath_cdbg(PKT, "Bad InfiniPath protocol version "
@@ -943,7 +944,7 @@ void ipath_kreceive(struct ipath_devdata *dd)
			ipath_cdbg(PKT, "RHFerrs %x hdrqtail=%x typ=%u "
			ipath_cdbg(PKT, "RHFerrs %x hdrqtail=%x typ=%u "
				   "tlen=%x opcode=%x egridx=%x: %s\n",
				   "tlen=%x opcode=%x egridx=%x: %s\n",
				   eflags, l, etype, tlen, bthbytes[0],
				   eflags, l, etype, tlen, bthbytes[0],
				   ips_get_index((__le32 *) rc), emsg);
				   ipath_hdrget_index((__le32 *) rc), emsg);
			/* Count local link integrity errors. */
			/* Count local link integrity errors. */
			if (eflags & (INFINIPATH_RHF_H_ICRCERR |
			if (eflags & (INFINIPATH_RHF_H_ICRCERR |
				      INFINIPATH_RHF_H_VCRCERR)) {
				      INFINIPATH_RHF_H_VCRCERR)) {
+2 −2
Original line number Original line Diff line number Diff line
@@ -39,8 +39,8 @@
#include <asm/pgtable.h>
#include <asm/pgtable.h>


#include "ipath_kernel.h"
#include "ipath_kernel.h"
#include "ips_common.h"
#include "ipath_layer.h"
#include "ipath_layer.h"
#include "ipath_common.h"


static int ipath_open(struct inode *, struct file *);
static int ipath_open(struct inode *, struct file *);
static int ipath_close(struct inode *, struct file *);
static int ipath_close(struct inode *, struct file *);
@@ -458,7 +458,7 @@ static int ipath_set_part_key(struct ipath_portdata *pd, u16 key)
	u16 lkey = key & 0x7FFF;
	u16 lkey = key & 0x7FFF;
	int ret;
	int ret;


	if (lkey == (IPS_DEFAULT_P_KEY & 0x7FFF)) {
	if (lkey == (IPATH_DEFAULT_P_KEY & 0x7FFF)) {
		/* nothing to do; this key always valid */
		/* nothing to do; this key always valid */
		ret = 0;
		ret = 0;
		goto bail;
		goto bail;
+2 −2
Original line number Original line Diff line number Diff line
@@ -36,7 +36,7 @@
#include <linux/vmalloc.h>
#include <linux/vmalloc.h>


#include "ipath_kernel.h"
#include "ipath_kernel.h"
#include "ips_common.h"
#include "ipath_common.h"


/*
/*
 * min buffers we want to have per port, after driver
 * min buffers we want to have per port, after driver
@@ -277,7 +277,7 @@ static int init_chip_first(struct ipath_devdata *dd,
	pd->port_port = 0;
	pd->port_port = 0;
	pd->port_cnt = 1;
	pd->port_cnt = 1;
	/* The port 0 pkey table is used by the layer interface. */
	/* The port 0 pkey table is used by the layer interface. */
	pd->port_pkeys[0] = IPS_DEFAULT_P_KEY;
	pd->port_pkeys[0] = IPATH_DEFAULT_P_KEY;
	dd->ipath_rcvtidcnt =
	dd->ipath_rcvtidcnt =
		ipath_read_kreg32(dd, dd->ipath_kregs->kr_rcvtidcnt);
		ipath_read_kreg32(dd, dd->ipath_kregs->kr_rcvtidcnt);
	dd->ipath_rcvtidbase =
	dd->ipath_rcvtidbase =
Loading