Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nes_hw.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2006 - 2011 Intel Corporation. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32 
33 #ifndef __NES_HW_H
34 #define __NES_HW_H
35 
36 #include <linux/inet_lro.h>
37 
38 #define NES_PHY_TYPE_CX4 1
39 #define NES_PHY_TYPE_1G 2
40 #define NES_PHY_TYPE_ARGUS 4
41 #define NES_PHY_TYPE_PUMA_1G 5
42 #define NES_PHY_TYPE_PUMA_10G 6
43 #define NES_PHY_TYPE_GLADIUS 7
44 #define NES_PHY_TYPE_SFP_D 8
45 #define NES_PHY_TYPE_KR 9
46 
47 #define NES_MULTICAST_PF_MAX 8
48 #define NES_A0 3
49 
50 #define NES_ENABLE_PAU 0x07000001
51 #define NES_DISABLE_PAU 0x07000000
52 #define NES_PAU_COUNTER 10
53 #define NES_CQP_OPCODE_MASK 0x3f
54 
55 enum pci_regs {
56  NES_INT_STAT = 0x0000,
57  NES_INT_MASK = 0x0004,
58  NES_INT_PENDING = 0x0008,
61  NES_TIMER_STAT = 0x0014,
65  NES_EEPROM_DATA = 0x0024,
67  NES_FLASH_DATA = 0x002C,
69  NES_CQ_ACK = 0x0034,
70  NES_WQE_ALLOC = 0x0040,
71  NES_CQE_ALLOC = 0x0044,
72  NES_AEQ_ALLOC = 0x0048
73 };
74 
84  NES_IDX_GPR2 = 0x010c,
87  NES_IDX_TCP_NOW = 0x01f0,
94  NES_IDX_MRT_SIZE = 0x0278,
194 };
195 
196 #define NES_IDX_MAC_TX_CONFIG_ENABLE_PAUSE 1
197 #define NES_IDX_MPP_DEBUG_PORT_DISABLE_PAUSE (1 << 17)
198 
223 };
224 
232 };
233 
234 enum nes_cqp_wqe_word_download_idx { /* format differs from other cqp ops */
239  /* For index values 4-15 use NES_NIC_SQ_WQE_ values */
240 };
241 
248 };
249 
260 };
261 
262 #define NES_CQP_OP_LOGICAL_PORT_SHIFT 26
263 #define NES_CQP_OP_IWARP_STATE_SHIFT 28
264 #define NES_CQP_OP_TERMLEN_SHIFT 28
265 
291  NES_CQP_QP_RESET = (1<<31),
292 };
293 
300 };
301 
307 };
308 
315 };
316 
320  NES_CQP_CQ_RESIZE = (1<<11),
323  NES_CQP_CQ_VIRT = (1<<15),
324 };
325 
330  NES_CQP_STAG_MR = (1<<13),
338 };
339 
344 };
345 
348  NES_CQP_CEQ_VIRT = (1<<15),
349 };
350 
355 };
356 
359  NES_CQP_AEQ_VIRT = (1<<15),
360 };
361 
367 };
368 
373 };
374 
379 };
380 
384 };
385 
387  NES_CQP_FLUSH_SQ = (1<<30),
388  NES_CQP_FLUSH_RQ = (1<<31),
390 };
391 
394  NES_CQE_ERROR = (1<<7),
395  NES_CQE_SQ = (1<<8),
396  NES_CQE_SE = (1<<9),
397  NES_CQE_PSH = (1<<29),
398  NES_CQE_FIN = (1<<30),
399  NES_CQE_VALID = (1<<31),
400 };
401 
402 
411 };
412 
416 };
417 
419  NES_CEQE_VALID = (1<<31),
420 };
421 
423  NES_INT_CEQ0 = (1<<0),
424  NES_INT_CEQ1 = (1<<1),
425  NES_INT_CEQ2 = (1<<2),
426  NES_INT_CEQ3 = (1<<3),
427  NES_INT_CEQ4 = (1<<4),
428  NES_INT_CEQ5 = (1<<5),
429  NES_INT_CEQ6 = (1<<6),
430  NES_INT_CEQ7 = (1<<7),
431  NES_INT_CEQ8 = (1<<8),
432  NES_INT_CEQ9 = (1<<9),
433  NES_INT_CEQ10 = (1<<10),
434  NES_INT_CEQ11 = (1<<11),
435  NES_INT_CEQ12 = (1<<12),
436  NES_INT_CEQ13 = (1<<13),
437  NES_INT_CEQ14 = (1<<14),
438  NES_INT_CEQ15 = (1<<15),
439  NES_INT_AEQ0 = (1<<16),
440  NES_INT_AEQ1 = (1<<17),
441  NES_INT_AEQ2 = (1<<18),
442  NES_INT_AEQ3 = (1<<19),
443  NES_INT_AEQ4 = (1<<20),
444  NES_INT_AEQ5 = (1<<21),
445  NES_INT_AEQ6 = (1<<22),
446  NES_INT_AEQ7 = (1<<23),
447  NES_INT_MAC0 = (1<<24),
448  NES_INT_MAC1 = (1<<25),
449  NES_INT_MAC2 = (1<<26),
450  NES_INT_MAC3 = (1<<27),
451  NES_INT_TSW = (1<<28),
452  NES_INT_TIMER = (1<<29),
453  NES_INT_INTF = (1<<30),
454 };
455 
470 };
471 
477 };
478 
484 };
485 
497 };
498 
516 };
517 
547 };
548 
556 };
557 
567 };
568 
578 };
579 
580 #define NES_IWARP_SQ_FMR_WQE_MR_LENGTH_HIGH_MASK 0xFF;
581 
584 };
585 
608 };
609 
616 };
617 
623 };
624 
625 #define NES_PKT_TYPE_APBVT_BITS 0xC112
626 #define NES_PKT_TYPE_APBVT_MASK 0xff3e
627 
628 #define NES_PKT_TYPE_PVALID_BITS 0x10000000
629 #define NES_PKT_TYPE_PVALID_MASK 0x30000000
630 
631 #define NES_PKT_TYPE_TCPV4_BITS 0x0110
632 #define NES_PKT_TYPE_TCPV4_MASK 0x3f30
633 
634 #define NES_PKT_TYPE_UDPV4_BITS 0x0210
635 #define NES_PKT_TYPE_UDPV4_MASK 0x3f30
636 
637 #define NES_PKT_TYPE_IPV4_BITS 0x0010
638 #define NES_PKT_TYPE_IPV4_MASK 0x3f30
639 
640 #define NES_PKT_TYPE_OTHER_BITS 0x0000
641 #define NES_PKT_TYPE_OTHER_MASK 0x0030
642 
643 #define NES_NIC_CQE_ERRV_SHIFT 16
650 };
651 
654  NES_NIC_CQE_SQ = (1<<24),
658  NES_NIC_CQE_VALID = (1<<31),
659 };
660 
666 };
667 
669  NES_AEQE_QP = (1<<16),
670  NES_AEQE_CQ = (1<<17),
671  NES_AEQE_SQ = (1<<18),
676  NES_AEQE_VALID = (1<<31),
677 };
678 
679 #define NES_AEQE_IWARP_STATE_SHIFT 20
680 #define NES_AEQE_TCP_STATE_SHIFT 24
681 #define NES_AEQE_Q2_DATA_ETHERNET (1<<28)
682 #define NES_AEQE_Q2_DATA_MPA (1<<29)
683 
691 };
692 
706 };
707 
770 };
771 
780 };
781 
794 };
795 
799 };
800 
803 };
804 
805 #define NES_EEPROM_READ_REQUEST (1<<16)
806 #define NES_MAC_ADDR_VALID (1<<20)
807 
808 /*
809  * NES index registers init values.
810  */
815 };
816 
817 /*
818  * NES registers in BAR0.
819  */
820 struct nes_pci_regs {
826  u32 other_regs[59]; /* pad out to 256 bytes for now */
827 };
828 
829 #define NES_CQP_SQ_SIZE 128
830 #define NES_CCQ_SIZE 128
831 #define NES_NIC_WQ_SIZE 512
832 #define NES_NIC_CTX_SIZE ((NES_NIC_CTX_RQ_SIZE_512) | (NES_NIC_CTX_SQ_SIZE_512))
833 #define NES_NIC_BACK_STORE 0x00038000
834 
835 struct nes_device;
836 
839 };
840 
843 };
844 
847 };
848 
851 };
852 
855 };
856 
859 };
860 
863 };
864 
865 struct nes_hw_cqe {
867 };
868 
869 struct nes_hw_ceqe {
871 };
872 
873 struct nes_hw_aeqe {
875 };
876 
878  union {
881  };
884  struct list_head list;
886  void (*cqp_callback)(struct nes_device *nesdev, struct nes_cqp_request *cqp_request);
893 };
894 
895 struct nes_hw_cqp {
904 };
905 
906 #define NES_FIRST_FRAG_SIZE 128
909 };
910 
911 struct nes_hw_nic {
912  struct nes_first_frag *first_frag_vbase; /* virtual address of first frags */
913  struct nes_hw_nic_sq_wqe *sq_vbase; /* virtual address of sq */
914  struct nes_hw_nic_rq_wqe *rq_vbase; /* virtual address of rq */
919  dma_addr_t sq_pbase; /* PCI memory for host rings */
920  dma_addr_t rq_pbase; /* PCI memory for host rings */
921 
931 
933 };
934 
936  struct nes_hw_nic_cqe volatile *cq_vbase; /* PCI memory for host rings */
937  void (*ce_handler)(struct nes_device *nesdev, struct nes_hw_nic_cq *cq);
938  dma_addr_t cq_pbase; /* PCI memory for host rings */
946 };
947 
948 struct nes_hw_qp {
949  struct nes_hw_qp_wqe *sq_vbase; /* PCI memory for host rings */
950  struct nes_hw_qp_wqe *rq_vbase; /* PCI memory for host rings */
951  void *q2_vbase; /* PCI memory for host rings */
952  dma_addr_t sq_pbase; /* PCI memory for host rings */
953  dma_addr_t rq_pbase; /* PCI memory for host rings */
954  dma_addr_t q2_pbase; /* PCI memory for host rings */
964 };
965 
966 struct nes_hw_cq {
967  struct nes_hw_cqe *cq_vbase; /* PCI memory for host rings */
968  void (*ce_handler)(struct nes_device *nesdev, struct nes_hw_cq *cq);
969  dma_addr_t cq_pbase; /* PCI memory for host rings */
973 };
974 
975 struct nes_hw_ceq {
976  struct nes_hw_ceqe volatile *ceq_vbase; /* PCI memory for host rings */
977  dma_addr_t ceq_pbase; /* PCI memory for host rings */
980 };
981 
982 struct nes_hw_aeq {
983  struct nes_hw_aeqe volatile *aeq_vbase; /* PCI memory for host rings */
984  dma_addr_t aeq_pbase; /* PCI memory for host rings */
987 };
988 
989 struct nic_qp_map {
994 };
995 
996 #define NES_CQP_ARP_AEQ_INDEX_MASK 0x000f0000
997 #define NES_CQP_ARP_AEQ_INDEX_SHIFT 16
998 
999 #define NES_CQP_APBVT_ADD 0x00008000
1000 #define NES_CQP_APBVT_NIC_SHIFT 16
1001 
1002 #define NES_ARP_ADD 1
1003 #define NES_ARP_DELETE 2
1004 #define NES_ARP_RESOLVE 3
1005 
1006 #define NES_MAC_SW_IDLE 0
1007 #define NES_MAC_SW_INTERRUPT 1
1008 #define NES_MAC_SW_MH 2
1009 
1013 };
1014 
1015 #define NES_NIC_FAST_TIMER 96
1016 #define NES_NIC_FAST_TIMER_LOW 40
1017 #define NES_NIC_FAST_TIMER_HIGH 1000
1018 #define DEFAULT_NES_QL_HIGH 256
1019 #define DEFAULT_NES_QL_LOW 16
1020 #define DEFAULT_NES_QL_TARGET 64
1021 #define DEFAULT_JUMBO_NES_QL_LOW 12
1022 #define DEFAULT_JUMBO_NES_QL_TARGET 40
1023 #define DEFAULT_JUMBO_NES_QL_HIGH 128
1024 #define NES_NIC_CQ_DOWNWARD_TREND 16
1025 #define NES_PFT_SIZE 48
1026 
1027 #define NES_MGT_WQ_COUNT 32
1028 #define NES_MGT_CTX_SIZE ((NES_NIC_CTX_RQ_SIZE_32) | (NES_NIC_CTX_SQ_SIZE_32))
1029 #define NES_MGT_QP_OFFSET 36
1030 #define NES_MGT_QP_COUNT 4
1031 
1033  /* u16 cq_count; */
1045 };
1046 
1047 #define NES_TIMER_INT_LIMIT 2
1048 #define NES_TIMER_INT_LIMIT_DYNAMIC 10
1049 #define NES_TIMER_ENABLE_LIMIT 4
1050 #define NES_MAX_LINK_INTERRUPTS 128
1051 #define NES_MAX_LINK_CHECK 200
1052 #define NES_MAX_LRO_DESCRIPTORS 32
1053 #define NES_LRO_MAX_AGGR 64
1054 
1055 struct nes_adapter {
1057  unsigned long *allocated_qps;
1058  unsigned long *allocated_cqs;
1059  unsigned long *allocated_mrs;
1060  unsigned long *allocated_pds;
1061  unsigned long *allocated_arps;
1062  struct nes_qp **qp_table;
1064 
1065  struct list_head list;
1067  /* list of the netdev's associated with each logical port */
1069 
1077 
1079 
1080  /* Adapter CEQ and AEQs */
1081  struct nes_hw_ceq ceq[16];
1082  struct nes_hw_aeq aeq[8];
1083 
1085 
1086  unsigned long doorbell_start;
1087 
1096 
1115 
1116  /* EEPROM information */
1129 
1131 
1146 
1147  /* Adapter base MAC address */
1150 
1153 
1155 
1156  /* pd config for each port */
1159 
1162 
1163  /* the phy index for each port */
1169 
1170  /* PCI information */
1171  unsigned int devfn;
1172  unsigned char bus_number;
1173  unsigned char OneG_Mode;
1174 
1175  unsigned char ref_count;
1177  u8 netdev_max; /* from host nic address count in EEPROM */
1184 };
1185 
1186 struct nes_pbl {
1189  struct page *page;
1190  unsigned long user_base;
1192  struct list_head list;
1193  /* TODO: need to add list for two level tables */
1194 };
1195 
1196 #define NES_4K_PBL_CHUNK_SIZE 4096
1197 
1201 };
1202 
1207 };
1208 
1213  struct iw_cm_id *cm_id;
1214  struct list_head list;
1215  unsigned long socket;
1217 };
1218 
1219 struct nes_ib_device;
1220 
1221 #define NES_EVENT_DELAY msecs_to_jiffies(100)
1222 
1223 struct nes_vnic {
1236  /* void *mem; */
1241  int budget;
1243  /* u32 tx_avail; */
1246  spinlock_t tx_lock; /* could use netdev tx lock? */
1249  void *nic_vbase;
1251  struct nes_hw_nic nic;
1255  struct nes_cqp_request* (*get_cqp_request)(struct nes_device *nesdev);
1257  int (*mcrq_mcast_filter)( struct nes_vnic* nesvnic, __u8* dmi_addr );
1259  /* used to put the netdev on the adapters logical port list */
1260  struct list_head list;
1265  u8 netdev_index; /* might not be needed, indexes nesdev->netdev */
1280  void *mgt_vbase;
1286 
1287 };
1288 
1292 
1293  /* Virtual RNIC Limits */
1302 };
1303 
1308 };
1309 
1314 };
1315 
1324 };
1325 
1338 };
1339 
1353 };
1354 
1356  MPA_CLOSED = 0x01,
1357  MPA_CRC = 0x02,
1358  MPA_MARKER = 0x03,
1359  MPA_REQ_RSP = 0x04,
1360 };
1361 
1367 };
1368 
1369 /* Used to determine how to fill in terminate error codes */
1370 #define IWARP_OPCODE_WRITE 0
1371 #define IWARP_OPCODE_READREQ 1
1372 #define IWARP_OPCODE_READRSP 2
1373 #define IWARP_OPCODE_SEND 3
1374 #define IWARP_OPCODE_SEND_INV 4
1375 #define IWARP_OPCODE_SEND_SE 5
1376 #define IWARP_OPCODE_SEND_SE_INV 6
1377 #define IWARP_OPCODE_TERM 7
1378 
1379 /* These values are used only during terminate processing */
1380 #define TERM_DDP_LEN_TAGGED 14
1381 #define TERM_DDP_LEN_UNTAGGED 18
1382 #define TERM_RDMA_LEN 28
1383 #define RDMA_OPCODE_MASK 0x0f
1384 #define RDMA_READ_REQ_OPCODE 1
1385 #define BAD_FRAME_OFFSET 64
1386 #define CQE_MAJOR_DRV 0x8000
1387 
1388 /* Used for link status recheck after interrupt processing */
1389 #define NES_LINK_RECHECK_DELAY msecs_to_jiffies(50)
1390 #define NES_LINK_RECHECK_MAX 60
1391 
1392 #endif /* __NES_HW_H */