igc.h 1.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c)  2018 Intel Corporation */

#ifndef _IGC_H_
#define _IGC_H_

#include <linux/kobject.h>

#include <linux/pci.h>
#include <linux/netdevice.h>
#include <linux/vmalloc.h>

#include <linux/ethtool.h>

#include <linux/sctp.h>

#define IGC_ERR(args...) pr_err("igc: " args)

#define PFX "igc: "

#include <linux/timecounter.h>
#include <linux/net_tstamp.h>
#include <linux/ptp_clock_kernel.h>

S
Sasha Neftin 已提交
25 26
#include "igc_hw.h"

27 28 29 30
/* main */
extern char igc_driver_name[];
extern char igc_driver_version[];

S
Sasha Neftin 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
/* Transmit and receive queues */
#define IGC_MAX_RX_QUEUES		4
#define IGC_MAX_TX_QUEUES		4

#define MAX_Q_VECTORS			8
#define MAX_STD_JUMBO_FRAME_SIZE	9216

enum igc_state_t {
	__IGC_TESTING,
	__IGC_RESETTING,
	__IGC_DOWN,
	__IGC_PTP_TX_IN_PROGRESS,
};

struct igc_q_vector {
	struct igc_adapter *adapter;    /* backlink */

	struct napi_struct napi;
};

struct igc_mac_addr {
	u8 addr[ETH_ALEN];
	u8 queue;
	u8 state; /* bitmask */
};

#define IGC_MAC_STATE_DEFAULT	0x1
#define IGC_MAC_STATE_MODIFIED	0x2
#define IGC_MAC_STATE_IN_USE	0x4

S
Sasha Neftin 已提交
61 62
/* Board specific private data structure */
struct igc_adapter {
S
Sasha Neftin 已提交
63 64 65 66 67 68 69 70 71 72
	struct net_device *netdev;

	unsigned long state;
	unsigned int flags;
	unsigned int num_q_vectors;
	u16 link_speed;
	u16 link_duplex;

	u8 port_num;

S
Sasha Neftin 已提交
73
	u8 __iomem *io_addr;
S
Sasha Neftin 已提交
74 75 76 77
	struct work_struct watchdog_task;

	int msg_enable;
	u32 max_frame_size;
S
Sasha Neftin 已提交
78 79 80 81 82 83

	/* OS defined structs */
	struct pci_dev *pdev;

	/* structs defined in igc_hw.h */
	struct igc_hw hw;
S
Sasha Neftin 已提交
84 85 86 87

	struct igc_q_vector *q_vector[MAX_Q_VECTORS];

	struct igc_mac_addr *mac_table;
S
Sasha Neftin 已提交
88 89
};

90
#endif /* _IGC_H_ */