be_roce.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (C) 2005 - 2016 Broadcom
  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. #ifndef BE_ROCE_H
  18. #define BE_ROCE_H
  19. #include <linux/pci.h>
  20. #include <linux/netdevice.h>
  21. #define BE_ROCE_ABI_VERSION 1
  22. struct ocrdma_dev;
  23. enum be_interrupt_mode {
  24. BE_INTERRUPT_MODE_MSIX = 0,
  25. BE_INTERRUPT_MODE_INTX = 1,
  26. BE_INTERRUPT_MODE_MSI = 2,
  27. };
  28. #define MAX_MSIX_VECTORS 32
  29. struct be_dev_info {
  30. u8 __iomem *db;
  31. u64 unmapped_db;
  32. u32 db_page_size;
  33. u32 db_total_size;
  34. u64 dpp_unmapped_addr;
  35. u32 dpp_unmapped_len;
  36. struct pci_dev *pdev;
  37. struct net_device *netdev;
  38. u8 mac_addr[ETH_ALEN];
  39. u32 dev_family;
  40. enum be_interrupt_mode intr_mode;
  41. struct {
  42. int num_vectors;
  43. int start_vector;
  44. u32 vector_list[MAX_MSIX_VECTORS];
  45. } msix;
  46. };
  47. /* ocrdma driver register's the callback functions with nic driver. */
  48. struct ocrdma_driver {
  49. unsigned char name[32];
  50. u32 be_abi_version;
  51. struct ocrdma_dev *(*add) (struct be_dev_info *dev_info);
  52. void (*remove) (struct ocrdma_dev *);
  53. void (*state_change_handler) (struct ocrdma_dev *, u32 new_state);
  54. };
  55. enum be_roce_event {
  56. BE_DEV_SHUTDOWN = 2
  57. };
  58. /* APIs for RoCE driver to register callback handlers,
  59. * which will be invoked when device is added, removed, ifup, ifdown
  60. */
  61. int be_roce_register_driver(struct ocrdma_driver *drv);
  62. void be_roce_unregister_driver(struct ocrdma_driver *drv);
  63. /* API for RoCE driver to issue mailbox commands */
  64. int be_roce_mcc_cmd(void *netdev_handle, void *wrb_payload,
  65. int wrb_payload_size, u16 *cmd_status, u16 *ext_status);
  66. #endif /* BE_ROCE_H */