Commit | Line | Data |
---|---|---|
045508a8 | 1 | /* |
c7bb15a6 | 2 | * Copyright (C) 2005 - 2013 Emulex |
045508a8 PP |
3 | * All rights reserved. |
4 | * | |
5 | * This program is free software; you can redistribute it and/or | |
6 | * modify it under the terms of the GNU General Public License version 2 | |
7 | * as published by the Free Software Foundation. The full GNU General | |
8 | * Public License is included in this distribution in the file called COPYING. | |
9 | * | |
10 | * Contact Information: | |
11 | * linux-drivers@emulex.com | |
12 | * | |
13 | * Emulex | |
14 | * 3333 Susan Street | |
15 | * Costa Mesa, CA 92626 | |
16 | */ | |
17 | ||
18 | #ifndef BE_ROCE_H | |
19 | #define BE_ROCE_H | |
20 | ||
21 | #include <linux/pci.h> | |
22 | #include <linux/netdevice.h> | |
23 | ||
24 | struct ocrdma_dev; | |
25 | ||
26 | enum be_interrupt_mode { | |
27 | BE_INTERRUPT_MODE_MSIX = 0, | |
28 | BE_INTERRUPT_MODE_INTX = 1, | |
29 | BE_INTERRUPT_MODE_MSI = 2, | |
30 | }; | |
31 | ||
32 | #define MAX_ROCE_MSIX_VECTORS 16 | |
33 | struct be_dev_info { | |
34 | u8 __iomem *db; | |
35 | u64 unmapped_db; | |
36 | u32 db_page_size; | |
37 | u32 db_total_size; | |
38 | u64 dpp_unmapped_addr; | |
39 | u32 dpp_unmapped_len; | |
40 | struct pci_dev *pdev; | |
41 | struct net_device *netdev; | |
42 | u8 mac_addr[ETH_ALEN]; | |
43 | u32 dev_family; | |
44 | enum be_interrupt_mode intr_mode; | |
45 | struct { | |
46 | int num_vectors; | |
47 | int start_vector; | |
48 | u32 vector_list[MAX_ROCE_MSIX_VECTORS]; | |
49 | } msix; | |
50 | }; | |
51 | ||
52 | /* ocrdma driver register's the callback functions with nic driver. */ | |
53 | struct ocrdma_driver { | |
54 | unsigned char name[32]; | |
55 | struct ocrdma_dev *(*add) (struct be_dev_info *dev_info); | |
56 | void (*remove) (struct ocrdma_dev *); | |
57 | void (*state_change_handler) (struct ocrdma_dev *, u32 new_state); | |
58 | }; | |
59 | ||
60 | enum { | |
61 | BE_DEV_UP = 0, | |
62 | BE_DEV_DOWN = 1 | |
63 | }; | |
64 | ||
65 | /* APIs for RoCE driver to register callback handlers, | |
66 | * which will be invoked when device is added, removed, ifup, ifdown | |
67 | */ | |
68 | int be_roce_register_driver(struct ocrdma_driver *drv); | |
69 | void be_roce_unregister_driver(struct ocrdma_driver *drv); | |
70 | ||
71 | /* API for RoCE driver to issue mailbox commands */ | |
72 | int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload, | |
73 | int wrb_payload_size, u16 *cmd_status, u16 *ext_status); | |
74 | ||
75 | #endif /* BE_ROCE_H */ |