-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/mlx5: FPGA, Add basic support for Innova
Mellanox Innova is a NIC with ConnectX and an FPGA on the same board. The FPGA is a bump-on-the-wire and thus affects operation of the mlx5_core driver on the ConnectX ASIC. Add basic support for Innova in mlx5_core. This allows using the Innova card as a regular NIC, by detecting the FPGA capability bit, and verifying its load state before initializing ConnectX interfaces. Also detect FPGA fatal runtime failures and enter error state if they ever happen. All new FPGA-related logic is placed in its own subdirectory 'fpga', which may be built by selecting CONFIG_MLX5_FPGA. This prepares for further support of various Innova features in later patchsets. Additional details about hardware architecture will be provided as more features get submitted. Signed-off-by: Ilan Tayari <ilant@mellanox.com> Reviewed-by: Boris Pismenny <borisp@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
- Loading branch information
Ilan Tayari
authored and
Saeed Mahameed
committed
May 14, 2017
1 parent
0179720
commit e29341f
Showing
13 changed files
with
640 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) 2017, Mellanox Technologies. 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 | ||
* General Public License (GPL) Version 2, available from the file | ||
* COPYING in the main directory of this source tree, or the | ||
* OpenIB.org BSD license below: | ||
* | ||
* Redistribution and use in source and binary forms, with or | ||
* without modification, are permitted provided that the following | ||
* conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer. | ||
* | ||
* - Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials | ||
* provided with the distribution. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
#include <linux/etherdevice.h> | ||
#include <linux/mlx5/cmd.h> | ||
#include <linux/mlx5/driver.h> | ||
|
||
#include "mlx5_core.h" | ||
#include "fpga/cmd.h" | ||
|
||
int mlx5_fpga_caps(struct mlx5_core_dev *dev, u32 *caps) | ||
{ | ||
u32 in[MLX5_ST_SZ_DW(fpga_cap)] = {0}; | ||
|
||
return mlx5_core_access_reg(dev, in, sizeof(in), caps, | ||
MLX5_ST_SZ_BYTES(fpga_cap), | ||
MLX5_REG_FPGA_CAP, 0, 0); | ||
} | ||
|
||
int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query) | ||
{ | ||
u32 in[MLX5_ST_SZ_DW(fpga_ctrl)] = {0}; | ||
u32 out[MLX5_ST_SZ_DW(fpga_ctrl)]; | ||
int err; | ||
|
||
err = mlx5_core_access_reg(dev, in, sizeof(in), out, sizeof(out), | ||
MLX5_REG_FPGA_CTRL, 0, false); | ||
if (err) | ||
return err; | ||
|
||
query->status = MLX5_GET(fpga_ctrl, out, status); | ||
query->admin_image = MLX5_GET(fpga_ctrl, out, flash_select_admin); | ||
query->oper_image = MLX5_GET(fpga_ctrl, out, flash_select_oper); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (c) 2017, 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 | ||
* General Public License (GPL) Version 2, available from the file | ||
* COPYING in the main directory of this source tree, or the | ||
* OpenIB.org BSD license below: | ||
* | ||
* Redistribution and use in source and binary forms, with or | ||
* without modification, are permitted provided that the following | ||
* conditions are met: | ||
* | ||
* - Redistributions of source code must retain the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer. | ||
* | ||
* - Redistributions in binary form must reproduce the above | ||
* copyright notice, this list of conditions and the following | ||
* disclaimer in the documentation and/or other materials | ||
* provided with the distribution. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
#ifndef __MLX5_FPGA_H__ | ||
#define __MLX5_FPGA_H__ | ||
|
||
#include <linux/mlx5/driver.h> | ||
|
||
enum mlx5_fpga_image { | ||
MLX5_FPGA_IMAGE_USER = 0, | ||
MLX5_FPGA_IMAGE_FACTORY, | ||
}; | ||
|
||
enum mlx5_fpga_status { | ||
MLX5_FPGA_STATUS_SUCCESS = 0, | ||
MLX5_FPGA_STATUS_FAILURE = 1, | ||
MLX5_FPGA_STATUS_IN_PROGRESS = 2, | ||
MLX5_FPGA_STATUS_NONE = 0xFFFF, | ||
}; | ||
|
||
struct mlx5_fpga_query { | ||
enum mlx5_fpga_image admin_image; | ||
enum mlx5_fpga_image oper_image; | ||
enum mlx5_fpga_status status; | ||
}; | ||
|
||
int mlx5_fpga_caps(struct mlx5_core_dev *dev, u32 *caps); | ||
int mlx5_fpga_query(struct mlx5_core_dev *dev, struct mlx5_fpga_query *query); | ||
|
||
#endif /* __MLX5_FPGA_H__ */ |
Oops, something went wrong.