forked from Xilinx/open-nic-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
onic_hardware.h
145 lines (126 loc) · 3.72 KB
/
onic_hardware.h
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
* Copyright (c) 2020 Xilinx, Inc.
* All rights reserved.
*
* This source code is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*/
#ifndef __ONIC_HARDWARE_H__
#define __ONIC_HARDWARE_H__
#include "qdma_export.h"
#define ONIC_MAX_CMACS 2
#define ONIC_CMAC_CORE_VERSION 0x00000301
struct onic_hardware {
int RS_FEC;
unsigned long qdma;
u8 num_cmacs;
void __iomem *addr; /* mapping of shell registers */
};
struct onic_qdma_h2c_param {
u8 rngcnt_idx;
dma_addr_t dma_addr;
u16 vid;
};
struct onic_qdma_c2h_param {
u8 bufsz_idx;
u8 desc_rngcnt_idx;
u8 cmpl_rngcnt_idx;
u8 cmpl_desc_sz;
dma_addr_t desc_dma_addr;
dma_addr_t cmpl_dma_addr;
u16 vid;
};
struct onic_private;
/**
* onic_ring_count - get the number of descriptors from index
* @idx: index into the pool
*
* Return the number of descriptors pointed at index
**/
u16 onic_ring_count(u8 idx);
/**
* onic_init_hardware - initialize NIC hardware
* @priv: pointer to driver private data
*
* Return 0 on success, negative on failure
**/
int onic_init_hardware(struct onic_private *priv);
/**
* onic_clear_hardware - clear NIC hardware
* @priv: pointer to driver private data
**/
void onic_clear_hardware(struct onic_private *priv);
/**
* onic_qdma_init_error_interrupt - initialize QDMA error interrupt
* @qdma: handle to QDMA device
* @vid: vector ID
**/
void onic_qdma_init_error_interrupt(unsigned long qdma, u16 vid);
/**
* onic_qdma_clear_error_interrupt - invalidate QDMA error interrupt
* @qdma: handle to QDMA device
**/
void onic_qdma_clear_error_interrupt(unsigned long qdma);
/**
* onic_qdma_init_tx_queue - initialize a QDMA H2C queue
* @qdma: handle to QDMA device
* @qid: queue ID
* @param: pointer to QDMA H2C queue parameters
*
* Return 0 on success, negative on failure
**/
int onic_qdma_init_tx_queue(unsigned long qdma, u16 qid,
const struct onic_qdma_h2c_param *param);
/**
* onic_qdma_init_rx_queue - initialize a QDMA C2H queue
* @qdma: handle to QDMA device
* @qid: queue ID
* @param: pointer to QDMA C2H queue parameters
*
* Return 0 on success, negative on failure
**/
int onic_qdma_init_rx_queue(unsigned long qdma, u16 qid,
const struct onic_qdma_c2h_param *param);
/**
* onic_qdma_clear_tx_queue - clear a QDMA H2C queue
* @qdma: handle to QDMA device
* @qid: queue ID
**/
void onic_qdma_clear_tx_queue(unsigned long qdma, u16 qid);
/**
* onic_qdma_clear_rx_queue - clear a QDMA C2H queue
* @qdma: handle to QDMA device
* @qid: queue ID
**/
void onic_qdma_clear_rx_queue(unsigned long qdma, u16 qid);
/**
* onic_set_tx_head - set TX ring head pointer
* @qdma: handle to QDMA device
* @qid: queue ID
* @head: head pointer of the TX ring, i.e., next_to_use
**/
void onic_set_tx_head(unsigned long qdma, u16 qid, u16 head);
/**
* onic_set_rx_head - set RX ring head pointer
* @qdma: handle to QDMA device
* @qid: queue ID
* @head: head pointer of the RX ring, i.e., next_to_use
**/
void onic_set_rx_head(unsigned long qdma, u16 qid, u16 head);
/**
* onic_set_completion_tail - set RX completion ring tail pointer
* @qdma: handle to QDMA device
* @qid: queue ID
* @tail: tail pointer of the RX completion ring, i.e., next_to_clean
**/
void onic_set_completion_tail(unsigned long qdma, u16 qid, u16 tail, u8 irq_arm);
#endif