aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@pathscale.com>2006-07-01 07:36:17 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-01 12:56:02 -0400
commit27b678dd04a636f2c351816f4b3042c8815d4e9d (patch)
tree08b409db5d54bab50e1616b1bf65479b0751de5b /drivers/infiniband
parent357b552ff3d82a2e6b97c63c6394f748cb217cf8 (diff)
[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: Christian Bell <christian.bell@qlogic.com> Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com> Cc: "Michael S. Tsirkin" <mst@mellanox.co.il> Cc: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_common.h123
-rw-r--r--drivers/infiniband/hw/ipath/ipath_diag.c3
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c23
-rw-r--r--drivers/infiniband/hw/ipath/ipath_file_ops.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_init_chip.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_intr.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_layer.c8
-rw-r--r--drivers/infiniband/hw/ipath/ipath_mad.c6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c16
-rw-r--r--drivers/infiniband/hw/ipath/ipath_rc.c40
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ruc.c8
-rw-r--r--drivers/infiniband/hw/ipath/ipath_sysfs.c6
-rw-r--r--drivers/infiniband/hw/ipath/ipath_uc.c4
-rw-r--r--drivers/infiniband/hw/ipath/ipath_ud.c24
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c20
-rw-r--r--drivers/infiniband/hw/ipath/ips_common.h264
16 files changed, 198 insertions, 357 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h
index 3130a7ed254b..062bd392e7e5 100644
--- a/drivers/infiniband/hw/ipath/ipath_common.h
+++ b/drivers/infiniband/hw/ipath/ipath_common.h
@@ -39,7 +39,8 @@
39 * to communicate between kernel and user code. 39 * to communicate between kernel and user code.
40 */ 40 */
41 41
42/* This is the IEEE-assigned OUI for QLogic, Inc. InfiniPath */ 42
43/* This is the IEEE-assigned OUI for QLogic Inc. InfiniPath */
43#define IPATH_SRC_OUI_1 0x00 44#define IPATH_SRC_OUI_1 0x00
44#define IPATH_SRC_OUI_2 0x11 45#define IPATH_SRC_OUI_2 0x11
45#define IPATH_SRC_OUI_3 0x75 46#define IPATH_SRC_OUI_3 0x75
@@ -343,9 +344,9 @@ struct ipath_base_info {
343/* 344/*
344 * Similarly, this is the kernel version going back to the user. It's 345 * Similarly, this is the kernel version going back to the user. It's
345 * slightly different, in that we want to tell if the driver was built as 346 * slightly different, in that we want to tell if the driver was built as
346 * part of a QLogic release, or from the driver from OpenIB, kernel.org, 347 * part of a QLogic release, or from the driver from openfabrics.org,
347 * or a standard distribution, for support reasons. The high bit is 0 for 348 * kernel.org, or a standard distribution, for support reasons.
348 * non-QLogic, and 1 for QLogic-built/supplied. 349 * The high bit is 0 for non-QLogic and 1 for QLogic-built/supplied.
349 * 350 *
350 * It's returned by the driver to the user code during initialization in the 351 * It's returned by the driver to the user code during initialization in the
351 * spi_sw_version field of ipath_base_info, so the user code can in turn 352 * spi_sw_version field of ipath_base_info, so the user code can in turn
@@ -600,14 +601,118 @@ struct infinipath_counters {
600#define INFINIPATH_KPF_INTR 0x1 601#define INFINIPATH_KPF_INTR 0x1
601 602
602/* SendPIO per-buffer control */ 603/* SendPIO per-buffer control */
603#define INFINIPATH_SP_LENGTHP1_MASK 0x3FF 604#define INFINIPATH_SP_TEST 0x40
604#define INFINIPATH_SP_LENGTHP1_SHIFT 0 605#define INFINIPATH_SP_TESTEBP 0x20
605#define INFINIPATH_SP_INTR 0x80000000
606#define INFINIPATH_SP_TEST 0x40000000
607#define INFINIPATH_SP_TESTEBP 0x20000000
608 606
609/* SendPIOAvail bits */ 607/* SendPIOAvail bits */
610#define INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT 1 608#define INFINIPATH_SENDPIOAVAIL_BUSY_SHIFT 1
611#define INFINIPATH_SENDPIOAVAIL_CHECK_SHIFT 0 609#define INFINIPATH_SENDPIOAVAIL_CHECK_SHIFT 0
612 610
611/* infinipath header format */
612struct ipath_header {
613 /*
614 * Version - 4 bits, Port - 4 bits, TID - 10 bits and Offset -
615 * 14 bits before ECO change ~28 Dec 03. After that, Vers 4,
616 * Port 3, TID 11, offset 14.
617 */
618 __le32 ver_port_tid_offset;
619 __le16 chksum;
620 __le16 pkt_flags;
621};
622
623/* infinipath user message header format.
624 * This structure contains the first 4 fields common to all protocols
625 * that employ infinipath.
626 */
627struct ipath_message_header {
628 __be16 lrh[4];
629 __be32 bth[3];
630 /* fields below this point are in host byte order */
631 struct ipath_header iph;
632 __u8 sub_opcode;
633};
634
635/* infinipath ethernet header format */
636struct ether_header {
637 __be16 lrh[4];
638 __be32 bth[3];
639 struct ipath_header iph;
640 __u8 sub_opcode;
641 __u8 cmd;
642 __be16 lid;
643 __u16 mac[3];
644 __u8 frag_num;
645 __u8 seq_num;
646 __le32 len;
647 /* MUST be of word size due to PIO write requirements */
648 __le32 csum;
649 __le16 csum_offset;
650 __le16 flags;
651 __u16 first_2_bytes;
652 __u8 unused[2]; /* currently unused */
653};
654
655
656/* IB - LRH header consts */
657#define IPATH_LRH_GRH 0x0003 /* 1. word of IB LRH - next header: GRH */
658#define IPATH_LRH_BTH 0x0002 /* 1. word of IB LRH - next header: BTH */
659
660/* misc. */
661#define SIZE_OF_CRC 1
662
663#define IPATH_DEFAULT_P_KEY 0xFFFF
664#define IPATH_PERMISSIVE_LID 0xFFFF
665#define IPATH_AETH_CREDIT_SHIFT 24
666#define IPATH_AETH_CREDIT_MASK 0x1F
667#define IPATH_AETH_CREDIT_INVAL 0x1F
668#define IPATH_PSN_MASK 0xFFFFFF
669#define IPATH_MSN_MASK 0xFFFFFF
670#define IPATH_QPN_MASK 0xFFFFFF
671#define IPATH_MULTICAST_LID_BASE 0xC000
672#define IPATH_MULTICAST_QPN 0xFFFFFF
673
674/* Receive Header Queue: receive type (from infinipath) */
675#define RCVHQ_RCV_TYPE_EXPECTED 0
676#define RCVHQ_RCV_TYPE_EAGER 1
677#define RCVHQ_RCV_TYPE_NON_KD 2
678#define RCVHQ_RCV_TYPE_ERROR 3
679
680
681/* sub OpCodes - ith4x */
682#define IPATH_ITH4X_OPCODE_ENCAP 0x81
683#define IPATH_ITH4X_OPCODE_LID_ARP 0x82
684
685#define IPATH_HEADER_QUEUE_WORDS 9
686
687/* functions for extracting fields from rcvhdrq entries for the driver.
688 */
689static inline __u32 ipath_hdrget_err_flags(const __le32 * rbuf)
690{
691 return __le32_to_cpu(rbuf[1]);
692}
693
694static inline __u32 ipath_hdrget_rcv_type(const __le32 * rbuf)
695{
696 return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_RCVTYPE_SHIFT)
697 & INFINIPATH_RHF_RCVTYPE_MASK;
698}
699
700static inline __u32 ipath_hdrget_length_in_bytes(const __le32 * rbuf)
701{
702 return ((__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_LENGTH_SHIFT)
703 & INFINIPATH_RHF_LENGTH_MASK) << 2;
704}
705
706static inline __u32 ipath_hdrget_index(const __le32 * rbuf)
707{
708 return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_EGRINDEX_SHIFT)
709 & INFINIPATH_RHF_EGRINDEX_MASK;
710}
711
712static inline __u32 ipath_hdrget_ipath_ver(__le32 hdrword)
713{
714 return (__le32_to_cpu(hdrword) >> INFINIPATH_I_VERS_SHIFT)
715 & INFINIPATH_I_VERS_MASK;
716}
717
613#endif /* _IPATH_COMMON_H */ 718#endif /* _IPATH_COMMON_H */
diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
index 8a0425e98b5f..147dd89e21c9 100644
--- a/drivers/infiniband/hw/ipath/ipath_diag.c
+++ b/drivers/infiniband/hw/ipath/ipath_diag.c
@@ -44,10 +44,9 @@
44#include <linux/pci.h> 44#include <linux/pci.h>
45#include <asm/uaccess.h> 45#include <asm/uaccess.h>
46 46
47#include "ipath_common.h"
48#include "ipath_kernel.h" 47#include "ipath_kernel.h"
49#include "ips_common.h"
50#include "ipath_layer.h" 48#include "ipath_layer.h"
49#include "ipath_common.h"
51 50
52int ipath_diag_inuse; 51int ipath_diag_inuse;
53static int diag_set_link; 52static int diag_set_link;
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c
index f647918db62b..6efc56bce921 100644
--- a/drivers/infiniband/hw/ipath/ipath_driver.c
+++ b/drivers/infiniband/hw/ipath/ipath_driver.c
@@ -39,8 +39,8 @@
39#include <linux/vmalloc.h> 39#include <linux/vmalloc.h>
40 40
41#include "ipath_kernel.h" 41#include "ipath_kernel.h"
42#include "ips_common.h"
43#include "ipath_layer.h" 42#include "ipath_layer.h"
43#include "ipath_common.h"
44 44
45static void ipath_update_pio_bufs(struct ipath_devdata *); 45static void ipath_update_pio_bufs(struct ipath_devdata *);
46 46
@@ -823,7 +823,8 @@ static void ipath_rcv_layer(struct ipath_devdata *dd, u32 etail,
823 u8 pad, *bthbytes; 823 u8 pad, *bthbytes;
824 struct sk_buff *skb, *nskb; 824 struct sk_buff *skb, *nskb;
825 825
826 if (dd->ipath_port0_skbs && hdr->sub_opcode == OPCODE_ENCAP) { 826 if (dd->ipath_port0_skbs &&
827 hdr->sub_opcode == IPATH_ITH4X_OPCODE_ENCAP) {
827 /* 828 /*
828 * Allocate a new sk_buff to replace the one we give 829 * Allocate a new sk_buff to replace the one we give
829 * to the network stack. 830 * to the network stack.
@@ -854,7 +855,7 @@ static void ipath_rcv_layer(struct ipath_devdata *dd, u32 etail,
854 /* another ether packet received */ 855 /* another ether packet received */
855 ipath_stats.sps_ether_rpkts++; 856 ipath_stats.sps_ether_rpkts++;
856 } 857 }
857 else if (hdr->sub_opcode == OPCODE_LID_ARP) 858 else if (hdr->sub_opcode == IPATH_ITH4X_OPCODE_LID_ARP)
858 __ipath_layer_rcv_lid(dd, hdr); 859 __ipath_layer_rcv_lid(dd, hdr);
859} 860}
860 861
@@ -871,7 +872,7 @@ void ipath_kreceive(struct ipath_devdata *dd)
871 const u32 rsize = dd->ipath_rcvhdrentsize; /* words */ 872 const u32 rsize = dd->ipath_rcvhdrentsize; /* words */
872 const u32 maxcnt = dd->ipath_rcvhdrcnt * rsize; /* words */ 873 const u32 maxcnt = dd->ipath_rcvhdrcnt * rsize; /* words */
873 u32 etail = -1, l, hdrqtail; 874 u32 etail = -1, l, hdrqtail;
874 struct ips_message_header *hdr; 875 struct ipath_message_header *hdr;
875 u32 eflags, i, etype, tlen, pkttot = 0, updegr=0, reloop=0; 876 u32 eflags, i, etype, tlen, pkttot = 0, updegr=0, reloop=0;
876 static u64 totcalls; /* stats, may eventually remove */ 877 static u64 totcalls; /* stats, may eventually remove */
877 char emsg[128]; 878 char emsg[128];
@@ -897,7 +898,7 @@ reloop:
897 u8 *bthbytes; 898 u8 *bthbytes;
898 899
899 rc = (u64 *) (dd->ipath_pd[0]->port_rcvhdrq + (l << 2)); 900 rc = (u64 *) (dd->ipath_pd[0]->port_rcvhdrq + (l << 2));
900 hdr = (struct ips_message_header *)&rc[1]; 901 hdr = (struct ipath_message_header *)&rc[1];
901 /* 902 /*
902 * could make a network order version of IPATH_KD_QP, and 903 * could make a network order version of IPATH_KD_QP, and
903 * do the obvious shift before masking to speed this up. 904 * do the obvious shift before masking to speed this up.
@@ -905,10 +906,10 @@ reloop:
905 qp = ntohl(hdr->bth[1]) & 0xffffff; 906 qp = ntohl(hdr->bth[1]) & 0xffffff;
906 bthbytes = (u8 *) hdr->bth; 907 bthbytes = (u8 *) hdr->bth;
907 908
908 eflags = ips_get_hdr_err_flags((__le32 *) rc); 909 eflags = ipath_hdrget_err_flags((__le32 *) rc);
909 etype = ips_get_rcv_type((__le32 *) rc); 910 etype = ipath_hdrget_rcv_type((__le32 *) rc);
910 /* total length */ 911 /* total length */
911 tlen = ips_get_length_in_bytes((__le32 *) rc); 912 tlen = ipath_hdrget_length_in_bytes((__le32 *) rc);
912 ebuf = NULL; 913 ebuf = NULL;
913 if (etype != RCVHQ_RCV_TYPE_EXPECTED) { 914 if (etype != RCVHQ_RCV_TYPE_EXPECTED) {
914 /* 915 /*
@@ -918,7 +919,7 @@ reloop:
918 * set ebuf (so we try to copy data) unless the 919 * set ebuf (so we try to copy data) unless the
919 * length requires it. 920 * length requires it.
920 */ 921 */
921 etail = ips_get_index((__le32 *) rc); 922 etail = ipath_hdrget_index((__le32 *) rc);
922 if (tlen > sizeof(*hdr) || 923 if (tlen > sizeof(*hdr) ||
923 etype == RCVHQ_RCV_TYPE_NON_KD) 924 etype == RCVHQ_RCV_TYPE_NON_KD)
924 ebuf = ipath_get_egrbuf(dd, etail, 0); 925 ebuf = ipath_get_egrbuf(dd, etail, 0);
@@ -930,7 +931,7 @@ reloop:
930 */ 931 */
931 932
932 if (etype != RCVHQ_RCV_TYPE_NON_KD && etype != 933 if (etype != RCVHQ_RCV_TYPE_NON_KD && etype !=
933 RCVHQ_RCV_TYPE_ERROR && ips_get_ipath_ver( 934 RCVHQ_RCV_TYPE_ERROR && ipath_hdrget_ipath_ver(
934 hdr->iph.ver_port_tid_offset) != 935 hdr->iph.ver_port_tid_offset) !=
935 IPS_PROTO_VERSION) { 936 IPS_PROTO_VERSION) {
936 ipath_cdbg(PKT, "Bad InfiniPath protocol version " 937 ipath_cdbg(PKT, "Bad InfiniPath protocol version "
@@ -943,7 +944,7 @@ reloop:
943 ipath_cdbg(PKT, "RHFerrs %x hdrqtail=%x typ=%u " 944 ipath_cdbg(PKT, "RHFerrs %x hdrqtail=%x typ=%u "
944 "tlen=%x opcode=%x egridx=%x: %s\n", 945 "tlen=%x opcode=%x egridx=%x: %s\n",
945 eflags, l, etype, tlen, bthbytes[0], 946 eflags, l, etype, tlen, bthbytes[0],
946 ips_get_index((__le32 *) rc), emsg); 947 ipath_hdrget_index((__le32 *) rc), emsg);
947 /* Count local link integrity errors. */ 948 /* Count local link integrity errors. */
948 if (eflags & (INFINIPATH_RHF_H_ICRCERR | 949 if (eflags & (INFINIPATH_RHF_H_ICRCERR |
949 INFINIPATH_RHF_H_VCRCERR)) { 950 INFINIPATH_RHF_H_VCRCERR)) {
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index 51a609d47087..bbaa70e57db1 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -39,8 +39,8 @@
39#include <asm/pgtable.h> 39#include <asm/pgtable.h>
40 40
41#include "ipath_kernel.h" 41#include "ipath_kernel.h"
42#include "ips_common.h"
43#include "ipath_layer.h" 42#include "ipath_layer.h"
43#include "ipath_common.h"
44 44
45static int ipath_open(struct inode *, struct file *); 45static int ipath_open(struct inode *, struct file *);
46static int ipath_close(struct inode *, struct file *); 46static int ipath_close(struct inode *, struct file *);
@@ -458,7 +458,7 @@ static int ipath_set_part_key(struct ipath_portdata *pd, u16 key)
458 u16 lkey = key & 0x7FFF; 458 u16 lkey = key & 0x7FFF;
459 int ret; 459 int ret;
460 460
461 if (lkey == (IPS_DEFAULT_P_KEY & 0x7FFF)) { 461 if (lkey == (IPATH_DEFAULT_P_KEY & 0x7FFF)) {
462 /* nothing to do; this key always valid */ 462 /* nothing to do; this key always valid */
463 ret = 0; 463 ret = 0;
464 goto bail; 464 goto bail;
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
index ff322e5c14c8..414cdd1d80a6 100644
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
@@ -36,7 +36,7 @@
36#include <linux/vmalloc.h> 36#include <linux/vmalloc.h>
37 37
38#include "ipath_kernel.h" 38#include "ipath_kernel.h"
39#include "ips_common.h" 39#include "ipath_common.h"
40 40
41/* 41/*
42 * min buffers we want to have per port, after driver 42 * min buffers we want to have per port, after driver
@@ -277,7 +277,7 @@ static int init_chip_first(struct ipath_devdata *dd,
277 pd->port_port = 0; 277 pd->port_port = 0;
278 pd->port_cnt = 1; 278 pd->port_cnt = 1;
279 /* The port 0 pkey table is used by the layer interface. */ 279 /* The port 0 pkey table is used by the layer interface. */
280 pd->port_pkeys[0] = IPS_DEFAULT_P_KEY; 280 pd->port_pkeys[0] = IPATH_DEFAULT_P_KEY;
281 dd->ipath_rcvtidcnt = 281 dd->ipath_rcvtidcnt =
282 ipath_read_kreg32(dd, dd->ipath_kregs->kr_rcvtidcnt); 282 ipath_read_kreg32(dd, dd->ipath_kregs->kr_rcvtidcnt);
283 dd->ipath_rcvtidbase = 283 dd->ipath_rcvtidbase =
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c
index 30160bcd1acf..280e732660a1 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -34,8 +34,8 @@
34#include <linux/pci.h> 34#include <linux/pci.h>
35 35
36#include "ipath_kernel.h" 36#include "ipath_kernel.h"
37#include "ips_common.h"
38#include "ipath_layer.h" 37#include "ipath_layer.h"
38#include "ipath_common.h"
39 39
40/* These are all rcv-related errors which we want to count for stats */ 40/* These are all rcv-related errors which we want to count for stats */
41#define E_SUM_PKTERRS \ 41#define E_SUM_PKTERRS \
diff --git a/drivers/infiniband/hw/ipath/ipath_layer.c b/drivers/infiniband/hw/ipath/ipath_layer.c
index 963942d7ef09..b28c6f81c731 100644
--- a/drivers/infiniband/hw/ipath/ipath_layer.c
+++ b/drivers/infiniband/hw/ipath/ipath_layer.c
@@ -41,8 +41,8 @@
41#include <asm/byteorder.h> 41#include <asm/byteorder.h>
42 42
43#include "ipath_kernel.h" 43#include "ipath_kernel.h"
44#include "ips_common.h"
45#include "ipath_layer.h" 44#include "ipath_layer.h"
45#include "ipath_common.h"
46 46
47/* Acquire before ipath_devs_lock. */ 47/* Acquire before ipath_devs_lock. */
48static DEFINE_MUTEX(ipath_layer_mutex); 48static DEFINE_MUTEX(ipath_layer_mutex);
@@ -622,7 +622,7 @@ int ipath_layer_open(struct ipath_devdata *dd, u32 * pktmax)
622 goto bail; 622 goto bail;
623 } 623 }
624 624
625 ret = ipath_setrcvhdrsize(dd, NUM_OF_EXTRA_WORDS_IN_HEADER_QUEUE); 625 ret = ipath_setrcvhdrsize(dd, IPATH_HEADER_QUEUE_WORDS);
626 626
627 if (ret < 0) 627 if (ret < 0)
628 goto bail; 628 goto bail;
@@ -1106,10 +1106,10 @@ int ipath_layer_send_hdr(struct ipath_devdata *dd, struct ether_header *hdr)
1106 } 1106 }
1107 1107
1108 vlsllnh = *((__be16 *) hdr); 1108 vlsllnh = *((__be16 *) hdr);
1109 if (vlsllnh != htons(IPS_LRH_BTH)) { 1109 if (vlsllnh != htons(IPATH_LRH_BTH)) {
1110 ipath_dbg("Warning: lrh[0] wrong (%x, not %x); " 1110 ipath_dbg("Warning: lrh[0] wrong (%x, not %x); "
1111 "not sending\n", be16_to_cpu(vlsllnh), 1111 "not sending\n", be16_to_cpu(vlsllnh),
1112 IPS_LRH_BTH); 1112 IPATH_LRH_BTH);
1113 ret = -EINVAL; 1113 ret = -EINVAL;
1114 } 1114 }
1115 if (ret) 1115 if (ret)
diff --git a/drivers/infiniband/hw/ipath/ipath_mad.c b/drivers/infiniband/hw/ipath/ipath_mad.c
index 195f82e136e4..d3402341b7d0 100644
--- a/drivers/infiniband/hw/ipath/ipath_mad.c
+++ b/drivers/infiniband/hw/ipath/ipath_mad.c
@@ -35,7 +35,7 @@
35 35
36#include "ipath_kernel.h" 36#include "ipath_kernel.h"
37#include "ipath_verbs.h" 37#include "ipath_verbs.h"
38#include "ips_common.h" 38#include "ipath_common.h"
39 39
40#define IB_SMP_UNSUP_VERSION __constant_htons(0x0004) 40#define IB_SMP_UNSUP_VERSION __constant_htons(0x0004)
41#define IB_SMP_UNSUP_METHOD __constant_htons(0x0008) 41#define IB_SMP_UNSUP_METHOD __constant_htons(0x0008)
@@ -306,7 +306,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp,
306 lid = be16_to_cpu(pip->lid); 306 lid = be16_to_cpu(pip->lid);
307 if (lid != ipath_layer_get_lid(dev->dd)) { 307 if (lid != ipath_layer_get_lid(dev->dd)) {
308 /* Must be a valid unicast LID address. */ 308 /* Must be a valid unicast LID address. */
309 if (lid == 0 || lid >= IPS_MULTICAST_LID_BASE) 309 if (lid == 0 || lid >= IPATH_MULTICAST_LID_BASE)
310 goto err; 310 goto err;
311 ipath_set_lid(dev->dd, lid, pip->mkeyprot_resv_lmc & 7); 311 ipath_set_lid(dev->dd, lid, pip->mkeyprot_resv_lmc & 7);
312 event.event = IB_EVENT_LID_CHANGE; 312 event.event = IB_EVENT_LID_CHANGE;
@@ -316,7 +316,7 @@ static int recv_subn_set_portinfo(struct ib_smp *smp,
316 smlid = be16_to_cpu(pip->sm_lid); 316 smlid = be16_to_cpu(pip->sm_lid);
317 if (smlid != dev->sm_lid) { 317 if (smlid != dev->sm_lid) {
318 /* Must be a valid unicast LID address. */ 318 /* Must be a valid unicast LID address. */
319 if (smlid == 0 || smlid >= IPS_MULTICAST_LID_BASE) 319 if (smlid == 0 || smlid >= IPATH_MULTICAST_LID_BASE)
320 goto err; 320 goto err;
321 dev->sm_lid = smlid; 321 dev->sm_lid = smlid;
322 event.event = IB_EVENT_SM_CHANGE; 322 event.event = IB_EVENT_SM_CHANGE;
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index a77a0dad0fa0..83e557be591e 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -35,7 +35,7 @@
35#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
36 36
37#include "ipath_verbs.h" 37#include "ipath_verbs.h"
38#include "ips_common.h" 38#include "ipath_common.h"
39 39
40#define BITS_PER_PAGE (PAGE_SIZE*BITS_PER_BYTE) 40#define BITS_PER_PAGE (PAGE_SIZE*BITS_PER_BYTE)
41#define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1) 41#define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1)
@@ -450,7 +450,7 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
450 450
451 if (attr_mask & IB_QP_AV) 451 if (attr_mask & IB_QP_AV)
452 if (attr->ah_attr.dlid == 0 || 452 if (attr->ah_attr.dlid == 0 ||
453 attr->ah_attr.dlid >= IPS_MULTICAST_LID_BASE) 453 attr->ah_attr.dlid >= IPATH_MULTICAST_LID_BASE)
454 goto inval; 454 goto inval;
455 455
456 if (attr_mask & IB_QP_PKEY_INDEX) 456 if (attr_mask & IB_QP_PKEY_INDEX)
@@ -585,14 +585,14 @@ int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
585 */ 585 */
586__be32 ipath_compute_aeth(struct ipath_qp *qp) 586__be32 ipath_compute_aeth(struct ipath_qp *qp)
587{ 587{
588 u32 aeth = qp->r_msn & IPS_MSN_MASK; 588 u32 aeth = qp->r_msn & IPATH_MSN_MASK;
589 589
590 if (qp->ibqp.srq) { 590 if (qp->ibqp.srq) {
591 /* 591 /*
592 * Shared receive queues don't generate credits. 592 * Shared receive queues don't generate credits.
593 * Set the credit field to the invalid value. 593 * Set the credit field to the invalid value.
594 */ 594 */
595 aeth |= IPS_AETH_CREDIT_INVAL << IPS_AETH_CREDIT_SHIFT; 595 aeth |= IPATH_AETH_CREDIT_INVAL << IPATH_AETH_CREDIT_SHIFT;
596 } else { 596 } else {
597 u32 min, max, x; 597 u32 min, max, x;
598 u32 credits; 598 u32 credits;
@@ -622,7 +622,7 @@ __be32 ipath_compute_aeth(struct ipath_qp *qp)
622 else 622 else
623 min = x; 623 min = x;
624 } 624 }
625 aeth |= x << IPS_AETH_CREDIT_SHIFT; 625 aeth |= x << IPATH_AETH_CREDIT_SHIFT;
626 } 626 }
627 return cpu_to_be32(aeth); 627 return cpu_to_be32(aeth);
628} 628}
@@ -888,18 +888,18 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc)
888 */ 888 */
889void ipath_get_credit(struct ipath_qp *qp, u32 aeth) 889void ipath_get_credit(struct ipath_qp *qp, u32 aeth)
890{ 890{
891 u32 credit = (aeth >> IPS_AETH_CREDIT_SHIFT) & IPS_AETH_CREDIT_MASK; 891 u32 credit = (aeth >> IPATH_AETH_CREDIT_SHIFT) & IPATH_AETH_CREDIT_MASK;
892 892
893 /* 893 /*
894 * If the credit is invalid, we can send 894 * If the credit is invalid, we can send
895 * as many packets as we like. Otherwise, we have to 895 * as many packets as we like. Otherwise, we have to
896 * honor the credit field. 896 * honor the credit field.
897 */ 897 */
898 if (credit == IPS_AETH_CREDIT_INVAL) 898 if (credit == IPATH_AETH_CREDIT_INVAL)
899 qp->s_lsn = (u32) -1; 899 qp->s_lsn = (u32) -1;
900 else if (qp->s_lsn != (u32) -1) { 900 else if (qp->s_lsn != (u32) -1) {
901 /* Compute new LSN (i.e., MSN + credit) */ 901 /* Compute new LSN (i.e., MSN + credit) */
902 credit = (aeth + credit_table[credit]) & IPS_MSN_MASK; 902 credit = (aeth + credit_table[credit]) & IPATH_MSN_MASK;
903 if (ipath_cmp24(credit, qp->s_lsn) > 0) 903 if (ipath_cmp24(credit, qp->s_lsn) > 0)
904 qp->s_lsn = credit; 904 qp->s_lsn = credit;
905 } 905 }
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c
index 8568dd0538cf..774d1615ce2f 100644
--- a/drivers/infiniband/hw/ipath/ipath_rc.c
+++ b/drivers/infiniband/hw/ipath/ipath_rc.c
@@ -32,7 +32,7 @@
32 */ 32 */
33 33
34#include "ipath_verbs.h" 34#include "ipath_verbs.h"
35#include "ips_common.h" 35#include "ipath_common.h"
36 36
37/* cut down ridiculously long IB macro names */ 37/* cut down ridiculously long IB macro names */
38#define OP(x) IB_OPCODE_RC_##x 38#define OP(x) IB_OPCODE_RC_##x
@@ -49,7 +49,7 @@ static void ipath_init_restart(struct ipath_qp *qp, struct ipath_swqe *wqe)
49 struct ipath_ibdev *dev; 49 struct ipath_ibdev *dev;
50 u32 len; 50 u32 len;
51 51
52 len = ((qp->s_psn - wqe->psn) & IPS_PSN_MASK) * 52 len = ((qp->s_psn - wqe->psn) & IPATH_PSN_MASK) *
53 ib_mtu_enum_to_int(qp->path_mtu); 53 ib_mtu_enum_to_int(qp->path_mtu);
54 qp->s_sge.sge = wqe->sg_list[0]; 54 qp->s_sge.sge = wqe->sg_list[0];
55 qp->s_sge.sg_list = wqe->sg_list + 1; 55 qp->s_sge.sg_list = wqe->sg_list + 1;
@@ -159,9 +159,9 @@ u32 ipath_make_rc_ack(struct ipath_qp *qp,
159 qp->s_ack_state = OP(RDMA_READ_RESPONSE_LAST); 159 qp->s_ack_state = OP(RDMA_READ_RESPONSE_LAST);
160 bth0 = OP(ACKNOWLEDGE) << 24; 160 bth0 = OP(ACKNOWLEDGE) << 24;
161 if (qp->s_nak_state) 161 if (qp->s_nak_state)
162 ohdr->u.aeth = cpu_to_be32((qp->r_msn & IPS_MSN_MASK) | 162 ohdr->u.aeth = cpu_to_be32((qp->r_msn & IPATH_MSN_MASK) |
163 (qp->s_nak_state << 163 (qp->s_nak_state <<
164 IPS_AETH_CREDIT_SHIFT)); 164 IPATH_AETH_CREDIT_SHIFT));
165 else 165 else
166 ohdr->u.aeth = ipath_compute_aeth(qp); 166 ohdr->u.aeth = ipath_compute_aeth(qp);
167 hwords++; 167 hwords++;
@@ -361,7 +361,7 @@ int ipath_make_rc_req(struct ipath_qp *qp,
361 if (qp->s_tail >= qp->s_size) 361 if (qp->s_tail >= qp->s_size)
362 qp->s_tail = 0; 362 qp->s_tail = 0;
363 } 363 }
364 bth2 |= qp->s_psn++ & IPS_PSN_MASK; 364 bth2 |= qp->s_psn++ & IPATH_PSN_MASK;
365 if ((int)(qp->s_psn - qp->s_next_psn) > 0) 365 if ((int)(qp->s_psn - qp->s_next_psn) > 0)
366 qp->s_next_psn = qp->s_psn; 366 qp->s_next_psn = qp->s_psn;
367 /* 367 /*
@@ -387,7 +387,7 @@ int ipath_make_rc_req(struct ipath_qp *qp,
387 qp->s_state = OP(SEND_MIDDLE); 387 qp->s_state = OP(SEND_MIDDLE);
388 /* FALLTHROUGH */ 388 /* FALLTHROUGH */
389 case OP(SEND_MIDDLE): 389 case OP(SEND_MIDDLE):
390 bth2 = qp->s_psn++ & IPS_PSN_MASK; 390 bth2 = qp->s_psn++ & IPATH_PSN_MASK;
391 if ((int)(qp->s_psn - qp->s_next_psn) > 0) 391 if ((int)(qp->s_psn - qp->s_next_psn) > 0)
392 qp->s_next_psn = qp->s_psn; 392 qp->s_next_psn = qp->s_psn;
393 ss = &qp->s_sge; 393 ss = &qp->s_sge;
@@ -429,7 +429,7 @@ int ipath_make_rc_req(struct ipath_qp *qp,
429 qp->s_state = OP(RDMA_WRITE_MIDDLE); 429 qp->s_state = OP(RDMA_WRITE_MIDDLE);
430 /* FALLTHROUGH */ 430 /* FALLTHROUGH */
431 case OP(RDMA_WRITE_MIDDLE): 431 case OP(RDMA_WRITE_MIDDLE):
432 bth2 = qp->s_psn++ & IPS_PSN_MASK; 432 bth2 = qp->s_psn++ & IPATH_PSN_MASK;
433 if ((int)(qp->s_psn - qp->s_next_psn) > 0) 433 if ((int)(qp->s_psn - qp->s_next_psn) > 0)
434 qp->s_next_psn = qp->s_psn; 434 qp->s_next_psn = qp->s_psn;
435 ss = &qp->s_sge; 435 ss = &qp->s_sge;
@@ -466,7 +466,7 @@ int ipath_make_rc_req(struct ipath_qp *qp,
466 * See ipath_restart_rc(). 466 * See ipath_restart_rc().
467 */ 467 */
468 ipath_init_restart(qp, wqe); 468 ipath_init_restart(qp, wqe);
469 len = ((qp->s_psn - wqe->psn) & IPS_PSN_MASK) * pmtu; 469 len = ((qp->s_psn - wqe->psn) & IPATH_PSN_MASK) * pmtu;
470 ohdr->u.rc.reth.vaddr = 470 ohdr->u.rc.reth.vaddr =
471 cpu_to_be64(wqe->wr.wr.rdma.remote_addr + len); 471 cpu_to_be64(wqe->wr.wr.rdma.remote_addr + len);
472 ohdr->u.rc.reth.rkey = 472 ohdr->u.rc.reth.rkey =
@@ -474,7 +474,7 @@ int ipath_make_rc_req(struct ipath_qp *qp,
474 ohdr->u.rc.reth.length = cpu_to_be32(qp->s_len); 474 ohdr->u.rc.reth.length = cpu_to_be32(qp->s_len);
475 qp->s_state = OP(RDMA_READ_REQUEST); 475 qp->s_state = OP(RDMA_READ_REQUEST);
476 hwords += sizeof(ohdr->u.rc.reth) / 4; 476 hwords += sizeof(ohdr->u.rc.reth) / 4;
477 bth2 = qp->s_psn++ & IPS_PSN_MASK; 477 bth2 = qp->s_psn++ & IPATH_PSN_MASK;
478 if ((int)(qp->s_psn - qp->s_next_psn) > 0) 478 if ((int)(qp->s_psn - qp->s_next_psn) > 0)
479 qp->s_next_psn = qp->s_psn; 479 qp->s_next_psn = qp->s_psn;
480 ss = NULL; 480 ss = NULL;
@@ -529,7 +529,7 @@ static void send_rc_ack(struct ipath_qp *qp)
529 529
530 /* Construct the header. */ 530 /* Construct the header. */
531 ohdr = &hdr.u.oth; 531 ohdr = &hdr.u.oth;
532 lrh0 = IPS_LRH_BTH; 532 lrh0 = IPATH_LRH_BTH;
533 /* header size in 32-bit words LRH+BTH+AETH = (8+12+4)/4. */ 533 /* header size in 32-bit words LRH+BTH+AETH = (8+12+4)/4. */
534 hwords = 6; 534 hwords = 6;
535 if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) { 535 if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) {
@@ -537,14 +537,14 @@ static void send_rc_ack(struct ipath_qp *qp)
537 &qp->remote_ah_attr.grh, 537 &qp->remote_ah_attr.grh,
538 hwords, 0); 538 hwords, 0);
539 ohdr = &hdr.u.l.oth; 539 ohdr = &hdr.u.l.oth;
540 lrh0 = IPS_LRH_GRH; 540 lrh0 = IPATH_LRH_GRH;
541 } 541 }
542 /* read pkey_index w/o lock (its atomic) */ 542 /* read pkey_index w/o lock (its atomic) */
543 bth0 = ipath_layer_get_pkey(dev->dd, qp->s_pkey_index); 543 bth0 = ipath_layer_get_pkey(dev->dd, qp->s_pkey_index);
544 if (qp->r_nak_state) 544 if (qp->r_nak_state)
545 ohdr->u.aeth = cpu_to_be32((qp->r_msn & IPS_MSN_MASK) | 545 ohdr->u.aeth = cpu_to_be32((qp->r_msn & IPATH_MSN_MASK) |
546 (qp->r_nak_state << 546 (qp->r_nak_state <<
547 IPS_AETH_CREDIT_SHIFT)); 547 IPATH_AETH_CREDIT_SHIFT));
548 else 548 else
549 ohdr->u.aeth = ipath_compute_aeth(qp); 549 ohdr->u.aeth = ipath_compute_aeth(qp);
550 if (qp->r_ack_state >= OP(COMPARE_SWAP)) { 550 if (qp->r_ack_state >= OP(COMPARE_SWAP)) {
@@ -560,7 +560,7 @@ static void send_rc_ack(struct ipath_qp *qp)
560 hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd)); 560 hdr.lrh[3] = cpu_to_be16(ipath_layer_get_lid(dev->dd));
561 ohdr->bth[0] = cpu_to_be32(bth0); 561 ohdr->bth[0] = cpu_to_be32(bth0);
562 ohdr->bth[1] = cpu_to_be32(qp->remote_qpn); 562 ohdr->bth[1] = cpu_to_be32(qp->remote_qpn);
563 ohdr->bth[2] = cpu_to_be32(qp->r_ack_psn & IPS_PSN_MASK); 563 ohdr->bth[2] = cpu_to_be32(qp->r_ack_psn & IPATH_PSN_MASK);
564 564
565 /* 565 /*
566 * If we can send the ACK, clear the ACK state. 566 * If we can send the ACK, clear the ACK state.
@@ -890,8 +890,8 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode)
890 reset_psn(qp, psn); 890 reset_psn(qp, psn);
891 891
892 qp->s_rnr_timeout = 892 qp->s_rnr_timeout =
893 ib_ipath_rnr_table[(aeth >> IPS_AETH_CREDIT_SHIFT) & 893 ib_ipath_rnr_table[(aeth >> IPATH_AETH_CREDIT_SHIFT) &
894 IPS_AETH_CREDIT_MASK]; 894 IPATH_AETH_CREDIT_MASK];
895 ipath_insert_rnr_queue(qp); 895 ipath_insert_rnr_queue(qp);
896 goto bail; 896 goto bail;
897 897
@@ -899,8 +899,8 @@ static int do_rc_ack(struct ipath_qp *qp, u32 aeth, u32 psn, int opcode)
899 /* The last valid PSN seen is the previous request's. */ 899 /* The last valid PSN seen is the previous request's. */
900 if (qp->s_last != qp->s_tail) 900 if (qp->s_last != qp->s_tail)
901 qp->s_last_psn = wqe->psn - 1; 901 qp->s_last_psn = wqe->psn - 1;
902 switch ((aeth >> IPS_AETH_CREDIT_SHIFT) & 902 switch ((aeth >> IPATH_AETH_CREDIT_SHIFT) &
903 IPS_AETH_CREDIT_MASK) { 903 IPATH_AETH_CREDIT_MASK) {
904 case 0: /* PSN sequence error */ 904 case 0: /* PSN sequence error */
905 dev->n_seq_naks++; 905 dev->n_seq_naks++;
906 /* 906 /*
@@ -1268,7 +1268,7 @@ static inline int ipath_rc_rcv_error(struct ipath_ibdev *dev,
1268 * Check for the PSN of the last atomic operation 1268 * Check for the PSN of the last atomic operation
1269 * performed and resend the result if found. 1269 * performed and resend the result if found.
1270 */ 1270 */
1271 if ((psn & IPS_PSN_MASK) != qp->r_atomic_psn) 1271 if ((psn & IPATH_PSN_MASK) != qp->r_atomic_psn)
1272 goto done; 1272 goto done;
1273 break; 1273 break;
1274 } 1274 }
@@ -1638,7 +1638,7 @@ void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
1638 *(u64 *) qp->r_sge.sge.vaddr = sdata; 1638 *(u64 *) qp->r_sge.sge.vaddr = sdata;
1639 spin_unlock_irq(&dev->pending_lock); 1639 spin_unlock_irq(&dev->pending_lock);
1640 qp->r_msn++; 1640 qp->r_msn++;
1641 qp->r_atomic_psn = psn & IPS_PSN_MASK; 1641 qp->r_atomic_psn = psn & IPATH_PSN_MASK;
1642 psn |= 1 << 31; 1642 psn |= 1 << 31;
1643 break; 1643 break;
1644 } 1644 }
diff --git a/drivers/infiniband/hw/ipath/ipath_ruc.c b/drivers/infiniband/hw/ipath/ipath_ruc.c
index 99c0652d49dc..772bc59fb85c 100644
--- a/drivers/infiniband/hw/ipath/ipath_ruc.c
+++ b/drivers/infiniband/hw/ipath/ipath_ruc.c
@@ -32,7 +32,7 @@
32 */ 32 */
33 33
34#include "ipath_verbs.h" 34#include "ipath_verbs.h"
35#include "ips_common.h" 35#include "ipath_common.h"
36 36
37/* 37/*
38 * Convert the AETH RNR timeout code into the number of milliseconds. 38 * Convert the AETH RNR timeout code into the number of milliseconds.
@@ -632,7 +632,7 @@ again:
632 /* Sending responses has higher priority over sending requests. */ 632 /* Sending responses has higher priority over sending requests. */
633 if (qp->s_ack_state != IB_OPCODE_RC_ACKNOWLEDGE && 633 if (qp->s_ack_state != IB_OPCODE_RC_ACKNOWLEDGE &&
634 (bth0 = ipath_make_rc_ack(qp, ohdr, pmtu)) != 0) 634 (bth0 = ipath_make_rc_ack(qp, ohdr, pmtu)) != 0)
635 bth2 = qp->s_ack_psn++ & IPS_PSN_MASK; 635 bth2 = qp->s_ack_psn++ & IPATH_PSN_MASK;
636 else if (!((qp->ibqp.qp_type == IB_QPT_RC) ? 636 else if (!((qp->ibqp.qp_type == IB_QPT_RC) ?
637 ipath_make_rc_req(qp, ohdr, pmtu, &bth0, &bth2) : 637 ipath_make_rc_req(qp, ohdr, pmtu, &bth0, &bth2) :
638 ipath_make_uc_req(qp, ohdr, pmtu, &bth0, &bth2))) { 638 ipath_make_uc_req(qp, ohdr, pmtu, &bth0, &bth2))) {
@@ -651,12 +651,12 @@ again:
651 /* Construct the header. */ 651 /* Construct the header. */
652 extra_bytes = (4 - qp->s_cur_size) & 3; 652 extra_bytes = (4 - qp->s_cur_size) & 3;
653 nwords = (qp->s_cur_size + extra_bytes) >> 2; 653 nwords = (qp->s_cur_size + extra_bytes) >> 2;
654 lrh0 = IPS_LRH_BTH; 654 lrh0 = IPATH_LRH_BTH;
655 if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) { 655 if (unlikely(qp->remote_ah_attr.ah_flags & IB_AH_GRH)) {
656 qp->s_hdrwords += ipath_make_grh(dev, &qp->s_hdr.u.l.grh, 656 qp->s_hdrwords += ipath_make_grh(dev, &qp->s_hdr.u.l.grh,
657 &qp->remote_ah_attr.grh, 657 &qp->remote_ah_attr.grh,
658 qp->s_hdrwords, nwords); 658 qp->s_hdrwords, nwords);
659 lrh0 = IPS_LRH_GRH; 659 lrh0 = IPATH_LRH_GRH;
660 } 660 }
661 lrh0 |= qp->remote_ah_attr.sl << 4; 661 lrh0 |= qp->remote_ah_attr.sl << 4;
662 qp->s_hdr.lrh[0] = cpu_to_be16(lrh0); 662 qp->s_hdr.lrh[0] = cpu_to_be16(lrh0);
diff --git a/drivers/infiniband/hw/ipath/ipath_sysfs.c b/drivers/infiniband/hw/ipath/ipath_sysfs.c
index bb75076c182f..b98821d7801d 100644
--- a/drivers/infiniband/hw/ipath/ipath_sysfs.c
+++ b/drivers/infiniband/hw/ipath/ipath_sysfs.c
@@ -35,8 +35,8 @@
35#include <linux/pci.h> 35#include <linux/pci.h>
36 36
37#include "ipath_kernel.h" 37#include "ipath_kernel.h"
38#include "ips_common.h"
39#include "ipath_layer.h" 38#include "ipath_layer.h"
39#include "ipath_common.h"
40 40
41/** 41/**
42 * ipath_parse_ushort - parse an unsigned short value in an arbitrary base 42 * ipath_parse_ushort - parse an unsigned short value in an arbitrary base
@@ -187,7 +187,7 @@ static ssize_t store_lid(struct device *dev,
187 if (ret < 0) 187 if (ret < 0)
188 goto invalid; 188 goto invalid;
189 189
190 if (lid == 0 || lid >= IPS_MULTICAST_LID_BASE) { 190 if (lid == 0 || lid >= IPATH_MULTICAST_LID_BASE) {
191 ret = -EINVAL; 191 ret = -EINVAL;
192 goto invalid; 192 goto invalid;
193 } 193 }
@@ -221,7 +221,7 @@ static ssize_t store_mlid(struct device *dev,
221 int ret; 221 int ret;
222 222
223 ret = ipath_parse_ushort(buf, &mlid); 223 ret = ipath_parse_ushort(buf, &mlid);
224 if (ret < 0 || mlid < IPS_MULTICAST_LID_BASE) 224 if (ret < 0 || mlid < IPATH_MULTICAST_LID_BASE)
225 goto invalid; 225 goto invalid;
226 226
227 unit = dd->ipath_unit; 227 unit = dd->ipath_unit;
diff --git a/drivers/infiniband/hw/ipath/ipath_uc.c b/drivers/infiniband/hw/ipath/ipath_uc.c
index 10516842bb82..c33abea2d5a7 100644
--- a/drivers/infiniband/hw/ipath/ipath_uc.c
+++ b/drivers/infiniband/hw/ipath/ipath_uc.c
@@ -32,7 +32,7 @@
32 */ 32 */
33 33
34#include "ipath_verbs.h" 34#include "ipath_verbs.h"
35#include "ips_common.h" 35#include "ipath_common.h"
36 36
37/* cut down ridiculously long IB macro names */ 37/* cut down ridiculously long IB macro names */
38#define OP(x) IB_OPCODE_UC_##x 38#define OP(x) IB_OPCODE_UC_##x
@@ -213,7 +213,7 @@ int ipath_make_uc_req(struct ipath_qp *qp,
213 qp->s_cur_sge = &qp->s_sge; 213 qp->s_cur_sge = &qp->s_sge;
214 qp->s_cur_size = len; 214 qp->s_cur_size = len;
215 *bth0p = bth0 | (qp->s_state << 24); 215 *bth0p = bth0 | (qp->s_state << 24);
216 *bth2p = qp->s_next_psn++ & IPS_PSN_MASK; 216 *bth2p = qp->s_next_psn++ & IPATH_PSN_MASK;
217 return 1; 217 return 1;
218 218
219done: 219done:
diff --git a/drivers/infiniband/hw/ipath/ipath_ud.c b/drivers/infiniband/hw/ipath/ipath_ud.c
index 4b0502907f3c..3466129af804 100644
--- a/drivers/infiniband/hw/ipath/ipath_ud.c
+++ b/drivers/infiniband/hw/ipath/ipath_ud.c
@@ -34,7 +34,7 @@
34#include <rdma/ib_smi.h> 34#include <rdma/ib_smi.h>
35 35
36#include "ipath_verbs.h" 36#include "ipath_verbs.h"
37#include "ips_common.h" 37#include "ipath_common.h"
38 38
39/** 39/**
40 * ipath_ud_loopback - handle send on loopback QPs 40 * ipath_ud_loopback - handle send on loopback QPs
@@ -289,8 +289,8 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
289 ret = -EINVAL; 289 ret = -EINVAL;
290 goto bail; 290 goto bail;
291 } 291 }
292 if (ah_attr->dlid >= IPS_MULTICAST_LID_BASE) { 292 if (ah_attr->dlid >= IPATH_MULTICAST_LID_BASE) {
293 if (ah_attr->dlid != IPS_PERMISSIVE_LID) 293 if (ah_attr->dlid != IPATH_PERMISSIVE_LID)
294 dev->n_multicast_xmit++; 294 dev->n_multicast_xmit++;
295 else 295 else
296 dev->n_unicast_xmit++; 296 dev->n_unicast_xmit++;
@@ -310,7 +310,7 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
310 if (ah_attr->ah_flags & IB_AH_GRH) { 310 if (ah_attr->ah_flags & IB_AH_GRH) {
311 /* Header size in 32-bit words. */ 311 /* Header size in 32-bit words. */
312 hwords = 17; 312 hwords = 17;
313 lrh0 = IPS_LRH_GRH; 313 lrh0 = IPATH_LRH_GRH;
314 ohdr = &qp->s_hdr.u.l.oth; 314 ohdr = &qp->s_hdr.u.l.oth;
315 qp->s_hdr.u.l.grh.version_tclass_flow = 315 qp->s_hdr.u.l.grh.version_tclass_flow =
316 cpu_to_be32((6 << 28) | 316 cpu_to_be32((6 << 28) |
@@ -336,7 +336,7 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
336 } else { 336 } else {
337 /* Header size in 32-bit words. */ 337 /* Header size in 32-bit words. */
338 hwords = 7; 338 hwords = 7;
339 lrh0 = IPS_LRH_BTH; 339 lrh0 = IPATH_LRH_BTH;
340 ohdr = &qp->s_hdr.u.oth; 340 ohdr = &qp->s_hdr.u.oth;
341 } 341 }
342 if (wr->opcode == IB_WR_SEND_WITH_IMM) { 342 if (wr->opcode == IB_WR_SEND_WITH_IMM) {
@@ -367,18 +367,18 @@ int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr)
367 if (wr->send_flags & IB_SEND_SOLICITED) 367 if (wr->send_flags & IB_SEND_SOLICITED)
368 bth0 |= 1 << 23; 368 bth0 |= 1 << 23;
369 bth0 |= extra_bytes << 20; 369 bth0 |= extra_bytes << 20;
370 bth0 |= qp->ibqp.qp_type == IB_QPT_SMI ? IPS_DEFAULT_P_KEY : 370 bth0 |= qp->ibqp.qp_type == IB_QPT_SMI ? IPATH_DEFAULT_P_KEY :
371 ipath_layer_get_pkey(dev->dd, qp->s_pkey_index); 371 ipath_layer_get_pkey(dev->dd, qp->s_pkey_index);
372 ohdr->bth[0] = cpu_to_be32(bth0); 372 ohdr->bth[0] = cpu_to_be32(bth0);
373 /* 373 /*
374 * Use the multicast QP if the destination LID is a multicast LID. 374 * Use the multicast QP if the destination LID is a multicast LID.
375 */ 375 */
376 ohdr->bth[1] = ah_attr->dlid >= IPS_MULTICAST_LID_BASE && 376 ohdr->bth[1] = ah_attr->dlid >= IPATH_MULTICAST_LID_BASE &&
377 ah_attr->dlid != IPS_PERMISSIVE_LID ? 377 ah_attr->dlid != IPATH_PERMISSIVE_LID ?
378 __constant_cpu_to_be32(IPS_MULTICAST_QPN) : 378 __constant_cpu_to_be32(IPATH_MULTICAST_QPN) :
379 cpu_to_be32(wr->wr.ud.remote_qpn); 379 cpu_to_be32(wr->wr.ud.remote_qpn);
380 /* XXX Could lose a PSN count but not worth locking */ 380 /* XXX Could lose a PSN count but not worth locking */
381 ohdr->bth[2] = cpu_to_be32(qp->s_next_psn++ & IPS_PSN_MASK); 381 ohdr->bth[2] = cpu_to_be32(qp->s_next_psn++ & IPATH_PSN_MASK);
382 /* 382 /*
383 * Qkeys with the high order bit set mean use the 383 * Qkeys with the high order bit set mean use the
384 * qkey from the QP context instead of the WR (see 10.2.5). 384 * qkey from the QP context instead of the WR (see 10.2.5).
@@ -469,7 +469,7 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
469 src_qp = be32_to_cpu(ohdr->u.ud.deth[1]); 469 src_qp = be32_to_cpu(ohdr->u.ud.deth[1]);
470 } 470 }
471 } 471 }
472 src_qp &= IPS_QPN_MASK; 472 src_qp &= IPATH_QPN_MASK;
473 473
474 /* 474 /*
475 * Check that the permissive LID is only used on QP0 475 * Check that the permissive LID is only used on QP0
@@ -627,7 +627,7 @@ void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
627 /* 627 /*
628 * Save the LMC lower bits if the destination LID is a unicast LID. 628 * Save the LMC lower bits if the destination LID is a unicast LID.
629 */ 629 */
630 wc.dlid_path_bits = dlid >= IPS_MULTICAST_LID_BASE ? 0 : 630 wc.dlid_path_bits = dlid >= IPATH_MULTICAST_LID_BASE ? 0 :
631 dlid & ((1 << (dev->mkeyprot_resv_lmc & 7)) - 1); 631 dlid & ((1 << (dev->mkeyprot_resv_lmc & 7)) - 1);
632 /* Signal completion event if the solicited bit is set. */ 632 /* Signal completion event if the solicited bit is set. */
633 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc, 633 ipath_cq_enter(to_icq(qp->ibqp.recv_cq), &wc,
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index ab4d5331e81e..56ac336dd1ec 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -37,7 +37,7 @@
37 37
38#include "ipath_kernel.h" 38#include "ipath_kernel.h"
39#include "ipath_verbs.h" 39#include "ipath_verbs.h"
40#include "ips_common.h" 40#include "ipath_common.h"
41 41
42/* Not static, because we don't want the compiler removing it */ 42/* Not static, because we don't want the compiler removing it */
43const char ipath_verbs_version[] = "ipath_verbs " IPATH_IDSTR; 43const char ipath_verbs_version[] = "ipath_verbs " IPATH_IDSTR;
@@ -429,7 +429,7 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen)
429 429
430 /* Check for a valid destination LID (see ch. 7.11.1). */ 430 /* Check for a valid destination LID (see ch. 7.11.1). */
431 lid = be16_to_cpu(hdr->lrh[1]); 431 lid = be16_to_cpu(hdr->lrh[1]);
432 if (lid < IPS_MULTICAST_LID_BASE) { 432 if (lid < IPATH_MULTICAST_LID_BASE) {
433 lid &= ~((1 << (dev->mkeyprot_resv_lmc & 7)) - 1); 433 lid &= ~((1 << (dev->mkeyprot_resv_lmc & 7)) - 1);
434 if (unlikely(lid != ipath_layer_get_lid(dev->dd))) { 434 if (unlikely(lid != ipath_layer_get_lid(dev->dd))) {
435 dev->rcv_errors++; 435 dev->rcv_errors++;
@@ -439,9 +439,9 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen)
439 439
440 /* Check for GRH */ 440 /* Check for GRH */
441 lnh = be16_to_cpu(hdr->lrh[0]) & 3; 441 lnh = be16_to_cpu(hdr->lrh[0]) & 3;
442 if (lnh == IPS_LRH_BTH) 442 if (lnh == IPATH_LRH_BTH)
443 ohdr = &hdr->u.oth; 443 ohdr = &hdr->u.oth;
444 else if (lnh == IPS_LRH_GRH) 444 else if (lnh == IPATH_LRH_GRH)
445 ohdr = &hdr->u.l.oth; 445 ohdr = &hdr->u.l.oth;
446 else { 446 else {
447 dev->rcv_errors++; 447 dev->rcv_errors++;
@@ -453,8 +453,8 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen)
453 dev->opstats[opcode].n_packets++; 453 dev->opstats[opcode].n_packets++;
454 454
455 /* Get the destination QP number. */ 455 /* Get the destination QP number. */
456 qp_num = be32_to_cpu(ohdr->bth[1]) & IPS_QPN_MASK; 456 qp_num = be32_to_cpu(ohdr->bth[1]) & IPATH_QPN_MASK;
457 if (qp_num == IPS_MULTICAST_QPN) { 457 if (qp_num == IPATH_MULTICAST_QPN) {
458 struct ipath_mcast *mcast; 458 struct ipath_mcast *mcast;
459 struct ipath_mcast_qp *p; 459 struct ipath_mcast_qp *p;
460 460
@@ -465,7 +465,7 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen)
465 } 465 }
466 dev->n_multicast_rcv++; 466 dev->n_multicast_rcv++;
467 list_for_each_entry_rcu(p, &mcast->qp_list, list) 467 list_for_each_entry_rcu(p, &mcast->qp_list, list)
468 ipath_qp_rcv(dev, hdr, lnh == IPS_LRH_GRH, data, 468 ipath_qp_rcv(dev, hdr, lnh == IPATH_LRH_GRH, data,
469 tlen, p->qp); 469 tlen, p->qp);
470 /* 470 /*
471 * Notify ipath_multicast_detach() if it is waiting for us 471 * Notify ipath_multicast_detach() if it is waiting for us
@@ -477,7 +477,7 @@ static void ipath_ib_rcv(void *arg, void *rhdr, void *data, u32 tlen)
477 qp = ipath_lookup_qpn(&dev->qp_table, qp_num); 477 qp = ipath_lookup_qpn(&dev->qp_table, qp_num);
478 if (qp) { 478 if (qp) {
479 dev->n_unicast_rcv++; 479 dev->n_unicast_rcv++;
480 ipath_qp_rcv(dev, hdr, lnh == IPS_LRH_GRH, data, 480 ipath_qp_rcv(dev, hdr, lnh == IPATH_LRH_GRH, data,
481 tlen, qp); 481 tlen, qp);
482 /* 482 /*
483 * Notify ipath_destroy_qp() if it is waiting 483 * Notify ipath_destroy_qp() if it is waiting
@@ -860,8 +860,8 @@ static struct ib_ah *ipath_create_ah(struct ib_pd *pd,
860 } 860 }
861 861
862 /* A multicast address requires a GRH (see ch. 8.4.1). */ 862 /* A multicast address requires a GRH (see ch. 8.4.1). */
863 if (ah_attr->dlid >= IPS_MULTICAST_LID_BASE && 863 if (ah_attr->dlid >= IPATH_MULTICAST_LID_BASE &&
864 ah_attr->dlid != IPS_PERMISSIVE_LID && 864 ah_attr->dlid != IPATH_PERMISSIVE_LID &&
865 !(ah_attr->ah_flags & IB_AH_GRH)) { 865 !(ah_attr->ah_flags & IB_AH_GRH)) {
866 ret = ERR_PTR(-EINVAL); 866 ret = ERR_PTR(-EINVAL);
867 goto bail; 867 goto bail;
diff --git a/drivers/infiniband/hw/ipath/ips_common.h b/drivers/infiniband/hw/ipath/ips_common.h
deleted file mode 100644
index 1f83af958e2f..000000000000
--- a/drivers/infiniband/hw/ipath/ips_common.h
+++ /dev/null
@@ -1,264 +0,0 @@
1#ifndef IPS_COMMON_H
2#define IPS_COMMON_H
3/*
4 * Copyright (c) 2006 QLogic, Inc. All rights reserved.
5 * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
6 *
7 * This software is available to you under a choice of one of two
8 * licenses. You may choose to be licensed under the terms of the GNU
9 * General Public License (GPL) Version 2, available from the file
10 * COPYING in the main directory of this source tree, or the
11 * OpenIB.org BSD license below:
12 *
13 * Redistribution and use in source and binary forms, with or
14 * without modification, are permitted provided that the following
15 * conditions are met:
16 *
17 * - Redistributions of source code must retain the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer.
20 *
21 * - Redistributions in binary form must reproduce the above
22 * copyright notice, this list of conditions and the following
23 * disclaimer in the documentation and/or other materials
24 * provided with the distribution.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 * SOFTWARE.
34 */
35
36#include "ipath_common.h"
37
38struct ipath_header {
39 /*
40 * Version - 4 bits, Port - 4 bits, TID - 10 bits and Offset -
41 * 14 bits before ECO change ~28 Dec 03. After that, Vers 4,
42 * Port 3, TID 11, offset 14.
43 */
44 __le32 ver_port_tid_offset;
45 __le16 chksum;
46 __le16 pkt_flags;
47};
48
49struct ips_message_header {
50 __be16 lrh[4];
51 __be32 bth[3];
52 /* fields below this point are in host byte order */
53 struct ipath_header iph;
54 __u8 sub_opcode;
55 __u8 flags;
56 __u16 src_rank;
57 /* 24 bits. The upper 8 bit is available for other use */
58 union {
59 struct {
60 unsigned ack_seq_num:24;
61 unsigned port:4;
62 unsigned unused:4;
63 };
64 __u32 ack_seq_num_org;
65 };
66 __u8 expected_tid_session_id;
67 __u8 tinylen; /* to aid MPI */
68 union {
69 __u16 tag; /* to aid MPI */
70 __u16 mqhdr; /* for PSM MQ */
71 };
72 union {
73 __u32 mpi[4]; /* to aid MPI */
74 __u32 data[4];
75 __u64 mq[2]; /* for PSM MQ */
76 struct {
77 __u16 mtu;
78 __u8 major_ver;
79 __u8 minor_ver;
80 __u32 not_used; //free
81 __u32 run_id;
82 __u32 client_ver;
83 };
84 };
85};
86
87struct ether_header {
88 __be16 lrh[4];
89 __be32 bth[3];
90 struct ipath_header iph;
91 __u8 sub_opcode;
92 __u8 cmd;
93 __be16 lid;
94 __u16 mac[3];
95 __u8 frag_num;
96 __u8 seq_num;
97 __le32 len;
98 /* MUST be of word size due to PIO write requirements */
99 __le32 csum;
100 __le16 csum_offset;
101 __le16 flags;
102 __u16 first_2_bytes;
103 __u8 unused[2]; /* currently unused */
104};
105
106/*
107 * The PIO buffer used for sending infinipath messages must only be written
108 * in 32-bit words, all the data must be written, and no writes can occur
109 * after the last word is written (which transfers "ownership" of the buffer
110 * to the chip and triggers the message to be sent).
111 * Since the Linux sk_buff structure can be recursive, non-aligned, and
112 * any number of bytes in each segment, we use the following structure
113 * to keep information about the overall state of the copy operation.
114 * This is used to save the information needed to store the checksum
115 * in the right place before sending the last word to the hardware and
116 * to buffer the last 0-3 bytes of non-word sized segments.
117 */
118struct copy_data_s {
119 struct ether_header *hdr;
120 /* addr of PIO buf to write csum to */
121 __u32 __iomem *csum_pio;
122 __u32 __iomem *to; /* addr of PIO buf to write data to */
123 __u32 device; /* which device to allocate PIO bufs from */
124 __s32 error; /* set if there is an error. */
125 __s32 extra; /* amount of data saved in u.buf below */
126 __u32 len; /* total length to send in bytes */
127 __u32 flen; /* frament length in words */
128 __u32 csum; /* partial IP checksum */
129 __u32 pos; /* position for partial checksum */
130 __u32 offset; /* offset to where data currently starts */
131 __s32 checksum_calc; /* set to 1 when csum has been calculated */
132 struct sk_buff *skb;
133 union {
134 __u32 w;
135 __u8 buf[4];
136 } u;
137};
138
139/* IB - LRH header consts */
140#define IPS_LRH_GRH 0x0003 /* 1. word of IB LRH - next header: GRH */
141#define IPS_LRH_BTH 0x0002 /* 1. word of IB LRH - next header: BTH */
142
143#define IPS_OFFSET 0
144
145/*
146 * defines the cut-off point between the header queue and eager/expected
147 * TID queue
148 */
149#define NUM_OF_EXTRA_WORDS_IN_HEADER_QUEUE \
150 ((sizeof(struct ips_message_header) - \
151 offsetof(struct ips_message_header, iph)) >> 2)
152
153/* OpCodes */
154#define OPCODE_IPS 0xC0
155#define OPCODE_ITH4X 0xC1
156
157/* OpCode 30 is use by stand-alone test programs */
158#define OPCODE_RAW_DATA 0xDE
159/* last OpCode (31) is reserved for test */
160#define OPCODE_TEST 0xDF
161
162/* sub OpCodes - ips */
163#define OPCODE_SEQ_DATA 0x01
164#define OPCODE_SEQ_CTRL 0x02
165
166#define OPCODE_SEQ_MQ_DATA 0x03
167#define OPCODE_SEQ_MQ_CTRL 0x04
168
169#define OPCODE_ACK 0x10
170#define OPCODE_NAK 0x11
171
172#define OPCODE_ERR_CHK 0x20
173#define OPCODE_ERR_CHK_PLS 0x21
174
175#define OPCODE_STARTUP 0x30
176#define OPCODE_STARTUP_ACK 0x31
177#define OPCODE_STARTUP_NAK 0x32
178
179#define OPCODE_STARTUP_EXT 0x34
180#define OPCODE_STARTUP_ACK_EXT 0x35
181#define OPCODE_STARTUP_NAK_EXT 0x36
182
183#define OPCODE_TIDS_RELEASE 0x40
184#define OPCODE_TIDS_RELEASE_CONFIRM 0x41
185
186#define OPCODE_CLOSE 0x50
187#define OPCODE_CLOSE_ACK 0x51
188/*
189 * like OPCODE_CLOSE, but no complaint if other side has already closed.
190 * Used when doing abort(), MPI_Abort(), etc.
191 */
192#define OPCODE_ABORT 0x52
193
194/* sub OpCodes - ith4x */
195#define OPCODE_ENCAP 0x81
196#define OPCODE_LID_ARP 0x82
197
198/* Receive Header Queue: receive type (from infinipath) */
199#define RCVHQ_RCV_TYPE_EXPECTED 0
200#define RCVHQ_RCV_TYPE_EAGER 1
201#define RCVHQ_RCV_TYPE_NON_KD 2
202#define RCVHQ_RCV_TYPE_ERROR 3
203
204/* misc. */
205#define SIZE_OF_CRC 1
206
207#define EAGER_TID_ID INFINIPATH_I_TID_MASK
208
209#define IPS_DEFAULT_P_KEY 0xFFFF
210
211#define IPS_PERMISSIVE_LID 0xFFFF
212#define IPS_MULTICAST_LID_BASE 0xC000
213
214#define IPS_AETH_CREDIT_SHIFT 24
215#define IPS_AETH_CREDIT_MASK 0x1F
216#define IPS_AETH_CREDIT_INVAL 0x1F
217
218#define IPS_PSN_MASK 0xFFFFFF
219#define IPS_MSN_MASK 0xFFFFFF
220#define IPS_QPN_MASK 0xFFFFFF
221#define IPS_MULTICAST_QPN 0xFFFFFF
222
223/* functions for extracting fields from rcvhdrq entries */
224static inline __u32 ips_get_hdr_err_flags(const __le32 * rbuf)
225{
226 return __le32_to_cpu(rbuf[1]);
227}
228
229static inline __u32 ips_get_index(const __le32 * rbuf)
230{
231 return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_EGRINDEX_SHIFT)
232 & INFINIPATH_RHF_EGRINDEX_MASK;
233}
234
235static inline __u32 ips_get_rcv_type(const __le32 * rbuf)
236{
237 return (__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_RCVTYPE_SHIFT)
238 & INFINIPATH_RHF_RCVTYPE_MASK;
239}
240
241static inline __u32 ips_get_length_in_bytes(const __le32 * rbuf)
242{
243 return ((__le32_to_cpu(rbuf[0]) >> INFINIPATH_RHF_LENGTH_SHIFT)
244 & INFINIPATH_RHF_LENGTH_MASK) << 2;
245}
246
247static inline void *ips_get_first_protocol_header(const __u32 * rbuf)
248{
249 return (void *)&rbuf[2];
250}
251
252static inline struct ips_message_header *ips_get_ips_header(const __u32 *
253 rbuf)
254{
255 return (struct ips_message_header *)&rbuf[2];
256}
257
258static inline __u32 ips_get_ipath_ver(__le32 hdrword)
259{
260 return (__le32_to_cpu(hdrword) >> INFINIPATH_I_VERS_SHIFT)
261 & INFINIPATH_I_VERS_MASK;
262}
263
264#endif /* IPS_COMMON_H */