• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2005 - 2016 Broadcom
4  * All rights reserved.
5  *
6  * Contact Information:
7  * linux-drivers@emulex.com
8  *
9  * Emulex
10  * 3333 Susan Street
11  * Costa Mesa, CA 92626
12  */
13 
14 #ifndef BE_ROCE_H
15 #define BE_ROCE_H
16 
17 #include <linux/pci.h>
18 #include <linux/netdevice.h>
19 
20 #define BE_ROCE_ABI_VERSION	1
21 
22 struct ocrdma_dev;
23 
24 enum be_interrupt_mode {
25 	BE_INTERRUPT_MODE_MSIX	= 0,
26 	BE_INTERRUPT_MODE_INTX	= 1,
27 	BE_INTERRUPT_MODE_MSI	= 2,
28 };
29 
30 #define MAX_MSIX_VECTORS		32
31 struct be_dev_info {
32 	u8 __iomem *db;
33 	u64 unmapped_db;
34 	u32 db_page_size;
35 	u32 db_total_size;
36 	u64 dpp_unmapped_addr;
37 	u32 dpp_unmapped_len;
38 	struct pci_dev *pdev;
39 	struct net_device *netdev;
40 	u8 mac_addr[ETH_ALEN];
41 	u32 dev_family;
42 	enum be_interrupt_mode intr_mode;
43 	struct {
44 		int num_vectors;
45 		int start_vector;
46 		u32 vector_list[MAX_MSIX_VECTORS];
47 	} msix;
48 };
49 
50 /* ocrdma driver register's the callback functions with nic driver. */
51 struct ocrdma_driver {
52 	unsigned char name[32];
53 	u32 be_abi_version;
54 	struct ocrdma_dev *(*add) (struct be_dev_info *dev_info);
55 	void (*remove) (struct ocrdma_dev *);
56 	void (*state_change_handler) (struct ocrdma_dev *, u32 new_state);
57 };
58 
59 enum be_roce_event {
60 	BE_DEV_SHUTDOWN = 2
61 };
62 
63 /* APIs for RoCE driver to register callback handlers,
64  * which will be invoked when device is added, removed, ifup, ifdown
65  */
66 int be_roce_register_driver(struct ocrdma_driver *drv);
67 void be_roce_unregister_driver(struct ocrdma_driver *drv);
68 
69 /* API for RoCE driver to issue mailbox commands */
70 int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload,
71 		    int wrb_payload_size, u16 *cmd_status, u16 *ext_status);
72 
73 #endif /* BE_ROCE_H */
74