Parav Pandit | 045508a | 2012-03-26 14:27:13 +0000 | [diff] [blame] | 1 | /* |
Vasundhara Volam | 4026382 | 2014-02-12 16:09:07 +0530 | [diff] [blame] | 2 | * Copyright (C) 2005 - 2014 Emulex |
Parav Pandit | 045508a | 2012-03-26 14:27:13 +0000 | [diff] [blame] | 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 | |
Devesh Sharma | 2407116 | 2014-02-04 11:56:59 +0530 | [diff] [blame] | 24 | #define BE_ROCE_ABI_VERSION 1 |
| 25 | |
Parav Pandit | 045508a | 2012-03-26 14:27:13 +0000 | [diff] [blame] | 26 | struct ocrdma_dev; |
| 27 | |
| 28 | enum be_interrupt_mode { |
| 29 | BE_INTERRUPT_MODE_MSIX = 0, |
| 30 | BE_INTERRUPT_MODE_INTX = 1, |
| 31 | BE_INTERRUPT_MODE_MSI = 2, |
| 32 | }; |
| 33 | |
Sathya Perla | 92bf14a | 2013-08-27 16:57:32 +0530 | [diff] [blame] | 34 | #define MAX_MSIX_VECTORS 32 |
Parav Pandit | 045508a | 2012-03-26 14:27:13 +0000 | [diff] [blame] | 35 | struct be_dev_info { |
| 36 | u8 __iomem *db; |
| 37 | u64 unmapped_db; |
| 38 | u32 db_page_size; |
| 39 | u32 db_total_size; |
| 40 | u64 dpp_unmapped_addr; |
| 41 | u32 dpp_unmapped_len; |
| 42 | struct pci_dev *pdev; |
| 43 | struct net_device *netdev; |
| 44 | u8 mac_addr[ETH_ALEN]; |
| 45 | u32 dev_family; |
| 46 | enum be_interrupt_mode intr_mode; |
| 47 | struct { |
| 48 | int num_vectors; |
| 49 | int start_vector; |
Sathya Perla | 92bf14a | 2013-08-27 16:57:32 +0530 | [diff] [blame] | 50 | u32 vector_list[MAX_MSIX_VECTORS]; |
Parav Pandit | 045508a | 2012-03-26 14:27:13 +0000 | [diff] [blame] | 51 | } msix; |
| 52 | }; |
| 53 | |
| 54 | /* ocrdma driver register's the callback functions with nic driver. */ |
| 55 | struct ocrdma_driver { |
| 56 | unsigned char name[32]; |
Devesh Sharma | 2407116 | 2014-02-04 11:56:59 +0530 | [diff] [blame] | 57 | u32 be_abi_version; |
Parav Pandit | 045508a | 2012-03-26 14:27:13 +0000 | [diff] [blame] | 58 | struct ocrdma_dev *(*add) (struct be_dev_info *dev_info); |
| 59 | void (*remove) (struct ocrdma_dev *); |
| 60 | void (*state_change_handler) (struct ocrdma_dev *, u32 new_state); |
| 61 | }; |
| 62 | |
| 63 | enum { |
| 64 | BE_DEV_UP = 0, |
Devesh Sharma | d114f99 | 2014-06-10 19:32:15 +0530 | [diff] [blame] | 65 | BE_DEV_DOWN = 1, |
| 66 | BE_DEV_SHUTDOWN = 2 |
Parav Pandit | 045508a | 2012-03-26 14:27:13 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
| 69 | /* APIs for RoCE driver to register callback handlers, |
| 70 | * which will be invoked when device is added, removed, ifup, ifdown |
| 71 | */ |
| 72 | int be_roce_register_driver(struct ocrdma_driver *drv); |
| 73 | void be_roce_unregister_driver(struct ocrdma_driver *drv); |
| 74 | |
| 75 | /* API for RoCE driver to issue mailbox commands */ |
| 76 | int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload, |
| 77 | int wrb_payload_size, u16 *cmd_status, u16 *ext_status); |
| 78 | |
| 79 | #endif /* BE_ROCE_H */ |