linux/include/net/mana/hw_channel.h

/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/* Copyright (c) 2021, Microsoft Corporation. */

#ifndef _HW_CHANNEL_H
#define _HW_CHANNEL_H

#define DEFAULT_LOG2_THROTTLING_FOR_ERROR_EQ

#define HW_CHANNEL_MAX_REQUEST_SIZE
#define HW_CHANNEL_MAX_RESPONSE_SIZE

#define HW_CHANNEL_VF_BOOTSTRAP_QUEUE_DEPTH

#define HWC_INIT_DATA_CQID
#define HWC_INIT_DATA_RQID
#define HWC_INIT_DATA_SQID
#define HWC_INIT_DATA_QUEUE_DEPTH
#define HWC_INIT_DATA_MAX_REQUEST
#define HWC_INIT_DATA_MAX_RESPONSE
#define HWC_INIT_DATA_MAX_NUM_CQS
#define HWC_INIT_DATA_PDID
#define HWC_INIT_DATA_GPA_MKEY
#define HWC_INIT_DATA_PF_DEST_RQ_ID
#define HWC_INIT_DATA_PF_DEST_CQ_ID

#define HWC_DATA_CFG_HWC_TIMEOUT

#define HW_CHANNEL_WAIT_RESOURCE_TIMEOUT_MS

/* Structures labeled with "HW DATA" are exchanged with the hardware. All of
 * them are naturally aligned and hence don't need __packed.
 */

hwc_init_eq_id_db; /* HW DATA */

hwc_init_type_data; /* HW DATA */

struct hwc_rx_oob {}; /* HW DATA */

struct hwc_tx_oob {}; /* HW DATA */

struct hwc_work_request {};

/* hwc_dma_buf represents the array of in-flight WQEs.
 * mem_info as know as the GDMA mapped memory is partitioned and used by
 * in-flight WQEs.
 * The number of WQEs is determined by the number of in-flight messages.
 */
struct hwc_dma_buf {};

hwc_rx_event_handler_t;

hwc_tx_event_handler_t;

struct hwc_cq {};

struct hwc_wq {};

struct hwc_caller_ctx {};

struct hw_channel_context {};

int mana_hwc_create_channel(struct gdma_context *gc);
void mana_hwc_destroy_channel(struct gdma_context *gc);

int mana_hwc_send_request(struct hw_channel_context *hwc, u32 req_len,
			  const void *req, u32 resp_len, void *resp);

#endif /* _HW_CHANNEL_H */