1 /* 2 * Copyright (C) 2005 - 2015 Emulex 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 #define BE_ROCE_ABI_VERSION 1 25 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 34 #define MAX_MSIX_VECTORS 32 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; 50 u32 vector_list[MAX_MSIX_VECTORS]; 51 } msix; 52 }; 53 54 /* ocrdma driver register's the callback functions with nic driver. */ 55 struct ocrdma_driver { 56 unsigned char name[32]; 57 u32 be_abi_version; 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, 65 BE_DEV_DOWN = 1, 66 BE_DEV_SHUTDOWN = 2 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 */ 80