Skip to content

Commit b876b9a

Browse files
jpirkodavem330
authored andcommitted
mlxsw: spectrum: Introduce basic set of flexible key blocks
Introduce basic set of Spectrum flexible key blocks. It contains blocks needed to carry all elements defined so far. Signed-off-by: Jiri Pirko <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4cda7d8 commit b876b9a

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*
2+
* drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_flex_keys.h
3+
* Copyright (c) 2017 Mellanox Technologies. All rights reserved.
4+
* Copyright (c) 2017 Jiri Pirko <[email protected]>
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright
12+
* notice, this list of conditions and the following disclaimer in the
13+
* documentation and/or other materials provided with the distribution.
14+
* 3. Neither the names of the copyright holders nor the names of its
15+
* contributors may be used to endorse or promote products derived from
16+
* this software without specific prior written permission.
17+
*
18+
* Alternatively, this software may be distributed under the terms of the
19+
* GNU General Public License ("GPL") version 2 as published by the Free
20+
* Software Foundation.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
* POSSIBILITY OF SUCH DAMAGE.
33+
*/
34+
35+
#ifndef _MLXSW_SPECTRUM_ACL_FLEX_KEYS_H
36+
#define _MLXSW_SPECTRUM_ACL_FLEX_KEYS_H
37+
38+
#include "core_acl_flex_keys.h"
39+
40+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_l2_dmac[] = {
41+
MLXSW_AFK_ELEMENT_INST_BUF(DMAC, 0x00, 6),
42+
MLXSW_AFK_ELEMENT_INST_U32(SRC_SYS_PORT, 0x0C, 0, 16),
43+
};
44+
45+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_l2_smac[] = {
46+
MLXSW_AFK_ELEMENT_INST_BUF(SMAC, 0x00, 6),
47+
MLXSW_AFK_ELEMENT_INST_U32(SRC_SYS_PORT, 0x0C, 0, 16),
48+
};
49+
50+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_l2_smac_ex[] = {
51+
MLXSW_AFK_ELEMENT_INST_BUF(SMAC, 0x02, 6),
52+
MLXSW_AFK_ELEMENT_INST_U32(ETHERTYPE, 0x0C, 0, 16),
53+
};
54+
55+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4_sip[] = {
56+
MLXSW_AFK_ELEMENT_INST_U32(SRC_IP4, 0x00, 0, 32),
57+
MLXSW_AFK_ELEMENT_INST_U32(IP_PROTO, 0x08, 0, 8),
58+
MLXSW_AFK_ELEMENT_INST_U32(SRC_SYS_PORT, 0x0C, 0, 16),
59+
};
60+
61+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4_dip[] = {
62+
MLXSW_AFK_ELEMENT_INST_U32(DST_IP4, 0x00, 0, 32),
63+
MLXSW_AFK_ELEMENT_INST_U32(IP_PROTO, 0x08, 0, 8),
64+
MLXSW_AFK_ELEMENT_INST_U32(SRC_SYS_PORT, 0x0C, 0, 16),
65+
};
66+
67+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv4_ex[] = {
68+
MLXSW_AFK_ELEMENT_INST_U32(SRC_L4_PORT, 0x08, 0, 16),
69+
MLXSW_AFK_ELEMENT_INST_U32(DST_L4_PORT, 0x0C, 0, 16),
70+
};
71+
72+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv6_dip[] = {
73+
MLXSW_AFK_ELEMENT_INST_BUF(DST_IP6_LO, 0x00, 8),
74+
};
75+
76+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv6_ex1[] = {
77+
MLXSW_AFK_ELEMENT_INST_BUF(DST_IP6_HI, 0x00, 8),
78+
MLXSW_AFK_ELEMENT_INST_U32(IP_PROTO, 0x08, 0, 8),
79+
};
80+
81+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv6_sip[] = {
82+
MLXSW_AFK_ELEMENT_INST_BUF(SRC_IP6_LO, 0x00, 8),
83+
};
84+
85+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_ipv6_sip_ex[] = {
86+
MLXSW_AFK_ELEMENT_INST_BUF(SRC_IP6_HI, 0x00, 8),
87+
};
88+
89+
static struct mlxsw_afk_element_inst mlxsw_sp_afk_element_info_packet_type[] = {
90+
MLXSW_AFK_ELEMENT_INST_U32(ETHERTYPE, 0x00, 0, 16),
91+
};
92+
93+
static const struct mlxsw_afk_block mlxsw_sp_afk_blocks[] = {
94+
MLXSW_AFK_BLOCK(0x10, mlxsw_sp_afk_element_info_l2_dmac),
95+
MLXSW_AFK_BLOCK(0x11, mlxsw_sp_afk_element_info_l2_smac),
96+
MLXSW_AFK_BLOCK(0x12, mlxsw_sp_afk_element_info_l2_smac_ex),
97+
MLXSW_AFK_BLOCK(0x30, mlxsw_sp_afk_element_info_ipv4_sip),
98+
MLXSW_AFK_BLOCK(0x31, mlxsw_sp_afk_element_info_ipv4_dip),
99+
MLXSW_AFK_BLOCK(0x33, mlxsw_sp_afk_element_info_ipv4_ex),
100+
MLXSW_AFK_BLOCK(0x60, mlxsw_sp_afk_element_info_ipv6_dip),
101+
MLXSW_AFK_BLOCK(0x65, mlxsw_sp_afk_element_info_ipv6_ex1),
102+
MLXSW_AFK_BLOCK(0x62, mlxsw_sp_afk_element_info_ipv6_sip),
103+
MLXSW_AFK_BLOCK(0x63, mlxsw_sp_afk_element_info_ipv6_sip_ex),
104+
MLXSW_AFK_BLOCK(0xB0, mlxsw_sp_afk_element_info_packet_type),
105+
};
106+
107+
#define MLXSW_SP_AFK_BLOCKS_COUNT ARRAY_SIZE(mlxsw_sp_afk_blocks)
108+
109+
#endif

0 commit comments

Comments
 (0)