be_roce.h 1.8 KB

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