| 1 |
# SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) |
| 2 |
# Copyright (c) 2019 Mellanox Technologies, Inc. All rights reserved. See COPYING file |
| 3 |
|
| 4 |
import unittest |
| 5 |
import os |
| 6 |
|
| 7 |
from tests.rdmacm_utils import CMSyncConnection, CMAsyncConnection |
| 8 |
from tests.base import RDMATestCase, RDMACMBaseTest |
| 9 |
from tests.utils import requires_mcast_support |
| 10 |
import tests.irdma_base as irdma |
| 11 |
from pyverbs.librdmacm_enums import rdma_port_space |
| 12 |
import pyverbs.device as d |
| 13 |
|
| 14 |
|
| 15 |
class CMTestCase(RDMACMBaseTest): |
| 16 |
""" |
| 17 |
RDMACM Test class. Include all the native RDMACM functionalities. |
| 18 |
""" |
| 19 |
@staticmethod |
| 20 |
def get_port_space(): |
| 21 |
# IPoIB currently is not supported |
| 22 |
return rdma_port_space.RDMA_PS_UDP |
| 23 |
|
| 24 |
|
| 25 |
def test_rdmacm_sync_traffic(self): |
| 26 |
self.two_nodes_rdmacm_traffic(CMSyncConnection, self.rdmacm_traffic) |
| 27 |
|
| 28 |
def test_rdmacm_async_traffic(self): |
| 29 |
# QP ack timeout formula: 4.096 * 2^(ack_timeout) [usec] |
| 30 |
irdma.skip_if_irdma_dev(d.Context(name=self.dev_name)) |
| 31 |
self.two_nodes_rdmacm_traffic(CMAsyncConnection, self.rdmacm_traffic, |
| 32 |
qp_timeout=21) |
| 33 |
|
| 34 |
def test_rdmacm_async_reject_traffic(self): |
| 35 |
self.two_nodes_rdmacm_traffic(CMAsyncConnection, self.rdmacm_traffic, |
| 36 |
reject_conn=True) |
| 37 |
|
| 38 |
@requires_mcast_support() |
| 39 |
def test_rdmacm_async_multicast_traffic(self): |
| 40 |
self.two_nodes_rdmacm_traffic(CMAsyncConnection, |
| 41 |
self.rdmacm_multicast_traffic, |
| 42 |
port_space=self.get_port_space()) |
| 43 |
|
| 44 |
@requires_mcast_support() |
| 45 |
def test_rdmacm_async_ex_multicast_traffic(self): |
| 46 |
self.two_nodes_rdmacm_traffic(CMAsyncConnection, |
| 47 |
self.rdmacm_multicast_traffic, |
| 48 |
port_space=self.get_port_space(), extended=True) |
| 49 |
|
| 50 |
@requires_mcast_support() |
| 51 |
def test_rdmacm_async_ex_leave_multicast_traffic(self): |
| 52 |
self.two_nodes_rdmacm_traffic(CMAsyncConnection, |
| 53 |
self.rdmacm_multicast_traffic, |
| 54 |
port_space=self.get_port_space(), extended=True, |
| 55 |
leave_test=True, bad_flow=True) |
| 56 |
|
| 57 |
def test_rdmacm_async_traffic_external_qp(self): |
| 58 |
self.two_nodes_rdmacm_traffic(CMAsyncConnection, self.rdmacm_traffic, |
| 59 |
with_ext_qp=True) |
| 60 |
|
| 61 |
def test_rdmacm_async_udp_traffic(self): |
| 62 |
self.two_nodes_rdmacm_traffic(CMAsyncConnection, self.rdmacm_traffic, |
| 63 |
port_space=self.get_port_space(), ib_port=self.ib_port) |
| 64 |
|
| 65 |
def test_rdmacm_async_read(self): |
| 66 |
self.two_nodes_rdmacm_traffic(CMAsyncConnection, |
| 67 |
self.rdmacm_remote_traffic, |
| 68 |
remote_op='read') |
| 69 |
|
| 70 |
def test_rdmacm_async_write(self): |
| 71 |
self.two_nodes_rdmacm_traffic(CMAsyncConnection, |
| 72 |
self.rdmacm_remote_traffic, |
| 73 |
remote_op='write') |
| 74 |
|
| 75 |
def test_rdmacm_async_resolve_addrinfo(self): |
| 76 |
self.two_nodes_rdmacm_traffic(CMAsyncConnection, self.rdmacm_traffic, |
| 77 |
port_space=self.get_port_space(), |
| 78 |
use_resolve_addrinfo=True, ib_port=self.ib_port) |