netcp_pa_host.h
4.05 KB
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
/*
* Keystone NetCP PA (Packet Accelerator)/ Security Accelerator PDSP
* Host packet handler/formatter definitions
*
* Copyright (C) 2012-2015 Texas Instruments Incorporated
* Authors: Murali Karicheri (Ported to v4.1.x kernel)
* Sandeep Paulraj (Initial version of the driver)
*
* Other contributors: Reece Pollack (Maintenance)
* Sandeep Nair (Maintenance)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation version 2.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef NETCP_PA_HOST_H
#define NETCP_PA_HOST_H
#define PAHO_PAMOD_CMPT_CHKSUM 0
#define PAHO_PAMOD_CMPT_CRC 1
#define PAHO_PAMOD_NROUTE 3
#define PAHO_PAMOD_REPORT_TIMESTAMP 6
#define PAHO_PAMOD_GROUP_7 7
#define PAHO_PAMOD_DUMMY PAHO_PAMOD_GROUP_7
#define PAHO_SA_SHORT_INFO 1
#define PAHO_READ_BITFIELD(a, b, c) (((a) >> (b)) & ((1UL << (c)) - 1))
#define PAHO_SET_BITFIELD(a, x, b, c) ((a) &= ~(((1UL << (c)) - 1) << (b)), \
(a) |= (((x) & ((1UL << (c)) - 1)) << (b)))
#define PAHO_SET_CMDID(x, v) \
PAHO_SET_BITFIELD((x)->word0, (v), 29, 3)
/**
* @ingroup paho_if_structures
* @brief pahoCmdInfo_t defines the general short command information
*
*/
struct paho_cmd_info {
/* Control block word 0 */
u32 word0;
};
struct paho_long_info {
/* Control block word 0 */
u32 word0;
/* Control block word 1 */
u32 word1;
/* Control block word 2 */
u32 word2;
/* Control block word 3 */
u32 word3;
/* Control block word 4 */
u32 word4;
};
/* Extract the offset to the level 5 header */
#define PAHO_LINFO_READ_L5_OFFSET(x) \
PAHO_READ_BITFIELD((x)->word2, 8, 8)
struct paho_next_route {
u32 word0;
u32 sw_info0;
u32 sw_info1;
u32 word1;
};
/* Sets the E bit which indicates the extended
* parameters (packet type) are present for SRIO
*/
#define PAHO_SET_E(x, v) PAHO_SET_BITFIELD((x)->word0, (v), 27, 1)
/* Sets the destination of the route defined */
#define PAHO_SET_DEST(x, v) PAHO_SET_BITFIELD((x)->word0, (v), 24, 3)
/* Specifies the flow to use for packets sent to the host */
#define PAHO_SET_FLOW(x, v) PAHO_SET_BITFIELD((x)->word0, (v), 16, 8)
/* Specifies the queue to use for packets send to the host */
#define PAHO_SET_QUEUE(x, v) PAHO_SET_BITFIELD((x)->word0, (v), 0, 16)
/* Specifies the packet type to use for packets send to the SRIO */
#define PAHO_SET_PKTTYPE(x, v) PAHO_SET_BITFIELD((x)->word1, (v), 24, 8)
struct paho_com_chk_crc {
/* PAHO_chksum_command_macros */
u32 word0;
/* PAHO_chksum_command_macros */
u32 word1;
/* PAHO_chksum_command_macros */
u32 word2;
};
/* Sets the negative 0 flag - if set a
* checksum computed as 0 will be sent as 0xffff
*/
#define PAHO_CHKCRC_SET_NEG0(x, v) \
PAHO_SET_BITFIELD((x)->word0, (v), 23, 1)
/* Sets the optional flags of the CRC/Checksum command */
#define PAHO_CHKCRC_SET_CTRL(x, v) \
PAHO_SET_BITFIELD((x)->word0, (v), 16, 8)
/* Sets the start offset of the checksum/crc */
#define PAHO_CHKCRC_SET_START(x, v) \
PAHO_SET_BITFIELD((x)->word0, (v), 0, 16)
/* Sets the length of the checksum/crc */
#define PAHO_CHKCRC_SET_LEN(x, v) \
PAHO_SET_BITFIELD((x)->word1, (v), 16, 16)
/* Sets the offset to where to paste the checksum/crc into the packet */
#define PAHO_CHKCRC_SET_RESULT_OFF(x, v) \
PAHO_SET_BITFIELD((x)->word1, (v), 0, 16)
/* Sets the initial value of the checksum/crc */
#define PAHO_CHKCRC_SET_INITVAL(x, v) \
PAHO_SET_BITFIELD((x)->word2, (v), 16, 16)
struct paho_report_timestamp {
u32 word0;
u32 sw_info0;
};
/* Specifies the flow to use for report packets sent to the host */
#define PAHO_SET_REPORT_FLOW(x, v) PAHO_SET_BITFIELD((x)->word0, (v), 16, 8)
/* Specifies the queue to use for report packets send to the host */
#define PAHO_SET_REPORT_QUEUE(x, v) \
PAHO_SET_BITFIELD((x)->word0, (v), 0, 16)
#endif /* NETCP_PAHOST_H */