Skip to content

Commit c89d9c3

Browse files
Amit Cohenkuba-moo
Amit Cohen
authored andcommitted
mlxsw: Define Tx header fields in txheader.h
The next patch will move Tx header constructing to pci.c. As preparation, move the definitions of Tx header fields from spectrum.c to txheader.h, so pci.c will include this header and can access the fields. Remove 'etclass' which is not used. Signed-off-by: Amit Cohen <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Link: https://patch.msgid.link/2250b5cb3998ab4850fc8251c3a0f5926d32e194.1737044384.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e8e0827 commit c89d9c3

File tree

2 files changed

+63
-68
lines changed

2 files changed

+63
-68
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

-68
Original file line numberDiff line numberDiff line change
@@ -107,74 +107,6 @@ static const unsigned char mlxsw_sp2_mac_mask[ETH_ALEN] = {
107107
0xff, 0xff, 0xff, 0xff, 0xf0, 0x00
108108
};
109109

110-
/* tx_hdr_version
111-
* Tx header version.
112-
* Must be set to 1.
113-
*/
114-
MLXSW_ITEM32(tx, hdr, version, 0x00, 28, 4);
115-
116-
/* tx_hdr_ctl
117-
* Packet control type.
118-
* 0 - Ethernet control (e.g. EMADs, LACP)
119-
* 1 - Ethernet data
120-
*/
121-
MLXSW_ITEM32(tx, hdr, ctl, 0x00, 26, 2);
122-
123-
/* tx_hdr_proto
124-
* Packet protocol type. Must be set to 1 (Ethernet).
125-
*/
126-
MLXSW_ITEM32(tx, hdr, proto, 0x00, 21, 3);
127-
128-
/* tx_hdr_rx_is_router
129-
* Packet is sent from the router. Valid for data packets only.
130-
*/
131-
MLXSW_ITEM32(tx, hdr, rx_is_router, 0x00, 19, 1);
132-
133-
/* tx_hdr_fid_valid
134-
* Indicates if the 'fid' field is valid and should be used for
135-
* forwarding lookup. Valid for data packets only.
136-
*/
137-
MLXSW_ITEM32(tx, hdr, fid_valid, 0x00, 16, 1);
138-
139-
/* tx_hdr_swid
140-
* Switch partition ID. Must be set to 0.
141-
*/
142-
MLXSW_ITEM32(tx, hdr, swid, 0x00, 12, 3);
143-
144-
/* tx_hdr_control_tclass
145-
* Indicates if the packet should use the control TClass and not one
146-
* of the data TClasses.
147-
*/
148-
MLXSW_ITEM32(tx, hdr, control_tclass, 0x00, 6, 1);
149-
150-
/* tx_hdr_etclass
151-
* Egress TClass to be used on the egress device on the egress port.
152-
*/
153-
MLXSW_ITEM32(tx, hdr, etclass, 0x00, 0, 4);
154-
155-
/* tx_hdr_port_mid
156-
* Destination local port for unicast packets.
157-
* Destination multicast ID for multicast packets.
158-
*
159-
* Control packets are directed to a specific egress port, while data
160-
* packets are transmitted through the CPU port (0) into the switch partition,
161-
* where forwarding rules are applied.
162-
*/
163-
MLXSW_ITEM32(tx, hdr, port_mid, 0x04, 16, 16);
164-
165-
/* tx_hdr_fid
166-
* Forwarding ID used for L2 forwarding lookup. Valid only if 'fid_valid' is
167-
* set, otherwise calculated based on the packet's VID using VID to FID mapping.
168-
* Valid for data packets only.
169-
*/
170-
MLXSW_ITEM32(tx, hdr, fid, 0x08, 16, 16);
171-
172-
/* tx_hdr_type
173-
* 0 - Data packets
174-
* 6 - Control packets
175-
*/
176-
MLXSW_ITEM32(tx, hdr, type, 0x0C, 0, 4);
177-
178110
int mlxsw_sp_flow_counter_get(struct mlxsw_sp *mlxsw_sp,
179111
unsigned int counter_index, bool clear,
180112
u64 *packets, u64 *bytes)

drivers/net/ethernet/mellanox/mlxsw/txheader.h

+63
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,69 @@
44
#ifndef _MLXSW_TXHEADER_H
55
#define _MLXSW_TXHEADER_H
66

7+
/* tx_hdr_version
8+
* Tx header version.
9+
* Must be set to 1.
10+
*/
11+
MLXSW_ITEM32(tx, hdr, version, 0x00, 28, 4);
12+
13+
/* tx_hdr_ctl
14+
* Packet control type.
15+
* 0 - Ethernet control (e.g. EMADs, LACP)
16+
* 1 - Ethernet data
17+
*/
18+
MLXSW_ITEM32(tx, hdr, ctl, 0x00, 26, 2);
19+
20+
/* tx_hdr_proto
21+
* Packet protocol type. Must be set to 1 (Ethernet).
22+
*/
23+
MLXSW_ITEM32(tx, hdr, proto, 0x00, 21, 3);
24+
25+
/* tx_hdr_rx_is_router
26+
* Packet is sent from the router. Valid for data packets only.
27+
*/
28+
MLXSW_ITEM32(tx, hdr, rx_is_router, 0x00, 19, 1);
29+
30+
/* tx_hdr_fid_valid
31+
* Indicates if the 'fid' field is valid and should be used for
32+
* forwarding lookup. Valid for data packets only.
33+
*/
34+
MLXSW_ITEM32(tx, hdr, fid_valid, 0x00, 16, 1);
35+
36+
/* tx_hdr_swid
37+
* Switch partition ID. Must be set to 0.
38+
*/
39+
MLXSW_ITEM32(tx, hdr, swid, 0x00, 12, 3);
40+
41+
/* tx_hdr_control_tclass
42+
* Indicates if the packet should use the control TClass and not one
43+
* of the data TClasses.
44+
*/
45+
MLXSW_ITEM32(tx, hdr, control_tclass, 0x00, 6, 1);
46+
47+
/* tx_hdr_port_mid
48+
* Destination local port for unicast packets.
49+
* Destination multicast ID for multicast packets.
50+
*
51+
* Control packets are directed to a specific egress port, while data
52+
* packets are transmitted through the CPU port (0) into the switch partition,
53+
* where forwarding rules are applied.
54+
*/
55+
MLXSW_ITEM32(tx, hdr, port_mid, 0x04, 16, 16);
56+
57+
/* tx_hdr_fid
58+
* Forwarding ID used for L2 forwarding lookup. Valid only if 'fid_valid' is
59+
* set, otherwise calculated based on the packet's VID using VID to FID mapping.
60+
* Valid for data packets only.
61+
*/
62+
MLXSW_ITEM32(tx, hdr, fid, 0x08, 16, 16);
63+
64+
/* tx_hdr_type
65+
* 0 - Data packets
66+
* 6 - Control packets
67+
*/
68+
MLXSW_ITEM32(tx, hdr, type, 0x0C, 0, 4);
69+
770
#define MLXSW_TXHDR_LEN 0x10
871
#define MLXSW_TXHDR_VERSION_0 0
972
#define MLXSW_TXHDR_VERSION_1 1

0 commit comments

Comments
 (0)