summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/mlx5/macsec.h
diff options
context:
space:
mode:
authorPatrisious Haddad <phaddad@nvidia.com>2022-05-03 08:37:48 +0300
committerLeon Romanovsky <leon@kernel.org>2023-08-20 12:35:24 +0300
commit758ce14aee825f8f3ca8f76c9991c108094cae8b (patch)
tree05c7b831c5c6aefe9489d2620e1c21e01757b599 /drivers/infiniband/hw/mlx5/macsec.h
parentd4ece08f4b1d29471cc4c0eb0c87427600a77acd (diff)
downloadlinux-758ce14aee825f8f3ca8f76c9991c108094cae8b.tar.gz
linux-758ce14aee825f8f3ca8f76c9991c108094cae8b.tar.bz2
linux-758ce14aee825f8f3ca8f76c9991c108094cae8b.zip
RDMA/mlx5: Implement MACsec gid addition and deletion
Handle MACsec IP ambiguity issue, since mlx5 hw can't support programming both the MACsec and the physical gid when they have the same IP address, because it wouldn't know to whom to steer the traffic. Hence in such case we delete the physical gid from the hw gid table, which would then cause all traffic sent over it to fail, and we'll only be able to send traffic over the MACsec gid. Signed-off-by: Patrisious Haddad <phaddad@nvidia.com> Reviewed-by: Raed Salem <raeds@nvidia.com> Reviewed-by: Mark Zhang <markzhang@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx5/macsec.h')
-rw-r--r--drivers/infiniband/hw/mlx5/macsec.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx5/macsec.h b/drivers/infiniband/hw/mlx5/macsec.h
new file mode 100644
index 000000000000..b60f8f046d6f
--- /dev/null
+++ b/drivers/infiniband/hw/mlx5/macsec.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
+/* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. */
+
+#ifndef __MLX5_MACSEC_H__
+#define __MLX5_MACSEC_H__
+
+#include <net/macsec.h>
+#include <rdma/ib_cache.h>
+#include <rdma/ib_addr.h>
+#include "mlx5_ib.h"
+
+#ifdef CONFIG_MLX5_MACSEC
+struct mlx5_reserved_gids;
+
+int mlx5r_add_gid_macsec_operations(const struct ib_gid_attr *attr);
+void mlx5r_del_gid_macsec_operations(const struct ib_gid_attr *attr);
+int mlx5r_macsec_alloc_gids(struct mlx5_ib_dev *dev);
+void mlx5r_macsec_dealloc_gids(struct mlx5_ib_dev *dev);
+#else
+static inline int mlx5r_add_gid_macsec_operations(const struct ib_gid_attr *attr) { return 0; }
+static inline void mlx5r_del_gid_macsec_operations(const struct ib_gid_attr *attr) {}
+static inline int mlx5r_macsec_alloc_gids(struct mlx5_ib_dev *dev) { return 0; }
+static inline void mlx5r_macsec_dealloc_gids(struct mlx5_ib_dev *dev) {}
+#endif
+#endif /* __MLX5_MACSEC_H__ */