/* * * Copyright (c) 2003 by Karsten Wiese * * 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; either version 2 of the License, or * (at your option) any later version. * * 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. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ enum E_In84{ eFader0 = 0, eFader1, eFader2, eFader3, eFader4, eFader5, eFader6, eFader7, eFaderM, eTransport, eModifier = 10, eFilterSelect, eSelect, eMute, eSwitch = 15, eWheelGain, eWheelFreq, eWheelQ, eWheelPan, eWheel = 20 }; #define T_RECORD 1 #define T_PLAY 2 #define T_STOP 4 #define T_F_FWD 8 #define T_REW 0x10 #define T_SOLO 0x20 #define T_REC 0x40 #define T_NULL 0x80 struct us428_ctls { unsigned char Fader[9]; unsigned char Transport; unsigned char Modifier; unsigned char FilterSelect; unsigned char Select; unsigned char Mute; unsigned char UNKNOWN; unsigned char Switch; unsigned char Wheel[5]; }; struct us428_setByte { unsigned char Offset, Value; }; enum { eLT_Volume = 0, eLT_Light }; struct usX2Y_volume { unsigned char Channel, LH, LL, RH, RL; }; struct us428_lights { struct us428_setByte Light[7]; }; struct us428_p4out { char type; union { struct usX2Y_volume vol; struct us428_lights lights; } val; }; #define N_us428_ctl_BUFS 16 #define N_us428_p4out_BUFS 16 struct us428ctls_sharedmem{ struct us428_ctls CtlSnapShot[N_us428_ctl_BUFS]; int CtlSnapShotDiffersAt[N_us428_ctl_BUFS]; int CtlSnapShotLast, CtlSnapShotRed; struct us428_p4out p4out[N_us428_p4out_BUFS]; int p4outLast, p4outSent; }; e1c7d977e52759167a4916d71e80aaf5070'>diff
path: root/drivers
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2017-02-09 10:28:42 +0100
committerDavid S. Miller <davem@davemloft.net>2017-02-10 11:32:13 -0500
commit9aecce1c7d977e52759167a4916d71e80aaf5070 (patch)
treecd97f605c4967b3da6cfc7d792c9ea1529f4c9ec /drivers
parent2f3a5272e5c16c3c10fbba06928a513f9b1e2fcd (diff)
mlxsw: spectrum_router: Correctly handle identical routes
In the device, routes are indexed in a routing table based on the prefix and its length. This is in contrast to the kernel's FIB where several FIB aliases can exist with these parameters being identical. In such cases, the routes will be sorted by table ID (LOCAL first, then MAIN), TOS and finally priority (metric). During lookup, these routes will be evaluated in order. In case the packet's TOS field is non-zero and a FIB alias with a matching TOS is found, then it's selected. Otherwise, the lookup defaults to the route with TOS 0 (if it exists). However, if the requested scope is narrower than the one found, then the lookup continues. To best reflect the kernel's datapath we should take the above into account. Given a prefix and its length, the reflected route will always be the first one in the FIB alias list. However, if the route has a non-zero TOS then its action will be converted to trap instead of forward, since we currently don't support TOS-based routing. If this turns out to be a real issue, we can add support for that using policy-based switching. The route's scope can be effectively ignored as any packet being routed by the device would've been looked-up using the widest scope (UNIVERSE). To achieve that we need to do two changes. Firstly, we need to create another struct (FIB node) that will hold the list of FIB entries sharing the same prefix and length. This struct will be hashed using these two parameters. Secondly, we need to change the route reflection to match the above logic, so that the first FIB entry in the list will be programmed into the device while the rest will remain in the driver's cache in case of subsequent changes. Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c581
1 files changed, 403 insertions, 178 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c