Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'mlxsw-Two-small-updates'

Ido Schimmel says:

====================
mlxsw: Two small updates

Patch #1 from Petr handles a corner case in GRE tunnel offload.

Patch #2 from Amit fixes a recent issue where the driver was programming
the device to use an adjacency index (for a nexthop) that was not
properly initialized.
====================

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>

+40 -4
+40 -4
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
··· 1614 1614 mlxsw_sp_netdevice_ipip_ul_vrf_event(struct mlxsw_sp *mlxsw_sp, 1615 1615 struct mlxsw_sp_ipip_entry *ipip_entry, 1616 1616 struct net_device *ul_dev, 1617 + bool *demote_this, 1617 1618 struct netlink_ext_ack *extack) 1618 1619 { 1620 + u32 ul_tb_id = l3mdev_fib_table(ul_dev) ? : RT_TABLE_MAIN; 1621 + enum mlxsw_sp_l3proto ul_proto; 1622 + union mlxsw_sp_l3addr saddr; 1623 + 1624 + /* Moving underlay to a different VRF might cause local address 1625 + * conflict, and the conflicting tunnels need to be demoted. 1626 + */ 1627 + ul_proto = mlxsw_sp->router->ipip_ops_arr[ipip_entry->ipipt]->ul_proto; 1628 + saddr = mlxsw_sp_ipip_netdev_saddr(ul_proto, ipip_entry->ol_dev); 1629 + if (mlxsw_sp_ipip_demote_tunnel_by_saddr(mlxsw_sp, ul_proto, 1630 + saddr, ul_tb_id, 1631 + ipip_entry)) { 1632 + *demote_this = true; 1633 + return 0; 1634 + } 1635 + 1619 1636 return __mlxsw_sp_ipip_entry_update_tunnel(mlxsw_sp, ipip_entry, 1620 1637 true, true, false, extack); 1621 1638 } ··· 1783 1766 __mlxsw_sp_netdevice_ipip_ul_event(struct mlxsw_sp *mlxsw_sp, 1784 1767 struct mlxsw_sp_ipip_entry *ipip_entry, 1785 1768 struct net_device *ul_dev, 1769 + bool *demote_this, 1786 1770 unsigned long event, 1787 1771 struct netdev_notifier_info *info) 1788 1772 { ··· 1798 1780 return mlxsw_sp_netdevice_ipip_ul_vrf_event(mlxsw_sp, 1799 1781 ipip_entry, 1800 1782 ul_dev, 1783 + demote_this, 1801 1784 extack); 1802 1785 break; 1803 1786 ··· 1825 1806 while ((ipip_entry = mlxsw_sp_ipip_entry_find_by_ul_dev(mlxsw_sp, 1826 1807 ul_dev, 1827 1808 ipip_entry))) { 1809 + struct mlxsw_sp_ipip_entry *prev; 1810 + bool demote_this = false; 1811 + 1828 1812 err = __mlxsw_sp_netdevice_ipip_ul_event(mlxsw_sp, ipip_entry, 1829 - ul_dev, event, info); 1813 + ul_dev, &demote_this, 1814 + event, info); 1830 1815 if (err) { 1831 1816 mlxsw_sp_ipip_demote_tunnel_by_ul_netdev(mlxsw_sp, 1832 1817 ul_dev); 1833 1818 return err; 1819 + } 1820 + 1821 + if (demote_this) { 1822 + if (list_is_first(&ipip_entry->ipip_list_node, 1823 + &mlxsw_sp->router->ipip_list)) 1824 + prev = NULL; 1825 + else 1826 + /* This can't be cached from previous iteration, 1827 + * because that entry could be gone now. 1828 + */ 1829 + prev = list_prev_entry(ipip_entry, 1830 + ipip_list_node); 1831 + mlxsw_sp_ipip_entry_demote_tunnel(mlxsw_sp, ipip_entry); 1832 + ipip_entry = prev; 1834 1833 } 1835 1834 } 1836 1835 ··· 4221 4184 4222 4185 static int mlxsw_sp_adj_discard_write(struct mlxsw_sp *mlxsw_sp, u16 rif_index) 4223 4186 { 4224 - u32 adj_discard_index = mlxsw_sp->router->adj_discard_index; 4225 4187 enum mlxsw_reg_ratr_trap_action trap_action; 4226 4188 char ratr_pl[MLXSW_REG_RATR_LEN]; 4227 4189 int err; ··· 4235 4199 4236 4200 trap_action = MLXSW_REG_RATR_TRAP_ACTION_DISCARD_ERRORS; 4237 4201 mlxsw_reg_ratr_pack(ratr_pl, MLXSW_REG_RATR_OP_WRITE_WRITE_ENTRY, true, 4238 - MLXSW_REG_RATR_TYPE_ETHERNET, adj_discard_index, 4239 - rif_index); 4202 + MLXSW_REG_RATR_TYPE_ETHERNET, 4203 + mlxsw_sp->router->adj_discard_index, rif_index); 4240 4204 mlxsw_reg_ratr_trap_action_set(ratr_pl, trap_action); 4241 4205 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ratr), ratr_pl); 4242 4206 if (err)