xref: /linux/drivers/net/ethernet/zte/dinghai/dh_queue.h (revision 91ec2035134982b98fab0609a9fd8480e8217dc1)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * ZTE DingHai Ethernet driver - PCI capability definitions
4  * Copyright (c) 2022-2026, ZTE Corporation.
5  */
6 
7 #ifndef __DH_QUEUE_H__
8 #define __DH_QUEUE_H__
9 
10 #include <linux/types.h>
11 
12 /* This is the PCI capability header: */
13 struct zxdh_pf_pci_cap {
14 	__u8 cap_vndr;		/* Generic PCI field: PCI_CAP_ID_VNDR */
15 	__u8 cap_next;		/* Generic PCI field: next ptr. */
16 	__u8 cap_len;		/* Generic PCI field: capability length */
17 	__u8 cfg_type;		/* Identifies the structure. */
18 	__u8 bar;		/* Where to find it. */
19 	__u8 id;		/* Multiple capabilities of the same type */
20 	__u8 padding[2];		/* Pad to full dword. */
21 	__le32 offset;		/* Offset within bar. */
22 	__le32 length;		/* Length of the structure, in bytes. */
23 };
24 
25 /* Fields in ZXDH_PF_PCI_CAP_COMMON_CFG: */
26 struct zxdh_pf_pci_common_cfg {
27 	/* About the whole device. */
28 	__le32 device_feature_select; /* read-write */
29 	__le32 device_feature;	/* read-only */
30 	__le32 guest_feature_select; /* read-write */
31 	__le32 guest_feature;		/* read-write */
32 	__le16 msix_config;		/* read-write */
33 	__le16 num_queues;		/* read-only */
34 	__u8 device_status;		/* read-write */
35 	__u8 config_generation;	/* read-only */
36 
37 	/* About a specific virtqueue. */
38 	__le16 queue_select;		/* read-write */
39 	__le16 queue_size;		/* read-write, power of 2. */
40 	__le16 queue_msix_vector;	/* read-write */
41 	__le16 queue_enable;		/* read-write */
42 	__le16 queue_notify_off;	/* read-only */
43 	__le32 queue_desc_lo;		/* read-write */
44 	__le32 queue_desc_hi;		/* read-write */
45 	__le32 queue_avail_lo;		/* read-write */
46 	__le32 queue_avail_hi;		/* read-write */
47 	__le32 queue_used_lo;		/* read-write */
48 	__le32 queue_used_hi;		/* read-write */
49 };
50 
51 struct zxdh_pf_pci_notify_cap {
52 	struct zxdh_pf_pci_cap cap;
53 	__le32 notify_off_multiplier; /* Multiplier for queue_notify_off. */
54 };
55 
56 #endif /* __DH_QUEUE_H__ */
57