Commit 7766a99f authored by Matan Barak's avatar Matan Barak Committed by Doug Ledford

IB/core: Add ROCE_UDP_ENCAP (RoCE V2) type

Adding RoCE v2 GID type and port type. Vendors
which support this type will get their GID table
populated with RoCE v2 GIDs automatically.
Signed-off-by: default avatarMatan Barak <matanb@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 470be516
...@@ -128,6 +128,7 @@ static void dispatch_gid_change_event(struct ib_device *ib_dev, u8 port) ...@@ -128,6 +128,7 @@ static void dispatch_gid_change_event(struct ib_device *ib_dev, u8 port)
static const char * const gid_type_str[] = { static const char * const gid_type_str[] = {
[IB_GID_TYPE_IB] = "IB/RoCE v1", [IB_GID_TYPE_IB] = "IB/RoCE v1",
[IB_GID_TYPE_ROCE_UDP_ENCAP] = "RoCE v2",
}; };
const char *ib_cache_gid_type_str(enum ib_gid_type gid_type) const char *ib_cache_gid_type_str(enum ib_gid_type gid_type)
......
...@@ -71,7 +71,8 @@ static const struct { ...@@ -71,7 +71,8 @@ static const struct {
bool (*is_supported)(const struct ib_device *device, u8 port_num); bool (*is_supported)(const struct ib_device *device, u8 port_num);
enum ib_gid_type gid_type; enum ib_gid_type gid_type;
} PORT_CAP_TO_GID_TYPE[] = { } PORT_CAP_TO_GID_TYPE[] = {
{rdma_protocol_roce, IB_GID_TYPE_ROCE}, {rdma_protocol_roce_eth_encap, IB_GID_TYPE_ROCE},
{rdma_protocol_roce_udp_encap, IB_GID_TYPE_ROCE_UDP_ENCAP},
}; };
#define CAP_TO_GID_TABLE_SIZE ARRAY_SIZE(PORT_CAP_TO_GID_TYPE) #define CAP_TO_GID_TABLE_SIZE ARRAY_SIZE(PORT_CAP_TO_GID_TYPE)
......
...@@ -73,6 +73,7 @@ enum ib_gid_type { ...@@ -73,6 +73,7 @@ enum ib_gid_type {
/* If link layer is Ethernet, this is RoCE V1 */ /* If link layer is Ethernet, this is RoCE V1 */
IB_GID_TYPE_IB = 0, IB_GID_TYPE_IB = 0,
IB_GID_TYPE_ROCE = 0, IB_GID_TYPE_ROCE = 0,
IB_GID_TYPE_ROCE_UDP_ENCAP = 1,
IB_GID_TYPE_SIZE IB_GID_TYPE_SIZE
}; };
...@@ -403,6 +404,7 @@ union rdma_protocol_stats { ...@@ -403,6 +404,7 @@ union rdma_protocol_stats {
#define RDMA_CORE_CAP_PROT_IB 0x00100000 #define RDMA_CORE_CAP_PROT_IB 0x00100000
#define RDMA_CORE_CAP_PROT_ROCE 0x00200000 #define RDMA_CORE_CAP_PROT_ROCE 0x00200000
#define RDMA_CORE_CAP_PROT_IWARP 0x00400000 #define RDMA_CORE_CAP_PROT_IWARP 0x00400000
#define RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP 0x00800000
#define RDMA_CORE_PORT_IBA_IB (RDMA_CORE_CAP_PROT_IB \ #define RDMA_CORE_PORT_IBA_IB (RDMA_CORE_CAP_PROT_IB \
| RDMA_CORE_CAP_IB_MAD \ | RDMA_CORE_CAP_IB_MAD \
...@@ -415,6 +417,12 @@ union rdma_protocol_stats { ...@@ -415,6 +417,12 @@ union rdma_protocol_stats {
| RDMA_CORE_CAP_IB_CM \ | RDMA_CORE_CAP_IB_CM \
| RDMA_CORE_CAP_AF_IB \ | RDMA_CORE_CAP_AF_IB \
| RDMA_CORE_CAP_ETH_AH) | RDMA_CORE_CAP_ETH_AH)
#define RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP \
(RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP \
| RDMA_CORE_CAP_IB_MAD \
| RDMA_CORE_CAP_IB_CM \
| RDMA_CORE_CAP_AF_IB \
| RDMA_CORE_CAP_ETH_AH)
#define RDMA_CORE_PORT_IWARP (RDMA_CORE_CAP_PROT_IWARP \ #define RDMA_CORE_PORT_IWARP (RDMA_CORE_CAP_PROT_IWARP \
| RDMA_CORE_CAP_IW_CM) | RDMA_CORE_CAP_IW_CM)
#define RDMA_CORE_PORT_INTEL_OPA (RDMA_CORE_PORT_IBA_IB \ #define RDMA_CORE_PORT_INTEL_OPA (RDMA_CORE_PORT_IBA_IB \
...@@ -2000,6 +2008,17 @@ static inline bool rdma_protocol_ib(const struct ib_device *device, u8 port_num) ...@@ -2000,6 +2008,17 @@ static inline bool rdma_protocol_ib(const struct ib_device *device, u8 port_num)
} }
static inline bool rdma_protocol_roce(const struct ib_device *device, u8 port_num) static inline bool rdma_protocol_roce(const struct ib_device *device, u8 port_num)
{
return device->port_immutable[port_num].core_cap_flags &
(RDMA_CORE_CAP_PROT_ROCE | RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP);
}
static inline bool rdma_protocol_roce_udp_encap(const struct ib_device *device, u8 port_num)
{
return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_ROCE_UDP_ENCAP;
}
static inline bool rdma_protocol_roce_eth_encap(const struct ib_device *device, u8 port_num)
{ {
return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_ROCE; return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_ROCE;
} }
...@@ -2011,8 +2030,8 @@ static inline bool rdma_protocol_iwarp(const struct ib_device *device, u8 port_n ...@@ -2011,8 +2030,8 @@ static inline bool rdma_protocol_iwarp(const struct ib_device *device, u8 port_n
static inline bool rdma_ib_or_roce(const struct ib_device *device, u8 port_num) static inline bool rdma_ib_or_roce(const struct ib_device *device, u8 port_num)
{ {
return device->port_immutable[port_num].core_cap_flags & return rdma_protocol_ib(device, port_num) ||
(RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_PROT_ROCE); rdma_protocol_roce(device, port_num);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment