mlxsw: spectrum_switchdev: Add more extack messages
authorIdo Schimmel <idosch@mellanox.com>
Mon, 28 Jan 2019 12:02:10 +0000 (12:02 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2019 18:43:15 +0000 (10:43 -0800)
Add more extack messages that let the user know why VXLAN offload
failed.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Suggested-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c

index 0f4e68d31cc3b34ad538e5b73d812835e2fe14c1..a4a9fe9921933adb845531d379376772327f1edf 100644 (file)
@@ -2027,6 +2027,7 @@ mlxsw_sp_bridge_8021q_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
                return 0;
 
        if (mlxsw_sp_fid_vni_is_set(fid)) {
+               NL_SET_ERR_MSG_MOD(extack, "VNI is already set on FID");
                err = -EINVAL;
                goto err_vni_exists;
        }
@@ -2213,10 +2214,13 @@ mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
        int err;
 
        fid = mlxsw_sp_fid_8021d_lookup(mlxsw_sp, bridge_device->dev->ifindex);
-       if (!fid)
+       if (!fid) {
+               NL_SET_ERR_MSG_MOD(extack, "Did not find a corresponding FID");
                return -EINVAL;
+       }
 
        if (mlxsw_sp_fid_vni_is_set(fid)) {
+               NL_SET_ERR_MSG_MOD(extack, "VNI is already set on FID");
                err = -EINVAL;
                goto err_vni_exists;
        }
@@ -3231,8 +3235,10 @@ mlxsw_sp_switchdev_vxlan_vlan_add(struct mlxsw_sp *mlxsw_sp,
         * the lookup function to return 'vxlan_dev'
         */
        if (flag_untagged && flag_pvid &&
-           mlxsw_sp_bridge_8021q_vxlan_dev_find(bridge_device->dev, vid))
+           mlxsw_sp_bridge_8021q_vxlan_dev_find(bridge_device->dev, vid)) {
+               NL_SET_ERR_MSG_MOD(extack, "VLAN already mapped to a different VNI");
                return -EINVAL;
+       }
 
        if (!netif_running(vxlan_dev))
                return 0;