Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 1 | /* |
| 2 | * drivers/net/ethernet/mellanox/mlxsw/spectrum.h |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 3 | * Copyright (c) 2015-2017 Mellanox Technologies. All rights reserved. |
| 4 | * Copyright (c) 2015-2017 Jiri Pirko <jiri@mellanox.com> |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 5 | * Copyright (c) 2015 Ido Schimmel <idosch@mellanox.com> |
| 6 | * Copyright (c) 2015 Elad Raz <eladr@mellanox.com> |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions are met: |
| 10 | * |
| 11 | * 1. Redistributions of source code must retain the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer. |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer in the |
| 15 | * documentation and/or other materials provided with the distribution. |
| 16 | * 3. Neither the names of the copyright holders nor the names of its |
| 17 | * contributors may be used to endorse or promote products derived from |
| 18 | * this software without specific prior written permission. |
| 19 | * |
| 20 | * Alternatively, this software may be distributed under the terms of the |
| 21 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 22 | * Software Foundation. |
| 23 | * |
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 28 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 31 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 32 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 33 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 34 | * POSSIBILITY OF SUCH DAMAGE. |
| 35 | */ |
| 36 | |
| 37 | #ifndef _MLXSW_SPECTRUM_H |
| 38 | #define _MLXSW_SPECTRUM_H |
| 39 | |
| 40 | #include <linux/types.h> |
| 41 | #include <linux/netdevice.h> |
Jiri Pirko | 6cf3c97 | 2016-07-05 11:27:39 +0200 | [diff] [blame] | 42 | #include <linux/rhashtable.h> |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 43 | #include <linux/bitops.h> |
| 44 | #include <linux/if_vlan.h> |
Ido Schimmel | 7f71eb4 | 2015-12-15 16:03:37 +0100 | [diff] [blame] | 45 | #include <linux/list.h> |
Ido Schimmel | 8e8dfe9 | 2016-04-06 17:10:10 +0200 | [diff] [blame] | 46 | #include <linux/dcbnl.h> |
Jiri Pirko | 5e9c16c | 2016-07-04 08:23:04 +0200 | [diff] [blame] | 47 | #include <linux/in6.h> |
Jiri Pirko | b45f64d | 2016-09-26 12:52:31 +0200 | [diff] [blame] | 48 | #include <linux/notifier.h> |
Yotam Gigi | 98d0f7b | 2017-01-23 11:07:11 +0100 | [diff] [blame] | 49 | #include <net/psample.h> |
Jiri Pirko | 7aa0f5a | 2017-02-03 10:29:09 +0100 | [diff] [blame] | 50 | #include <net/pkt_cls.h> |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 51 | |
Elad Raz | 3a49b4f | 2016-01-10 21:06:28 +0100 | [diff] [blame] | 52 | #include "port.h" |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 53 | #include "core.h" |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 54 | #include "core_acl_flex_keys.h" |
| 55 | #include "core_acl_flex_actions.h" |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 56 | |
Ido Schimmel | a110748 | 2017-05-26 08:37:39 +0200 | [diff] [blame] | 57 | #define MLXSW_SP_FID_8021D_MAX 1024 |
Ido Schimmel | 7f71eb4 | 2015-12-15 16:03:37 +0100 | [diff] [blame] | 58 | |
Elad Raz | 53ae628 | 2016-01-10 21:06:26 +0100 | [diff] [blame] | 59 | #define MLXSW_SP_MID_MAX 7000 |
| 60 | |
Ido Schimmel | 18f1e70 | 2016-02-26 17:32:31 +0100 | [diff] [blame] | 61 | #define MLXSW_SP_PORTS_PER_CLUSTER_MAX 4 |
| 62 | |
| 63 | #define MLXSW_SP_PORT_BASE_SPEED 25000 /* Mb/s */ |
| 64 | |
Jiri Pirko | c602242 | 2016-07-05 11:27:46 +0200 | [diff] [blame] | 65 | #define MLXSW_SP_KVD_LINEAR_SIZE 65536 /* entries */ |
Nogah Frankel | 403547d | 2016-09-20 11:16:52 +0200 | [diff] [blame] | 66 | #define MLXSW_SP_KVD_GRANULARITY 128 |
Jiri Pirko | c602242 | 2016-07-05 11:27:46 +0200 | [diff] [blame] | 67 | |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 68 | struct mlxsw_sp_port; |
Ido Schimmel | 4724ba56 | 2017-03-10 08:53:39 +0100 | [diff] [blame] | 69 | struct mlxsw_sp_rif; |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 70 | |
Jiri Pirko | 0d65fc1 | 2015-12-03 12:12:28 +0100 | [diff] [blame] | 71 | struct mlxsw_sp_upper { |
| 72 | struct net_device *dev; |
| 73 | unsigned int ref_count; |
| 74 | }; |
| 75 | |
Ido Schimmel | a110748 | 2017-05-26 08:37:39 +0200 | [diff] [blame] | 76 | enum mlxsw_sp_rif_type { |
| 77 | MLXSW_SP_RIF_TYPE_SUBPORT, |
| 78 | MLXSW_SP_RIF_TYPE_VLAN, |
| 79 | MLXSW_SP_RIF_TYPE_FID, |
| 80 | MLXSW_SP_RIF_TYPE_MAX, |
| 81 | }; |
| 82 | |
| 83 | enum mlxsw_sp_fid_type { |
| 84 | MLXSW_SP_FID_TYPE_8021Q, |
| 85 | MLXSW_SP_FID_TYPE_8021D, |
| 86 | MLXSW_SP_FID_TYPE_RFID, |
| 87 | MLXSW_SP_FID_TYPE_DUMMY, |
| 88 | MLXSW_SP_FID_TYPE_MAX, |
Ido Schimmel | 7f71eb4 | 2015-12-15 16:03:37 +0100 | [diff] [blame] | 89 | }; |
| 90 | |
Elad Raz | 3a49b4f | 2016-01-10 21:06:28 +0100 | [diff] [blame] | 91 | struct mlxsw_sp_mid { |
| 92 | struct list_head list; |
| 93 | unsigned char addr[ETH_ALEN]; |
Ido Schimmel | 46d0847 | 2016-10-30 10:09:22 +0100 | [diff] [blame] | 94 | u16 fid; |
Elad Raz | 3a49b4f | 2016-01-10 21:06:28 +0100 | [diff] [blame] | 95 | u16 mid; |
| 96 | unsigned int ref_count; |
| 97 | }; |
| 98 | |
Yotam Gigi | 763b4b7 | 2016-07-21 12:03:17 +0200 | [diff] [blame] | 99 | enum mlxsw_sp_span_type { |
| 100 | MLXSW_SP_SPAN_EGRESS, |
| 101 | MLXSW_SP_SPAN_INGRESS |
| 102 | }; |
| 103 | |
| 104 | struct mlxsw_sp_span_inspected_port { |
| 105 | struct list_head list; |
| 106 | enum mlxsw_sp_span_type type; |
| 107 | u8 local_port; |
| 108 | }; |
| 109 | |
| 110 | struct mlxsw_sp_span_entry { |
| 111 | u8 local_port; |
| 112 | bool used; |
| 113 | struct list_head bound_ports_list; |
| 114 | int ref_count; |
| 115 | int id; |
| 116 | }; |
| 117 | |
| 118 | enum mlxsw_sp_port_mall_action_type { |
| 119 | MLXSW_SP_PORT_MALL_MIRROR, |
Yotam Gigi | 98d0f7b | 2017-01-23 11:07:11 +0100 | [diff] [blame] | 120 | MLXSW_SP_PORT_MALL_SAMPLE, |
Yotam Gigi | 763b4b7 | 2016-07-21 12:03:17 +0200 | [diff] [blame] | 121 | }; |
| 122 | |
| 123 | struct mlxsw_sp_port_mall_mirror_tc_entry { |
| 124 | u8 to_local_port; |
| 125 | bool ingress; |
| 126 | }; |
| 127 | |
| 128 | struct mlxsw_sp_port_mall_tc_entry { |
| 129 | struct list_head list; |
| 130 | unsigned long cookie; |
| 131 | enum mlxsw_sp_port_mall_action_type type; |
| 132 | union { |
| 133 | struct mlxsw_sp_port_mall_mirror_tc_entry mirror; |
| 134 | }; |
| 135 | }; |
| 136 | |
Ido Schimmel | 33cbd87 | 2017-05-16 19:38:24 +0200 | [diff] [blame] | 137 | struct mlxsw_sp_sb; |
Ido Schimmel | 5f6935c | 2017-05-16 19:38:26 +0200 | [diff] [blame] | 138 | struct mlxsw_sp_bridge; |
Ido Schimmel | 9011b67 | 2017-05-16 19:38:25 +0200 | [diff] [blame] | 139 | struct mlxsw_sp_router; |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 140 | struct mlxsw_sp_acl; |
Arkadi Sharshevsky | ff7b0d2 | 2017-03-11 09:42:51 +0100 | [diff] [blame] | 141 | struct mlxsw_sp_counter_pool; |
Ido Schimmel | a110748 | 2017-05-26 08:37:39 +0200 | [diff] [blame] | 142 | struct mlxsw_sp_fid_core; |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 143 | |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 144 | struct mlxsw_sp { |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 145 | struct mlxsw_sp_port **ports; |
| 146 | struct mlxsw_core *core; |
| 147 | const struct mlxsw_bus_info *bus_info; |
| 148 | unsigned char base_mac[ETH_ALEN]; |
Nogah Frankel | ce0bd2b | 2016-09-20 11:16:50 +0200 | [diff] [blame] | 149 | struct mlxsw_sp_upper *lags; |
Ido Schimmel | 5ec2ee7 | 2017-03-24 08:02:48 +0100 | [diff] [blame] | 150 | u8 *port_to_module; |
Ido Schimmel | 33cbd87 | 2017-05-16 19:38:24 +0200 | [diff] [blame] | 151 | struct mlxsw_sp_sb *sb; |
Ido Schimmel | 5f6935c | 2017-05-16 19:38:26 +0200 | [diff] [blame] | 152 | struct mlxsw_sp_bridge *bridge; |
Ido Schimmel | 9011b67 | 2017-05-16 19:38:25 +0200 | [diff] [blame] | 153 | struct mlxsw_sp_router *router; |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 154 | struct mlxsw_sp_acl *acl; |
Ido Schimmel | a110748 | 2017-05-26 08:37:39 +0200 | [diff] [blame] | 155 | struct mlxsw_sp_fid_core *fid_core; |
Jiri Pirko | b090ef0 | 2016-07-05 11:27:47 +0200 | [diff] [blame] | 156 | struct { |
| 157 | DECLARE_BITMAP(usage, MLXSW_SP_KVD_LINEAR_SIZE); |
| 158 | } kvdl; |
Yotam Gigi | 763b4b7 | 2016-07-21 12:03:17 +0200 | [diff] [blame] | 159 | |
Arkadi Sharshevsky | ff7b0d2 | 2017-03-11 09:42:51 +0100 | [diff] [blame] | 160 | struct mlxsw_sp_counter_pool *counter_pool; |
Yotam Gigi | 763b4b7 | 2016-07-21 12:03:17 +0200 | [diff] [blame] | 161 | struct { |
| 162 | struct mlxsw_sp_span_entry *entries; |
| 163 | int entries_count; |
| 164 | } span; |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 165 | }; |
| 166 | |
Jiri Pirko | 0d65fc1 | 2015-12-03 12:12:28 +0100 | [diff] [blame] | 167 | static inline struct mlxsw_sp_upper * |
| 168 | mlxsw_sp_lag_get(struct mlxsw_sp *mlxsw_sp, u16 lag_id) |
| 169 | { |
| 170 | return &mlxsw_sp->lags[lag_id]; |
| 171 | } |
| 172 | |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 173 | struct mlxsw_sp_port_pcpu_stats { |
| 174 | u64 rx_packets; |
| 175 | u64 rx_bytes; |
| 176 | u64 tx_packets; |
| 177 | u64 tx_bytes; |
| 178 | struct u64_stats_sync syncp; |
| 179 | u32 tx_dropped; |
| 180 | }; |
| 181 | |
Yotam Gigi | 98d0f7b | 2017-01-23 11:07:11 +0100 | [diff] [blame] | 182 | struct mlxsw_sp_port_sample { |
| 183 | struct psample_group __rcu *psample_group; |
| 184 | u32 trunc_size; |
| 185 | u32 rate; |
| 186 | bool truncate; |
| 187 | }; |
| 188 | |
Ido Schimmel | c57529e | 2017-05-26 08:37:31 +0200 | [diff] [blame] | 189 | struct mlxsw_sp_bridge_port; |
Ido Schimmel | a110748 | 2017-05-26 08:37:39 +0200 | [diff] [blame] | 190 | struct mlxsw_sp_fid; |
Ido Schimmel | c57529e | 2017-05-26 08:37:31 +0200 | [diff] [blame] | 191 | |
Ido Schimmel | 31a08a5 | 2017-05-26 08:37:26 +0200 | [diff] [blame] | 192 | struct mlxsw_sp_port_vlan { |
| 193 | struct list_head list; |
| 194 | struct mlxsw_sp_port *mlxsw_sp_port; |
| 195 | struct mlxsw_sp_fid *fid; |
| 196 | u16 vid; |
Ido Schimmel | c57529e | 2017-05-26 08:37:31 +0200 | [diff] [blame] | 197 | struct mlxsw_sp_bridge_port *bridge_port; |
| 198 | struct list_head bridge_vlan_node; |
Ido Schimmel | 31a08a5 | 2017-05-26 08:37:26 +0200 | [diff] [blame] | 199 | }; |
| 200 | |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 201 | struct mlxsw_sp_port { |
| 202 | struct net_device *dev; |
| 203 | struct mlxsw_sp_port_pcpu_stats __percpu *pcpu_stats; |
| 204 | struct mlxsw_sp *mlxsw_sp; |
| 205 | u8 local_port; |
Ido Schimmel | c57529e | 2017-05-26 08:37:31 +0200 | [diff] [blame] | 206 | u8 lagged:1, |
Ido Schimmel | 18f1e70 | 2016-02-26 17:32:31 +0100 | [diff] [blame] | 207 | split:1; |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 208 | u16 pvid; |
Jiri Pirko | 0d65fc1 | 2015-12-03 12:12:28 +0100 | [diff] [blame] | 209 | u16 lag_id; |
Ido Schimmel | 7f71eb4 | 2015-12-15 16:03:37 +0100 | [diff] [blame] | 210 | struct { |
Ido Schimmel | 9f7ec05 | 2016-04-06 17:10:14 +0200 | [diff] [blame] | 211 | u8 tx_pause:1, |
Ido Schimmel | 0c83f88 | 2016-09-12 13:26:23 +0200 | [diff] [blame] | 212 | rx_pause:1, |
| 213 | autoneg:1; |
Ido Schimmel | 9f7ec05 | 2016-04-06 17:10:14 +0200 | [diff] [blame] | 214 | } link; |
| 215 | struct { |
Ido Schimmel | 8e8dfe9 | 2016-04-06 17:10:10 +0200 | [diff] [blame] | 216 | struct ieee_ets *ets; |
Ido Schimmel | cc7cf51 | 2016-04-06 17:10:11 +0200 | [diff] [blame] | 217 | struct ieee_maxrate *maxrate; |
Ido Schimmel | d81a6bd | 2016-04-06 17:10:16 +0200 | [diff] [blame] | 218 | struct ieee_pfc *pfc; |
Ido Schimmel | 8e8dfe9 | 2016-04-06 17:10:10 +0200 | [diff] [blame] | 219 | } dcb; |
Ido Schimmel | d664b41 | 2016-06-09 09:51:40 +0200 | [diff] [blame] | 220 | struct { |
| 221 | u8 module; |
| 222 | u8 width; |
| 223 | u8 lane; |
| 224 | } mapping; |
Yotam Gigi | 763b4b7 | 2016-07-21 12:03:17 +0200 | [diff] [blame] | 225 | /* TC handles */ |
| 226 | struct list_head mall_tc_list; |
Nogah Frankel | fc1bbb0 | 2016-09-16 15:05:38 +0200 | [diff] [blame] | 227 | struct { |
| 228 | #define MLXSW_HW_STATS_UPDATE_TIME HZ |
| 229 | struct rtnl_link_stats64 *cache; |
| 230 | struct delayed_work update_dw; |
| 231 | } hw_stats; |
Yotam Gigi | 98d0f7b | 2017-01-23 11:07:11 +0100 | [diff] [blame] | 232 | struct mlxsw_sp_port_sample *sample; |
Ido Schimmel | 31a08a5 | 2017-05-26 08:37:26 +0200 | [diff] [blame] | 233 | struct list_head vlans_list; |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 234 | }; |
| 235 | |
Ido Schimmel | 9f7ec05 | 2016-04-06 17:10:14 +0200 | [diff] [blame] | 236 | static inline bool |
| 237 | mlxsw_sp_port_is_pause_en(const struct mlxsw_sp_port *mlxsw_sp_port) |
| 238 | { |
| 239 | return mlxsw_sp_port->link.tx_pause || mlxsw_sp_port->link.rx_pause; |
| 240 | } |
| 241 | |
Jiri Pirko | 0d65fc1 | 2015-12-03 12:12:28 +0100 | [diff] [blame] | 242 | static inline struct mlxsw_sp_port * |
| 243 | mlxsw_sp_port_lagged_get(struct mlxsw_sp *mlxsw_sp, u16 lag_id, u8 port_index) |
| 244 | { |
| 245 | struct mlxsw_sp_port *mlxsw_sp_port; |
| 246 | u8 local_port; |
| 247 | |
| 248 | local_port = mlxsw_core_lag_mapping_get(mlxsw_sp->core, |
| 249 | lag_id, port_index); |
| 250 | mlxsw_sp_port = mlxsw_sp->ports[local_port]; |
| 251 | return mlxsw_sp_port && mlxsw_sp_port->lagged ? mlxsw_sp_port : NULL; |
| 252 | } |
| 253 | |
Ido Schimmel | 31a08a5 | 2017-05-26 08:37:26 +0200 | [diff] [blame] | 254 | static inline struct mlxsw_sp_port_vlan * |
| 255 | mlxsw_sp_port_vlan_find_by_vid(const struct mlxsw_sp_port *mlxsw_sp_port, |
| 256 | u16 vid) |
| 257 | { |
| 258 | struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan; |
| 259 | |
| 260 | list_for_each_entry(mlxsw_sp_port_vlan, &mlxsw_sp_port->vlans_list, |
| 261 | list) { |
| 262 | if (mlxsw_sp_port_vlan->vid == vid) |
| 263 | return mlxsw_sp_port_vlan; |
| 264 | } |
| 265 | |
| 266 | return NULL; |
| 267 | } |
| 268 | |
Ido Schimmel | a110748 | 2017-05-26 08:37:39 +0200 | [diff] [blame] | 269 | enum mlxsw_sp_flood_type { |
| 270 | MLXSW_SP_FLOOD_TYPE_UC, |
| 271 | MLXSW_SP_FLOOD_TYPE_BC, |
| 272 | MLXSW_SP_FLOOD_TYPE_MC, |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 273 | }; |
| 274 | |
Ido Schimmel | cb4cc0e | 2017-06-04 16:53:38 +0200 | [diff] [blame] | 275 | /* spectrum_buffers.c */ |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 276 | int mlxsw_sp_buffers_init(struct mlxsw_sp *mlxsw_sp); |
Jiri Pirko | 0f433fa | 2016-04-14 18:19:24 +0200 | [diff] [blame] | 277 | void mlxsw_sp_buffers_fini(struct mlxsw_sp *mlxsw_sp); |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 278 | int mlxsw_sp_port_buffers_init(struct mlxsw_sp_port *mlxsw_sp_port); |
Jiri Pirko | 0f433fa | 2016-04-14 18:19:24 +0200 | [diff] [blame] | 279 | int mlxsw_sp_sb_pool_get(struct mlxsw_core *mlxsw_core, |
| 280 | unsigned int sb_index, u16 pool_index, |
| 281 | struct devlink_sb_pool_info *pool_info); |
| 282 | int mlxsw_sp_sb_pool_set(struct mlxsw_core *mlxsw_core, |
| 283 | unsigned int sb_index, u16 pool_index, u32 size, |
| 284 | enum devlink_sb_threshold_type threshold_type); |
| 285 | int mlxsw_sp_sb_port_pool_get(struct mlxsw_core_port *mlxsw_core_port, |
| 286 | unsigned int sb_index, u16 pool_index, |
| 287 | u32 *p_threshold); |
| 288 | int mlxsw_sp_sb_port_pool_set(struct mlxsw_core_port *mlxsw_core_port, |
| 289 | unsigned int sb_index, u16 pool_index, |
| 290 | u32 threshold); |
| 291 | int mlxsw_sp_sb_tc_pool_bind_get(struct mlxsw_core_port *mlxsw_core_port, |
| 292 | unsigned int sb_index, u16 tc_index, |
| 293 | enum devlink_sb_pool_type pool_type, |
| 294 | u16 *p_pool_index, u32 *p_threshold); |
| 295 | int mlxsw_sp_sb_tc_pool_bind_set(struct mlxsw_core_port *mlxsw_core_port, |
| 296 | unsigned int sb_index, u16 tc_index, |
| 297 | enum devlink_sb_pool_type pool_type, |
| 298 | u16 pool_index, u32 threshold); |
Jiri Pirko | 2d0ed39 | 2016-04-14 18:19:30 +0200 | [diff] [blame] | 299 | int mlxsw_sp_sb_occ_snapshot(struct mlxsw_core *mlxsw_core, |
| 300 | unsigned int sb_index); |
| 301 | int mlxsw_sp_sb_occ_max_clear(struct mlxsw_core *mlxsw_core, |
| 302 | unsigned int sb_index); |
| 303 | int mlxsw_sp_sb_occ_port_pool_get(struct mlxsw_core_port *mlxsw_core_port, |
| 304 | unsigned int sb_index, u16 pool_index, |
| 305 | u32 *p_cur, u32 *p_max); |
| 306 | int mlxsw_sp_sb_occ_tc_port_bind_get(struct mlxsw_core_port *mlxsw_core_port, |
| 307 | unsigned int sb_index, u16 tc_index, |
| 308 | enum devlink_sb_pool_type pool_type, |
| 309 | u32 *p_cur, u32 *p_max); |
Ido Schimmel | 33cbd87 | 2017-05-16 19:38:24 +0200 | [diff] [blame] | 310 | u32 mlxsw_sp_cells_bytes(const struct mlxsw_sp *mlxsw_sp, u32 cells); |
| 311 | u32 mlxsw_sp_bytes_cells(const struct mlxsw_sp *mlxsw_sp, u32 bytes); |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 312 | |
Ido Schimmel | cb4cc0e | 2017-06-04 16:53:38 +0200 | [diff] [blame] | 313 | /* spectrum_switchdev.c */ |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 314 | int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp); |
| 315 | void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp); |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 316 | void mlxsw_sp_port_switchdev_init(struct mlxsw_sp_port *mlxsw_sp_port); |
| 317 | void mlxsw_sp_port_switchdev_fini(struct mlxsw_sp_port *mlxsw_sp_port); |
Ido Schimmel | 6e095fd | 2016-07-04 08:23:13 +0200 | [diff] [blame] | 318 | int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, |
| 319 | bool adding); |
Ido Schimmel | c57529e | 2017-05-26 08:37:31 +0200 | [diff] [blame] | 320 | void |
| 321 | mlxsw_sp_port_vlan_bridge_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan); |
| 322 | int mlxsw_sp_port_bridge_join(struct mlxsw_sp_port *mlxsw_sp_port, |
| 323 | struct net_device *brport_dev, |
| 324 | struct net_device *br_dev); |
| 325 | void mlxsw_sp_port_bridge_leave(struct mlxsw_sp_port *mlxsw_sp_port, |
| 326 | struct net_device *brport_dev, |
| 327 | struct net_device *br_dev); |
| 328 | |
Ido Schimmel | cb4cc0e | 2017-06-04 16:53:38 +0200 | [diff] [blame] | 329 | /* spectrum.c */ |
Ido Schimmel | 8e8dfe9 | 2016-04-06 17:10:10 +0200 | [diff] [blame] | 330 | int mlxsw_sp_port_ets_set(struct mlxsw_sp_port *mlxsw_sp_port, |
| 331 | enum mlxsw_reg_qeec_hr hr, u8 index, u8 next_index, |
| 332 | bool dwrr, u8 dwrr_weight); |
| 333 | int mlxsw_sp_port_prio_tc_set(struct mlxsw_sp_port *mlxsw_sp_port, |
| 334 | u8 switch_prio, u8 tclass); |
| 335 | int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu, |
Ido Schimmel | d81a6bd | 2016-04-06 17:10:16 +0200 | [diff] [blame] | 336 | u8 *prio_tc, bool pause_en, |
| 337 | struct ieee_pfc *my_pfc); |
Ido Schimmel | cc7cf51 | 2016-04-06 17:10:11 +0200 | [diff] [blame] | 338 | int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port, |
| 339 | enum mlxsw_reg_qeec_hr hr, u8 index, |
| 340 | u8 next_index, u32 maxrate); |
Ido Schimmel | fe9ccc7 | 2017-05-16 19:38:31 +0200 | [diff] [blame] | 341 | int mlxsw_sp_port_vid_stp_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid, |
| 342 | u8 state); |
Ido Schimmel | a110748 | 2017-05-26 08:37:39 +0200 | [diff] [blame] | 343 | int mlxsw_sp_port_vp_mode_set(struct mlxsw_sp_port *mlxsw_sp_port, bool enable); |
Ido Schimmel | fe9ccc7 | 2017-05-16 19:38:31 +0200 | [diff] [blame] | 344 | int mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid, |
| 345 | bool learn_enable); |
Ido Schimmel | b02eae9 | 2017-05-16 19:38:34 +0200 | [diff] [blame] | 346 | int mlxsw_sp_port_pvid_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid); |
Ido Schimmel | c57529e | 2017-05-26 08:37:31 +0200 | [diff] [blame] | 347 | struct mlxsw_sp_port_vlan * |
| 348 | mlxsw_sp_port_vlan_get(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid); |
| 349 | void mlxsw_sp_port_vlan_put(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan); |
Ido Schimmel | cb4cc0e | 2017-06-04 16:53:38 +0200 | [diff] [blame] | 350 | int mlxsw_sp_port_vlan_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid_begin, |
| 351 | u16 vid_end, bool is_member, bool untagged); |
| 352 | int mlxsw_sp_flow_counter_get(struct mlxsw_sp *mlxsw_sp, |
| 353 | unsigned int counter_index, u64 *packets, |
| 354 | u64 *bytes); |
| 355 | int mlxsw_sp_flow_counter_alloc(struct mlxsw_sp *mlxsw_sp, |
| 356 | unsigned int *p_counter_index); |
| 357 | void mlxsw_sp_flow_counter_free(struct mlxsw_sp *mlxsw_sp, |
| 358 | unsigned int counter_index); |
| 359 | bool mlxsw_sp_port_dev_check(const struct net_device *dev); |
| 360 | struct mlxsw_sp *mlxsw_sp_lower_get(struct net_device *dev); |
| 361 | struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find(struct net_device *dev); |
| 362 | struct mlxsw_sp_port *mlxsw_sp_port_lower_dev_hold(struct net_device *dev); |
| 363 | void mlxsw_sp_port_dev_put(struct mlxsw_sp_port *mlxsw_sp_port); |
Arkadi Sharshevsky | af061378 | 2017-06-08 08:44:20 +0200 | [diff] [blame] | 364 | struct mlxsw_sp_port *mlxsw_sp_port_dev_lower_find_rcu(struct net_device *dev); |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 365 | |
Ido Schimmel | cb4cc0e | 2017-06-04 16:53:38 +0200 | [diff] [blame] | 366 | /* spectrum_dcb.c */ |
Ido Schimmel | f00817d | 2016-04-06 17:10:09 +0200 | [diff] [blame] | 367 | #ifdef CONFIG_MLXSW_SPECTRUM_DCB |
Ido Schimmel | f00817d | 2016-04-06 17:10:09 +0200 | [diff] [blame] | 368 | int mlxsw_sp_port_dcb_init(struct mlxsw_sp_port *mlxsw_sp_port); |
| 369 | void mlxsw_sp_port_dcb_fini(struct mlxsw_sp_port *mlxsw_sp_port); |
Ido Schimmel | f00817d | 2016-04-06 17:10:09 +0200 | [diff] [blame] | 370 | #else |
Ido Schimmel | f00817d | 2016-04-06 17:10:09 +0200 | [diff] [blame] | 371 | static inline int mlxsw_sp_port_dcb_init(struct mlxsw_sp_port *mlxsw_sp_port) |
| 372 | { |
| 373 | return 0; |
| 374 | } |
Ido Schimmel | f00817d | 2016-04-06 17:10:09 +0200 | [diff] [blame] | 375 | static inline void mlxsw_sp_port_dcb_fini(struct mlxsw_sp_port *mlxsw_sp_port) |
| 376 | {} |
Ido Schimmel | f00817d | 2016-04-06 17:10:09 +0200 | [diff] [blame] | 377 | #endif |
| 378 | |
Ido Schimmel | cb4cc0e | 2017-06-04 16:53:38 +0200 | [diff] [blame] | 379 | /* spectrum_router.c */ |
Ido Schimmel | 464dce1 | 2016-07-02 11:00:15 +0200 | [diff] [blame] | 380 | int mlxsw_sp_router_init(struct mlxsw_sp *mlxsw_sp); |
| 381 | void mlxsw_sp_router_fini(struct mlxsw_sp *mlxsw_sp); |
Jiri Pirko | e732263 | 2016-09-01 10:37:43 +0200 | [diff] [blame] | 382 | int mlxsw_sp_router_netevent_event(struct notifier_block *unused, |
| 383 | unsigned long event, void *ptr); |
Ido Schimmel | 4724ba56 | 2017-03-10 08:53:39 +0100 | [diff] [blame] | 384 | int mlxsw_sp_netdevice_router_port_event(struct net_device *dev); |
| 385 | int mlxsw_sp_inetaddr_event(struct notifier_block *unused, |
| 386 | unsigned long event, void *ptr); |
Arkadi Sharshevsky | 5ea1237 | 2017-07-18 10:10:13 +0200 | [diff] [blame] | 387 | int mlxsw_sp_inet6addr_event(struct notifier_block *unused, |
| 388 | unsigned long event, void *ptr); |
Ido Schimmel | b1e4552 | 2017-04-30 19:47:14 +0300 | [diff] [blame] | 389 | int mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event, |
| 390 | struct netdev_notifier_changeupper_info *info); |
Ido Schimmel | a110748 | 2017-05-26 08:37:39 +0200 | [diff] [blame] | 391 | void |
| 392 | mlxsw_sp_port_vlan_router_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan); |
Ido Schimmel | e4f3c1c | 2017-05-26 08:37:40 +0200 | [diff] [blame] | 393 | void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif); |
Ido Schimmel | 464dce1 | 2016-07-02 11:00:15 +0200 | [diff] [blame] | 394 | |
Ido Schimmel | cb4cc0e | 2017-06-04 16:53:38 +0200 | [diff] [blame] | 395 | /* spectrum_kvdl.c */ |
Arkadi Sharshevsky | 1312444 | 2017-03-25 08:28:22 +0100 | [diff] [blame] | 396 | int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count, |
| 397 | u32 *p_entry_index); |
Jiri Pirko | b090ef0 | 2016-07-05 11:27:47 +0200 | [diff] [blame] | 398 | void mlxsw_sp_kvdl_free(struct mlxsw_sp *mlxsw_sp, int entry_index); |
| 399 | |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 400 | struct mlxsw_sp_acl_rule_info { |
| 401 | unsigned int priority; |
| 402 | struct mlxsw_afk_element_values values; |
| 403 | struct mlxsw_afa_block *act_block; |
Arkadi Sharshevsky | 4817072 | 2017-03-11 09:42:58 +0100 | [diff] [blame] | 404 | unsigned int counter_index; |
| 405 | bool counter_valid; |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 406 | }; |
| 407 | |
| 408 | enum mlxsw_sp_acl_profile { |
| 409 | MLXSW_SP_ACL_PROFILE_FLOWER, |
| 410 | }; |
| 411 | |
| 412 | struct mlxsw_sp_acl_profile_ops { |
| 413 | size_t ruleset_priv_size; |
| 414 | int (*ruleset_add)(struct mlxsw_sp *mlxsw_sp, |
| 415 | void *priv, void *ruleset_priv); |
| 416 | void (*ruleset_del)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv); |
| 417 | int (*ruleset_bind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv, |
| 418 | struct net_device *dev, bool ingress); |
| 419 | void (*ruleset_unbind)(struct mlxsw_sp *mlxsw_sp, void *ruleset_priv); |
Jiri Pirko | 0ade3b6 | 2017-08-23 10:08:20 +0200 | [diff] [blame^] | 420 | u16 (*ruleset_group_id)(void *ruleset_priv); |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 421 | size_t rule_priv_size; |
| 422 | int (*rule_add)(struct mlxsw_sp *mlxsw_sp, |
| 423 | void *ruleset_priv, void *rule_priv, |
| 424 | struct mlxsw_sp_acl_rule_info *rulei); |
| 425 | void (*rule_del)(struct mlxsw_sp *mlxsw_sp, void *rule_priv); |
Arkadi Sharshevsky | 7fd056c | 2017-03-11 09:42:54 +0100 | [diff] [blame] | 426 | int (*rule_activity_get)(struct mlxsw_sp *mlxsw_sp, void *rule_priv, |
| 427 | bool *activity); |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 428 | }; |
| 429 | |
| 430 | struct mlxsw_sp_acl_ops { |
| 431 | size_t priv_size; |
| 432 | int (*init)(struct mlxsw_sp *mlxsw_sp, void *priv); |
| 433 | void (*fini)(struct mlxsw_sp *mlxsw_sp, void *priv); |
| 434 | const struct mlxsw_sp_acl_profile_ops * |
| 435 | (*profile_ops)(struct mlxsw_sp *mlxsw_sp, |
| 436 | enum mlxsw_sp_acl_profile profile); |
| 437 | }; |
| 438 | |
| 439 | struct mlxsw_sp_acl_ruleset; |
| 440 | |
Ido Schimmel | cb4cc0e | 2017-06-04 16:53:38 +0200 | [diff] [blame] | 441 | /* spectrum_acl.c */ |
| 442 | struct mlxsw_afk *mlxsw_sp_acl_afk(struct mlxsw_sp_acl *acl); |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 443 | struct mlxsw_sp_acl_ruleset * |
Jiri Pirko | 45b6274 | 2017-08-23 10:08:18 +0200 | [diff] [blame] | 444 | mlxsw_sp_acl_ruleset_get(struct mlxsw_sp *mlxsw_sp, struct net_device *dev, |
| 445 | bool ingress, u32 chain_index, |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 446 | enum mlxsw_sp_acl_profile profile); |
| 447 | void mlxsw_sp_acl_ruleset_put(struct mlxsw_sp *mlxsw_sp, |
| 448 | struct mlxsw_sp_acl_ruleset *ruleset); |
Jiri Pirko | 0ade3b6 | 2017-08-23 10:08:20 +0200 | [diff] [blame^] | 449 | u16 mlxsw_sp_acl_ruleset_group_id(struct mlxsw_sp_acl_ruleset *ruleset); |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 450 | |
| 451 | struct mlxsw_sp_acl_rule_info * |
| 452 | mlxsw_sp_acl_rulei_create(struct mlxsw_sp_acl *acl); |
| 453 | void mlxsw_sp_acl_rulei_destroy(struct mlxsw_sp_acl_rule_info *rulei); |
| 454 | int mlxsw_sp_acl_rulei_commit(struct mlxsw_sp_acl_rule_info *rulei); |
| 455 | void mlxsw_sp_acl_rulei_priority(struct mlxsw_sp_acl_rule_info *rulei, |
| 456 | unsigned int priority); |
| 457 | void mlxsw_sp_acl_rulei_keymask_u32(struct mlxsw_sp_acl_rule_info *rulei, |
| 458 | enum mlxsw_afk_element element, |
| 459 | u32 key_value, u32 mask_value); |
| 460 | void mlxsw_sp_acl_rulei_keymask_buf(struct mlxsw_sp_acl_rule_info *rulei, |
| 461 | enum mlxsw_afk_element element, |
| 462 | const char *key_value, |
| 463 | const char *mask_value, unsigned int len); |
| 464 | void mlxsw_sp_acl_rulei_act_continue(struct mlxsw_sp_acl_rule_info *rulei); |
| 465 | void mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei, |
| 466 | u16 group_id); |
| 467 | int mlxsw_sp_acl_rulei_act_drop(struct mlxsw_sp_acl_rule_info *rulei); |
Jiri Pirko | df7eea9 | 2017-06-06 14:12:06 +0200 | [diff] [blame] | 468 | int mlxsw_sp_acl_rulei_act_trap(struct mlxsw_sp_acl_rule_info *rulei); |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 469 | int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp, |
| 470 | struct mlxsw_sp_acl_rule_info *rulei, |
| 471 | struct net_device *out_dev); |
Petr Machata | a150201 | 2017-03-09 09:25:19 +0100 | [diff] [blame] | 472 | int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp, |
| 473 | struct mlxsw_sp_acl_rule_info *rulei, |
| 474 | u32 action, u16 vid, u16 proto, u8 prio); |
Arkadi Sharshevsky | 4817072 | 2017-03-11 09:42:58 +0100 | [diff] [blame] | 475 | int mlxsw_sp_acl_rulei_act_count(struct mlxsw_sp *mlxsw_sp, |
| 476 | struct mlxsw_sp_acl_rule_info *rulei); |
Jiri Pirko | ac44dd4 | 2017-04-18 16:55:32 +0200 | [diff] [blame] | 477 | int mlxsw_sp_acl_rulei_act_fid_set(struct mlxsw_sp *mlxsw_sp, |
| 478 | struct mlxsw_sp_acl_rule_info *rulei, |
| 479 | u16 fid); |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 480 | |
| 481 | struct mlxsw_sp_acl_rule; |
| 482 | |
| 483 | struct mlxsw_sp_acl_rule * |
| 484 | mlxsw_sp_acl_rule_create(struct mlxsw_sp *mlxsw_sp, |
| 485 | struct mlxsw_sp_acl_ruleset *ruleset, |
| 486 | unsigned long cookie); |
| 487 | void mlxsw_sp_acl_rule_destroy(struct mlxsw_sp *mlxsw_sp, |
| 488 | struct mlxsw_sp_acl_rule *rule); |
| 489 | int mlxsw_sp_acl_rule_add(struct mlxsw_sp *mlxsw_sp, |
| 490 | struct mlxsw_sp_acl_rule *rule); |
| 491 | void mlxsw_sp_acl_rule_del(struct mlxsw_sp *mlxsw_sp, |
| 492 | struct mlxsw_sp_acl_rule *rule); |
| 493 | struct mlxsw_sp_acl_rule * |
| 494 | mlxsw_sp_acl_rule_lookup(struct mlxsw_sp *mlxsw_sp, |
| 495 | struct mlxsw_sp_acl_ruleset *ruleset, |
| 496 | unsigned long cookie); |
| 497 | struct mlxsw_sp_acl_rule_info * |
| 498 | mlxsw_sp_acl_rule_rulei(struct mlxsw_sp_acl_rule *rule); |
Arkadi Sharshevsky | 4817072 | 2017-03-11 09:42:58 +0100 | [diff] [blame] | 499 | int mlxsw_sp_acl_rule_get_stats(struct mlxsw_sp *mlxsw_sp, |
| 500 | struct mlxsw_sp_acl_rule *rule, |
| 501 | u64 *packets, u64 *bytes, u64 *last_use); |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 502 | |
Ido Schimmel | a110748 | 2017-05-26 08:37:39 +0200 | [diff] [blame] | 503 | struct mlxsw_sp_fid *mlxsw_sp_acl_dummy_fid(struct mlxsw_sp *mlxsw_sp); |
| 504 | |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 505 | int mlxsw_sp_acl_init(struct mlxsw_sp *mlxsw_sp); |
| 506 | void mlxsw_sp_acl_fini(struct mlxsw_sp *mlxsw_sp); |
| 507 | |
Ido Schimmel | cb4cc0e | 2017-06-04 16:53:38 +0200 | [diff] [blame] | 508 | /* spectrum_acl_tcam.c */ |
Jiri Pirko | 22a6776 | 2017-02-03 10:29:07 +0100 | [diff] [blame] | 509 | extern const struct mlxsw_sp_acl_ops mlxsw_sp_acl_tcam_ops; |
| 510 | |
Ido Schimmel | cb4cc0e | 2017-06-04 16:53:38 +0200 | [diff] [blame] | 511 | /* spectrum_flower.c */ |
Jiri Pirko | 7aa0f5a | 2017-02-03 10:29:09 +0100 | [diff] [blame] | 512 | int mlxsw_sp_flower_replace(struct mlxsw_sp_port *mlxsw_sp_port, bool ingress, |
Jiri Pirko | 5fd9fc4 | 2017-08-07 10:15:29 +0200 | [diff] [blame] | 513 | struct tc_cls_flower_offload *f); |
Jiri Pirko | 7aa0f5a | 2017-02-03 10:29:09 +0100 | [diff] [blame] | 514 | void mlxsw_sp_flower_destroy(struct mlxsw_sp_port *mlxsw_sp_port, bool ingress, |
| 515 | struct tc_cls_flower_offload *f); |
Arkadi Sharshevsky | 7c1b8eb | 2017-03-11 09:42:59 +0100 | [diff] [blame] | 516 | int mlxsw_sp_flower_stats(struct mlxsw_sp_port *mlxsw_sp_port, bool ingress, |
| 517 | struct tc_cls_flower_offload *f); |
Jiri Pirko | 7aa0f5a | 2017-02-03 10:29:09 +0100 | [diff] [blame] | 518 | |
Ido Schimmel | cb4cc0e | 2017-06-04 16:53:38 +0200 | [diff] [blame] | 519 | /* spectrum_fid.c */ |
Ido Schimmel | a110748 | 2017-05-26 08:37:39 +0200 | [diff] [blame] | 520 | int mlxsw_sp_fid_flood_set(struct mlxsw_sp_fid *fid, |
| 521 | enum mlxsw_sp_flood_type packet_type, u8 local_port, |
| 522 | bool member); |
| 523 | int mlxsw_sp_fid_port_vid_map(struct mlxsw_sp_fid *fid, |
| 524 | struct mlxsw_sp_port *mlxsw_sp_port, u16 vid); |
| 525 | void mlxsw_sp_fid_port_vid_unmap(struct mlxsw_sp_fid *fid, |
| 526 | struct mlxsw_sp_port *mlxsw_sp_port, u16 vid); |
| 527 | enum mlxsw_sp_rif_type mlxsw_sp_fid_rif_type(const struct mlxsw_sp_fid *fid); |
| 528 | u16 mlxsw_sp_fid_index(const struct mlxsw_sp_fid *fid); |
| 529 | enum mlxsw_sp_fid_type mlxsw_sp_fid_type(const struct mlxsw_sp_fid *fid); |
| 530 | void mlxsw_sp_fid_rif_set(struct mlxsw_sp_fid *fid, struct mlxsw_sp_rif *rif); |
Ido Schimmel | e4f3c1c | 2017-05-26 08:37:40 +0200 | [diff] [blame] | 531 | enum mlxsw_sp_rif_type |
| 532 | mlxsw_sp_fid_type_rif_type(const struct mlxsw_sp *mlxsw_sp, |
| 533 | enum mlxsw_sp_fid_type type); |
| 534 | u16 mlxsw_sp_fid_8021q_vid(const struct mlxsw_sp_fid *fid); |
Ido Schimmel | a110748 | 2017-05-26 08:37:39 +0200 | [diff] [blame] | 535 | struct mlxsw_sp_fid *mlxsw_sp_fid_8021q_get(struct mlxsw_sp *mlxsw_sp, u16 vid); |
| 536 | struct mlxsw_sp_fid *mlxsw_sp_fid_8021d_get(struct mlxsw_sp *mlxsw_sp, |
| 537 | int br_ifindex); |
| 538 | struct mlxsw_sp_fid *mlxsw_sp_fid_rfid_get(struct mlxsw_sp *mlxsw_sp, |
| 539 | u16 rif_index); |
| 540 | struct mlxsw_sp_fid *mlxsw_sp_fid_dummy_get(struct mlxsw_sp *mlxsw_sp); |
| 541 | void mlxsw_sp_fid_put(struct mlxsw_sp_fid *fid); |
| 542 | int mlxsw_sp_port_fids_init(struct mlxsw_sp_port *mlxsw_sp_port); |
| 543 | void mlxsw_sp_port_fids_fini(struct mlxsw_sp_port *mlxsw_sp_port); |
| 544 | int mlxsw_sp_fids_init(struct mlxsw_sp *mlxsw_sp); |
| 545 | void mlxsw_sp_fids_fini(struct mlxsw_sp *mlxsw_sp); |
| 546 | |
Jiri Pirko | 56ade8f | 2015-10-16 14:01:37 +0200 | [diff] [blame] | 547 | #endif |