linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Noa Osherovich <noaos@mellanox.com>
To: dledford@redhat.com, jgg@mellanox.com, leonro@mellanox.com
Cc: linux-rdma@vger.kernel.org, Maxim Chicherin <maximc@mellanox.com>
Subject: [PATCH rdma-core 07/12] pyverbs: Add XRC to ODPCaps
Date: Mon,  9 Sep 2019 12:07:07 +0300	[thread overview]
Message-ID: <20190909090712.11029-8-noaos@mellanox.com> (raw)
In-Reply-To: <20190909090712.11029-1-noaos@mellanox.com>

From: Maxim Chicherin <maximc@mellanox.com>

Added PCI atomic caps and XRC ODP caps:
XRC ODP caps reports about XRC ODP capabilities of the device. To make
it easier for users, pyverbs reports XRC ODP caps as part of the
device's odp_caps, even though they're reported in a separate field.
PCI atomic caps represents ibv_pci_atomic_caps which is part of
DeviceAttrEx and is now exposed to pyverbs' users.

Signed-off-by: Maxim Chicherin <maximc@mellanox.com>
---
 pyverbs/device.pxd     |  4 ++++
 pyverbs/device.pyx     | 42 ++++++++++++++++++++++++++++++++++++++++++
 pyverbs/libibverbs.pxd |  9 ++++++++-
 3 files changed, 54 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 pyverbs/device.pxd
 mode change 100644 => 100755 pyverbs/device.pyx

diff --git a/pyverbs/device.pxd b/pyverbs/device.pxd
old mode 100644
new mode 100755
index ed2f1ca3d6ef..5cc13acb4331
--- a/pyverbs/device.pxd
+++ b/pyverbs/device.pxd
@@ -26,6 +26,7 @@ cdef class QueryDeviceExInput(PyverbsObject):
 
 cdef class ODPCaps(PyverbsObject):
     cdef v.ibv_odp_caps odp_caps
+    cdef object xrc_odp_caps
 
 cdef class RSSCaps(PyverbsObject):
     cdef v.ibv_rss_caps rss_caps
@@ -33,6 +34,9 @@ cdef class RSSCaps(PyverbsObject):
 cdef class PacketPacingCaps(PyverbsObject):
     cdef v.ibv_packet_pacing_caps packet_pacing_caps
 
+cdef class PCIAtomicCaps(PyverbsObject):
+    cdef v.ibv_pci_atomic_caps caps
+
 cdef class TMCaps(PyverbsObject):
     cdef v.ibv_tm_caps tm_caps
 
diff --git a/pyverbs/device.pyx b/pyverbs/device.pyx
old mode 100644
new mode 100755
index f238d37ce3a9..084086bdbc69
--- a/pyverbs/device.pyx
+++ b/pyverbs/device.pyx
@@ -393,6 +393,42 @@ cdef class ODPCaps(PyverbsObject):
     @property
     def ud_odp_caps(self):
         return self.odp_caps.per_transport_caps.ud_odp_caps
+    @property
+    def xrc_odp_caps(self):
+        return self.xrc_odp_caps
+    @xrc_odp_caps.setter
+    def xrc_odp_caps(self, val):
+       self.xrc_odp_caps = val
+
+    def __str__(self):
+        general_caps = {e.IBV_ODP_SUPPORT: 'IBV_ODP_SUPPORT',
+              e.IBV_ODP_SUPPORT_IMPLICIT: 'IBV_ODP_SUPPORT_IMPLICIT'}
+
+        l = {e.IBV_ODP_SUPPORT_SEND: 'IBV_ODP_SUPPORT_SEND',
+             e.IBV_ODP_SUPPORT_RECV: 'IBV_ODP_SUPPORT_RECV',
+             e.IBV_ODP_SUPPORT_WRITE: 'IBV_ODP_SUPPORT_WRITE',
+             e.IBV_ODP_SUPPORT_READ: 'IBV_ODP_SUPPORT_READ',
+             e.IBV_ODP_SUPPORT_ATOMIC: 'IBV_ODP_SUPPORT_ATOMIC',
+             e.IBV_ODP_SUPPORT_SRQ_RECV: 'IBV_ODP_SUPPORT_SRQ_RECV'}
+
+        print_format = '{}: {}\n'
+        return print_format.format('ODP General caps', str_from_flags(self.general_caps, general_caps)) +\
+            print_format.format('RC ODP caps', str_from_flags(self.rc_odp_caps, l)) +\
+            print_format.format('UD ODP caps', str_from_flags(self.ud_odp_caps, l)) +\
+            print_format.format('UC ODP caps', str_from_flags(self.uc_odp_caps, l)) +\
+            print_format.format('XRC ODP caps', str_from_flags(self.xrc_odp_caps, l))
+
+
+cdef class PCIAtomicCaps(PyverbsObject):
+    @property
+    def fetch_add(self):
+        return self.caps.fetch_add
+    @property
+    def swap(self):
+        return self.caps.swap
+    @property
+    def compare_swap(self):
+        return self.caps.compare_swap
 
 
 cdef class TSOCaps(PyverbsObject):
@@ -477,6 +513,7 @@ cdef class DeviceAttrEx(PyverbsObject):
     def odp_caps(self):
         caps = ODPCaps()
         caps.odp_caps = self.dev_attr.odp_caps
+        caps.xrc_odp_caps = self.dev_attr.xrc_odp_caps
         return caps
     @property
     def completion_timestamp_mask(self):
@@ -493,6 +530,11 @@ cdef class DeviceAttrEx(PyverbsObject):
         caps.tso_caps = self.dev_attr.tso_caps
         return caps
     @property
+    def pci_atomic_caps(self):
+        caps = PCIAtomicCaps()
+        caps.caps = self.dev_attr.pci_atomic_caps
+        return caps
+    @property
     def rss_caps(self):
         caps = RSSCaps()
         caps.rss_caps = self.dev_attr.rss_caps
diff --git a/pyverbs/libibverbs.pxd b/pyverbs/libibverbs.pxd
index a92286d42c67..02137d81e2d3 100755
--- a/pyverbs/libibverbs.pxd
+++ b/pyverbs/libibverbs.pxd
@@ -2,7 +2,7 @@
 # Copyright (c) 2018, Mellanox Technologies. All rights reserved. See COPYING file
 
 include 'libibverbs_enums.pxd'
-from libc.stdint cimport uint8_t, uint32_t, uint64_t
+from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t
 
 cdef extern from 'infiniband/verbs.h':
 
@@ -117,6 +117,11 @@ cdef extern from 'infiniband/verbs.h':
         unsigned int    max_cq_count
         unsigned int    max_cq_period
 
+    cdef struct ibv_pci_atomic_caps:
+        uint16_t fetch_add
+        uint16_t swap
+        uint16_t compare_swap
+
     cdef struct ibv_device_attr_ex:
         ibv_device_attr         orig_attr
         unsigned int            comp_mask
@@ -132,6 +137,8 @@ cdef extern from 'infiniband/verbs.h':
         ibv_tm_caps             tm_caps
         ibv_cq_moderation_caps  cq_mod_caps
         unsigned long           max_dm_size
+        ibv_pci_atomic_caps     pci_atomic_caps
+        uint32_t                xrc_odp_caps
 
     cdef struct ibv_mw:
         ibv_context     *context
-- 
2.21.0


  parent reply	other threads:[~2019-09-09  9:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09  9:07 [PATCH rdma-core 00/12] Add XRCD and SRQ support to pyverbs Noa Osherovich
2019-09-09  9:07 ` [PATCH rdma-core 01/12] pyverbs: Fix WC creation process Noa Osherovich
2019-09-09  9:07 ` [PATCH rdma-core 02/12] pyverbs: Fix CQ and PD assignment in QPAttr Noa Osherovich
2019-09-09  9:07 ` [PATCH rdma-core 03/12] pyverbs: Remove TM enums Noa Osherovich
2019-09-09  9:07 ` [PATCH rdma-core 04/12] pyverbs: Introducing XRCD class Noa Osherovich
2019-09-09  9:07 ` [PATCH rdma-core 05/12] pyverbs: Introducing SRQ class Noa Osherovich
2019-09-09  9:07 ` [PATCH rdma-core 06/12] pyverbs: Support XRC QPs when modifying QP states Noa Osherovich
2019-09-09  9:07 ` Noa Osherovich [this message]
2019-09-09  9:07 ` [PATCH rdma-core 08/12] Documentation: Document creation of XRCD and SRQ Noa Osherovich
2019-09-09  9:07 ` [PATCH rdma-core 09/12] tests: Add missing constant in UDResources Noa Osherovich
2019-09-09  9:07 ` [PATCH rdma-core 10/12] tests: Fixes to to_rts() in RCResources Noa Osherovich
2019-09-09  9:07 ` [PATCH rdma-core 11/12] tests: Add XRCResources class Noa Osherovich
2019-09-09  9:07 ` [PATCH rdma-core 12/12] tests: Add XRC ODP test case Noa Osherovich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190909090712.11029-8-noaos@mellanox.com \
    --to=noaos@mellanox.com \
    --cc=dledford@redhat.com \
    --cc=jgg@mellanox.com \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maximc@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).