diff mbox series

[1/2] configure: Check if we can use ibv_reg_mr_iova

Message ID 20190818132107.18181-2-yuval.shaia@oracle.com (mailing list archive)
State New, archived
Headers show
Series rdma: Utilize ibv_reg_mr_iova for memory registration | expand

Commit Message

Yuval Shaia Aug. 18, 2019, 1:21 p.m. UTC
The function reg_mr_iova is an enhanced version of ibv_reg_mr function
that can help to easly register and use guest's MRs.

Add check in 'configure' phase to detect if we have libibverbs with this
support.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 configure | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Marcel Apfelbaum Aug. 31, 2019, 7:28 p.m. UTC | #1
On 8/18/19 4:21 PM, Yuval Shaia wrote:
> The function reg_mr_iova is an enhanced version of ibv_reg_mr function
> that can help to easly register and use guest's MRs.
>
> Add check in 'configure' phase to detect if we have libibverbs with this
> support.
>
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
>   configure | 28 ++++++++++++++++++++++++++++
>   1 file changed, 28 insertions(+)
>
> diff --git a/configure b/configure
> index 714e7fb6a1..e8e4a57b6f 100755
> --- a/configure
> +++ b/configure
> @@ -3205,6 +3205,34 @@ else
>       pvrdma="no"
>   fi
>   
> +# Let's see if enhanced reg_mr is supported
> +if test "$pvrdma" = "yes" ; then
> +
> +cat > $TMPC <<EOF &&
> +#include <infiniband/verbs.h>
> +
> +int
> +main(void)
> +{
> +    struct ibv_mr *mr;
> +    struct ibv_pd *pd = NULL;
> +    size_t length = 10;
> +    uint64_t iova = 0;
> +    int access = 0;
> +    void *addr = NULL;
> +
> +    mr = ibv_reg_mr_iova(pd, addr, length, iova, access);

Here you check if the API is changed, right?
Can you query for a library version instead?

Thanks,
Marcel

> +
> +    ibv_dereg_mr(mr);
> +
> +    return 0;
> +}
> +EOF
> +    if ! compile_prog "" "-libverbs"; then
> +        QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR"
> +    fi
> +fi
> +
>   ##########################################
>   # VNC SASL detection
>   if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then
Yuval Shaia Sept. 1, 2019, 9:25 a.m. UTC | #2
On Sat, Aug 31, 2019 at 10:28:18PM +0300, Marcel Apfelbaum wrote:
> 
> 
> On 8/18/19 4:21 PM, Yuval Shaia wrote:
> > The function reg_mr_iova is an enhanced version of ibv_reg_mr function
> > that can help to easly register and use guest's MRs.
> > 
> > Add check in 'configure' phase to detect if we have libibverbs with this
> > support.
> > 
> > Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> > ---
> >   configure | 28 ++++++++++++++++++++++++++++
> >   1 file changed, 28 insertions(+)
> > 
> > diff --git a/configure b/configure
> > index 714e7fb6a1..e8e4a57b6f 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3205,6 +3205,34 @@ else
> >       pvrdma="no"
> >   fi
> > +# Let's see if enhanced reg_mr is supported
> > +if test "$pvrdma" = "yes" ; then
> > +
> > +cat > $TMPC <<EOF &&
> > +#include <infiniband/verbs.h>
> > +
> > +int
> > +main(void)
> > +{
> > +    struct ibv_mr *mr;
> > +    struct ibv_pd *pd = NULL;
> > +    size_t length = 10;
> > +    uint64_t iova = 0;
> > +    int access = 0;
> > +    void *addr = NULL;
> > +
> > +    mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
> 
> Here you check if the API is changed, right?

Yes.

> Can you query for a library version instead?

Library version is set in the spec file which is under the distros'es
responsibility. I don't see a reason to be depend on that especially when
the check for support is so easy. In addition, this way allows one to
download latest upstream code and compile against it even when his distro
still didn't update the repo.

> 
> Thanks,
> Marcel
> 
> > +
> > +    ibv_dereg_mr(mr);
> > +
> > +    return 0;
> > +}
> > +EOF
> > +    if ! compile_prog "" "-libverbs"; then
> > +        QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR"
> > +    fi
> > +fi
> > +
> >   ##########################################
> >   # VNC SASL detection
> >   if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then
> 
>
diff mbox series

Patch

diff --git a/configure b/configure
index 714e7fb6a1..e8e4a57b6f 100755
--- a/configure
+++ b/configure
@@ -3205,6 +3205,34 @@  else
     pvrdma="no"
 fi
 
+# Let's see if enhanced reg_mr is supported
+if test "$pvrdma" = "yes" ; then
+
+cat > $TMPC <<EOF &&
+#include <infiniband/verbs.h>
+
+int
+main(void)
+{
+    struct ibv_mr *mr;
+    struct ibv_pd *pd = NULL;
+    size_t length = 10;
+    uint64_t iova = 0;
+    int access = 0;
+    void *addr = NULL;
+
+    mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
+
+    ibv_dereg_mr(mr);
+
+    return 0;
+}
+EOF
+    if ! compile_prog "" "-libverbs"; then
+        QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR"
+    fi
+fi
+
 ##########################################
 # VNC SASL detection
 if test "$vnc" = "yes" && test "$vnc_sasl" != "no" ; then