blob: e6f7eb1a7d879b23ba57e8e03f301f38b7c33d12 [file] [log] [blame]
Parav Pandit045508a2012-03-26 14:27:13 +00001/*
Vasundhara Volam40263822014-02-12 16:09:07 +05302 * Copyright (C) 2005 - 2014 Emulex
Parav Pandit045508a2012-03-26 14:27:13 +00003 * 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 Sharma24071162014-02-04 11:56:59 +053024#define BE_ROCE_ABI_VERSION 1
25
Parav Pandit045508a2012-03-26 14:27:13 +000026struct ocrdma_dev;
27
28enum be_interrupt_mode {
29 BE_INTERRUPT_MODE_MSIX = 0,
30 BE_INTERRUPT_MODE_INTX = 1,
31 BE_INTERRUPT_MODE_MSI = 2,
32};
33
Sathya Perla92bf14a2013-08-27 16:57:32 +053034#define MAX_MSIX_VECTORS 32
Parav Pandit045508a2012-03-26 14:27:13 +000035struct 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 Perla92bf14a2013-08-27 16:57:32 +053050 u32 vector_list[MAX_MSIX_VECTORS];
Parav Pandit045508a2012-03-26 14:27:13 +000051 } msix;
52};
53
54/* ocrdma driver register's the callback functions with nic driver. */
55struct ocrdma_driver {
56 unsigned char name[32];
Devesh Sharma24071162014-02-04 11:56:59 +053057 u32 be_abi_version;
Parav Pandit045508a2012-03-26 14:27:13 +000058 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
63enum {
64 BE_DEV_UP = 0,
Devesh Sharmad114f992014-06-10 19:32:15 +053065 BE_DEV_DOWN = 1,
66 BE_DEV_SHUTDOWN = 2
Parav Pandit045508a2012-03-26 14:27:13 +000067};
68
69/* APIs for RoCE driver to register callback handlers,
70 * which will be invoked when device is added, removed, ifup, ifdown
71 */
72int be_roce_register_driver(struct ocrdma_driver *drv);
73void be_roce_unregister_driver(struct ocrdma_driver *drv);
74
75/* API for RoCE driver to issue mailbox commands */
76int 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 */