Commit 609c8ae8 authored by David S. Miller's avatar David S. Miller

Merge branch 'mlxsw-next'

Ido Schimmel says:

====================
mlxsw: Various updates

This patchset contains various updates to the mlxsw driver and related
selftests.

Patches #1-#5 contain various updates to mlxsw selftests. The most
significant change is the conversion of the DCB selftests to use the new
iproute2 DCB support.

Patches #6-#9 contain mostly trivial changes to the driver itself. No
user facing changes.

Patches #10-#11 remove support for SwitchX-2 and SwitchIB ASICs that did
not see any updates in the last 4-5 years and will not see any in the
future. See individual commit messages for detailed explanation as to
why it is OK to remove these drivers from the kernel.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 16145dbd b0d80c01
...@@ -49,28 +49,6 @@ config MLXSW_I2C ...@@ -49,28 +49,6 @@ config MLXSW_I2C
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called mlxsw_i2c. module will be called mlxsw_i2c.
config MLXSW_SWITCHIB
tristate "Mellanox Technologies SwitchIB and SwitchIB-2 support"
depends on MLXSW_CORE && MLXSW_PCI && NET_SWITCHDEV
default m
help
This driver supports Mellanox Technologies SwitchIB and SwitchIB-2
Infiniband Switch ASICs.
To compile this driver as a module, choose M here: the
module will be called mlxsw_switchib.
config MLXSW_SWITCHX2
tristate "Mellanox Technologies SwitchX-2 support"
depends on MLXSW_CORE && MLXSW_PCI && NET_SWITCHDEV
default m
help
This driver supports Mellanox Technologies SwitchX-2 Ethernet
Switch ASICs.
To compile this driver as a module, choose M here: the
module will be called mlxsw_switchx2.
config MLXSW_SPECTRUM config MLXSW_SPECTRUM
tristate "Mellanox Technologies Spectrum family support" tristate "Mellanox Technologies Spectrum family support"
depends on MLXSW_CORE && MLXSW_PCI && NET_SWITCHDEV && VLAN_8021Q depends on MLXSW_CORE && MLXSW_PCI && NET_SWITCHDEV && VLAN_8021Q
......
...@@ -8,10 +8,6 @@ obj-$(CONFIG_MLXSW_PCI) += mlxsw_pci.o ...@@ -8,10 +8,6 @@ obj-$(CONFIG_MLXSW_PCI) += mlxsw_pci.o
mlxsw_pci-objs := pci.o mlxsw_pci-objs := pci.o
obj-$(CONFIG_MLXSW_I2C) += mlxsw_i2c.o obj-$(CONFIG_MLXSW_I2C) += mlxsw_i2c.o
mlxsw_i2c-objs := i2c.o mlxsw_i2c-objs := i2c.o
obj-$(CONFIG_MLXSW_SWITCHIB) += mlxsw_switchib.o
mlxsw_switchib-objs := switchib.o
obj-$(CONFIG_MLXSW_SWITCHX2) += mlxsw_switchx2.o
mlxsw_switchx2-objs := switchx2.o
obj-$(CONFIG_MLXSW_SPECTRUM) += mlxsw_spectrum.o obj-$(CONFIG_MLXSW_SPECTRUM) += mlxsw_spectrum.o
mlxsw_spectrum-objs := spectrum.o spectrum_buffers.o \ mlxsw_spectrum-objs := spectrum.o spectrum_buffers.o \
spectrum_switchdev.o spectrum_router.o \ spectrum_switchdev.o spectrum_router.o \
......
...@@ -630,7 +630,7 @@ static int mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core, ...@@ -630,7 +630,7 @@ static int mlxsw_emad_transmit(struct mlxsw_core *mlxsw_core,
struct sk_buff *skb; struct sk_buff *skb;
int err; int err;
skb = skb_copy(trans->tx_skb, GFP_KERNEL); skb = skb_clone(trans->tx_skb, GFP_KERNEL);
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
......
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
/* Copyright (c) 2016-2018 Mellanox Technologies. All rights reserved */
#ifndef _MLXSW_IB_H
#define _MLXSW_IB_H
#define MLXSW_IB_DEFAULT_MTU 4096
#endif /* _MLXSW_IB_H */
...@@ -234,6 +234,7 @@ static void mlxsw_m_port_remove(struct mlxsw_m *mlxsw_m, u8 local_port) ...@@ -234,6 +234,7 @@ static void mlxsw_m_port_remove(struct mlxsw_m *mlxsw_m, u8 local_port)
static int mlxsw_m_port_module_map(struct mlxsw_m *mlxsw_m, u8 local_port, static int mlxsw_m_port_module_map(struct mlxsw_m *mlxsw_m, u8 local_port,
u8 *last_module) u8 *last_module)
{ {
unsigned int max_ports = mlxsw_core_max_ports(mlxsw_m->core);
u8 module, width; u8 module, width;
int err; int err;
...@@ -249,6 +250,9 @@ static int mlxsw_m_port_module_map(struct mlxsw_m *mlxsw_m, u8 local_port, ...@@ -249,6 +250,9 @@ static int mlxsw_m_port_module_map(struct mlxsw_m *mlxsw_m, u8 local_port,
if (module == *last_module) if (module == *last_module)
return 0; return 0;
*last_module = module; *last_module = module;
if (WARN_ON_ONCE(module >= max_ports))
return -EINVAL;
mlxsw_m->module_to_port[module] = ++mlxsw_m->max_ports; mlxsw_m->module_to_port[module] = ++mlxsw_m->max_ports;
return 0; return 0;
......
...@@ -1426,11 +1426,6 @@ static int mlxsw_pci_sys_ready_wait(struct mlxsw_pci *mlxsw_pci, ...@@ -1426,11 +1426,6 @@ static int mlxsw_pci_sys_ready_wait(struct mlxsw_pci *mlxsw_pci,
unsigned long end; unsigned long end;
u32 val; u32 val;
if (id->device == PCI_DEVICE_ID_MELLANOX_SWITCHX2) {
msleep(MLXSW_PCI_SW_RESET_TIMEOUT_MSECS);
return 0;
}
/* We must wait for the HW to become responsive. */ /* We must wait for the HW to become responsive. */
msleep(MLXSW_PCI_SW_RESET_WAIT_MSECS); msleep(MLXSW_PCI_SW_RESET_WAIT_MSECS);
......
...@@ -6,12 +6,9 @@ ...@@ -6,12 +6,9 @@
#include <linux/pci.h> #include <linux/pci.h>
#define PCI_DEVICE_ID_MELLANOX_SWITCHX2 0xc738
#define PCI_DEVICE_ID_MELLANOX_SPECTRUM 0xcb84 #define PCI_DEVICE_ID_MELLANOX_SPECTRUM 0xcb84
#define PCI_DEVICE_ID_MELLANOX_SPECTRUM2 0xcf6c #define PCI_DEVICE_ID_MELLANOX_SPECTRUM2 0xcf6c
#define PCI_DEVICE_ID_MELLANOX_SPECTRUM3 0xcf70 #define PCI_DEVICE_ID_MELLANOX_SPECTRUM3 0xcf70
#define PCI_DEVICE_ID_MELLANOX_SWITCHIB 0xcb20
#define PCI_DEVICE_ID_MELLANOX_SWITCHIB2 0xcf08
#if IS_ENABLED(CONFIG_MLXSW_PCI) #if IS_ENABLED(CONFIG_MLXSW_PCI)
......
...@@ -2125,9 +2125,14 @@ static void mlxsw_sp_pude_event_func(const struct mlxsw_reg_info *reg, ...@@ -2125,9 +2125,14 @@ static void mlxsw_sp_pude_event_func(const struct mlxsw_reg_info *reg,
struct mlxsw_sp *mlxsw_sp = priv; struct mlxsw_sp *mlxsw_sp = priv;
struct mlxsw_sp_port *mlxsw_sp_port; struct mlxsw_sp_port *mlxsw_sp_port;
enum mlxsw_reg_pude_oper_status status; enum mlxsw_reg_pude_oper_status status;
unsigned int max_ports;
u8 local_port; u8 local_port;
max_ports = mlxsw_core_max_ports(mlxsw_sp->core);
local_port = mlxsw_reg_pude_local_port_get(pude_pl); local_port = mlxsw_reg_pude_local_port_get(pude_pl);
if (WARN_ON_ONCE(local_port >= max_ports))
return;
mlxsw_sp_port = mlxsw_sp->ports[local_port]; mlxsw_sp_port = mlxsw_sp->ports[local_port];
if (!mlxsw_sp_port) if (!mlxsw_sp_port)
return; return;
......
...@@ -364,7 +364,7 @@ static u16 mlxsw_sp_hdroom_buf_delay_get(const struct mlxsw_sp *mlxsw_sp, ...@@ -364,7 +364,7 @@ static u16 mlxsw_sp_hdroom_buf_delay_get(const struct mlxsw_sp *mlxsw_sp,
static u32 mlxsw_sp_hdroom_int_buf_size_get(struct mlxsw_sp *mlxsw_sp, int mtu, u32 speed) static u32 mlxsw_sp_hdroom_int_buf_size_get(struct mlxsw_sp *mlxsw_sp, int mtu, u32 speed)
{ {
u32 buffsize = mlxsw_sp->sb_ops->int_buf_size_get(speed, mtu); u32 buffsize = mlxsw_sp->sb_ops->int_buf_size_get(mtu, speed);
return mlxsw_sp_bytes_cells(mlxsw_sp, buffsize) + 1; return mlxsw_sp_bytes_cells(mlxsw_sp, buffsize) + 1;
} }
...@@ -388,8 +388,8 @@ void mlxsw_sp_hdroom_bufs_reset_sizes(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -388,8 +388,8 @@ void mlxsw_sp_hdroom_bufs_reset_sizes(struct mlxsw_sp_port *mlxsw_sp_port,
int i; int i;
/* Internal buffer. */ /* Internal buffer. */
reserve_cells = mlxsw_sp_hdroom_int_buf_size_get(mlxsw_sp, mlxsw_sp_port->max_speed, reserve_cells = mlxsw_sp_hdroom_int_buf_size_get(mlxsw_sp, mlxsw_sp_port->max_mtu,
mlxsw_sp_port->max_mtu); mlxsw_sp_port->max_speed);
reserve_cells = mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, reserve_cells); reserve_cells = mlxsw_sp_port_headroom_8x_adjust(mlxsw_sp_port, reserve_cells);
hdroom->int_buf.reserve_cells = reserve_cells; hdroom->int_buf.reserve_cells = reserve_cells;
......
...@@ -568,10 +568,13 @@ void mlxsw_sp1_ptp_got_timestamp(struct mlxsw_sp *mlxsw_sp, bool ingress, ...@@ -568,10 +568,13 @@ void mlxsw_sp1_ptp_got_timestamp(struct mlxsw_sp *mlxsw_sp, bool ingress,
u8 domain_number, u16 sequence_id, u8 domain_number, u16 sequence_id,
u64 timestamp) u64 timestamp)
{ {
unsigned int max_ports = mlxsw_core_max_ports(mlxsw_sp->core);
struct mlxsw_sp_port *mlxsw_sp_port; struct mlxsw_sp_port *mlxsw_sp_port;
struct mlxsw_sp1_ptp_key key; struct mlxsw_sp1_ptp_key key;
u8 types; u8 types;
if (WARN_ON_ONCE(local_port >= max_ports))
return;
mlxsw_sp_port = mlxsw_sp->ports[local_port]; mlxsw_sp_port = mlxsw_sp->ports[local_port];
if (!mlxsw_sp_port) if (!mlxsw_sp_port)
return; return;
......
...@@ -2282,6 +2282,7 @@ static void mlxsw_sp_router_neigh_ent_ipv4_process(struct mlxsw_sp *mlxsw_sp, ...@@ -2282,6 +2282,7 @@ static void mlxsw_sp_router_neigh_ent_ipv4_process(struct mlxsw_sp *mlxsw_sp,
char *rauhtd_pl, char *rauhtd_pl,
int ent_index) int ent_index)
{ {
u64 max_rifs = MLXSW_CORE_RES_GET(mlxsw_sp->core, MAX_RIFS);
struct net_device *dev; struct net_device *dev;
struct neighbour *n; struct neighbour *n;
__be32 dipn; __be32 dipn;
...@@ -2290,6 +2291,8 @@ static void mlxsw_sp_router_neigh_ent_ipv4_process(struct mlxsw_sp *mlxsw_sp, ...@@ -2290,6 +2291,8 @@ static void mlxsw_sp_router_neigh_ent_ipv4_process(struct mlxsw_sp *mlxsw_sp,
mlxsw_reg_rauhtd_ent_ipv4_unpack(rauhtd_pl, ent_index, &rif, &dip); mlxsw_reg_rauhtd_ent_ipv4_unpack(rauhtd_pl, ent_index, &rif, &dip);
if (WARN_ON_ONCE(rif >= max_rifs))
return;
if (!mlxsw_sp->router->rifs[rif]) { if (!mlxsw_sp->router->rifs[rif]) {
dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Incorrect RIF in neighbour entry\n"); dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Incorrect RIF in neighbour entry\n");
return; return;
...@@ -3841,8 +3844,8 @@ mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp, ...@@ -3841,8 +3844,8 @@ mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp,
bool offload_change = false; bool offload_change = false;
u32 adj_index; u32 adj_index;
bool old_adj_index_valid; bool old_adj_index_valid;
int i, err2, err = 0;
u32 old_adj_index; u32 old_adj_index;
int i, err2, err;
if (!nhgi->gateway) if (!nhgi->gateway)
return mlxsw_sp_nexthop_fib_entries_update(mlxsw_sp, nh_grp); return mlxsw_sp_nexthop_fib_entries_update(mlxsw_sp, nh_grp);
...@@ -3872,11 +3875,13 @@ mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp, ...@@ -3872,11 +3875,13 @@ mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp,
return 0; return 0;
} }
mlxsw_sp_nexthop_group_normalize(nhgi); mlxsw_sp_nexthop_group_normalize(nhgi);
if (!nhgi->sum_norm_weight) if (!nhgi->sum_norm_weight) {
/* No neigh of this group is connected so we just set /* No neigh of this group is connected so we just set
* the trap and let everthing flow through kernel. * the trap and let everthing flow through kernel.
*/ */
err = 0;
goto set_trap; goto set_trap;
}
ecmp_size = nhgi->sum_norm_weight; ecmp_size = nhgi->sum_norm_weight;
err = mlxsw_sp_fix_adj_grp_size(mlxsw_sp, &ecmp_size); err = mlxsw_sp_fix_adj_grp_size(mlxsw_sp, &ecmp_size);
......
...@@ -2520,6 +2520,7 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp, ...@@ -2520,6 +2520,7 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp,
char *sfn_pl, int rec_index, char *sfn_pl, int rec_index,
bool adding) bool adding)
{ {
unsigned int max_ports = mlxsw_core_max_ports(mlxsw_sp->core);
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan; struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
struct mlxsw_sp_bridge_device *bridge_device; struct mlxsw_sp_bridge_device *bridge_device;
struct mlxsw_sp_bridge_port *bridge_port; struct mlxsw_sp_bridge_port *bridge_port;
...@@ -2532,6 +2533,9 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp, ...@@ -2532,6 +2533,9 @@ static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp,
int err; int err;
mlxsw_reg_sfn_mac_unpack(sfn_pl, rec_index, mac, &fid, &local_port); mlxsw_reg_sfn_mac_unpack(sfn_pl, rec_index, mac, &fid, &local_port);
if (WARN_ON_ONCE(local_port >= max_ports))
return;
mlxsw_sp_port = mlxsw_sp->ports[local_port]; mlxsw_sp_port = mlxsw_sp->ports[local_port];
if (!mlxsw_sp_port) { if (!mlxsw_sp_port) {
dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Incorrect local port in FDB notification\n"); dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Incorrect local port in FDB notification\n");
......
This diff is collapsed.
This diff is collapsed.
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
PORT_NUM_NETIFS=0 PORT_NUM_NETIFS=0
declare -a unsplit
port_setup_prepare() port_setup_prepare()
{ {
: :
...@@ -20,12 +22,12 @@ port_cleanup() ...@@ -20,12 +22,12 @@ port_cleanup()
devlink port unsplit $port devlink port unsplit $port
check_err $? "Did not unsplit $netdev" check_err $? "Did not unsplit $netdev"
done done
unsplit=()
} }
split_all_ports() split_all_ports()
{ {
local should_fail=$1; shift local should_fail=$1; shift
local -a unsplit
# Loop over the splittable netdevs and create tuples of netdev along # Loop over the splittable netdevs and create tuples of netdev along
# with its width. For example: # with its width. For example:
......
...@@ -29,37 +29,38 @@ cleanup() ...@@ -29,37 +29,38 @@ cleanup()
get_prio_pg() get_prio_pg()
{ {
__mlnx_qos -i $swp | sed -n '/^PFC/,/^[^[:space:]]/p' | # Produces a string of numbers "<B0> <B1> ... <B7> ", where BX is number
grep buffer | sed 's/ \+/ /g' | cut -d' ' -f 2- # of buffer that priority X is mapped to.
dcb -j buffer show dev $swp |
jq -r '[.prio_buffer | .[] | tostring + " "] | add'
} }
get_prio_pfc() get_prio_pfc()
{ {
__mlnx_qos -i $swp | sed -n '/^PFC/,/^[^[:space:]]/p' | # Produces a string of numbers "<P0> <P1> ... <P7> ", where PX denotes
grep enabled | sed 's/ \+/ /g' | cut -d' ' -f 2- # whether priority X has PFC enabled (the value is 1) or disabled (0).
dcb -j pfc show dev $swp |
jq -r '[.prio_pfc | .[] | if . then "1 " else "0 " end] | add'
} }
get_prio_tc() get_prio_tc()
{ {
__mlnx_qos -i $swp | sed -n '/^tc/,$p' | # Produces a string of numbers "<T0> <T1> ... <T7> ", where TC is number
awk '/^tc/ { TC = $2 } # of TC that priority X is mapped to.
/priority:/ { PRIO[$2]=TC } dcb -j ets show dev $swp |
END { jq -r '[.prio_tc | .[] | tostring + " "] | add'
for (i in PRIO)
printf("%d ", PRIO[i])
}'
} }
get_buf_size() get_buf_size()
{ {
local idx=$1; shift local idx=$1; shift
__mlnx_qos -i $swp | grep Receive | sed 's/.*: //' | cut -d, -f $((idx + 1)) dcb -j buffer show dev $swp | jq ".buffer_size[$idx]"
} }
get_tot_size() get_tot_size()
{ {
__mlnx_qos -i $swp | grep Receive | sed 's/.*total_size=//' dcb -j buffer show dev $swp | jq '.total_size'
} }
check_prio_pg() check_prio_pg()
...@@ -121,18 +122,18 @@ test_dcb_ets() ...@@ -121,18 +122,18 @@ test_dcb_ets()
{ {
RET=0 RET=0
__mlnx_qos -i $swp --prio_tc=0,2,4,6,1,3,5,7 > /dev/null dcb ets set dev $swp prio-tc 0:0 1:2 2:4 3:6 4:1 5:3 6:5 7:7
check_prio_pg "0 2 4 6 1 3 5 7 " check_prio_pg "0 2 4 6 1 3 5 7 "
check_prio_tc "0 2 4 6 1 3 5 7 " check_prio_tc "0 2 4 6 1 3 5 7 "
check_prio_pfc "0 0 0 0 0 0 0 0 " check_prio_pfc "0 0 0 0 0 0 0 0 "
__mlnx_qos -i $swp --prio_tc=0,0,0,0,0,0,0,0 > /dev/null dcb ets set dev $swp prio-tc all:0
check_prio_pg "0 0 0 0 0 0 0 0 " check_prio_pg "0 0 0 0 0 0 0 0 "
check_prio_tc "0 0 0 0 0 0 0 0 " check_prio_tc "0 0 0 0 0 0 0 0 "
__mlnx_qos -i $swp --prio2buffer=1,3,5,7,0,2,4,6 &> /dev/null dcb buffer set dev $swp prio-buffer 0:1 1:3 2:5 3:7 4:0 5:2 6:4 7:6 2>/dev/null
check_fail $? "prio2buffer accepted in DCB mode" check_fail $? "prio2buffer accepted in DCB mode"
log_test "Configuring headroom through ETS" log_test "Configuring headroom through ETS"
...@@ -174,7 +175,7 @@ test_pfc() ...@@ -174,7 +175,7 @@ test_pfc()
{ {
RET=0 RET=0
__mlnx_qos -i $swp --prio_tc=0,0,0,0,0,1,2,3 > /dev/null dcb ets set dev $swp prio-tc all:0 5:1 6:2 7:3
local buf0size=$(get_buf_size 0) local buf0size=$(get_buf_size 0)
local buf1size=$(get_buf_size 1) local buf1size=$(get_buf_size 1)
...@@ -193,7 +194,7 @@ test_pfc() ...@@ -193,7 +194,7 @@ test_pfc()
RET=0 RET=0
__mlnx_qos -i $swp --pfc=0,0,0,0,0,1,1,1 --cable_len=0 > /dev/null dcb pfc set dev $swp prio-pfc all:off 5:on 6:on 7:on delay 0
check_prio_pg "0 0 0 0 0 1 2 3 " check_prio_pg "0 0 0 0 0 1 2 3 "
check_prio_pfc "0 0 0 0 0 1 1 1 " check_prio_pfc "0 0 0 0 0 1 1 1 "
...@@ -210,7 +211,7 @@ test_pfc() ...@@ -210,7 +211,7 @@ test_pfc()
RET=0 RET=0
__mlnx_qos -i $swp --pfc=0,0,0,0,0,1,1,1 --cable_len=1000 > /dev/null dcb pfc set dev $swp delay 1000
check_buf_size 0 "== $buf0size" check_buf_size 0 "== $buf0size"
check_buf_size 1 "> $buf1size" check_buf_size 1 "> $buf1size"
...@@ -221,8 +222,8 @@ test_pfc() ...@@ -221,8 +222,8 @@ test_pfc()
RET=0 RET=0
__mlnx_qos -i $swp --pfc=0,0,0,0,0,0,0,0 --cable_len=0 > /dev/null dcb pfc set dev $swp prio-pfc all:off delay 0
__mlnx_qos -i $swp --prio_tc=0,0,0,0,0,0,0,0 > /dev/null dcb ets set dev $swp prio-tc all:0
check_prio_pg "0 0 0 0 0 0 0 0 " check_prio_pg "0 0 0 0 0 0 0 0 "
check_prio_tc "0 0 0 0 0 0 0 0 " check_prio_tc "0 0 0 0 0 0 0 0 "
...@@ -242,13 +243,13 @@ test_tc_priomap() ...@@ -242,13 +243,13 @@ test_tc_priomap()
{ {
RET=0 RET=0
__mlnx_qos -i $swp --prio_tc=0,1,2,3,4,5,6,7 > /dev/null dcb ets set dev $swp prio-tc 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7
check_prio_pg "0 1 2 3 4 5 6 7 " check_prio_pg "0 1 2 3 4 5 6 7 "
tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M
check_prio_pg "0 0 0 0 0 0 0 0 " check_prio_pg "0 0 0 0 0 0 0 0 "
__mlnx_qos -i $swp --prio2buffer=1,3,5,7,0,2,4,6 > /dev/null dcb buffer set dev $swp prio-buffer 0:1 1:3 2:5 3:7 4:0 5:2 6:4 7:6
check_prio_pg "1 3 5 7 0 2 4 6 " check_prio_pg "1 3 5 7 0 2 4 6 "
tc qdisc delete dev $swp root tc qdisc delete dev $swp root
...@@ -256,9 +257,9 @@ test_tc_priomap() ...@@ -256,9 +257,9 @@ test_tc_priomap()
# Clean up. # Clean up.
tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M
__mlnx_qos -i $swp --prio2buffer=0,0,0,0,0,0,0,0 > /dev/null dcb buffer set dev $swp prio-buffer all:0
tc qdisc delete dev $swp root tc qdisc delete dev $swp root
__mlnx_qos -i $swp --prio_tc=0,0,0,0,0,0,0,0 > /dev/null dcb ets set dev $swp prio-tc all:0
log_test "TC: priomap" log_test "TC: priomap"
} }
...@@ -270,12 +271,12 @@ test_tc_sizes() ...@@ -270,12 +271,12 @@ test_tc_sizes()
RET=0 RET=0
__mlnx_qos -i $swp --buffer_size=$size,0,0,0,0,0,0,0 &> /dev/null dcb buffer set dev $swp buffer-size all:0 0:$size 2>/dev/null
check_fail $? "buffer_size should fail before qdisc is added" check_fail $? "buffer_size should fail before qdisc is added"
tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M
__mlnx_qos -i $swp --buffer_size=$size,0,0,0,0,0,0,0 > /dev/null dcb buffer set dev $swp buffer-size all:0 0:$size
check_err $? "buffer_size should pass after qdisc is added" check_err $? "buffer_size should pass after qdisc is added"
check_buf_size 0 "== $size" "set size: " check_buf_size 0 "== $size" "set size: "
...@@ -283,26 +284,26 @@ test_tc_sizes() ...@@ -283,26 +284,26 @@ test_tc_sizes()
check_buf_size 0 "== $size" "set MTU: " check_buf_size 0 "== $size" "set MTU: "
mtu_restore $swp mtu_restore $swp
__mlnx_qos -i $swp --buffer_size=0,0,0,0,0,0,0,0 > /dev/null dcb buffer set dev $swp buffer-size all:0
# After replacing the qdisc for the same kind, buffer_size still has to # After replacing the qdisc for the same kind, buffer_size still has to
# work. # work.
tc qdisc replace dev $swp root handle 1: bfifo limit 1M tc qdisc replace dev $swp root handle 1: bfifo limit 1M
__mlnx_qos -i $swp --buffer_size=$size,0,0,0,0,0,0,0 > /dev/null dcb buffer set dev $swp buffer-size all:0 0:$size
check_buf_size 0 "== $size" "post replace, set size: " check_buf_size 0 "== $size" "post replace, set size: "
__mlnx_qos -i $swp --buffer_size=0,0,0,0,0,0,0,0 > /dev/null dcb buffer set dev $swp buffer-size all:0
# Likewise after replacing for a different kind. # Likewise after replacing for a different kind.
tc qdisc replace dev $swp root handle 2: prio bands 8 tc qdisc replace dev $swp root handle 2: prio bands 8
__mlnx_qos -i $swp --buffer_size=$size,0,0,0,0,0,0,0 > /dev/null dcb buffer set dev $swp buffer-size all:0 0:$size
check_buf_size 0 "== $size" "post replace different kind, set size: " check_buf_size 0 "== $size" "post replace different kind, set size: "
tc qdisc delete dev $swp root tc qdisc delete dev $swp root
__mlnx_qos -i $swp --buffer_size=$size,0,0,0,0,0,0,0 &> /dev/null dcb buffer set dev $swp buffer-size all:0 0:$size 2>/dev/null
check_fail $? "buffer_size should fail after qdisc is deleted" check_fail $? "buffer_size should fail after qdisc is deleted"
log_test "TC: buffer size" log_test "TC: buffer size"
...@@ -363,10 +364,10 @@ test_tc_int_buf() ...@@ -363,10 +364,10 @@ test_tc_int_buf()
tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M tc qdisc replace dev $swp root handle 1: bfifo limit 1.5M
test_int_buf "TC: " test_int_buf "TC: "
__mlnx_qos -i $swp --buffer_size=$size,0,0,0,0,0,0,0 > /dev/null dcb buffer set dev $swp buffer-size all:0 0:$size
test_int_buf "TC+buffsize: " test_int_buf "TC+buffsize: "
__mlnx_qos -i $swp --buffer_size=0,0,0,0,0,0,0,0 > /dev/null dcb buffer set dev $swp buffer-size all:0
tc qdisc delete dev $swp root tc qdisc delete dev $swp root
} }
......
...@@ -82,17 +82,3 @@ bail_on_lldpad() ...@@ -82,17 +82,3 @@ bail_on_lldpad()
fi fi
fi fi
} }
__mlnx_qos()
{
local err
mlnx_qos "$@" 2>/dev/null
err=$?
if ((err)); then
echo "Error ($err) in mlnx_qos $@" >/dev/stderr
fi
return $err
}
...@@ -171,7 +171,7 @@ switch_create() ...@@ -171,7 +171,7 @@ switch_create()
# assignment. # assignment.
tc qdisc replace dev $swp1 root handle 1: \ tc qdisc replace dev $swp1 root handle 1: \
ets bands 8 strict 8 priomap 7 6 ets bands 8 strict 8 priomap 7 6
__mlnx_qos -i $swp1 --prio2buffer=0,1,0,0,0,0,0,0 >/dev/null dcb buffer set dev $swp1 prio-buffer all:0 1:1
# $swp2 # $swp2
# ----- # -----
...@@ -209,8 +209,8 @@ switch_create() ...@@ -209,8 +209,8 @@ switch_create()
# the lossless prio into a buffer of its own. Don't bother with buffer # the lossless prio into a buffer of its own. Don't bother with buffer
# sizes though, there is not going to be any pressure in the "backward" # sizes though, there is not going to be any pressure in the "backward"
# direction. # direction.
__mlnx_qos -i $swp3 --prio2buffer=0,1,0,0,0,0,0,0 >/dev/null dcb buffer set dev $swp3 prio-buffer all:0 1:1
__mlnx_qos -i $swp3 --pfc=0,1,0,0,0,0,0,0 >/dev/null dcb pfc set dev $swp3 prio-pfc all:off 1:on
# $swp4 # $swp4
# ----- # -----
...@@ -226,11 +226,11 @@ switch_create() ...@@ -226,11 +226,11 @@ switch_create()
# Configure qdisc so that we can hand-tune headroom. # Configure qdisc so that we can hand-tune headroom.
tc qdisc replace dev $swp4 root handle 1: \ tc qdisc replace dev $swp4 root handle 1: \
ets bands 8 strict 8 priomap 7 6 ets bands 8 strict 8 priomap 7 6
__mlnx_qos -i $swp4 --prio2buffer=0,1,0,0,0,0,0,0 >/dev/null dcb buffer set dev $swp4 prio-buffer all:0 1:1
__mlnx_qos -i $swp4 --pfc=0,1,0,0,0,0,0,0 >/dev/null dcb pfc set dev $swp4 prio-pfc all:off 1:on
# PG0 will get autoconfigured to Xoff, give PG1 arbitrarily 100K, which # PG0 will get autoconfigured to Xoff, give PG1 arbitrarily 100K, which
# is (-2*MTU) about 80K of delay provision. # is (-2*MTU) about 80K of delay provision.
__mlnx_qos -i $swp4 --buffer_size=0,$_100KB,0,0,0,0,0,0 >/dev/null dcb buffer set dev $swp4 buffer-size all:0 1:$_100KB
# bridges # bridges
# ------- # -------
...@@ -273,9 +273,9 @@ switch_destroy() ...@@ -273,9 +273,9 @@ switch_destroy()
# $swp4 # $swp4
# ----- # -----
__mlnx_qos -i $swp4 --buffer_size=0,0,0,0,0,0,0,0 >/dev/null dcb buffer set dev $swp4 buffer-size all:0
__mlnx_qos -i $swp4 --pfc=0,0,0,0,0,0,0,0 >/dev/null dcb pfc set dev $swp4 prio-pfc all:off
__mlnx_qos -i $swp4 --prio2buffer=0,0,0,0,0,0,0,0 >/dev/null dcb buffer set dev $swp4 prio-buffer all:0
tc qdisc del dev $swp4 root tc qdisc del dev $swp4 root
devlink_tc_bind_pool_th_restore $swp4 1 ingress devlink_tc_bind_pool_th_restore $swp4 1 ingress
...@@ -288,8 +288,8 @@ switch_destroy() ...@@ -288,8 +288,8 @@ switch_destroy()
# $swp3 # $swp3
# ----- # -----
__mlnx_qos -i $swp3 --pfc=0,0,0,0,0,0,0,0 >/dev/null dcb pfc set dev $swp3 prio-pfc all:off
__mlnx_qos -i $swp3 --prio2buffer=0,0,0,0,0,0,0,0 >/dev/null dcb buffer set dev $swp3 prio-buffer all:0
tc qdisc del dev $swp3 root tc qdisc del dev $swp3 root
devlink_tc_bind_pool_th_restore $swp3 1 egress devlink_tc_bind_pool_th_restore $swp3 1 egress
...@@ -315,7 +315,7 @@ switch_destroy() ...@@ -315,7 +315,7 @@ switch_destroy()
# $swp1 # $swp1
# ----- # -----
__mlnx_qos -i $swp1 --prio2buffer=0,0,0,0,0,0,0,0 >/dev/null dcb buffer set dev $swp1 prio-buffer all:0
tc qdisc del dev $swp1 root tc qdisc del dev $swp1 root
devlink_tc_bind_pool_th_restore $swp1 1 ingress devlink_tc_bind_pool_th_restore $swp1 1 ingress
......
...@@ -234,15 +234,15 @@ __tc_sample_rate_test() ...@@ -234,15 +234,15 @@ __tc_sample_rate_test()
psample_capture_start psample_capture_start
ip vrf exec v$h1 $MZ $h1 -c 3200 -d 1msec -p 64 -A 192.0.2.1 \ ip vrf exec v$h1 $MZ $h1 -c 320000 -d 100usec -p 64 -A 192.0.2.1 \
-B $dip -t udp dp=52768,sp=42768 -q -B $dip -t udp dp=52768,sp=42768 -q
psample_capture_stop psample_capture_stop
pkts=$(grep -e "group 1 " $CAPTURE_FILE | wc -l) pkts=$(grep -e "group 1 " $CAPTURE_FILE | wc -l)
pct=$((100 * (pkts - 100) / 100)) pct=$((100 * (pkts - 10000) / 10000))
(( -25 <= pct && pct <= 25)) (( -25 <= pct && pct <= 25))
check_err $? "Expected 100 packets, got $pkts packets, which is $pct% off. Required accuracy is +-25%" check_err $? "Expected 10000 packets, got $pkts packets, which is $pct% off. Required accuracy is +-25%"
log_test "tc sample rate ($desc)" log_test "tc sample rate ($desc)"
...@@ -587,15 +587,15 @@ __tc_sample_acl_rate_test() ...@@ -587,15 +587,15 @@ __tc_sample_acl_rate_test()
psample_capture_start psample_capture_start
ip vrf exec v$h1 $MZ $h1 -c 3200 -d 1msec -p 64 -A 192.0.2.1 \ ip vrf exec v$h1 $MZ $h1 -c 320000 -d 100usec -p 64 -A 192.0.2.1 \
-B 198.51.100.1 -t udp dp=52768,sp=42768 -q -B 198.51.100.1 -t udp dp=52768,sp=42768 -q
psample_capture_stop psample_capture_stop
pkts=$(grep -e "group 1 " $CAPTURE_FILE | wc -l) pkts=$(grep -e "group 1 " $CAPTURE_FILE | wc -l)
pct=$((100 * (pkts - 100) / 100)) pct=$((100 * (pkts - 10000) / 10000))
(( -25 <= pct && pct <= 25)) (( -25 <= pct && pct <= 25))
check_err $? "Expected 100 packets, got $pkts packets, which is $pct% off. Required accuracy is +-25%" check_err $? "Expected 10000 packets, got $pkts packets, which is $pct% off. Required accuracy is +-25%"
# Setup a filter that should not match any packet and make sure packets # Setup a filter that should not match any packet and make sure packets
# are not sampled. # are not sampled.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment