ice_adapter.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* SPDX-FileCopyrightText: Copyright Red Hat */
  3. #ifndef _ICE_ADAPTER_H_
  4. #define _ICE_ADAPTER_H_
  5. #include <linux/types.h>
  6. #include <linux/spinlock_types.h>
  7. #include <linux/refcount_types.h>
  8. struct pci_dev;
  9. struct ice_pf;
  10. /**
  11. * struct ice_port_list - data used to store the list of adapter ports
  12. *
  13. * This structure contains data used to maintain a list of adapter ports
  14. *
  15. * @ports: list of ports
  16. * @lock: protect access to the ports list
  17. */
  18. struct ice_port_list {
  19. struct list_head ports;
  20. /* To synchronize the ports list operations */
  21. struct mutex lock;
  22. };
  23. /**
  24. * struct ice_adapter - PCI adapter resources shared across PFs
  25. * @ptp_gltsyn_time_lock: Spinlock protecting access to the GLTSYN_TIME
  26. * register of the PTP clock.
  27. * @refcount: Reference count. struct ice_pf objects hold the references.
  28. * @ctrl_pf: Control PF of the adapter
  29. * @ports: Ports list
  30. * @index: 64-bit index cached for collision detection on 32bit systems
  31. */
  32. struct ice_adapter {
  33. refcount_t refcount;
  34. /* For access to the GLTSYN_TIME register */
  35. spinlock_t ptp_gltsyn_time_lock;
  36. struct ice_pf *ctrl_pf;
  37. struct ice_port_list ports;
  38. u64 index;
  39. };
  40. struct ice_adapter *ice_adapter_get(struct pci_dev *pdev);
  41. void ice_adapter_put(struct pci_dev *pdev);
  42. #endif /* _ICE_ADAPTER_H */