summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/pensando/ionic/ionic_api.h
blob: e0b766d1769f54ae1cc3ed09dc18849f2db05d2c (plain) (blame)
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
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2018-2025, Advanced Micro Devices, Inc. */

#ifndef _IONIC_API_H_
#define _IONIC_API_H_

#include <linux/auxiliary_bus.h>
#include "ionic_if.h"
#include "ionic_regs.h"

/**
 * struct ionic_aux_dev - Auxiliary device information
 * @lif:        Logical interface
 * @idx:        Index identifier
 * @adev:       Auxiliary device
 */
struct ionic_aux_dev {
	struct ionic_lif *lif;
	int idx;
	struct auxiliary_device adev;
};

/**
 * struct ionic_admin_ctx - Admin command context
 * @work:       Work completion wait queue element
 * @cmd:        Admin command (64B) to be copied to the queue
 * @comp:       Admin completion (16B) copied from the queue
 */
struct ionic_admin_ctx {
	struct completion work;
	union ionic_adminq_cmd cmd;
	union ionic_adminq_comp comp;
};

/**
 * ionic_adminq_post_wait - Post an admin command and wait for response
 * @lif:        Logical interface
 * @ctx:        API admin command context
 *
 * Post the command to an admin queue in the ethernet driver.  If this command
 * succeeds, then the command has been posted, but that does not indicate a
 * completion.  If this command returns success, then the completion callback
 * will eventually be called.
 *
 * Return: zero or negative error status
 */
int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);

/**
 * ionic_error_to_errno - Transform ionic_if errors to os errno
 * @code:       Ionic error number
 *
 * Return:      Negative OS error number or zero
 */
int ionic_error_to_errno(enum ionic_status_code code);

/**
 * ionic_request_rdma_reset - request reset or disable the device or lif
 * @lif:        Logical interface
 *
 * The reset is triggered asynchronously. It will wait until reset request
 * completes or times out.
 */
void ionic_request_rdma_reset(struct ionic_lif *lif);

#endif /* _IONIC_API_H_ */