diff options
Diffstat (limited to 'sys/dev/mlx5/mlx5_core/mlx5_main.c')
-rw-r--r-- | sys/dev/mlx5/mlx5_core/mlx5_main.c | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 6b9b63a24714..221781327b51 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -26,6 +26,7 @@ #include "opt_rss.h" #include "opt_ratelimit.h" +#include "opt_ipsec.h" #include <linux/kmod.h> #include <linux/module.h> @@ -52,8 +53,12 @@ #include <dev/mlx5/mlx5_core/diag_cnt.h> #ifdef PCI_IOV #include <sys/nv.h> +#include <sys/socket.h> #include <dev/pci/pci_iov.h> #include <sys/iov_schema.h> +#include <sys/iov.h> +#include <net/if.h> +#include <net/if_vlan_var.h> #endif static const char mlx5_version[] = "Mellanox Core driver " @@ -63,6 +68,9 @@ MODULE_LICENSE("Dual BSD/GPL"); MODULE_DEPEND(mlx5, linuxkpi, 1, 1, 1); MODULE_DEPEND(mlx5, mlxfw, 1, 1, 1); MODULE_DEPEND(mlx5, firmware, 1, 1, 1); +#ifdef IPSEC_OFFLOAD +MODULE_DEPEND(mlx5, ipsec, 1, 1, 1); +#endif MODULE_VERSION(mlx5, 1); SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, @@ -225,6 +233,7 @@ static void mlx5_set_driver_version(struct mlx5_core_dev *dev) #ifdef PCI_IOV static const char iov_mac_addr_name[] = "mac-addr"; +static const char iov_vlan_name[] = "vlan"; static const char iov_node_guid_name[] = "node-guid"; static const char iov_port_guid_name[] = "port-guid"; #endif @@ -752,8 +761,8 @@ static inline int fw_initializing(struct mlx5_core_dev *dev) static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili, u32 warn_time_mili) { - int warn = jiffies + msecs_to_jiffies(warn_time_mili); - int end = jiffies + msecs_to_jiffies(max_wait_mili); + unsigned long warn = jiffies + msecs_to_jiffies(warn_time_mili); + unsigned long end = jiffies + msecs_to_jiffies(max_wait_mili); int err = 0; MPASS(max_wait_mili > warn_time_mili); @@ -765,8 +774,8 @@ static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili, } if (warn_time_mili && time_after(jiffies, warn)) { mlx5_core_warn(dev, - "Waiting for FW initialization, timeout abort in %u s\n", - (unsigned)(jiffies_to_msecs(end - warn) / 1000)); + "Waiting for FW initialization, timeout abort in %lu s\n", + (unsigned long)(jiffies_to_msecs(end - warn) / 1000)); warn = jiffies + msecs_to_jiffies(warn_time_mili); } msleep(FW_INIT_WAIT_MS); @@ -1204,7 +1213,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, goto err_stop_eqs; } - err = mlx5_init_fs(dev); + err = mlx5_fs_core_init(dev); if (err) { mlx5_core_err(dev, "flow steering init %d\n", err); goto err_free_comp_eqs; @@ -1322,7 +1331,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv, mlx5_diag_cnt_cleanup(dev); mlx5_fpga_device_stop(dev); mlx5_mpfs_destroy(dev); - mlx5_cleanup_fs(dev); + mlx5_fs_core_cleanup(dev); mlx5_wait_for_reclaim_vfs_pages(dev); free_comp_eqs(dev); mlx5_stop_eqs(dev); @@ -1689,10 +1698,16 @@ static int init_one(struct pci_dev *pdev, mlx5_pagealloc_init(dev); + err = mlx5_fs_core_alloc(dev); + if (err) { + mlx5_core_err(dev, "Failed to alloc flow steering\n"); + goto clean_health; + } + err = mlx5_load_one(dev, priv, true); if (err) { mlx5_core_err(dev, "mlx5_load_one failed %d\n", err); - goto clean_health; + goto clean_fs; } mlx5_fwdump_prep(dev); @@ -1714,6 +1729,8 @@ static int init_one(struct pci_dev *pdev, vf_schema = pci_iov_schema_alloc_node(); pci_iov_schema_add_unicast_mac(vf_schema, iov_mac_addr_name, 0, NULL); + pci_iov_schema_add_vlan(vf_schema, + iov_vlan_name, 0, 0); pci_iov_schema_add_uint64(vf_schema, iov_node_guid_name, 0, 0); pci_iov_schema_add_uint64(vf_schema, iov_port_guid_name, @@ -1736,6 +1753,8 @@ static int init_one(struct pci_dev *pdev, pci_save_state(pdev); return 0; +clean_fs: + mlx5_fs_core_free(dev); clean_health: mlx5_pagealloc_cleanup(dev); mlx5_health_cleanup(dev); @@ -1767,6 +1786,7 @@ static void remove_one(struct pci_dev *pdev) (long long)(dev->priv.fw_pages * MLX5_ADAPTER_PAGE_SIZE)); } + mlx5_fs_core_free(dev); mlx5_pagealloc_cleanup(dev); mlx5_health_cleanup(dev); mlx5_fwdump_clean(dev); @@ -1950,6 +1970,25 @@ mlx5_iov_add_vf(device_t dev, uint16_t vfnum, const nvlist_t *vf_config) } } + if (nvlist_exists_number(vf_config, iov_vlan_name)) { + uint16_t vlan = nvlist_get_number(vf_config, iov_vlan_name); + + if (vlan == DOT1Q_VID_NULL) + error = ENOTSUP; + else { + if (vlan == VF_VLAN_TRUNK) + vlan = DOT1Q_VID_NULL; + + error = -mlx5_eswitch_set_vport_vlan(priv->eswitch, + vfnum + 1, vlan, 0); + } + if (error != 0) { + mlx5_core_err(core_dev, + "setting VLAN for VF %d failed, error %d\n", + vfnum + 1, error); + } + } + if (nvlist_exists_number(vf_config, iov_node_guid_name)) { node_guid = nvlist_get_number(vf_config, iov_node_guid_name); error = -mlx5_modify_nic_vport_node_guid(core_dev, vfnum + 1, @@ -2103,7 +2142,7 @@ static const struct pci_device_id mlx5_core_pci_table[] = { { PCI_VDEVICE(MELLANOX, 0xa2d3) }, /* BlueField integrated ConnectX-5 network controller VF */ { PCI_VDEVICE(MELLANOX, 0xa2d6) }, /* BlueField-2 integrated ConnectX-6 Dx network controller */ { PCI_VDEVICE(MELLANOX, 0xa2dc) }, /* BlueField-3 integrated ConnectX-7 network controller */ - { PCI_VDEVICE(MELLANOX, 0xa2df) }, /* BlueField-4 integrated ConnectX-8 network controller */ + { PCI_VDEVICE(MELLANOX, 0xa2df) }, /* BlueField-4 Family integrated network controller */ { } }; |