summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/intel/ixd/ixd.h
blob: 2a09ccba13d58bcab4c1e8157afb2a88694327c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
61
62
63
64
65
66
67
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (C) 2025 Intel Corporation */

#ifndef _IXD_H_
#define _IXD_H_

#include <linux/net/intel/libie/controlq.h>

#define IXD_INIT_TASK_DELAY_JIFFIES	msecs_to_jiffies(500)

/**
 * struct ixd_adapter - Data structure representing a CPF
 * @cp_ctx: Control plane communication context
 * @init_task: Delayed initialization after reset
 * @init_task.init_work: Delayed initialization work
 * @init_task.reset_retries: How many times to check, whether reset is completed
 * @init_task.vc_retries: Number of retries to establish mailbox communication
 * @init_task.success: init_work completion status
 * @mbx_task: Control queue Rx handling
 * @xnm: virtchnl transaction manager
 * @asq: Send control queue info
 * @arq: Receive control queue info
 * @vc_ver: Negotiated virtchnl version
 * @vc_ver.major: Negotiated major virtchnl version
 * @vc_ver.minor: Negotiated minor virtchnl version
 * @caps: Negotiated virtchnl capabilities
 */
struct ixd_adapter {
	struct libie_ctlq_ctx cp_ctx;
	struct {
		struct delayed_work init_work;
		u8 reset_retries;
		u8 vc_retries;
		bool success;
	} init_task;
	struct delayed_work mbx_task;
	struct libie_ctlq_xn_manager *xnm;
	struct libie_ctlq_info *asq;
	struct libie_ctlq_info *arq;
	struct {
		u32 major;
		u32 minor;
	} vc_ver;
	struct virtchnl2_get_capabilities caps;
};

/**
 * ixd_to_dev - Get the corresponding device struct from an adapter
 * @adapter: PCI device driver-specific private data
 *
 * Return: struct device corresponding to the given adapter
 */
static inline struct device *ixd_to_dev(struct ixd_adapter *adapter)
{
	return &adapter->cp_ctx.mmio_info.pdev->dev;
}

void ixd_ctlq_reg_init(struct ixd_adapter *adapter,
		       struct libie_ctlq_reg *ctlq_reg_tx,
		       struct libie_ctlq_reg *ctlq_reg_rx);
void ixd_trigger_reset(struct ixd_adapter *adapter);
bool ixd_check_reset_complete(struct ixd_adapter *adapter);
void ixd_init_task(struct work_struct *work);
int ixd_init_dflt_mbx(struct ixd_adapter *adapter);
void ixd_deinit_dflt_mbx(struct ixd_adapter *adapter);

#endif /* _IXD_H_ */