igc.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2018 Intel Corporation */
  3. #ifndef _IGC_H_
  4. #define _IGC_H_
  5. #include <linux/kobject.h>
  6. #include <linux/pci.h>
  7. #include <linux/netdevice.h>
  8. #include <linux/vmalloc.h>
  9. #include <linux/ethtool.h>
  10. #include <linux/sctp.h>
  11. #define IGC_ERR(args...) pr_err("igc: " args)
  12. #define PFX "igc: "
  13. #include <linux/timecounter.h>
  14. #include <linux/net_tstamp.h>
  15. #include <linux/ptp_clock_kernel.h>
  16. #include "igc_hw.h"
  17. /* main */
  18. extern char igc_driver_name[];
  19. extern char igc_driver_version[];
  20. /* Transmit and receive queues */
  21. #define IGC_MAX_RX_QUEUES 4
  22. #define IGC_MAX_TX_QUEUES 4
  23. #define MAX_Q_VECTORS 8
  24. #define MAX_STD_JUMBO_FRAME_SIZE 9216
  25. enum igc_state_t {
  26. __IGC_TESTING,
  27. __IGC_RESETTING,
  28. __IGC_DOWN,
  29. __IGC_PTP_TX_IN_PROGRESS,
  30. };
  31. struct igc_q_vector {
  32. struct igc_adapter *adapter; /* backlink */
  33. struct napi_struct napi;
  34. };
  35. struct igc_mac_addr {
  36. u8 addr[ETH_ALEN];
  37. u8 queue;
  38. u8 state; /* bitmask */
  39. };
  40. #define IGC_MAC_STATE_DEFAULT 0x1
  41. #define IGC_MAC_STATE_MODIFIED 0x2
  42. #define IGC_MAC_STATE_IN_USE 0x4
  43. /* Board specific private data structure */
  44. struct igc_adapter {
  45. struct net_device *netdev;
  46. unsigned long state;
  47. unsigned int flags;
  48. unsigned int num_q_vectors;
  49. u16 link_speed;
  50. u16 link_duplex;
  51. u8 port_num;
  52. u8 __iomem *io_addr;
  53. struct work_struct watchdog_task;
  54. int msg_enable;
  55. u32 max_frame_size;
  56. /* OS defined structs */
  57. struct pci_dev *pdev;
  58. /* structs defined in igc_hw.h */
  59. struct igc_hw hw;
  60. struct igc_q_vector *q_vector[MAX_Q_VECTORS];
  61. struct igc_mac_addr *mac_table;
  62. };
  63. #endif /* _IGC_H_ */