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

net/mlx5: Kconfig, Better organize compilation flags

Always contain all acceleration functions declarations in
'accel' files, independent to the flags setting.
For this, introduce new flags CONFIG_FPGA_{IPSEC/TLS} and use stubs
where needed.

This obsoletes the need for stubs in 'fpga' files. Remove them.

Also use the new flags in Makefile, to decide whether to compile
TLS-specific or IPSEC-specific objects, or not.

Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Tariq Toukan and committed by
David S. Miller
e2869fb2 c778dd31

+47 -93
+33 -10
drivers/net/ethernet/mellanox/mlx5/core/Kconfig
··· 97 97 ---help--- 98 98 MLX5 IPoIB offloads & acceleration support. 99 99 100 + config MLX5_FPGA_IPSEC 101 + bool "Mellanox Technologies IPsec Innova support" 102 + depends on MLX5_CORE 103 + depends on MLX5_FPGA 104 + default n 105 + help 106 + Build IPsec support for the Innova family of network cards by Mellanox 107 + Technologies. Innova network cards are comprised of a ConnectX chip 108 + and an FPGA chip on one board. If you select this option, the 109 + mlx5_core driver will include the Innova FPGA core and allow building 110 + sandbox-specific client drivers. 111 + 100 112 config MLX5_EN_IPSEC 101 113 bool "IPSec XFRM cryptography-offload accelaration" 102 - depends on MLX5_ACCEL 103 114 depends on MLX5_CORE_EN 104 115 depends on XFRM_OFFLOAD 105 116 depends on INET_ESP_OFFLOAD || INET6_ESP_OFFLOAD 117 + depends on MLX5_FPGA_IPSEC 106 118 default n 107 - ---help--- 119 + help 108 120 Build support for IPsec cryptography-offload accelaration in the NIC. 109 121 Note: Support for hardware with this capability needs to be selected 110 122 for this option to become available. 111 123 124 + config MLX5_FPGA_TLS 125 + bool "Mellanox Technologies TLS Innova support" 126 + depends on TLS_DEVICE 127 + depends on TLS=y || MLX5_CORE=m 128 + depends on MLX5_FPGA 129 + default n 130 + help 131 + Build TLS support for the Innova family of network cards by Mellanox 132 + Technologies. Innova network cards are comprised of a ConnectX chip 133 + and an FPGA chip on one board. If you select this option, the 134 + mlx5_core driver will include the Innova FPGA core and allow building 135 + sandbox-specific client drivers. 136 + 112 137 config MLX5_EN_TLS 113 138 bool "TLS cryptography-offload accelaration" 114 139 depends on MLX5_CORE_EN 115 - depends on TLS_DEVICE 116 - depends on TLS=y || MLX5_CORE=m 117 - depends on MLX5_ACCEL 118 - default n 119 - ---help--- 120 - Build support for TLS cryptography-offload accelaration in the NIC. 121 - Note: Support for hardware with this capability needs to be selected 122 - for this option to become available. 140 + depends on MLX5_FPGA_TLS 141 + default y 142 + help 143 + Build support for TLS cryptography-offload accelaration in the NIC. 144 + Note: Support for hardware with this capability needs to be selected 145 + for this option to become available.
+4 -3
drivers/net/ethernet/mellanox/mlx5/core/Makefile
··· 53 53 # 54 54 # Accelerations & FPGA 55 55 # 56 - mlx5_core-$(CONFIG_MLX5_ACCEL) += accel/ipsec.o accel/tls.o 56 + mlx5_core-$(CONFIG_MLX5_FPGA_IPSEC) += fpga/ipsec.o 57 + mlx5_core-$(CONFIG_MLX5_FPGA_TLS) += fpga/tls.o 58 + mlx5_core-$(CONFIG_MLX5_ACCEL) += accel/tls.o accel/ipsec.o 57 59 58 - mlx5_core-$(CONFIG_MLX5_FPGA) += fpga/cmd.o fpga/core.o fpga/conn.o fpga/sdk.o \ 59 - fpga/ipsec.o fpga/tls.o 60 + mlx5_core-$(CONFIG_MLX5_FPGA) += fpga/cmd.o fpga/core.o fpga/conn.o fpga/sdk.o 60 61 61 62 mlx5_core-$(CONFIG_MLX5_EN_IPSEC) += en_accel/ipsec.o en_accel/ipsec_rxtx.o \ 62 63 en_accel/ipsec_stats.o
+4
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.c
··· 31 31 * 32 32 */ 33 33 34 + #ifdef CONFIG_MLX5_FPGA_IPSEC 35 + 34 36 #include <linux/mlx5/device.h> 35 37 36 38 #include "accel/ipsec.h" ··· 114 112 return mlx5_fpga_esp_modify_xfrm(xfrm, attrs); 115 113 } 116 114 EXPORT_SYMBOL_GPL(mlx5_accel_esp_modify_xfrm); 115 + 116 + #endif
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/accel/ipsec.h
··· 37 37 #include <linux/mlx5/driver.h> 38 38 #include <linux/mlx5/accel.h> 39 39 40 - #ifdef CONFIG_MLX5_ACCEL 40 + #ifdef CONFIG_MLX5_FPGA_IPSEC 41 41 42 42 #define MLX5_IPSEC_DEV(mdev) (mlx5_accel_ipsec_device_caps(mdev) & \ 43 43 MLX5_ACCEL_IPSEC_CAP_DEVICE)
+3
drivers/net/ethernet/mellanox/mlx5/core/accel/tls.c
··· 35 35 36 36 #include "accel/tls.h" 37 37 #include "mlx5_core.h" 38 + 39 + #ifdef CONFIG_MLX5_FPGA_TLS 38 40 #include "fpga/tls.h" 39 41 40 42 int mlx5_accel_tls_add_flow(struct mlx5_core_dev *mdev, void *flow, ··· 80 78 { 81 79 mlx5_fpga_tls_cleanup(mdev); 82 80 } 81 + #endif
+1 -3
drivers/net/ethernet/mellanox/mlx5/core/accel/tls.h
··· 37 37 #include <linux/mlx5/driver.h> 38 38 #include <linux/tls.h> 39 39 40 - #ifdef CONFIG_MLX5_ACCEL 41 - 40 + #ifdef CONFIG_MLX5_FPGA_TLS 42 41 enum { 43 42 MLX5_ACCEL_TLS_TX = BIT(0), 44 43 MLX5_ACCEL_TLS_RX = BIT(1), ··· 87 88 static inline u32 mlx5_accel_tls_device_caps(struct mlx5_core_dev *mdev) { return 0; } 88 89 static inline int mlx5_accel_tls_init(struct mlx5_core_dev *mdev) { return 0; } 89 90 static inline void mlx5_accel_tls_cleanup(struct mlx5_core_dev *mdev) { } 90 - 91 91 #endif 92 92 93 93 #endif /* __MLX5_ACCEL_TLS_H__ */
-75
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.h
··· 37 37 #include "accel/ipsec.h" 38 38 #include "fs_cmd.h" 39 39 40 - #ifdef CONFIG_MLX5_FPGA 41 - 42 40 u32 mlx5_fpga_ipsec_device_caps(struct mlx5_core_dev *mdev); 43 41 unsigned int mlx5_fpga_ipsec_counters_count(struct mlx5_core_dev *mdev); 44 42 int mlx5_fpga_ipsec_counters_read(struct mlx5_core_dev *mdev, u64 *counters, ··· 63 65 64 66 const struct mlx5_flow_cmds * 65 67 mlx5_fs_cmd_get_default_ipsec_fpga_cmds(enum fs_flow_table_type type); 66 - 67 - #else 68 - 69 - static inline u32 mlx5_fpga_ipsec_device_caps(struct mlx5_core_dev *mdev) 70 - { 71 - return 0; 72 - } 73 - 74 - static inline unsigned int 75 - mlx5_fpga_ipsec_counters_count(struct mlx5_core_dev *mdev) 76 - { 77 - return 0; 78 - } 79 - 80 - static inline int mlx5_fpga_ipsec_counters_read(struct mlx5_core_dev *mdev, 81 - u64 *counters) 82 - { 83 - return 0; 84 - } 85 - 86 - static inline void * 87 - mlx5_fpga_ipsec_create_sa_ctx(struct mlx5_core_dev *mdev, 88 - struct mlx5_accel_esp_xfrm *accel_xfrm, 89 - const __be32 saddr[4], 90 - const __be32 daddr[4], 91 - const __be32 spi, bool is_ipv6) 92 - { 93 - return NULL; 94 - } 95 - 96 - static inline void mlx5_fpga_ipsec_delete_sa_ctx(void *context) 97 - { 98 - } 99 - 100 - static inline int mlx5_fpga_ipsec_init(struct mlx5_core_dev *mdev) 101 - { 102 - return 0; 103 - } 104 - 105 - static inline void mlx5_fpga_ipsec_cleanup(struct mlx5_core_dev *mdev) 106 - { 107 - } 108 - 109 - static inline void mlx5_fpga_ipsec_build_fs_cmds(void) 110 - { 111 - } 112 - 113 - static inline struct mlx5_accel_esp_xfrm * 114 - mlx5_fpga_esp_create_xfrm(struct mlx5_core_dev *mdev, 115 - const struct mlx5_accel_esp_xfrm_attrs *attrs, 116 - u32 flags) 117 - { 118 - return ERR_PTR(-EOPNOTSUPP); 119 - } 120 - 121 - static inline void mlx5_fpga_esp_destroy_xfrm(struct mlx5_accel_esp_xfrm *xfrm) 122 - { 123 - } 124 - 125 - static inline int 126 - mlx5_fpga_esp_modify_xfrm(struct mlx5_accel_esp_xfrm *xfrm, 127 - const struct mlx5_accel_esp_xfrm_attrs *attrs) 128 - { 129 - return -EOPNOTSUPP; 130 - } 131 - 132 - static inline const struct mlx5_flow_cmds * 133 - mlx5_fs_cmd_get_default_ipsec_fpga_cmds(enum fs_flow_table_type type) 134 - { 135 - return mlx5_fs_cmd_get_default(type); 136 - } 137 - 138 - #endif /* CONFIG_MLX5_FPGA */ 139 68 140 69 #endif /* __MLX5_FPGA_SADB_H__ */
+1 -1
include/linux/mlx5/accel.h
··· 114 114 MLX5_ACCEL_IPSEC_CAP_TX_IV_IS_ESN = 1 << 7, 115 115 }; 116 116 117 - #ifdef CONFIG_MLX5_ACCEL 117 + #ifdef CONFIG_MLX5_FPGA_IPSEC 118 118 119 119 u32 mlx5_accel_ipsec_device_caps(struct mlx5_core_dev *mdev); 120 120