mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
net/mlx5: Extend mlx5_core to support ConnectX-4 Ethernet functionality
This is the Ethernet part of the driver for the Mellanox ConnectX(R)-4 Single/Dual-Port Adapter supporting 100Gb/s with VPI. The driver extends the existing mlx5 driver with Ethernet functionality. This patch contains the driver entry points but does not include transmit and receive (see the previous patch in the series) routines. It also adds the option MLX5_CORE_EN to Kconfig to enable/disable the Ethernet functionality. Currently, Kconfig is programmed to make Ethernet and Infiniband functionality mutally exclusive. Also changed MLX5_INFINIBAND to be depandant on MLX5_CORE instead of selecting it, since MLX5_CORE could be selected without MLX5_INFINIBAND being selected. Signed-off-by: Amir Vadai <amirv@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
afb736e933
commit
f62b8bb8f2
@@ -1,8 +1,6 @@
|
||||
config MLX5_INFINIBAND
|
||||
tristate "Mellanox Connect-IB HCA support"
|
||||
depends on NETDEVICES && ETHERNET && PCI
|
||||
select NET_VENDOR_MELLANOX
|
||||
select MLX5_CORE
|
||||
depends on NETDEVICES && ETHERNET && PCI && MLX5_CORE
|
||||
---help---
|
||||
This driver provides low-level InfiniBand support for
|
||||
Mellanox Connect-IB PCI Express host channel adapters (HCAs).
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
#
|
||||
|
||||
config MLX5_CORE
|
||||
tristate
|
||||
tristate "Mellanox Technologies ConnectX-4 and Connect-IB core driver"
|
||||
depends on PCI
|
||||
default n
|
||||
---help---
|
||||
Core driver for low level functionality of the ConnectX-4 and
|
||||
Connect-IB cards by Mellanox Technologies.
|
||||
|
||||
config MLX5_CORE_EN
|
||||
bool "Mellanox Technologies ConnectX-4 Ethernet support"
|
||||
depends on MLX5_INFINIBAND=n && NETDEVICES && ETHERNET && PCI && MLX5_CORE
|
||||
default n
|
||||
---help---
|
||||
Ethernet support in Mellanox Technologies ConnectX-4 NIC.
|
||||
Ethernet and Infiniband support in ConnectX-4 are currently mutually
|
||||
exclusive.
|
||||
|
||||
@@ -3,3 +3,6 @@ obj-$(CONFIG_MLX5_CORE) += mlx5_core.o
|
||||
mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
|
||||
health.o mcg.o cq.o srq.o alloc.o qp.o port.o mr.o pd.o \
|
||||
mad.o
|
||||
mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o flow_table.o vport.o transobj.o \
|
||||
en_main.o en_flow_table.o en_ethtool.o en_tx.o en_rx.o \
|
||||
en_txrx.o
|
||||
|
||||
@@ -75,25 +75,6 @@ enum {
|
||||
MLX5_CMD_DELIVERY_STAT_CMD_DESCR_ERR = 0x10,
|
||||
};
|
||||
|
||||
enum {
|
||||
MLX5_CMD_STAT_OK = 0x0,
|
||||
MLX5_CMD_STAT_INT_ERR = 0x1,
|
||||
MLX5_CMD_STAT_BAD_OP_ERR = 0x2,
|
||||
MLX5_CMD_STAT_BAD_PARAM_ERR = 0x3,
|
||||
MLX5_CMD_STAT_BAD_SYS_STATE_ERR = 0x4,
|
||||
MLX5_CMD_STAT_BAD_RES_ERR = 0x5,
|
||||
MLX5_CMD_STAT_RES_BUSY = 0x6,
|
||||
MLX5_CMD_STAT_LIM_ERR = 0x8,
|
||||
MLX5_CMD_STAT_BAD_RES_STATE_ERR = 0x9,
|
||||
MLX5_CMD_STAT_IX_ERR = 0xa,
|
||||
MLX5_CMD_STAT_NO_RES_ERR = 0xf,
|
||||
MLX5_CMD_STAT_BAD_INP_LEN_ERR = 0x50,
|
||||
MLX5_CMD_STAT_BAD_OUTP_LEN_ERR = 0x51,
|
||||
MLX5_CMD_STAT_BAD_QP_STATE_ERR = 0x10,
|
||||
MLX5_CMD_STAT_BAD_PKT_ERR = 0x30,
|
||||
MLX5_CMD_STAT_BAD_SIZE_OUTS_CQES_ERR = 0x40,
|
||||
};
|
||||
|
||||
static struct mlx5_cmd_work_ent *alloc_cmd(struct mlx5_cmd *cmd,
|
||||
struct mlx5_cmd_msg *in,
|
||||
struct mlx5_cmd_msg *out,
|
||||
|
||||
520
drivers/net/ethernet/mellanox/mlx5/core/en.h
Normal file
520
drivers/net/ethernet/mellanox/mlx5/core/en.h
Normal file
File diff suppressed because it is too large
Load Diff
679
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
Normal file
679
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
Normal file
File diff suppressed because it is too large
Load Diff
1899
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Normal file
1899
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -48,10 +48,6 @@
|
||||
#include <linux/mlx5/mlx5_ifc.h>
|
||||
#include "mlx5_core.h"
|
||||
|
||||
#define DRIVER_NAME "mlx5_core"
|
||||
#define DRIVER_VERSION "3.0"
|
||||
#define DRIVER_RELDATE "January 2015"
|
||||
|
||||
MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>");
|
||||
MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 core driver");
|
||||
MODULE_LICENSE("Dual BSD/GPL");
|
||||
@@ -614,6 +610,61 @@ clean:
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MLX5_CORE_EN
|
||||
static int mlx5_core_set_issi(struct mlx5_core_dev *dev)
|
||||
{
|
||||
u32 query_in[MLX5_ST_SZ_DW(query_issi_in)];
|
||||
u32 query_out[MLX5_ST_SZ_DW(query_issi_out)];
|
||||
u32 set_in[MLX5_ST_SZ_DW(set_issi_in)];
|
||||
u32 set_out[MLX5_ST_SZ_DW(set_issi_out)];
|
||||
int err;
|
||||
u32 sup_issi;
|
||||
|
||||
memset(query_in, 0, sizeof(query_in));
|
||||
memset(query_out, 0, sizeof(query_out));
|
||||
|
||||
MLX5_SET(query_issi_in, query_in, opcode, MLX5_CMD_OP_QUERY_ISSI);
|
||||
|
||||
err = mlx5_cmd_exec_check_status(dev, query_in, sizeof(query_in),
|
||||
query_out, sizeof(query_out));
|
||||
if (err) {
|
||||
if (((struct mlx5_outbox_hdr *)query_out)->status ==
|
||||
MLX5_CMD_STAT_BAD_OP_ERR) {
|
||||
pr_debug("Only ISSI 0 is supported\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
pr_err("failed to query ISSI\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
sup_issi = MLX5_GET(query_issi_out, query_out, supported_issi_dw0);
|
||||
|
||||
if (sup_issi & (1 << 1)) {
|
||||
memset(set_in, 0, sizeof(set_in));
|
||||
memset(set_out, 0, sizeof(set_out));
|
||||
|
||||
MLX5_SET(set_issi_in, set_in, opcode, MLX5_CMD_OP_SET_ISSI);
|
||||
MLX5_SET(set_issi_in, set_in, current_issi, 1);
|
||||
|
||||
err = mlx5_cmd_exec_check_status(dev, set_in, sizeof(set_in),
|
||||
set_out, sizeof(set_out));
|
||||
if (err) {
|
||||
pr_err("failed to set ISSI=1\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
dev->issi = 1;
|
||||
|
||||
return 0;
|
||||
} else if (sup_issi & (1 << 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev)
|
||||
{
|
||||
struct mlx5_priv *priv = &dev->priv;
|
||||
@@ -676,6 +727,14 @@ static int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev)
|
||||
goto err_pagealloc_cleanup;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MLX5_CORE_EN
|
||||
err = mlx5_core_set_issi(dev);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "failed to set issi\n");
|
||||
goto err_disable_hca;
|
||||
}
|
||||
#endif
|
||||
|
||||
err = mlx5_satisfy_startup_pages(dev, 1);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "failed to allocate boot pages\n");
|
||||
@@ -1084,6 +1143,10 @@ static int __init init(void)
|
||||
if (err)
|
||||
goto err_health;
|
||||
|
||||
#ifdef CONFIG_MLX5_CORE_EN
|
||||
mlx5e_init();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
err_health:
|
||||
@@ -1096,6 +1159,9 @@ err_debug:
|
||||
|
||||
static void __exit cleanup(void)
|
||||
{
|
||||
#ifdef CONFIG_MLX5_CORE_EN
|
||||
mlx5e_cleanup();
|
||||
#endif
|
||||
pci_unregister_driver(&mlx5_core_driver);
|
||||
mlx5_health_cleanup();
|
||||
destroy_workqueue(mlx5_core_wq);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2015, Mellanox Technologies. All rights reserved.
|
||||
* Copyright (c) 2013-2015, Mellanox Technologies, Ltd. All rights reserved.
|
||||
*
|
||||
* This software is available to you under a choice of one of two
|
||||
* licenses. You may choose to be licensed under the terms of the GNU
|
||||
@@ -37,6 +37,10 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
#define DRIVER_NAME "mlx5_core"
|
||||
#define DRIVER_VERSION "3.0-1"
|
||||
#define DRIVER_RELDATE "January 2015"
|
||||
|
||||
extern int mlx5_core_debug_mask;
|
||||
|
||||
#define mlx5_core_dbg(dev, format, ...) \
|
||||
@@ -78,4 +82,7 @@ int mlx5_cmd_query_adapter(struct mlx5_core_dev *dev);
|
||||
int mlx5_cmd_init_hca(struct mlx5_core_dev *dev);
|
||||
int mlx5_cmd_teardown_hca(struct mlx5_core_dev *dev);
|
||||
|
||||
void mlx5e_init(void);
|
||||
void mlx5e_cleanup(void);
|
||||
|
||||
#endif /* __MLX5_CORE_H__ */
|
||||
|
||||
@@ -1153,4 +1153,23 @@ enum mlx5_cap_type {
|
||||
#define MLX5_CAP_ODP(mdev, cap)\
|
||||
MLX5_GET(odp_cap, mdev->hca_caps_cur[MLX5_CAP_ODP], cap)
|
||||
|
||||
enum {
|
||||
MLX5_CMD_STAT_OK = 0x0,
|
||||
MLX5_CMD_STAT_INT_ERR = 0x1,
|
||||
MLX5_CMD_STAT_BAD_OP_ERR = 0x2,
|
||||
MLX5_CMD_STAT_BAD_PARAM_ERR = 0x3,
|
||||
MLX5_CMD_STAT_BAD_SYS_STATE_ERR = 0x4,
|
||||
MLX5_CMD_STAT_BAD_RES_ERR = 0x5,
|
||||
MLX5_CMD_STAT_RES_BUSY = 0x6,
|
||||
MLX5_CMD_STAT_LIM_ERR = 0x8,
|
||||
MLX5_CMD_STAT_BAD_RES_STATE_ERR = 0x9,
|
||||
MLX5_CMD_STAT_IX_ERR = 0xa,
|
||||
MLX5_CMD_STAT_NO_RES_ERR = 0xf,
|
||||
MLX5_CMD_STAT_BAD_INP_LEN_ERR = 0x50,
|
||||
MLX5_CMD_STAT_BAD_OUTP_LEN_ERR = 0x51,
|
||||
MLX5_CMD_STAT_BAD_QP_STATE_ERR = 0x10,
|
||||
MLX5_CMD_STAT_BAD_PKT_ERR = 0x30,
|
||||
MLX5_CMD_STAT_BAD_SIZE_OUTS_CQES_ERR = 0x40,
|
||||
};
|
||||
|
||||
#endif /* MLX5_DEVICE_H */
|
||||
|
||||
@@ -489,6 +489,7 @@ struct mlx5_core_dev {
|
||||
struct mlx5_priv priv;
|
||||
struct mlx5_profile *profile;
|
||||
atomic_t num_qps;
|
||||
u32 issi;
|
||||
};
|
||||
|
||||
struct mlx5_db {
|
||||
|
||||
Reference in New Issue
Block a user