1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* Copyright (C) 2025 Intel Corporation */ 3 4 #ifndef _IXD_H_ 5 #define _IXD_H_ 6 7 #include <linux/net/intel/libie/controlq.h> 8 9 #define IXD_INIT_TASK_DELAY_JIFFIES msecs_to_jiffies(500) 10 11 /** 12 * struct ixd_adapter - Data structure representing a CPF 13 * @cp_ctx: Control plane communication context 14 * @init_task: Delayed initialization after reset 15 * @init_task.init_work: Delayed initialization work 16 * @init_task.reset_retries: How many times to check, whether reset is completed 17 * @init_task.vc_retries: Number of retries to establish mailbox communication 18 * @init_task.success: init_work completion status 19 * @mbx_task: Control queue Rx handling 20 * @xnm: virtchnl transaction manager 21 * @asq: Send control queue info 22 * @arq: Receive control queue info 23 * @vc_ver: Negotiated virtchnl version 24 * @vc_ver.major: Negotiated major virtchnl version 25 * @vc_ver.minor: Negotiated minor virtchnl version 26 * @caps: Negotiated virtchnl capabilities 27 */ 28 struct ixd_adapter { 29 struct libie_ctlq_ctx cp_ctx; 30 struct { 31 struct delayed_work init_work; 32 u8 reset_retries; 33 u8 vc_retries; 34 bool success; 35 } init_task; 36 struct delayed_work mbx_task; 37 struct libie_ctlq_xn_manager *xnm; 38 struct libie_ctlq_info *asq; 39 struct libie_ctlq_info *arq; 40 struct { 41 u32 major; 42 u32 minor; 43 } vc_ver; 44 struct virtchnl2_get_capabilities caps; 45 }; 46 47 /** 48 * ixd_to_dev - Get the corresponding device struct from an adapter 49 * @adapter: PCI device driver-specific private data 50 * 51 * Return: struct device corresponding to the given adapter 52 */ ixd_to_dev(struct ixd_adapter * adapter)53static inline struct device *ixd_to_dev(struct ixd_adapter *adapter) 54 { 55 return &adapter->cp_ctx.mmio_info.pdev->dev; 56 } 57 58 void ixd_ctlq_reg_init(struct ixd_adapter *adapter, 59 struct libie_ctlq_reg *ctlq_reg_tx, 60 struct libie_ctlq_reg *ctlq_reg_rx); 61 void ixd_trigger_reset(struct ixd_adapter *adapter); 62 bool ixd_check_reset_complete(struct ixd_adapter *adapter); 63 void ixd_init_task(struct work_struct *work); 64 int ixd_init_dflt_mbx(struct ixd_adapter *adapter); 65 void ixd_deinit_dflt_mbx(struct ixd_adapter *adapter); 66 67 #endif /* _IXD_H_ */ 68