diff options
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_common.h')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_common.h | 123 |
1 files changed, 114 insertions, 9 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 */ | ||
612 | struct 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 | */ | ||
627 | struct 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 */ | ||
636 | struct 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 | */ | ||
689 | static inline __u32 ipath_hdrget_err_flags(const __le32 * rbuf) | ||
690 | { | ||
691 | return __le32_to_cpu(rbuf[1]); | ||
692 | } | ||
693 | |||
694 | static 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 | |||
700 | static 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 | |||
706 | static 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 | |||
712 | static 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 */ |