* [patch] net/mlx5: remove a duplicate condition
From: Dan Carpenter @ 2016-11-24 11:03 UTC (permalink / raw)
To: Saeed Mahameed
Cc: Matan Barak, Leon Romanovsky, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA
We verified that MLX5_FLOW_CONTEXT_ACTION_COUNT was set on the first
line of the function so we don't need to check again here.
Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
Not a bugfix so it would go into -next
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index 68ec4ea..a263d89 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1307,8 +1307,7 @@ static bool counter_is_valid(struct mlx5_fc *counter, u32 action)
return false;
return (action & (MLX5_FLOW_CONTEXT_ACTION_DROP |
- MLX5_FLOW_CONTEXT_ACTION_FWD_DEST)) &&
- (action & MLX5_FLOW_CONTEXT_ACTION_COUNT);
+ MLX5_FLOW_CONTEXT_ACTION_FWD_DEST));
}
static bool dest_is_valid(struct mlx5_flow_destination *dest,
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: Enabling peer to peer device transactions for PCIe devices
From: Christian König @ 2016-11-24 9:45 UTC (permalink / raw)
To: Jason Gunthorpe, Dan Williams
Cc: Haggai Eran, Bridgman, John,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
Kuehling, Felix, Serguei Sagalovitch,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Blinzer, Paul, Suthikulpanit, Suravee,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Deucher, Alexander, Sander, Ben,
Linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <20161123232503.GA13965-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Am 24.11.2016 um 00:25 schrieb Jason Gunthorpe:
> There is certainly nothing about the hardware that cares
> about ZONE_DEVICE vs System memory.
Well that is clearly not so simple. When your ZONE_DEVICE pages describe
a PCI BAR and another PCI device initiates a DMA to this address the DMA
subsystem must be able to check if the interconnection really works.
E.g. it can happen that PCI device A exports it's BAR using ZONE_DEVICE.
Not PCI device B (a SATA device) can directly read/write to it because
it is on the same bus segment, but PCI device C (a network card for
example) can't because it is on a different bus segment and the bridge
can't handle P2P transactions.
We need to be able to handle such cases and fall back to bouncing
buffers, but I don't see that in the DMA subsystem right now.
Regards,
Christian.
^ permalink raw reply
* Re: [RFC] Avoid running out of local port in RDMA_CM
From: Moni Shoua @ 2016-11-24 8:03 UTC (permalink / raw)
To: Hefty, Sean; +Cc: linux-rdma, Doug Ledford
In-Reply-To: <1828884A29C6694DAF28B7E6B8A82373AB0B8B08-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
On Thu, Nov 24, 2016 at 1:29 AM, Hefty, Sean <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
>> The documentation for struct inet_bind_bucket says:
>> /* There are a few simple rules, which allow for local port reuse by
>> * an application. In essence:
>> *
>> * 1) Sockets bound to different interfaces may share a local
>> port.
>> * Failing that, goto test 2.
>> * 2) If all sockets have sk->sk_reuse set, and none of them are
>> in
>> * TCP_LISTEN state, the port may be shared.
>> * Failing that, goto test 3.
>> * 3) If all sockets are bound to a specific inet_sk(sk)-
>> >rcv_saddr local
>> * address, and none of them are the same, the port may be
>> * shared.
>> * Failing this, the port cannot be shared.
>> ..
>>
>> If I understand this correctly the suggestion in the RFC follows this
>> scheme so the request to mimic TCP/IP stack seems to be fulfilled.
>
> I don't see how the proposal fulfills the above requirements (3 may be the key one here). If I understand the proposal correctly, you're wanting to re-use the same port number for all connections (once the port numbers run out) without checking that the local or remote addresses differ.
Maybe the suggestion isn't clear enough but it refers to port numbers
that no application is listening on. I should have added it to the
conditions for reusing a port. The suggestion also skips step #1
(checking different interfaces).
So actually, I can rewrite the suggestion and say that a local port in
RDMA_CM may be shared if both conditions below are true
1. No one listens on the port
2. The reuse flag is set in all rdma_ids that bind to this port.
TCP doesn't check that remote addresses differ so I don't add it to
the suggestion as well
TCP checks that local addresses differ if step #2 fails (someone is
listening on the port) but RDMA_CM code already implements this logic
(via bind list)
The use of global port for reuse or just peek a random port and reuse
it if conditions above are fulfilled is an implementation detail. I
prefer the global port solution but I'm OK with the other.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: Enabling peer to peer device transactions for PCIe devices
From: Logan Gunthorpe @ 2016-11-24 1:25 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Serguei Sagalovitch, Dan Williams, Deucher, Alexander,
linux-nvdimm@lists.01.org, linux-rdma@vger.kernel.org,
linux-pci@vger.kernel.org, Kuehling, Felix, Bridgman, John,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Koenig, Christian, Sander, Ben, Suthikulpanit, Suravee,
Blinzer, Paul, Linux-media@vger.kernel.org, H
In-Reply-To: <20161123215510.GA16311@obsidianresearch.com>
On 23/11/16 02:55 PM, Jason Gunthorpe wrote:
>>> Only ODP hardware allows changing the DMA address on the fly, and it
>>> works at the page table level. We do not need special handling for
>>> RDMA.
>>
>> I am aware of ODP but, noted by others, it doesn't provide a general
>> solution to the points above.
>
> How do you mean?
I was only saying it wasn't general in that it wouldn't work for IB
hardware that doesn't support ODP or other hardware that doesn't do
similar things (like an NVMe drive).
It makes sense for hardware that supports ODP to allow MRs to not pin
the underlying memory and provide for migrations that the hardware can
follow. But most DMA engines will require the memory to be pinned and
any complex allocators (GPU or otherwise) should respect that. And that
seems like it should be the default way most of this works -- and I
think it wouldn't actually take too much effort to make it all work now
as is. (Our iopmem work is actually quite small and simple.)
>> It's also worth noting that #4 makes use of ZONE_DEVICE (#2) so they are
>> really the same option. iopmem is really just one way to get BAR
>> addresses to user-space while inside the kernel it's ZONE_DEVICE.
>
> Seems fine for RDMA?
Yeah, we've had RDMA and O_DIRECT transfers to PCIe backed ZONE_DEVICE
memory working for some time. I'd say it's a good fit. The main question
we've had is how to expose PCIe bars to userspace to be used as MRs and
such.
Logan
^ permalink raw reply
* Re: Enabling peer to peer device transactions for PCIe devices
From: Sagalovitch, Serguei @ 2016-11-24 0:40 UTC (permalink / raw)
To: Jason Gunthorpe, Logan Gunthorpe
Cc: Haggai Eran, Bridgman, John,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
Kuehling, Felix, Blinzer, Paul,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Sander, Ben, Suthikulpanit, Suravee,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Deucher, Alexander, Koenig, Christian,
Linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <20161123215510.GA16311-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
On Wed, Nov 23, 2016 at 02:11:29PM -0700, Logan Gunthorpe wrote:
> Perhaps I am not following what Serguei is asking for, but I
> understood the desire was for a complex GPU allocator that could
> migrate pages between GPU and CPU memory under control of the GPU
> driver, among other things. The desire is for DMA to continue to work
> even after these migrations happen.
The main issue is to how to solve use cases when p2p is
requested/initiated via CPU pointers where such pointers could
point to non-system memory location e.g. VRAM.
It will allow to provide consistent working model for user to deal only
with pointers (HSA, CUDA, OpenCL 2.0 SVM) as well as provide
performance optimization avoiding double-buffering and extra special code
when dealing with PCIe device memory.
Examples are:
- RDMA Network operations. RDMA MRs where registered memory
could be e.g. VRAM. Currently it is solved using so called PeerDirect
interface which is currently out-of-tree and provided as part of OFED.
- File operations (fread/fwrite) when user wants to transfer file data directly
to/from e.g. VRAM
Challenges are:
- Because graphics sub-system must support overcomit (at least each
application/process should independently see all resources) ideally
such memory should be movable without changing CPU pointer value
as well as "paged-out" supporting "page fault" at least on access from
CPU.
- We must co-exist with existing DRM infrastructure, as well as
support sharing VRAM memory between different processes
- We should be able to deal with large allocations: tens, hundreds of
MBs or may be GBs.
- We may have PCIe devices where p2p may not work
- Potentially any GPU memory should be supported including
memory carved out from system RAM (e.g. allocated via
get_free_pages()).
Note:
- In the case of RDMA MRs life-span of "pinning"
(get_user_pages"/put_page) may be defined/controlled by
application not kernel which may be should
treated differently as special case.
Original proposal was to create "struct pages" for VRAM memory
to allow "get_user_pages" to work transparently similar
how it is/was done for "DAX Device" case. Unfortunately
based on my understanding "DAX Device" implementation
deal only with permanently "locked" memory (fixed location)
unrelated to "get_user_pages"/"put_page" scope
which doesn't satisfy requirements for "eviction" / "moving" of
memory keeping CPU address intact.
> The desire is for DMA to continue to work
> even after these migrations happen
At least some kind of mm notifier callback to inform about changing
in location (pre- and post-) similar how it is done for system pages.
My understanding is that It will not solve RDMA MR issue where "lock"
could be during the whole application life but (a) it will not make
RDMA MR case worse (b) should be enough for all other cases for
"get_user_pages"/"put_page" controlled by kernel.
^ permalink raw reply
* Re: [RFC 02/10] IB/hfi-vnic: Virtual Network Interface Controller (VNIC) Bus driver
From: Vishwanathapura, Niranjana @ 2016-11-24 0:08 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: ira.weiny, Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA, Dennis Dalessandro
In-Reply-To: <20161123004932.GA13598-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
On Tue, Nov 22, 2016 at 05:49:32PM -0700, Jason Gunthorpe wrote:
>> > > We could add a custom Interface between HFI1 driver and hfi_vnic drivers
>> > > without involving a bus.
>> >
>> > hfi is already registering on the infiniband class, just use that.
>>
>> I don't understand what you mean here?
>
>Get the struct ib_device for the hfi and then do something to get hfi
>specific function calls.
>
>Or work it backwards with a _register function..
>
OK, thanks for your feedback.
We can make the hfi_vnic module as an ib client (which it is) like other ULPs,
and do not have an in-built or custom bus for binding.
Then the hfi_vnic ULP by some mechanism will identify the device as hfi1 device
and will only serve that device.
In order to pass the hfi function pointers to the hfi_vnic ULP, I can,
a) Have hfi_vnic ULP define an interface API for hfi1 driver to call to
register its callback (as you pointed). Unfortunately there will be a module
dependency here.
Or,
b) Add a new member ‘struct vnic_ops’ either to the ib_device structure or
ib_port_immutable structure. As it is hfi1 specific, only hfi1 driver will set
it. No module dependency here.
And will move the hfi_vnic module under ‘drivers/infiniband/ulp/hfi_vnic’.
All these will remove undue complexity and fit the driver in current design
framework as per your suggestion.
Let me know your comments.
Niranjana
>
>Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH rdma-core 6/6] Add a script to run builds in docker containers
From: Jason Gunthorpe @ 2016-11-23 23:35 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1479944104-19949-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
This is useful to build test packaging and compiles in a wide range of
environments. It requires docker to be installed.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
README.md | 11 +
buildlib/cbuild | 740 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 751 insertions(+)
create mode 100755 buildlib/cbuild
diff --git a/README.md b/README.md
index 9c69bb545c0596..b77256ef44aba3 100644
--- a/README.md
+++ b/README.md
@@ -113,3 +113,14 @@ bug and how your fix works.
Make sure that your contribution can be licensed under the same
license as the original code you are patching, and that you have all
necessary permissions to release your work.
+
+## TravisCI
+
+Submitted patches must pass the TravisCI automatic builds without warnings.
+A build similar to TravisCI can be run locally using docker and the
+'buildlib/cbuild' script.
+
+```sh
+$ buildlib/cbuild build-images travis
+$ buildlib/cbuild pkg travis
+```
diff --git a/buildlib/cbuild b/buildlib/cbuild
new file mode 100755
index 00000000000000..98f69dbfba3d9d
--- /dev/null
+++ b/buildlib/cbuild
@@ -0,0 +1,740 @@
+#!/usr/bin/env python
+# Copyright 2015-2016 Obsidian Research Corp. See COPYING.
+# PYTHON_ARGCOMPLETE_OK
+"""cbuild - Build in a docker container
+
+This script helps using docker containers to run software builds. This allows
+building for a wide range of distributions without having to install them.
+
+Each target distribution has a base docker image and a set of packages to
+install. The first step is to build the customized docker container:
+
+ $ buildlib/cbuild build-images fc25
+
+This will download the base image and customize it with the required packages.
+
+Next, a build can be performed 'in place'. This is useful to do edit/compile
+cycles with an alternate distribution.
+
+ $ buildlib/cbuild make fc25
+
+The build output will be placed in build-fc25
+
+Finally, a full package build can be performed inside the container. Note this
+mode actually creates a source tree inside the container based on the current
+git HEAD commit, so any uncommitted edits will be lost.
+
+ $ buildlib/cbuild pkg fc25
+
+In this case only the final package results are copied outside the container
+(to ..) and everything else is discarded.
+
+In all cases the containers that are spun up are deleted after they are
+finished, only the base container created during 'build-images' is kept. The
+'--run-shell' option can be used to setup the container to the point of
+running the build command and instead run an interactive bash shell. This is
+useful for debugging certain kinds of build problems."""
+
+import argparse
+import collections
+import grp
+import imp
+import inspect
+import json
+import multiprocessing
+import os
+import pipes
+import pwd
+import re
+import shutil
+import subprocess
+import sys
+import tempfile
+import yaml
+from contextlib import contextmanager;
+
+project = "rdma-core";
+
+def get_version():
+ """Return the version string for the project, this gets automatically written
+ into the packaging files."""
+ with open("CMakeLists.txt","r") as F:
+ for ln in F:
+ g = re.match(r'^set\(PACKAGE_VERSION "(.+)"\)',ln)
+ if g is None:
+ continue;
+ return g.group(1);
+ raise RuntimeError("Could not find version");
+
+class DockerFile(object):
+ def __init__(self,src):
+ self.lines = ["FROM %s"%(src)];
+
+class Environment(object):
+ aliases = set();
+ use_make = False;
+ proxy = True;
+
+ def image_name(self):
+ return "build-%s/%s"%(project,self.name);
+
+# -------------------------------------------------------------------------
+
+class YumEnvironment(Environment):
+ is_rpm = True;
+ def get_docker_file(self):
+ res = DockerFile(self.docker_parent);
+ res.lines.append("RUN yum install -y %s && yum clean all"%(
+ " ".join(sorted(self.pkgs))));
+ return res;
+
+class centos6(YumEnvironment):
+ docker_parent = "centos:6";
+ pkgs = {
+ 'cmake',
+ 'gcc',
+ 'libnl3-devel',
+ 'libudev-devel',
+ 'make',
+ 'pkgconfig',
+ 'python',
+ 'rpm-build',
+ 'valgrind-devel',
+ };
+ name = "centos6";
+ use_make = True;
+
+class centos7(YumEnvironment):
+ docker_parent = "centos:7";
+ pkgs = centos6.pkgs;
+ name = "centos7";
+ use_make = True;
+ specfile = "redhat/rdma-core.spec";
+
+class centos7_epel(centos7):
+ pkgs = (centos7.pkgs - {"cmake","make"}) | {"ninja-build","cmake3"};
+ name = "centos7_epel";
+ use_make = False;
+ ninja_cmd = "ninja-build";
+ # Our spec file does not know how to cope with cmake3
+ is_rpm = False;
+
+ def get_docker_file(self):
+ res = YumEnvironment.get_docker_file(self);
+ res.lines.insert(1,"RUN yum install -y epel-release");
+ res.lines.append("RUN ln -s /usr/bin/cmake3 /usr/local/bin/cmake");
+ return res;
+
+class fc25(Environment):
+ docker_parent = "fedora:25";
+ pkgs = (centos7.pkgs - {"make"}) | {"ninja-build"};
+ name = "fc25";
+ specfile = "redhat/rdma-core.spec";
+ ninja_cmd = "ninja-build";
+ is_rpm = True;
+
+ def get_docker_file(self):
+ res = DockerFile(self.docker_parent);
+ res.lines.append("RUN dnf install -y %s && dnf clean all"%(
+ " ".join(sorted(self.pkgs))));
+ return res;
+
+# -------------------------------------------------------------------------
+
+class APTEnvironment(Environment):
+ is_deb = True;
+ def get_docker_file(self):
+ res = DockerFile(self.docker_parent);
+ res.lines.append("RUN apt-get update && apt-get install -y --no-install-recommends %s && apt-get clean"%(
+ " ".join(sorted(self.pkgs))));
+ return res;
+
+class trusty(APTEnvironment):
+ docker_parent = "ubuntu:14.04";
+ pkgs = {
+ 'build-essential',
+ 'cmake',
+ 'debhelper',
+ 'dh-systemd',
+ 'gcc',
+ 'libnl-3-dev',
+ 'libnl-route-3-dev',
+ 'libudev-dev',
+ 'make',
+ 'ninja-build',
+ 'pkg-config',
+ 'python',
+ 'valgrind',
+ };
+ name = "ubuntu-14.04";
+ aliases = {"trusty"};
+
+class xenial(APTEnvironment):
+ docker_parent = "ubuntu:16.04"
+ pkgs = trusty.pkgs;
+ name = "ubuntu-16.04";
+ aliases = {"xenial"};
+
+class jessie(APTEnvironment):
+ docker_parent = "debian:8"
+ pkgs = trusty.pkgs;
+ name = "debian-8";
+ aliases = {"jessie"};
+
+class travis(APTEnvironment):
+ """This parses the .travis.yml "apt" add on and converts it to a dockerfile,
+ basically creating a container that is similar to what travis would
+ use. Note this does not use the base travis image, nor does it install the
+ typical travis packages."""
+ docker_parent = "ubuntu:14.04";
+ name = "travis";
+ is_deb = True;
+ _yaml = None;
+
+ def get_yaml(self):
+ if self._yaml:
+ return self._yaml;
+
+ # Load the commands from the travis file
+ with open(".travis.yml") as F:
+ self._yaml = yaml.load(F);
+ return self._yaml;
+ yaml = property(get_yaml);
+
+ def get_repos(self):
+ """Return a list of things to add with apt-add-repository"""
+ Source = collections.namedtuple("Source",["sourceline","key_url"]);
+
+ # See https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
+ pre_defined = {
+ "ubuntu-toolchain-r-test": Source("ppa:ubuntu-toolchain-r/test",None),
+ };
+
+ # Unique the sources
+ res = set();
+ for src in self.yaml["addons"]["apt"]["sources"]:
+ if isinstance(src,dict):
+ res.add(Source(sourceline=src["sourceline"],
+ key_url=src["key_url"]));
+ else:
+ res.add(pre_defined[src]);
+
+ # Add the sources
+ scmds = [];
+ scmds.extend("apt-key add /etc/apt/trusted.gpg.d/%s"%(os.path.basename(I.key_url))
+ for I in res if I.key_url is not None);
+ scmds.extend("http_proxy= apt-add-repository -y %s"%(pipes.quote(I.sourceline))
+ for I in res);
+
+ # Download the keys
+ cmds = ["ADD %s /etc/apt/trusted.gpg.d/"%(I.key_url)
+ for I in res if I.key_url is not None];
+
+ cmds.append("RUN " + " && ".join(scmds));
+ return cmds;
+
+ def get_docker_file(self):
+ # First this to get apt-add-repository
+ self.pkgs = {"software-properties-common"}
+ res = APTEnvironment.get_docker_file(self);
+
+ # Sources list from the travis.yml
+ res.lines.extend(self.get_repos());
+
+ # Package list from the travis.yml
+ res.lines.append("RUN apt-get update && apt-get install -y --no-install-recommends %s"%(
+ " ".join(sorted(self.yaml["addons"]["apt"]["packages"]))));
+
+ return res;
+
+# -------------------------------------------------------------------------
+
+class ZypperEnvironment(Environment):
+ is_rpm = True;
+ def get_docker_file(self):
+ res = DockerFile(self.docker_parent);
+ res.lines.append("RUN zypper --non-interactive refresh");
+ res.lines.append("RUN zypper --non-interactive dist-upgrade");
+ res.lines.append("RUN zypper --non-interactive install %s"%(
+ " ".join(sorted(self.pkgs))));
+ return res;
+
+class harlequin(ZypperEnvironment):
+ proxy = False;
+ docker_parent = "opensuse:13.2";
+ pkgs = {
+ 'cmake',
+ 'gcc',
+ 'libnl3-devel',
+ 'libudev-devel',
+ 'make',
+ 'ninja',
+ 'pkg-config',
+ 'python',
+ 'rpm-build',
+ 'valgrind-devel',
+ };
+ name = "opensuse-13.2";
+ aliases = {"harelequin"};
+
+class malachite(ZypperEnvironment):
+ docker_parent = "opensuse:42.1";
+ pkgs = harlequin.pkgs;
+ name = "opensuse-42.1";
+ aliases = {"malachite"};
+
+class tumbleweed(ZypperEnvironment):
+ docker_parent = "opensuse:tumbleweed";
+ pkgs = harlequin.pkgs;
+ name = "tumbleweed";
+
+# -------------------------------------------------------------------------
+
+environments = [centos6(),
+ centos7(),
+ centos7_epel(),
+ travis(),
+ trusty(),
+ xenial(),
+ jessie(),
+ fc25(),
+ harlequin(),
+ malachite(),
+ tumbleweed(),
+];
+
+class ToEnvAction(argparse.Action):
+ """argparse helper to parse environment lists into environment classes"""
+ def __call__(self, parser, namespace, values, option_string=None):
+ if not isinstance(values,list):
+ values = [values];
+
+ res = set();
+ for I in values:
+ if I == "all":
+ res.update(environments);
+ else:
+ for env in environments:
+ if env.name == I or I in env.aliases:
+ res.add(env);
+ setattr(namespace, self.dest, sorted(res,key=lambda x:x.name))
+
+def env_choices():
+ """All the names that can be used with ToEnvAction"""
+ envs = set(("all",));
+ for I in environments:
+ envs.add(I.name);
+ envs.update(I.aliases);
+ return envs;
+
+def docker_cmd(env,*cmd):
+ """Invoke docker"""
+ cmd = list(cmd);
+ if env.sudo:
+ return subprocess.check_call(["sudo","docker"] + cmd);
+ return subprocess.check_call(["docker"] + cmd);
+
+def docker_cmd_str(env,*cmd):
+ """Invoke docker"""
+ cmd = list(cmd);
+ if env.sudo:
+ return subprocess.check_output(["sudo","docker"] + cmd);
+ return subprocess.check_output(["docker"] + cmd);
+
+@contextmanager
+def private_tmp(args):
+ """Simple version of Python 3's tempfile.TemporaryDirectory"""
+ dfn = tempfile.mkdtemp();
+ try:
+ yield dfn;
+ finally:
+ try:
+ shutil.rmtree(dfn);
+ except:
+ # The debian builds result in root owned files because we don't use fakeroot
+ subprocess.check_call(['sudo','rm','-rf',dfn]);
+
+@contextmanager
+def inDirectory(dir):
+ cdir = os.getcwd();
+ try:
+ os.chdir(dir);
+ yield True;
+ finally:
+ os.chdir(cdir);
+
+def get_image_id(args,image_name):
+ img = json.loads(docker_cmd_str(args,"inspect",image_name));
+ image_id = img[0]["Id"];
+ # Newer dockers put a prefix
+ if ":" in image_id:
+ image_id = image_id.partition(':')[2];
+ return image_id;
+
+# -------------------------------------------------------------------------
+
+def run_rpm_build(args,spec_file,env):
+ version = get_version();
+ with open(spec_file,"r") as F:
+ for ln in F:
+ if ln.startswith("Version:"):
+ ver = ln.strip().partition(' ')[2];
+ assert(ver == get_version());
+
+ if ln.startswith("Source:"):
+ tarfn = ln.strip().partition(' ')[2];
+ tarfn = tarfn.replace("%{version}",version);
+
+ image_id = get_image_id(args,env.image_name());
+ with private_tmp(args) as tmpdir:
+ os.mkdir(os.path.join(tmpdir,"SOURCES"));
+ os.mkdir(os.path.join(tmpdir,"tmp"));
+
+ subprocess.check_call(["git","archive",
+ "--prefix","%s/"%(os.path.splitext(tarfn)[0]),
+ "--output",os.path.join(tmpdir,"SOURCES",tarfn),
+ "HEAD"]);
+
+ with open(spec_file,"r") as inF:
+ spec = list(inF);
+ tspec_file = os.path.basename(spec_file);
+ with open(os.path.join(tmpdir,tspec_file),"w") as outF:
+ outF.write("".join(spec));
+
+ home = os.path.join(os.path.sep,"home",os.getenv("LOGNAME"));
+ vdir = os.path.join(home,"rpmbuild");
+
+ opts = [
+ "run",
+ "--rm=true",
+ "-v","%s:%s"%(tmpdir,vdir),
+ "-w",vdir,
+ "-h","builder-%s"%(image_id[:12]),
+ "-e","HOME=%s"%(home),
+ "-e","TMPDIR=%s"%(os.path.join(vdir,"tmp")),
+ ];
+
+ # rpmbuild complains if we do not have an entry in passwd and group
+ # for the user we are going to use to do the build.
+ with open(os.path.join(tmpdir,"go.py"),"w") as F:
+ print >> F,"""
+import os;
+with open("/etc/passwd","a") as F:
+ print >> F, {passwd!r};
+with open("/etc/group","a") as F:
+ print >> F, {group!r};
+os.setgid({gid:d});
+os.setuid({uid:d});
+""".format(passwd=":".join(str(I) for I in pwd.getpwuid(os.getuid())),
+ group=":".join(str(I) for I in grp.getgrgid(os.getgid())),
+ uid=os.getuid(),
+ gid=os.getgid());
+
+ bopts = ["-bb",tspec_file];
+
+ print >> F,'os.execlp("rpmbuild","rpmbuild",%s)'%(
+ ",".join(repr(I) for I in bopts));
+
+ if args.run_shell:
+ opts.append("-ti");
+ opts.append(env.image_name());
+
+ if args.run_shell:
+ opts.append("/bin/bash");
+ else:
+ opts.extend(["python","go.py"]);
+
+ docker_cmd(args,*opts)
+
+ print
+ for path,jnk,files in os.walk(os.path.join(tmpdir,"RPMS")):
+ for I in files:
+ print "Final RPM: ",os.path.join("..",I);
+ shutil.move(os.path.join(path,I),
+ os.path.join("..",I));
+
+def run_deb_build(args,env):
+ image_id = get_image_id(args,env.image_name());
+ with private_tmp(args) as tmpdir:
+ os.mkdir(os.path.join(tmpdir,"src"));
+ os.mkdir(os.path.join(tmpdir,"tmp"));
+
+ opwd = os.getcwd();
+ with inDirectory(os.path.join(tmpdir,"src")):
+ subprocess.check_call(["git",
+ "--git-dir",os.path.join(opwd,".git"),
+ "reset","--hard","HEAD"]);
+
+ home = os.path.join(os.path.sep,"home",os.getenv("LOGNAME"));
+
+ opts = [
+ "run",
+ "--read-only",
+ "--rm=true",
+ "-v","%s:%s"%(tmpdir,home),
+ "-w",os.path.join(home,"src"),
+ "-h","builder-%s"%(image_id[:12]),
+ "-e","HOME=%s"%(home),
+ "-e","TMPDIR=%s"%(os.path.join(home,"tmp")),
+ "-e","DEB_BUILD_OPTIONS=parallel=%u"%(multiprocessing.cpu_count()),
+ ];
+
+ # Create a go.py that will let us run the compilation as the user and
+ # then switch to root only for the packaging step.
+ with open(os.path.join(tmpdir,"go.py"),"w") as F:
+ print >> F,"""
+import subprocess,os;
+def to_user():
+ os.setgid({gid:d});
+ os.setuid({uid:d});
+subprocess.check_call(["debian/rules","debian/rules","build"],
+ preexec_fn=to_user);
+subprocess.check_call(["debian/rules","debian/rules","binary"]);
+""".format(uid=os.getuid(),
+ gid=os.getgid());
+
+ if args.run_shell:
+ opts.append("-ti");
+ opts.append(env.image_name());
+
+ if args.run_shell:
+ opts.append("/bin/bash");
+ else:
+ opts.extend(["python",os.path.join(home,"go.py")]);
+
+ docker_cmd(args,*opts);
+
+ print
+ for I in os.listdir(tmpdir):
+ if I.endswith(".deb"):
+ print "Final DEB: ",os.path.join("..",I);
+ shutil.move(os.path.join(tmpdir,I),
+ os.path.join("..",I));
+
+def run_travis_build(args,env):
+ with private_tmp(args) as tmpdir:
+ os.mkdir(os.path.join(tmpdir,"src"));
+ os.mkdir(os.path.join(tmpdir,"tmp"));
+
+ opwd = os.getcwd();
+ with inDirectory(os.path.join(tmpdir,"src")):
+ subprocess.check_call(["git",
+ "--git-dir",os.path.join(opwd,".git"),
+ "reset","--hard","HEAD"]);
+
+ home = os.path.join(os.path.sep,"home",os.getenv("LOGNAME"));
+
+ opts = [
+ "run",
+ "--read-only",
+ "--rm=true",
+ "-v","%s:%s"%(tmpdir,home),
+ "-w",os.path.join(home,"src"),
+ "-u",str(os.getuid()),
+ "-e","HOME=%s"%(home),
+ "-e","TMPDIR=%s"%(os.path.join(home,"tmp")),
+ ];
+
+ # Load the commands from the travis file
+ with open(os.path.join(opwd,".travis.yml")) as F:
+ cmds = yaml.load(F)["script"];
+
+ with open(os.path.join(tmpdir,"go.sh"),"w") as F:
+ print >> F,"#!/bin/bash";
+ print >> F,"set -e";
+ for I in cmds:
+ print >> F,I;
+
+ if args.run_shell:
+ opts.append("-ti");
+ opts.append(env.image_name());
+
+ if args.run_shell:
+ opts.append("/bin/bash");
+ else:
+ opts.extend(["/bin/bash",os.path.join(home,"go.sh")]);
+
+ docker_cmd(args,*opts);
+
+def args_pkg(parser):
+ parser.add_argument("ENV",action=ToEnvAction,choices=env_choices());
+ parser.add_argument("--run-shell",default=False,action="store_true",
+ help="Instead of running the build, enter a shell");
+def cmd_pkg(args):
+ """Build a package in the given environment."""
+ for env in args.ENV:
+ if env.name == "travis":
+ run_travis_build(args,env);
+ elif getattr(env,"is_deb",False):
+ run_deb_build(args,env);
+ elif getattr(env,"is_rpm",False):
+ run_rpm_build(args,
+ getattr(env,"specfile","%s.spec"%(project)),
+ env);
+ else:
+ print "%s does not support packaging"%(env.name);
+
+# -------------------------------------------------------------------------
+
+def args_make(parser):
+ parser.add_argument("--run-shell",default=False,action="store_true",
+ help="Instead of running the build, enter a shell");
+ parser.add_argument("ENV",action=ToEnvAction,choices=env_choices());
+ parser.add_argument('ARGS', nargs=argparse.REMAINDER);
+def cmd_make(args):
+ """Run cmake and ninja within a docker container. If cmake has not yet been
+ run then this runs it with the given environment variables, then invokes ninja.
+ Otherwise ninja is invoked without calling cmake."""
+ SRC = os.getcwd();
+
+ for env in args.ENV:
+ BUILD = "build-%s"%(env.name)
+ if not os.path.exists(BUILD):
+ os.mkdir(BUILD);
+
+ home = os.path.join(os.path.sep,"home",os.getenv("LOGNAME"));
+
+ dirs = [os.getcwd(),"/tmp"];
+ # Import the symlink target too if BUILD is a symlink
+ BUILD_r = os.path.realpath(BUILD);
+ if not BUILD_r.startswith(os.path.realpath(SRC)):
+ dirs.append(BUILD_r);
+
+ cmake_args = []
+ cmake_envs = []
+ ninja_args = []
+ for I in args.ARGS:
+ if I.startswith("-D"):
+ cmake_args.append(I);
+ elif I.find('=') != -1:
+ cmake_envs.append(I);
+ else:
+ ninja_args.append(I);
+
+ if env.use_make:
+ need_cmake = not os.path.exists(os.path.join(BUILD_r,"Makefile"));
+ else:
+ need_cmake = not os.path.exists(os.path.join(BUILD_r,"build.ninja"));
+ opts = ["run",
+ "--read-only",
+ "--rm=true",
+ "-ti",
+ "-u",str(os.getuid()),
+ "-e","HOME=%s"%(home),
+ "-w",BUILD_r,
+ ];
+ for I in dirs:
+ opts.append("-v");
+ opts.append("%s:%s"%(I,I));
+ for I in cmake_envs:
+ opts.append("-e");
+ opts.append(I);
+ if args.run_shell:
+ opts.append("-ti");
+ opts.append(env.image_name());
+
+ if args.run_shell:
+ os.execlp("sudo","sudo","docker",*(opts + ["/bin/bash"]));
+
+ if need_cmake:
+ if env.use_make:
+ prog_args = ["cmake",SRC] + cmake_args;
+ else:
+ prog_args = ["cmake","-GNinja",SRC] + cmake_args;
+ docker_cmd(args,*(opts + prog_args));
+
+ if env.use_make:
+ prog_args = ["make","-C",BUILD_r] + ninja_args;
+ else:
+ prog_args = [getattr(env,"ninja_cmd","ninja"),
+ "-C",BUILD_r] + ninja_args;
+
+ if len(args.ENV) <= 1:
+ os.execlp("sudo","sudo","docker",*(opts + prog_args));
+ else:
+ docker_cmd(args,*(opts + prog_args));
+
+# -------------------------------------------------------------------------
+
+def get_build_args(args,env):
+ """Return extra docker arguments for building. This is the system APT proxy."""
+ res = [];
+ if args.pull:
+ res.append("--pull");
+
+ if env.proxy and os.path.exists("/etc/apt/apt.conf.d/01proxy"):
+ # The line in this file must be 'Acquire::http { Proxy "http://xxxx:3142"; };'
+ with open("/etc/apt/apt.conf.d/01proxy") as F:
+ proxy = F.read().strip().split('"')[1];
+ res.append("--build-arg");
+ res.append('http_proxy=%s'%(proxy));
+ return res;
+
+def args_build_images(parser):
+ parser.add_argument("ENV",nargs="+",action=ToEnvAction,choices=env_choices());
+ parser.add_argument("--no-pull",default=True,action="store_false",
+ dest="pull",
+ help="Instead of running the build, enter a shell");
+def cmd_build_images(args):
+ """Run from the top level source directory to make the docker images that are
+ needed for building. This only needs to be run once."""
+ for env in args.ENV:
+ df = env.get_docker_file();
+ with private_tmp(args) as tmpdir:
+ fn = os.path.join(tmpdir,"Dockerfile");
+ with open(fn,"wt") as F:
+ for ln in df.lines:
+ print >> F,ln;
+ opts = (["build"] +
+ get_build_args(args,env) +
+ ["-f",fn,
+ "-t",env.image_name(),
+ tmpdir]);
+ docker_cmd(args,*opts);
+
+# -------------------------------------------------------------------------
+def args_docker_gc(parser):
+ pass;
+def cmd_docker_gc(args):
+ """Run garbage collection on docker images and containers."""
+
+ containers = set(docker_cmd_str(args,"ps","-a","-q","--filter","status=exited").split());
+ images = set(docker_cmd_str(args,"images","-q","--filter","dangling=true").split());
+
+ if containers:
+ docker_cmd(args,"rm",*sorted(containers));
+ if images:
+ docker_cmd(args,"rmi",*sorted(images));
+
+# -------------------------------------------------------------------------
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser(description='Operate docker for building this package')
+ subparsers = parser.add_subparsers(title="Sub Commands");
+
+ funcs = globals();
+ for k,v in funcs.items():
+ if k.startswith("cmd_") and inspect.isfunction(v):
+ sparser = subparsers.add_parser(k[4:].replace('_','-'),
+ help=v.__doc__);
+ funcs["args_" + k[4:]](sparser);
+ sparser.set_defaults(func=v);
+
+ try:
+ import argcomplete;
+ argcomplete.autocomplete(parser);
+ except ImportError:
+ pass;
+
+ args = parser.parse_args();
+ args.sudo = True;
+
+ # This script must always run from the top of the git tree, and a git
+ # checkout is mandatory.
+ git_top = subprocess.check_output(["git","rev-parse","--git-dir"]).strip();
+ if git_top != ".git":
+ os.chdir(os.path.dirname(git_top));
+
+ if not args.func(args):
+ sys.exit(100);
+ sys.exit(0);
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH rdma-core 5/6] Avoid rpmbuild warning
From: Jason Gunthorpe @ 2016-11-23 23:35 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1479944104-19949-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
There is already a catch all for this directory
warning: File listed twice: /usr/share/doc/packages/rdma-core-12/MAINTAINERS
warning: File listed twice: /usr/share/doc/packages/rdma-core-12/README.md
Fixes: 8df5873b969f ("Install end user focused documentation files")
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
rdma-core.spec | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/rdma-core.spec b/rdma-core.spec
index 8c0b50da7645ee..bdb64c6bb80567 100644
--- a/rdma-core.spec
+++ b/rdma-core.spec
@@ -118,8 +118,6 @@ rm -rf %{buildroot}/%{my_unitdir}/
%files
%doc %{_mandir}/man*/*
-%doc %{_docdir}/%{name}-%{version}/README.md
-%doc %{_docdir}/%{name}-%{version}/MAINTAINERS
%{_bindir}/*
%{_includedir}/*
%{_libdir}/lib*.so*
@@ -129,7 +127,7 @@ rm -rf %{buildroot}/%{my_unitdir}/
%{_sbindir}/*
%{_libexecdir}/*
%{_udevrulesdir}/*
-%{_docdir}/%{name}-%{version}/*
+%doc %{_docdir}/%{name}-%{version}/*
%if 0%{?_unitdir:1}
%{_unitdir}/*
%else
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH rdma-core 4/6] Fix package building on CentOS6
From: Jason Gunthorpe @ 2016-11-23 23:35 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1479944104-19949-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
The old rpmbuild does not define _udevrulesdir.
Fixes: 4910f1eb752e ("rdma-ndd: add rdma-ndd from infiniband-diags")
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
rdma-core.spec | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/rdma-core.spec b/rdma-core.spec
index 2c595a1da07d02..8c0b50da7645ee 100644
--- a/rdma-core.spec
+++ b/rdma-core.spec
@@ -77,6 +77,13 @@ This is a simple example without the split sub packages to get things started.
%define _rundir /var/run
%endif
+# New RPM defines _udevrulesdir, usually as /usr/lib/udev/rules.d
+%if 0%{?_udevrulesdir:1}
+%else
+# This is the old path (eg for C6)
+%define _udevrulesdir /lib/udev/rules.d
+%endif
+
# Pass all of the rpm paths directly to GNUInstallDirs and our other defines.
%cmake %{CMAKE_FLAGS} \
-DCMAKE_BUILD_TYPE=Release \
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH rdma-core 3/6] Fix RPM building on FC24
From: Jason Gunthorpe @ 2016-11-23 23:35 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1479944104-19949-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
ninja on RedHat distros is spelled 'ninja-build' for some reason. Missed
two places.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
rdma-core.spec | 2 +-
redhat/rdma-core.spec | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/rdma-core.spec b/rdma-core.spec
index 41ec47e9f86425..2c595a1da07d02 100644
--- a/rdma-core.spec
+++ b/rdma-core.spec
@@ -37,7 +37,7 @@ BuildRequires: ninja,make
# Ninja was introduced in FC23
BuildRequires: ninja-build
%define CMAKE_FLAGS -GNinja
-%define make_jobs ninja -v %{?_smp_mflags}
+%define make_jobs ninja-build -v %{?_smp_mflags}
%define cmake_install DESTDIR=%{buildroot} ninja-build install
%else
# Fallback to make otherwise
diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
index 39267be2033abc..801bb9410346db 100644
--- a/redhat/rdma-core.spec
+++ b/redhat/rdma-core.spec
@@ -31,7 +31,7 @@ Obsoletes: rdma < %{version}-%{release}
# Ninja was introduced in FC23
BuildRequires: ninja-build
%define CMAKE_FLAGS -GNinja
-%define make_jobs ninja -v %{?_smp_mflags}
+%define make_jobs ninja-build -v %{?_smp_mflags}
%define cmake_install DESTDIR=%{buildroot} ninja-build install
%else
# Fallback to make otherwise
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH rdma-core 2/6] Fix spelling of CMAKE_INSTALL_UDEV_RULESDIR
From: Jason Gunthorpe @ 2016-11-23 23:35 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1479944104-19949-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Fixes: 1b9b57df9924 ("Add a dependency on libudev")
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
rdma-core.spec | 2 +-
redhat/rdma-core.spec | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/rdma-core.spec b/rdma-core.spec
index 5e36c37745c5fb..41ec47e9f86425 100644
--- a/rdma-core.spec
+++ b/rdma-core.spec
@@ -94,7 +94,7 @@ This is a simple example without the split sub packages to get things started.
-DCMAKE_INSTALL_INITDDIR:PATH=%{_initrddir} \
-DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
-DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version} \
- -DCMAKE_INSTALL_UDEV_RULESDR:PATH=%{_udevrulesdir}
+ -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir}
%make_jobs
%install
diff --git a/redhat/rdma-core.spec b/redhat/rdma-core.spec
index 0d1275ad1bfb49..39267be2033abc 100644
--- a/redhat/rdma-core.spec
+++ b/redhat/rdma-core.spec
@@ -218,7 +218,7 @@ discover and use SCSI devices via the SCSI RDMA Protocol over InfiniBand.
-DCMAKE_INSTALL_INITDDIR:PATH=%{_initrddir} \
-DCMAKE_INSTALL_RUNDIR:PATH=%{_rundir} \
-DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name}-%{version} \
- -DCMAKE_INSTALL_UDEV_RULESDR:PATH=%{_udevrulesdir}
+ -DCMAKE_INSTALL_UDEV_RULESDIR:PATH=%{_udevrulesdir}
%make_jobs
%install
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH rdma-core 1/6] Update C7 build instructions to use ninja from EPEL
From: Jason Gunthorpe @ 2016-11-23 23:34 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1479944104-19949-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
This made it into EPEL recently, refer people to that build.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
README.md | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 1f6e20170e5ade..9c69bb545c0596 100644
--- a/README.md
+++ b/README.md
@@ -59,7 +59,7 @@ $ apt-get install build-essential cmake gcc libudev-dev libnl-3-dev libnl-route-
$ dnf install cmake gcc libnl3-devel libudev-devel pkgconfig valgrind-devel ninja-build
```
-NOTE: Fedora Core uses the name 'ninja-build' for the ninja command.
+NOTE: Fedora Core uses the name 'ninja-build' for the 'ninja' command.
### OpenSuSE
@@ -75,16 +75,17 @@ Install required packages:
$ yum install cmake gcc libnl3-devel libudev-devel make pkgconfig valgrind-devel
```
-Developers are suggested to install more modern tooling for the best experience.
+Developers on CentOS 7 are suggested to install more modern tooling for the
+best experience.
```sh
$ yum install epel-release
-$ yum install cmake3 unzip
-$ curl -OL https://github.com/ninja-build/ninja/releases/download/v1.7.1/ninja-linux.zip
-$ unzip ninja-linux.zip
-$ install -m755 ninja /usr/local/bin/ninja
+$ yum install cmake3 unzip ninja-build
```
+NOTE: EPEL uses the name 'ninja-build' for the 'ninja' command, and 'cmake3'
+for the 'cmake' command.
+
# Reporting bugs
Bugs should be reported to the <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> mailing list
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH rdma-core 0/6] Container build script
From: Jason Gunthorpe @ 2016-11-23 23:34 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
This is a revised version of the script I have been using to test builds
across all the distros using docker containers.
It should be very easy to setup, installing docker is fairly trivial these
days on a recent distro.
I found a few mistakes while running through the test matrix, those are
included here as well.
Jason Gunthorpe (6):
Update C7 build instructions to use ninja from EPEL
Fix spelling of CMAKE_INSTALL_UDEV_RULESDIR
Fix RPM building on FC24
Fix package building on CentOS6
Avoid rpmbuild warning
Add a script to run builds in docker containers
README.md | 24 +-
buildlib/cbuild | 740 ++++++++++++++++++++++++++++++++++++++++++++++++++
rdma-core.spec | 15 +-
redhat/rdma-core.spec | 4 +-
4 files changed, 770 insertions(+), 13 deletions(-)
create mode 100755 buildlib/cbuild
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RE: [RFC] Avoid running out of local port in RDMA_CM
From: Hefty, Sean @ 2016-11-23 23:29 UTC (permalink / raw)
To: Moni Shoua; +Cc: linux-rdma, Doug Ledford
In-Reply-To: <CAG9sBKO7YVjKgGMOMBUxrtz3iU5GtkqPFu6j52g=RqR=d_0HHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1276 bytes --]
> The documentation for struct inet_bind_bucket says:
> /* There are a few simple rules, which allow for local port reuse by
> * an application. In essence:
> *
> * 1) Sockets bound to different interfaces may share a local
> port.
> * Failing that, goto test 2.
> * 2) If all sockets have sk->sk_reuse set, and none of them are
> in
> * TCP_LISTEN state, the port may be shared.
> * Failing that, goto test 3.
> * 3) If all sockets are bound to a specific inet_sk(sk)-
> >rcv_saddr local
> * address, and none of them are the same, the port may be
> * shared.
> * Failing this, the port cannot be shared.
> ..
>
> If I understand this correctly the suggestion in the RFC follows this
> scheme so the request to mimic TCP/IP stack seems to be fulfilled.
I don't see how the proposal fulfills the above requirements (3 may be the key one here). If I understand the proposal correctly, you're wanting to re-use the same port number for all connections (once the port numbers run out) without checking that the local or remote addresses differ.
N§²æìr¸yúèØb²X¬¶Ç§vØ^)Þº{.nÇ+·¥{±Ù{ayº\x1dÊÚë,j\a¢f£¢·h»öì\x17/oSc¾Ú³9uÀ¦æåÈ&jw¨®\x03(éÝ¢j"ú\x1a¶^[m§ÿïêäz¹Þàþf£¢·h§~m
^ permalink raw reply
* Re: Enabling peer to peer device transactions for PCIe devices
From: Jason Gunthorpe @ 2016-11-23 23:25 UTC (permalink / raw)
To: Dan Williams
Cc: Haggai Eran, Bridgman, John,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
Kuehling, Felix, Serguei Sagalovitch, Blinzer, Paul,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Sander, Ben, Suthikulpanit, Suravee,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Deucher, Alexander, Koenig, Christian,
Linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <CAPcyv4jVDC=8AbVa9v6LcXm9n8QHgizv_+gQJC4RTd-wtTESWQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Wed, Nov 23, 2016 at 02:42:12PM -0800, Dan Williams wrote:
> > The crucial part for this discussion is the ability to fence and block
> > DMA for a specific range. This is the hardware capability that lets
> > page migration happen: fence&block DMA, migrate page, update page
> > table in HCA, unblock DMA.
>
> Wait, ODP requires migratable pages, ZONE_DEVICE pages are not
> migratable.
Does it? I didn't think so.. Does ZONE_DEVICE break MMU notifiers/etc
or something? There is certainly nothing about the hardware that cares
about ZONE_DEVICE vs System memory.
I used 'migration' in the broader sense of doing any transformation to
the page such that the DMA address changes - not the specific kernel
MM process...
> You can't replace a PCIe mapping with just any other System RAM
> physical address, right?
I thought that was exactly what HMM was trying to do? Migrate pages
between CPU and GPU memory as needed. As Serguei has said this process
needs to be driven by the GPU driver.
The peer-peer issue is how do you do that while RDMA is possible on
those pages, because when the page migrates to GPU memory you want the
RDMA to follow it seamlessly.
This is why page table mirroring is the best solution - use the
existing mm machinery to link the DMA driver and whatever is
controlling the VMA.
> At least not without a filesystem recording where things went, but
> at point we're no longer talking about the base P2P-DMA mapping
In the filesystem/DAX case, it would be the filesystem that initiates
any change in the page physical address.
ODP *follows* changes in the VMA it does not cause any change in
address mapping. That has to be done by whoever is in charge of the
VMA.
> something like pnfs-rdma to a DAX filesystem.
Something in the kernel (ie nfs-rdma) would be entirely different. We
generally don't do long lived mappings in the kernel for RDMA
(certainly not for NFS), so it is much more like your basic every day
DMA operation: map, execute, unmap. We probably don't need to use page
table mirroring for this.
ODP comes in when userpsace mmaps a DAX file and then tries to use it
for RDMA. Page table mirroring lets the DAX filesystem decide to move
the backing pages at any time. When it wants to do that it interacts
with the MM in the usual way which links to ODP and makes sure the
migration is seamless.
Jason
^ permalink raw reply
* Re: Enabling peer to peer device transactions for PCIe devices
From: Dan Williams @ 2016-11-23 22:42 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Haggai Eran, Bridgman, John,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
Kuehling, Felix, Serguei Sagalovitch, Blinzer, Paul,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Sander, Ben, Suthikulpanit, Suravee,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Deucher, Alexander, Koenig, Christian,
Linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <20161123215510.GA16311-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
On Wed, Nov 23, 2016 at 1:55 PM, Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
> On Wed, Nov 23, 2016 at 02:11:29PM -0700, Logan Gunthorpe wrote:
>> > As I said, there is no possible special handling. Standard IB hardware
>> > does not support changing the DMA address once a MR is created. Forget
>> > about doing that.
>>
>> Yeah, that's essentially the point I was trying to make. Not to mention
>> all the other unrelated hardware that can't DMA to an address that might
>> disappear mid-transfer.
>
> Right, it is impossible to ask for generic page migration with ongoing
> DMA. That is simply not supported by any of the hardware at all.
>
>> > Only ODP hardware allows changing the DMA address on the fly, and it
>> > works at the page table level. We do not need special handling for
>> > RDMA.
>>
>> I am aware of ODP but, noted by others, it doesn't provide a general
>> solution to the points above.
>
> How do you mean?
>
> Perhaps I am not following what Serguei is asking for, but I
> understood the desire was for a complex GPU allocator that could
> migrate pages between GPU and CPU memory under control of the GPU
> driver, among other things. The desire is for DMA to continue to work
> even after these migrations happen.
>
> Page table mirroring *is* the general solution for this problem. The
> GPU driver controls the VMA and the DMA driver mirrors that VMA.
>
> Do you know of another option that doesn't just degenerate to page
> table mirroring??
>
> Remember, there are two facets to the RDMA ODP implementation, I feel
> there is some confusion here..
>
> The crucial part for this discussion is the ability to fence and block
> DMA for a specific range. This is the hardware capability that lets
> page migration happen: fence&block DMA, migrate page, update page
> table in HCA, unblock DMA.
Wait, ODP requires migratable pages, ZONE_DEVICE pages are not
migratable. You can't replace a PCIe mapping with just any other
System RAM physical address, right? At least not without a filesystem
recording where things went, but at point we're no longer talking
about the base P2P-DMA mapping mechanism and are instead talking about
something like pnfs-rdma to a DAX filesystem.
^ permalink raw reply
* Re: Enabling peer to peer device transactions for PCIe devices
From: Jason Gunthorpe @ 2016-11-23 21:55 UTC (permalink / raw)
To: Logan Gunthorpe
Cc: Haggai Eran, Bridgman, John,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
Kuehling, Felix, Serguei Sagalovitch, Blinzer, Paul,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Sander, Ben, Suthikulpanit, Suravee,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Deucher, Alexander, Koenig, Christian,
Linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <dd60bca8-0a35-7a3a-d3ab-b95bc3d9b973-OTvnGxWRz7hWk0Htik3J/w@public.gmane.org>
On Wed, Nov 23, 2016 at 02:11:29PM -0700, Logan Gunthorpe wrote:
> > As I said, there is no possible special handling. Standard IB hardware
> > does not support changing the DMA address once a MR is created. Forget
> > about doing that.
>
> Yeah, that's essentially the point I was trying to make. Not to mention
> all the other unrelated hardware that can't DMA to an address that might
> disappear mid-transfer.
Right, it is impossible to ask for generic page migration with ongoing
DMA. That is simply not supported by any of the hardware at all.
> > Only ODP hardware allows changing the DMA address on the fly, and it
> > works at the page table level. We do not need special handling for
> > RDMA.
>
> I am aware of ODP but, noted by others, it doesn't provide a general
> solution to the points above.
How do you mean?
Perhaps I am not following what Serguei is asking for, but I
understood the desire was for a complex GPU allocator that could
migrate pages between GPU and CPU memory under control of the GPU
driver, among other things. The desire is for DMA to continue to work
even after these migrations happen.
Page table mirroring *is* the general solution for this problem. The
GPU driver controls the VMA and the DMA driver mirrors that VMA.
Do you know of another option that doesn't just degenerate to page
table mirroring??
Remember, there are two facets to the RDMA ODP implementation, I feel
there is some confusion here..
The crucial part for this discussion is the ability to fence and block
DMA for a specific range. This is the hardware capability that lets
page migration happen: fence&block DMA, migrate page, update page
table in HCA, unblock DMA.
Without that hardware support the DMA address must be unchanging, and
there is nothing we can do about it. This is why standard IB hardware
must have fixed MRs - it lacks the fence&block capability.
The other part is the page faulting implementation, but that is not
required, and to Serguei's point, is not desired for GPU anyhow.
> > To me this means at least items #1 and #3 should be removed from
> > Alexander's list.
>
> It's also worth noting that #4 makes use of ZONE_DEVICE (#2) so they are
> really the same option. iopmem is really just one way to get BAR
> addresses to user-space while inside the kernel it's ZONE_DEVICE.
Seems fine for RDMA?
Didn't we just strike off everything on the list except #2? :\
Jason
^ permalink raw reply
* Re: Enabling peer to peer device transactions for PCIe devices
From: Logan Gunthorpe @ 2016-11-23 21:11 UTC (permalink / raw)
To: Jason Gunthorpe, Serguei Sagalovitch
Cc: Dan Williams, Deucher, Alexander, linux-nvdimm@lists.01.org,
linux-rdma@vger.kernel.org, linux-pci@vger.kernel.org,
Kuehling, Felix, Bridgman, John, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, Koenig, Christian, Sander, Ben,
Suthikulpanit, Suravee, Blinzer, Paul,
Linux-media@vger.kernel.org, Haggai Eran
In-Reply-To: <20161123203332.GA15062@obsidianresearch.com>
On 23/11/16 01:33 PM, Jason Gunthorpe wrote:
> On Wed, Nov 23, 2016 at 02:58:38PM -0500, Serguei Sagalovitch wrote:
>
>> We do not want to have "highly" dynamic translation due to
>> performance cost. We need to support "overcommit" but would
>> like to minimize impact. To support RDMA MRs for GPU/VRAM/PCIe
>> device memory (which is must) we need either globally force
>> pinning for the scope of "get_user_pages() / "put_pages" or have
>> special handling for RDMA MRs and similar cases.
>
> As I said, there is no possible special handling. Standard IB hardware
> does not support changing the DMA address once a MR is created. Forget
> about doing that.
Yeah, that's essentially the point I was trying to make. Not to mention
all the other unrelated hardware that can't DMA to an address that might
disappear mid-transfer.
> Only ODP hardware allows changing the DMA address on the fly, and it
> works at the page table level. We do not need special handling for
> RDMA.
I am aware of ODP but, noted by others, it doesn't provide a general
solution to the points above.
> Like I said, this is the direction the industry seems to be moving in,
> so any solution here should focus on VMAs/page tables as the way to link
> the peer-peer devices.
Yes, this was the appeal to us of using ZONE_DEVICE.
> To me this means at least items #1 and #3 should be removed from
> Alexander's list.
It's also worth noting that #4 makes use of ZONE_DEVICE (#2) so they are
really the same option. iopmem is really just one way to get BAR
addresses to user-space while inside the kernel it's ZONE_DEVICE.
Logan
^ permalink raw reply
* Re: Enabling peer to peer device transactions for PCIe devices
From: Jason Gunthorpe @ 2016-11-23 20:33 UTC (permalink / raw)
To: Serguei Sagalovitch
Cc: Haggai Eran, Bridgman, John,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
Kuehling, Felix, Blinzer, Paul,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Sander, Ben, Suthikulpanit, Suravee,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Deucher, Alexander, Koenig, Christian,
Linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <c2c88376-5ba7-37d1-4d3e-592383ebb00a-5C7GfCeVMHo@public.gmane.org>
On Wed, Nov 23, 2016 at 02:58:38PM -0500, Serguei Sagalovitch wrote:
> We do not want to have "highly" dynamic translation due to
> performance cost. We need to support "overcommit" but would
> like to minimize impact. To support RDMA MRs for GPU/VRAM/PCIe
> device memory (which is must) we need either globally force
> pinning for the scope of "get_user_pages() / "put_pages" or have
> special handling for RDMA MRs and similar cases.
As I said, there is no possible special handling. Standard IB hardware
does not support changing the DMA address once a MR is created. Forget
about doing that.
Only ODP hardware allows changing the DMA address on the fly, and it
works at the page table level. We do not need special handling for
RDMA.
> Generally it could be difficult to correctly handle "DMA in
> progress" due to the facts that (a) DMA could originate from
> numerous PCIe devices simultaneously including requests to
> receive network data.
We handle all of this today in kernel via the page pinning mechanism.
This needs to be copied into peer-peer memory and GPU memory schemes
as well. A pinned page means the DMA address channot be changed and
there is active non-CPU access to it.
Any hardware that does not support page table mirroring must go this
route.
> (b) in HSA case DMA could originated from user space without kernel
> driver knowledge. So without corresponding h/w support
> everywhere I do not see how it could be solved effectively.
All true user triggered DMA must go through some kind of coherent page
table mirroring scheme (eg this is what CAPI does, presumably AMDs HSA
is similar). A page table mirroring scheme is basically the same as
what ODP does.
Like I said, this is the direction the industry seems to be moving in,
so any solution here should focus on VMAs/page tables as the way to link
the peer-peer devices.
To me this means at least items #1 and #3 should be removed from
Alexander's list.
Jason
^ permalink raw reply
* Re: Enabling peer to peer device transactions for PCIe devices
From: Serguei Sagalovitch @ 2016-11-23 19:58 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Haggai Eran, Bridgman, John,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
Kuehling, Felix, Blinzer, Paul,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Sander, Ben, Suthikulpanit, Suravee,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Deucher, Alexander, Koenig, Christian,
Linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <20161123193228.GC12146-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
On 2016-11-23 02:32 PM, Jason Gunthorpe wrote:
> On Wed, Nov 23, 2016 at 02:14:40PM -0500, Serguei Sagalovitch wrote:
>> On 2016-11-23 02:05 PM, Jason Gunthorpe wrote:
>>> As Bart says, it would be best to be combined with something like
>>> Mellanox's ODP MRs, which allows a page to be evicted and then trigger
>>> a CPU interrupt if a DMA is attempted so it can be brought back.
>> Please note that in the general case (including MR one) we could have
>> "page fault" from the different PCIe device. So all PCIe device must
>> be synchronized.
> Standard RDMA MRs require pinned pages, the DMA address cannot change
> while the MR exists (there is no hardware support for this at all), so
> page faulting from any other device is out of the question while they
> exist. This is the same requirement as typical simple driver DMA which
> requires pages pinned until the simple device completes DMA.
>
> ODP RDMA MRs do not require that, they just page fault like the CPU or
> really anything and the kernel has to make sense of concurrant page
> faults from multiple sources.
>
> The upshot is that GPU scenarios that rely on highly dynamic
> virtual->physical translation cannot sanely be combined with standard
> long-life RDMA MRs.
We do not want to have "highly" dynamic translation due to performance
cost.
We need to support "overcommit" but would like to minimize impact.
To support RDMA MRs for GPU/VRAM/PCIe device memory (which is must)
we need either globally force pinning for the scope of
"get_user_pages() / "put_pages" or have special handling for RDMA MRs and
similar cases. Generally it could be difficult to correctly handle "DMA
in progress"
due to the facts that (a) DMA could originate from numerous PCIe devices
simultaneously including requests to receive network data. (b) in HSA
case DMA could
originated from user space without kernel driver knowledge.
So without corresponding h/w support everywhere I do not see how it could
be solved effectively.
> Certainly, any solution for GPUs must follow the typical page pinning
> semantics, changing the DMA address of a page must be blocked while
> any DMA is in progress.
>>> Does HMM solve the peer-peer problem? Does it do it generically or
>>> only for drivers that are mirroring translation tables?
>> In current form HMM doesn't solve peer-peer problem. Currently it allow
>> "mirroring" of "malloc" memory on GPU which is not always what needed.
>> Additionally there is need to have opportunity to share VRAM allocations
>> between different processes.
> Humm, so it can be removed from Alexander's list then :\
HMM is very useful for some type of scenarios as well as it could
significantly
simplify (for performance) implementations of some features e.g. OpenCL
2.0 SVM.
>
> As Dan suggested, maybe we need to do both. Some kind of fix for
> get_user_pages() for smaller mappings (eg ZONE_DEVICE) and a mandatory
> API conversion to get_user_dma_sg() for other cases?
>
> Jason
Sincerely yours,
Serguei Sagalovitch
^ permalink raw reply
* [PATCH V3 for-next 11/11] IB/hns: Fix for Checkpatch.pl comment style errors
From: Salil Mehta @ 2016-11-23 19:41 UTC (permalink / raw)
To: dledford
Cc: salil.mehta, xavier.huwei, oulijun, xushaobo2, mehta.salil.lnk,
lijun_nudt, linux-rdma, netdev, linux-kernel, linuxarm
In-Reply-To: <20161123194109.420760-1-salil.mehta@huawei.com>
This patch correct the comment style errors caught by
checkpatch.pl script
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_cmd.c | 8 ++--
drivers/infiniband/hw/hns/hns_roce_device.h | 28 ++++++-------
drivers/infiniband/hw/hns/hns_roce_eq.c | 6 +--
drivers/infiniband/hw/hns/hns_roce_hem.c | 6 +--
drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 58 +++++++++++++--------------
drivers/infiniband/hw/hns/hns_roce_main.c | 28 ++++++-------
6 files changed, 67 insertions(+), 67 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_cmd.c b/drivers/infiniband/hw/hns/hns_roce_cmd.c
index 2a0b6c0..8c1f7a6 100644
--- a/drivers/infiniband/hw/hns/hns_roce_cmd.c
+++ b/drivers/infiniband/hw/hns/hns_roce_cmd.c
@@ -216,10 +216,10 @@ static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 in_param,
goto out;
/*
- * It is timeout when wait_for_completion_timeout return 0
- * The return value is the time limit set in advance
- * how many seconds showing
- */
+ * It is timeout when wait_for_completion_timeout return 0
+ * The return value is the time limit set in advance
+ * how many seconds showing
+ */
if (!wait_for_completion_timeout(&context->done,
msecs_to_jiffies(timeout))) {
dev_err(dev, "[cmd]wait_for_completion_timeout timeout\n");
diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 9ef1cc3..e48464d 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -201,9 +201,9 @@ struct hns_roce_bitmap {
/* Order = 0: bitmap is biggest, order = max bitmap is least (only a bit) */
/* Every bit repesent to a partner free/used status in bitmap */
/*
-* Initial, bits of other bitmap are all 0 except that a bit of max_order is 1
-* Bit = 1 represent to idle and available; bit = 0: not available
-*/
+ * Initial, bits of other bitmap are all 0 except that a bit of max_order is 1
+ * Bit = 1 represent to idle and available; bit = 0: not available
+ */
struct hns_roce_buddy {
/* Members point to every order level bitmap */
unsigned long **bits;
@@ -365,25 +365,25 @@ struct hns_roce_cmdq {
struct mutex hcr_mutex;
struct semaphore poll_sem;
/*
- * Event mode: cmd register mutex protection,
- * ensure to not exceed max_cmds and user use limit region
- */
+ * Event mode: cmd register mutex protection,
+ * ensure to not exceed max_cmds and user use limit region
+ */
struct semaphore event_sem;
int max_cmds;
spinlock_t context_lock;
int free_head;
struct hns_roce_cmd_context *context;
/*
- * Result of get integer part
- * which max_comds compute according a power of 2
- */
+ * Result of get integer part
+ * which max_comds compute according a power of 2
+ */
u16 token_mask;
/*
- * Process whether use event mode, init default non-zero
- * After the event queue of cmd event ready,
- * can switch into event mode
- * close device, switch into poll mode(non event mode)
- */
+ * Process whether use event mode, init default non-zero
+ * After the event queue of cmd event ready,
+ * can switch into event mode
+ * close device, switch into poll mode(non event mode)
+ */
u8 use_events;
u8 toggle;
};
diff --git a/drivers/infiniband/hw/hns/hns_roce_eq.c b/drivers/infiniband/hw/hns/hns_roce_eq.c
index 21e21b0..50f8649 100644
--- a/drivers/infiniband/hw/hns/hns_roce_eq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_eq.c
@@ -371,9 +371,9 @@ static int hns_roce_aeq_ovf_int(struct hns_roce_dev *hr_dev,
int i = 0;
/**
- * AEQ overflow ECC mult bit err CEQ overflow alarm
- * must clear interrupt, mask irq, clear irq, cancel mask operation
- */
+ * AEQ overflow ECC mult bit err CEQ overflow alarm
+ * must clear interrupt, mask irq, clear irq, cancel mask operation
+ */
aeshift_val = roce_read(hr_dev, ROCEE_CAEP_AEQC_AEQE_SHIFT_REG);
if (roce_get_bit(aeshift_val,
diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c
index 250d8f2..c5104e0 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hem.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hem.c
@@ -80,9 +80,9 @@ struct hns_roce_hem *hns_roce_alloc_hem(struct hns_roce_dev *hr_dev, int npages,
--order;
/*
- * Alloc memory one time. If failed, don't alloc small block
- * memory, directly return fail.
- */
+ * Alloc memory one time. If failed, don't alloc small block
+ * memory, directly return fail.
+ */
mem = &chunk->mem[chunk->npages];
buf = dma_alloc_coherent(&hr_dev->pdev->dev, PAGE_SIZE << order,
&sg_dma_address(mem), gfp_mask);
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index 34b7898..125ab90 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -1352,9 +1352,9 @@ static void __hns_roce_v1_cq_clean(struct hns_roce_cq *hr_cq, u32 qpn,
}
/*
- * Now backwards through the CQ, removing CQ entries
- * that match our QP by overwriting them with next entries.
- */
+ * Now backwards through the CQ, removing CQ entries
+ * that match our QP by overwriting them with next entries.
+ */
while ((int) --prod_index - (int) hr_cq->cons_index >= 0) {
cqe = get_cqe(hr_cq, prod_index & hr_cq->ib_cq.cqe);
if ((roce_get_field(cqe->cqe_byte_16, CQE_BYTE_16_LOCAL_QPN_M,
@@ -1376,9 +1376,9 @@ static void __hns_roce_v1_cq_clean(struct hns_roce_cq *hr_cq, u32 qpn,
if (nfreed) {
hr_cq->cons_index += nfreed;
/*
- * Make sure update of buffer contents is done before
- * updating consumer index.
- */
+ * Make sure update of buffer contents is done before
+ * updating consumer index.
+ */
wmb();
hns_roce_v1_cq_set_ci(hr_cq, hr_cq->cons_index);
@@ -1473,7 +1473,7 @@ void hns_roce_v1_write_cqc(struct hns_roce_dev *hr_dev,
roce_set_bit(cq_context->cqc_byte_32,
CQ_CQNTEXT_CQC_BYTE_32_TYPE_OF_COMPLETION_NOTIFICATION_S,
0);
- /*The initial value of cq's ci is 0 */
+ /* The initial value of cq's ci is 0 */
roce_set_field(cq_context->cqc_byte_32,
CQ_CONTEXT_CQC_BYTE_32_CQ_CONS_IDX_M,
CQ_CONTEXT_CQC_BYTE_32_CQ_CONS_IDX_S, 0);
@@ -1490,9 +1490,9 @@ int hns_roce_v1_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags)
notification_flag = (flags & IB_CQ_SOLICITED_MASK) ==
IB_CQ_SOLICITED ? CQ_DB_REQ_NOT : CQ_DB_REQ_NOT_SOL;
/*
- * flags = 0; Notification Flag = 1, next
- * flags = 1; Notification Flag = 0, solocited
- */
+ * flags = 0; Notification Flag = 1, next
+ * flags = 1; Notification Flag = 0, solocited
+ */
doorbell[0] = hr_cq->cons_index & ((hr_cq->cq_depth << 1) - 1);
roce_set_bit(doorbell[1], ROCEE_DB_OTHERS_H_ROCEE_DB_OTH_HW_SYNS_S, 1);
roce_set_field(doorbell[1], ROCEE_DB_OTHERS_H_ROCEE_DB_OTH_CMD_M,
@@ -1647,10 +1647,10 @@ static int hns_roce_v1_poll_one(struct hns_roce_cq *hr_cq,
wq = &(*cur_qp)->sq;
if ((*cur_qp)->sq_signal_bits) {
/*
- * If sg_signal_bit is 1,
- * firstly tail pointer updated to wqe
- * which current cqe correspond to
- */
+ * If sg_signal_bit is 1,
+ * firstly tail pointer updated to wqe
+ * which current cqe correspond to
+ */
wqe_ctr = (u16)roce_get_field(cqe->cqe_byte_4,
CQE_BYTE_4_WQE_INDEX_M,
CQE_BYTE_4_WQE_INDEX_S);
@@ -2072,11 +2072,11 @@ static int hns_roce_v1_m_qp(struct ib_qp *ibqp, const struct ib_qp_attr *attr,
}
/*
- *Reset to init
- * Mandatory param:
- * IB_QP_STATE | IB_QP_PKEY_INDEX | IB_QP_PORT | IB_QP_ACCESS_FLAGS
- * Optional param: NA
- */
+ * Reset to init
+ * Mandatory param:
+ * IB_QP_STATE | IB_QP_PKEY_INDEX | IB_QP_PORT | IB_QP_ACCESS_FLAGS
+ * Optional param: NA
+ */
if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) {
roce_set_field(context->qpc_bytes_4,
QP_CONTEXT_QPC_BYTES_4_TRANSPORT_SERVICE_TYPE_M,
@@ -2584,9 +2584,9 @@ static int hns_roce_v1_m_qp(struct ib_qp *ibqp, const struct ib_qp_attr *attr,
}
/*
- * Use rst2init to instead of init2init with drv,
- * need to hw to flash RQ HEAD by DB again
- */
+ * Use rst2init to instead of init2init with drv,
+ * need to hw to flash RQ HEAD by DB again
+ */
if (cur_state == IB_QPS_INIT && new_state == IB_QPS_INIT) {
/* Memory barrier */
wmb();
@@ -2708,7 +2708,7 @@ static int hns_roce_v1_q_sqp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
goto done;
}
- addr = ROCEE_QP1C_CFG0_0_REG +
+ addr = ROCEE_QP1C_CFG0_0_REG +
hr_qp->port * sizeof(struct hns_roce_sqp_context);
context.qp1c_bytes_4 = roce_read(hr_dev, addr);
context.sq_rq_bt_l = roce_read(hr_dev, addr + 1);
@@ -2921,9 +2921,9 @@ static void hns_roce_v1_destroy_qp_common(struct hns_roce_dev *hr_dev,
if (hr_qp->ibqp.qp_type == IB_QPT_RC) {
if (hr_qp->state != IB_QPS_RESET) {
/*
- * Set qp to ERR,
- * waiting for hw complete processing all dbs
- */
+ * Set qp to ERR,
+ * waiting for hw complete processing all dbs
+ */
if (hns_roce_v1_qp_modify(hr_dev, NULL,
to_hns_roce_state(
(enum ib_qp_state)hr_qp->state),
@@ -2936,9 +2936,9 @@ static void hns_roce_v1_destroy_qp_common(struct hns_roce_dev *hr_dev,
sdbisusepr_val = roce_read(hr_dev,
ROCEE_SDB_ISSUE_PTR_REG);
/*
- * Query db process status,
- * until hw process completely
- */
+ * Query db process status,
+ * until hw process completely
+ */
end = msecs_to_jiffies(
HNS_ROCE_QP_DESTROY_TIMEOUT_MSECS) + jiffies;
do {
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 795ef97..914d0ac 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -148,8 +148,8 @@ static int handle_en_event(struct hns_roce_dev *hr_dev, u8 port,
break;
case NETDEV_DOWN:
/*
- * In v1 engine, only support all ports closed together.
- */
+ * In v1 engine, only support all ports closed together.
+ */
break;
default:
dev_dbg(dev, "NETDEV event = 0x%x!\n", (u32)(event));
@@ -773,10 +773,10 @@ static int hns_roce_init_hem(struct hns_roce_dev *hr_dev)
}
/**
-* hns_roce_setup_hca - setup host channel adapter
-* @hr_dev: pointer to hns roce device
-* Return : int
-*/
+ * hns_roce_setup_hca - setup host channel adapter
+ * @hr_dev: pointer to hns roce device
+ * Return : int
+ */
static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)
{
int ret;
@@ -841,11 +841,11 @@ static int hns_roce_setup_hca(struct hns_roce_dev *hr_dev)
}
/**
-* hns_roce_probe - RoCE driver entrance
-* @pdev: pointer to platform device
-* Return : int
-*
-*/
+ * hns_roce_probe - RoCE driver entrance
+ * @pdev: pointer to platform device
+ * Return : int
+ *
+ */
static int hns_roce_probe(struct platform_device *pdev)
{
int ret;
@@ -958,9 +958,9 @@ static int hns_roce_probe(struct platform_device *pdev)
}
/**
-* hns_roce_remove - remove RoCE device
-* @pdev: pointer to platform device
-*/
+ * hns_roce_remove - remove RoCE device
+ * @pdev: pointer to platform device
+ */
static int hns_roce_remove(struct platform_device *pdev)
{
struct hns_roce_dev *hr_dev = platform_get_drvdata(pdev);
--
1.7.9.5
^ permalink raw reply related
* [PATCH V3 for-next 10/11] IB/hns: Implement the add_gid/del_gid and optimize the GIDs management
From: Salil Mehta @ 2016-11-23 19:41 UTC (permalink / raw)
To: dledford
Cc: salil.mehta, xavier.huwei, oulijun, xushaobo2, mehta.salil.lnk,
lijun_nudt, linux-rdma, netdev, linux-kernel, linuxarm
In-Reply-To: <20161123194109.420760-1-salil.mehta@huawei.com>
From: Shaobo Xu <xushaobo2@huawei.com>
IB core has implemented the calculation of GIDs and the management
of GID tables, and it is now responsible to supply query function
for GIDs. So the calculation of GIDs and the management of GID
tables in the RoCE driver is redundant.
The patch is to implement the add_gid/del_gid to set the GIDs in
the RoCE driver, remove the redundant calculation and management of
GIDs in the notifier call of the net device and the inet, and
update the query_gid.
Signed-off-by: Shaobo Xu <xushaobo2@huawei.com>
Reviewed-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_device.h | 2 -
drivers/infiniband/hw/hns/hns_roce_main.c | 270 +++++----------------------
2 files changed, 48 insertions(+), 224 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 593a42a..9ef1cc3 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -429,8 +429,6 @@ struct hns_roce_ib_iboe {
struct net_device *netdevs[HNS_ROCE_MAX_PORTS];
struct notifier_block nb;
struct notifier_block nb_inet;
- /* 16 GID is shared by 6 port in v1 engine. */
- union ib_gid gid_table[HNS_ROCE_MAX_GID_NUM];
u8 phy_port[HNS_ROCE_MAX_PORTS];
};
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 6770171..795ef97 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -35,52 +35,13 @@
#include <rdma/ib_addr.h>
#include <rdma/ib_smi.h>
#include <rdma/ib_user_verbs.h>
+#include <rdma/ib_cache.h>
#include "hns_roce_common.h"
#include "hns_roce_device.h"
#include "hns_roce_user.h"
#include "hns_roce_hem.h"
/**
- * hns_roce_addrconf_ifid_eui48 - Get default gid.
- * @eui: eui.
- * @vlan_id: gid
- * @dev: net device
- * Description:
- * MAC convert to GID
- * gid[0..7] = fe80 0000 0000 0000
- * gid[8] = mac[0] ^ 2
- * gid[9] = mac[1]
- * gid[10] = mac[2]
- * gid[11] = ff (VLAN ID high byte (4 MS bits))
- * gid[12] = fe (VLAN ID low byte)
- * gid[13] = mac[3]
- * gid[14] = mac[4]
- * gid[15] = mac[5]
- */
-static void hns_roce_addrconf_ifid_eui48(u8 *eui, u16 vlan_id,
- struct net_device *dev)
-{
- memcpy(eui, dev->dev_addr, 3);
- memcpy(eui + 5, dev->dev_addr + 3, 3);
- if (vlan_id < 0x1000) {
- eui[3] = vlan_id >> 8;
- eui[4] = vlan_id & 0xff;
- } else {
- eui[3] = 0xff;
- eui[4] = 0xfe;
- }
- eui[0] ^= 2;
-}
-
-static void hns_roce_make_default_gid(struct net_device *dev, union ib_gid *gid)
-{
- memset(gid, 0, sizeof(*gid));
- gid->raw[0] = 0xFE;
- gid->raw[1] = 0x80;
- hns_roce_addrconf_ifid_eui48(&gid->raw[8], 0xffff, dev);
-}
-
-/**
* hns_get_gid_index - Get gid index.
* @hr_dev: pointer to structure hns_roce_dev.
* @port: port, value range: 0 ~ MAX
@@ -96,30 +57,6 @@ int hns_get_gid_index(struct hns_roce_dev *hr_dev, u8 port, int gid_index)
return gid_index * hr_dev->caps.num_ports + port;
}
-static int hns_roce_set_gid(struct hns_roce_dev *hr_dev, u8 port, int gid_index,
- union ib_gid *gid)
-{
- struct device *dev = &hr_dev->pdev->dev;
- u8 gid_idx = 0;
-
- if (gid_index >= hr_dev->caps.gid_table_len[port]) {
- dev_err(dev, "gid_index %d illegal, port %d gid range: 0~%d\n",
- gid_index, port, hr_dev->caps.gid_table_len[port] - 1);
- return -EINVAL;
- }
-
- gid_idx = hns_get_gid_index(hr_dev, port, gid_index);
-
- if (!memcmp(gid, &hr_dev->iboe.gid_table[gid_idx], sizeof(*gid)))
- return -EINVAL;
-
- memcpy(&hr_dev->iboe.gid_table[gid_idx], gid, sizeof(*gid));
-
- hr_dev->hw->set_gid(hr_dev, port, gid_index, gid);
-
- return 0;
-}
-
static void hns_roce_set_mac(struct hns_roce_dev *hr_dev, u8 port, u8 *addr)
{
u8 phy_port;
@@ -147,15 +84,44 @@ static void hns_roce_set_mtu(struct hns_roce_dev *hr_dev, u8 port, int mtu)
hr_dev->hw->set_mtu(hr_dev, phy_port, tmp);
}
-static void hns_roce_update_gids(struct hns_roce_dev *hr_dev, int port)
+static int hns_roce_add_gid(struct ib_device *device, u8 port_num,
+ unsigned int index, const union ib_gid *gid,
+ const struct ib_gid_attr *attr, void **context)
+{
+ struct hns_roce_dev *hr_dev = to_hr_dev(device);
+ u8 port = port_num - 1;
+ unsigned long flags;
+
+ if (port >= hr_dev->caps.num_ports)
+ return -EINVAL;
+
+ spin_lock_irqsave(&hr_dev->iboe.lock, flags);
+
+ hr_dev->hw->set_gid(hr_dev, port, index, (union ib_gid *)gid);
+
+ spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
+
+ return 0;
+}
+
+static int hns_roce_del_gid(struct ib_device *device, u8 port_num,
+ unsigned int index, void **context)
{
- struct ib_event event;
+ struct hns_roce_dev *hr_dev = to_hr_dev(device);
+ union ib_gid zgid = { {0} };
+ u8 port = port_num - 1;
+ unsigned long flags;
+
+ if (port >= hr_dev->caps.num_ports)
+ return -EINVAL;
- /* Refresh gid in ib_cache */
- event.device = &hr_dev->ib_dev;
- event.element.port_num = port + 1;
- event.event = IB_EVENT_GID_CHANGE;
- ib_dispatch_event(&event);
+ spin_lock_irqsave(&hr_dev->iboe.lock, flags);
+
+ hr_dev->hw->set_gid(hr_dev, port, index, &zgid);
+
+ spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
+
+ return 0;
}
static int handle_en_event(struct hns_roce_dev *hr_dev, u8 port,
@@ -164,8 +130,6 @@ static int handle_en_event(struct hns_roce_dev *hr_dev, u8 port,
struct device *dev = &hr_dev->pdev->dev;
struct net_device *netdev;
unsigned long flags;
- union ib_gid gid;
- int ret = 0;
netdev = hr_dev->iboe.netdevs[port];
if (!netdev) {
@@ -181,10 +145,6 @@ static int handle_en_event(struct hns_roce_dev *hr_dev, u8 port,
case NETDEV_REGISTER:
case NETDEV_CHANGEADDR:
hns_roce_set_mac(hr_dev, port, netdev->dev_addr);
- hns_roce_make_default_gid(netdev, &gid);
- ret = hns_roce_set_gid(hr_dev, port, 0, &gid);
- if (!ret)
- hns_roce_update_gids(hr_dev, port);
break;
case NETDEV_DOWN:
/*
@@ -197,7 +157,7 @@ static int handle_en_event(struct hns_roce_dev *hr_dev, u8 port,
}
spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
- return ret;
+ return 0;
}
static int hns_roce_netdev_event(struct notifier_block *self,
@@ -224,118 +184,17 @@ static int hns_roce_netdev_event(struct notifier_block *self,
return NOTIFY_DONE;
}
-static void hns_roce_addr_event(int event, struct net_device *event_netdev,
- struct hns_roce_dev *hr_dev, union ib_gid *gid)
-{
- struct hns_roce_ib_iboe *iboe = NULL;
- int gid_table_len = 0;
- unsigned long flags;
- union ib_gid zgid;
- u8 gid_idx = 0;
- u8 port = 0;
- int i = 0;
- int free;
- struct net_device *real_dev = rdma_vlan_dev_real_dev(event_netdev) ?
- rdma_vlan_dev_real_dev(event_netdev) :
- event_netdev;
-
- if (event != NETDEV_UP && event != NETDEV_DOWN)
- return;
-
- iboe = &hr_dev->iboe;
- while (port < hr_dev->caps.num_ports) {
- if (real_dev == iboe->netdevs[port])
- break;
- port++;
- }
-
- if (port >= hr_dev->caps.num_ports) {
- dev_dbg(&hr_dev->pdev->dev, "can't find netdev\n");
- return;
- }
-
- memset(zgid.raw, 0, sizeof(zgid.raw));
- free = -1;
- gid_table_len = hr_dev->caps.gid_table_len[port];
-
- spin_lock_irqsave(&hr_dev->iboe.lock, flags);
-
- for (i = 0; i < gid_table_len; i++) {
- gid_idx = hns_get_gid_index(hr_dev, port, i);
- if (!memcmp(gid->raw, iboe->gid_table[gid_idx].raw,
- sizeof(gid->raw)))
- break;
- if (free < 0 && !memcmp(zgid.raw,
- iboe->gid_table[gid_idx].raw, sizeof(zgid.raw)))
- free = i;
- }
-
- if (i >= gid_table_len) {
- if (free < 0) {
- spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
- dev_dbg(&hr_dev->pdev->dev,
- "gid_index overflow, port(%d)\n", port);
- return;
- }
- if (!hns_roce_set_gid(hr_dev, port, free, gid))
- hns_roce_update_gids(hr_dev, port);
- } else if (event == NETDEV_DOWN) {
- if (!hns_roce_set_gid(hr_dev, port, i, &zgid))
- hns_roce_update_gids(hr_dev, port);
- }
-
- spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
-}
-
-static int hns_roce_inet_event(struct notifier_block *self, unsigned long event,
- void *ptr)
-{
- struct in_ifaddr *ifa = ptr;
- struct hns_roce_dev *hr_dev;
- struct net_device *dev = ifa->ifa_dev->dev;
- union ib_gid gid;
-
- ipv6_addr_set_v4mapped(ifa->ifa_address, (struct in6_addr *)&gid);
-
- hr_dev = container_of(self, struct hns_roce_dev, iboe.nb_inet);
-
- hns_roce_addr_event(event, dev, hr_dev, &gid);
-
- return NOTIFY_DONE;
-}
-
-static int hns_roce_setup_mtu_gids(struct hns_roce_dev *hr_dev)
+static int hns_roce_setup_mtu_mac(struct hns_roce_dev *hr_dev)
{
- struct in_ifaddr *ifa_list = NULL;
- union ib_gid gid = {{0} };
- u32 ipaddr = 0;
- int index = 0;
- int ret = 0;
- u8 i = 0;
+ u8 i;
for (i = 0; i < hr_dev->caps.num_ports; i++) {
hns_roce_set_mtu(hr_dev, i,
ib_mtu_enum_to_int(hr_dev->caps.max_mtu));
hns_roce_set_mac(hr_dev, i, hr_dev->iboe.netdevs[i]->dev_addr);
-
- if (hr_dev->iboe.netdevs[i]->ip_ptr) {
- ifa_list = hr_dev->iboe.netdevs[i]->ip_ptr->ifa_list;
- index = 1;
- while (ifa_list) {
- ipaddr = ifa_list->ifa_address;
- ipv6_addr_set_v4mapped(ipaddr,
- (struct in6_addr *)&gid);
- ret = hns_roce_set_gid(hr_dev, i, index, &gid);
- if (ret)
- break;
- index++;
- ifa_list = ifa_list->ifa_next;
- }
- hns_roce_update_gids(hr_dev, i);
- }
}
- return ret;
+ return 0;
}
static int hns_roce_query_device(struct ib_device *ib_dev,
@@ -444,31 +303,6 @@ static enum rdma_link_layer hns_roce_get_link_layer(struct ib_device *device,
static int hns_roce_query_gid(struct ib_device *ib_dev, u8 port_num, int index,
union ib_gid *gid)
{
- struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev);
- struct device *dev = &hr_dev->pdev->dev;
- u8 gid_idx = 0;
- u8 port;
-
- if (port_num < 1 || port_num > hr_dev->caps.num_ports ||
- index >= hr_dev->caps.gid_table_len[port_num - 1]) {
- dev_err(dev,
- "port_num %d index %d illegal! correct range: port_num 1~%d index 0~%d!\n",
- port_num, index, hr_dev->caps.num_ports,
- hr_dev->caps.gid_table_len[port_num - 1] - 1);
- return -EINVAL;
- }
-
- port = port_num - 1;
- gid_idx = hns_get_gid_index(hr_dev, port, index);
- if (gid_idx >= HNS_ROCE_MAX_GID_NUM) {
- dev_err(dev, "port_num %d index %d illegal! total gid num %d!\n",
- port_num, index, HNS_ROCE_MAX_GID_NUM);
- return -EINVAL;
- }
-
- memcpy(gid->raw, hr_dev->iboe.gid_table[gid_idx].raw,
- HNS_ROCE_GID_SIZE);
-
return 0;
}
@@ -646,6 +480,8 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
ib_dev->get_link_layer = hns_roce_get_link_layer;
ib_dev->get_netdev = hns_roce_get_netdev;
ib_dev->query_gid = hns_roce_query_gid;
+ ib_dev->add_gid = hns_roce_add_gid;
+ ib_dev->del_gid = hns_roce_del_gid;
ib_dev->query_pkey = hns_roce_query_pkey;
ib_dev->alloc_ucontext = hns_roce_alloc_ucontext;
ib_dev->dealloc_ucontext = hns_roce_dealloc_ucontext;
@@ -688,32 +524,22 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
return ret;
}
- ret = hns_roce_setup_mtu_gids(hr_dev);
+ ret = hns_roce_setup_mtu_mac(hr_dev);
if (ret) {
- dev_err(dev, "roce_setup_mtu_gids failed!\n");
- goto error_failed_setup_mtu_gids;
+ dev_err(dev, "setup_mtu_mac failed!\n");
+ goto error_failed_setup_mtu_mac;
}
iboe->nb.notifier_call = hns_roce_netdev_event;
ret = register_netdevice_notifier(&iboe->nb);
if (ret) {
dev_err(dev, "register_netdevice_notifier failed!\n");
- goto error_failed_setup_mtu_gids;
- }
-
- iboe->nb_inet.notifier_call = hns_roce_inet_event;
- ret = register_inetaddr_notifier(&iboe->nb_inet);
- if (ret) {
- dev_err(dev, "register inet addr notifier failed!\n");
- goto error_failed_register_inetaddr_notifier;
+ goto error_failed_setup_mtu_mac;
}
return 0;
-error_failed_register_inetaddr_notifier:
- unregister_netdevice_notifier(&iboe->nb);
-
-error_failed_setup_mtu_gids:
+error_failed_setup_mtu_mac:
ib_unregister_device(ib_dev);
return ret;
--
1.7.9.5
^ permalink raw reply related
* [PATCH V3 for-next 09/11] IB/hns: Change qpn allocation to round-robin mode.
From: Salil Mehta @ 2016-11-23 19:41 UTC (permalink / raw)
To: dledford
Cc: salil.mehta, xavier.huwei, oulijun, xushaobo2, mehta.salil.lnk,
lijun_nudt, linux-rdma, netdev, linux-kernel, linuxarm
In-Reply-To: <20161123194109.420760-1-salil.mehta@huawei.com>
From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
When using CM to establish connections, qp number that was freed
just now will be rejected by ib core. To fix these problem, We
change qpn allocation to round-robin mode. We added the round-robin
mode for allocating resources using bitmap. We use round-robin mode
for qp number and non round-robing mode for other resources like
cq number, pd number etc.
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_alloc.c | 11 +++++++----
drivers/infiniband/hw/hns/hns_roce_cq.c | 4 ++--
drivers/infiniband/hw/hns/hns_roce_device.h | 9 +++++++--
drivers/infiniband/hw/hns/hns_roce_mr.c | 2 +-
drivers/infiniband/hw/hns/hns_roce_pd.c | 5 +++--
drivers/infiniband/hw/hns/hns_roce_qp.c | 2 +-
6 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_alloc.c b/drivers/infiniband/hw/hns/hns_roce_alloc.c
index 863a17a..605962f 100644
--- a/drivers/infiniband/hw/hns/hns_roce_alloc.c
+++ b/drivers/infiniband/hw/hns/hns_roce_alloc.c
@@ -61,9 +61,10 @@ int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj)
return ret;
}
-void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj)
+void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj,
+ int rr)
{
- hns_roce_bitmap_free_range(bitmap, obj, 1);
+ hns_roce_bitmap_free_range(bitmap, obj, 1, rr);
}
int hns_roce_bitmap_alloc_range(struct hns_roce_bitmap *bitmap, int cnt,
@@ -106,7 +107,8 @@ int hns_roce_bitmap_alloc_range(struct hns_roce_bitmap *bitmap, int cnt,
}
void hns_roce_bitmap_free_range(struct hns_roce_bitmap *bitmap,
- unsigned long obj, int cnt)
+ unsigned long obj, int cnt,
+ int rr)
{
int i;
@@ -116,7 +118,8 @@ void hns_roce_bitmap_free_range(struct hns_roce_bitmap *bitmap,
for (i = 0; i < cnt; i++)
clear_bit(obj + i, bitmap->table);
- bitmap->last = min(bitmap->last, obj);
+ if (!rr)
+ bitmap->last = min(bitmap->last, obj);
bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
& bitmap->mask;
spin_unlock(&bitmap->lock);
diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c
index 461a273..c9f6c3d 100644
--- a/drivers/infiniband/hw/hns/hns_roce_cq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_cq.c
@@ -166,7 +166,7 @@ static int hns_roce_cq_alloc(struct hns_roce_dev *hr_dev, int nent,
hns_roce_table_put(hr_dev, &cq_table->table, hr_cq->cqn);
err_out:
- hns_roce_bitmap_free(&cq_table->bitmap, hr_cq->cqn);
+ hns_roce_bitmap_free(&cq_table->bitmap, hr_cq->cqn, BITMAP_NO_RR);
return ret;
}
@@ -204,7 +204,7 @@ static void hns_roce_free_cq(struct hns_roce_dev *hr_dev,
spin_unlock_irq(&cq_table->lock);
hns_roce_table_put(hr_dev, &cq_table->table, hr_cq->cqn);
- hns_roce_bitmap_free(&cq_table->bitmap, hr_cq->cqn);
+ hns_roce_bitmap_free(&cq_table->bitmap, hr_cq->cqn, BITMAP_NO_RR);
}
static int hns_roce_ib_get_cq_umem(struct hns_roce_dev *hr_dev,
diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h
index 7242b14..593a42a 100644
--- a/drivers/infiniband/hw/hns/hns_roce_device.h
+++ b/drivers/infiniband/hw/hns/hns_roce_device.h
@@ -72,6 +72,9 @@
#define HNS_ROCE_MAX_GID_NUM 16
#define HNS_ROCE_GID_SIZE 16
+#define BITMAP_NO_RR 0
+#define BITMAP_RR 1
+
#define MR_TYPE_MR 0x00
#define MR_TYPE_DMA 0x03
@@ -661,7 +664,8 @@ int hns_roce_buf_write_mtt(struct hns_roce_dev *hr_dev,
void hns_roce_cleanup_qp_table(struct hns_roce_dev *hr_dev);
int hns_roce_bitmap_alloc(struct hns_roce_bitmap *bitmap, unsigned long *obj);
-void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj);
+void hns_roce_bitmap_free(struct hns_roce_bitmap *bitmap, unsigned long obj,
+ int rr);
int hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask,
u32 reserved_bot, u32 resetrved_top);
void hns_roce_bitmap_cleanup(struct hns_roce_bitmap *bitmap);
@@ -669,7 +673,8 @@ int hns_roce_bitmap_init(struct hns_roce_bitmap *bitmap, u32 num, u32 mask,
int hns_roce_bitmap_alloc_range(struct hns_roce_bitmap *bitmap, int cnt,
int align, unsigned long *obj);
void hns_roce_bitmap_free_range(struct hns_roce_bitmap *bitmap,
- unsigned long obj, int cnt);
+ unsigned long obj, int cnt,
+ int rr);
struct ib_ah *hns_roce_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
int hns_roce_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr);
diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c
index a5bd645..9b8a1ad 100644
--- a/drivers/infiniband/hw/hns/hns_roce_mr.c
+++ b/drivers/infiniband/hw/hns/hns_roce_mr.c
@@ -289,7 +289,7 @@ static void hns_roce_mr_free(struct hns_roce_dev *hr_dev,
}
hns_roce_bitmap_free(&hr_dev->mr_table.mtpt_bitmap,
- key_to_hw_index(mr->key));
+ key_to_hw_index(mr->key), BITMAP_NO_RR);
}
static int hns_roce_mr_enable(struct hns_roce_dev *hr_dev,
diff --git a/drivers/infiniband/hw/hns/hns_roce_pd.c b/drivers/infiniband/hw/hns/hns_roce_pd.c
index 05db7d5..a64500f 100644
--- a/drivers/infiniband/hw/hns/hns_roce_pd.c
+++ b/drivers/infiniband/hw/hns/hns_roce_pd.c
@@ -40,7 +40,7 @@ static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn)
static void hns_roce_pd_free(struct hns_roce_dev *hr_dev, unsigned long pdn)
{
- hns_roce_bitmap_free(&hr_dev->pd_bitmap, pdn);
+ hns_roce_bitmap_free(&hr_dev->pd_bitmap, pdn, BITMAP_NO_RR);
}
int hns_roce_init_pd_table(struct hns_roce_dev *hr_dev)
@@ -121,7 +121,8 @@ int hns_roce_uar_alloc(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
void hns_roce_uar_free(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar)
{
- hns_roce_bitmap_free(&hr_dev->uar_table.bitmap, uar->index);
+ hns_roce_bitmap_free(&hr_dev->uar_table.bitmap, uar->index,
+ BITMAP_NO_RR);
}
int hns_roce_init_uar_table(struct hns_roce_dev *hr_dev)
diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
index e86dd8d..4775b5c 100644
--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
+++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
@@ -250,7 +250,7 @@ void hns_roce_release_range_qp(struct hns_roce_dev *hr_dev, int base_qpn,
if (base_qpn < SQP_NUM)
return;
- hns_roce_bitmap_free_range(&qp_table->bitmap, base_qpn, cnt);
+ hns_roce_bitmap_free_range(&qp_table->bitmap, base_qpn, cnt, BITMAP_RR);
}
static int hns_roce_set_rq_size(struct hns_roce_dev *hr_dev,
--
1.7.9.5
^ permalink raw reply related
* [PATCH V3 for-next 08/11] IB/hns: Modify query info named port_num when querying RC QP
From: Salil Mehta @ 2016-11-23 19:41 UTC (permalink / raw)
To: dledford
Cc: salil.mehta, xavier.huwei, oulijun, xushaobo2, mehta.salil.lnk,
lijun_nudt, linux-rdma, netdev, linux-kernel, linuxarm
In-Reply-To: <20161123194109.420760-1-salil.mehta@huawei.com>
From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
This patch modified the output query info qp_attr->port_num
to fix bug in hip06.
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index 509ea75..34b7898 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -2857,9 +2857,7 @@ static int hns_roce_v1_q_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
qp_attr->pkey_index = roce_get_field(context->qpc_bytes_12,
QP_CONTEXT_QPC_BYTES_12_P_KEY_INDEX_M,
QP_CONTEXT_QPC_BYTES_12_P_KEY_INDEX_S);
- qp_attr->port_num = (u8)roce_get_field(context->qpc_bytes_156,
- QP_CONTEXT_QPC_BYTES_156_PORT_NUM_M,
- QP_CONTEXT_QPC_BYTES_156_PORT_NUM_S) + 1;
+ qp_attr->port_num = hr_qp->port + 1;
qp_attr->sq_draining = 0;
qp_attr->max_rd_atomic = roce_get_field(context->qpc_bytes_156,
QP_CONTEXT_QPC_BYTES_156_INITIATOR_DEPTH_M,
--
1.7.9.5
^ permalink raw reply related
* [PATCH V3 for-next 07/11] IB/hns: Modify the macro for the timeout when cmd process
From: Salil Mehta @ 2016-11-23 19:41 UTC (permalink / raw)
To: dledford
Cc: salil.mehta, xavier.huwei, oulijun, xushaobo2, mehta.salil.lnk,
lijun_nudt, linux-rdma, netdev, linux-kernel, linuxarm
In-Reply-To: <20161123194109.420760-1-salil.mehta@huawei.com>
From: "Wei Hu (Xavier)" <xavier.huwei@huawei.com>
This patch modified the macro for the timeout when cmd is
processing as follows:
Before modification:
enum {
HNS_ROCE_CMD_TIME_CLASS_A = 10000,
HNS_ROCE_CMD_TIME_CLASS_B = 10000,
HNS_ROCE_CMD_TIME_CLASS_C = 10000,
};
After modification:
#define HNS_ROCE_CMD_TIMEOUT_MSECS 10000
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---
drivers/infiniband/hw/hns/hns_roce_cmd.h | 7 +------
drivers/infiniband/hw/hns/hns_roce_cq.c | 4 ++--
drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 8 ++++----
drivers/infiniband/hw/hns/hns_roce_mr.c | 4 ++--
4 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/drivers/infiniband/hw/hns/hns_roce_cmd.h b/drivers/infiniband/hw/hns/hns_roce_cmd.h
index e3997d3..ed14ad3 100644
--- a/drivers/infiniband/hw/hns/hns_roce_cmd.h
+++ b/drivers/infiniband/hw/hns/hns_roce_cmd.h
@@ -34,6 +34,7 @@
#define _HNS_ROCE_CMD_H
#define HNS_ROCE_MAILBOX_SIZE 4096
+#define HNS_ROCE_CMD_TIMEOUT_MSECS 10000
enum {
/* TPT commands */
@@ -57,12 +58,6 @@ enum {
HNS_ROCE_CMD_QUERY_QP = 0x22,
};
-enum {
- HNS_ROCE_CMD_TIME_CLASS_A = 10000,
- HNS_ROCE_CMD_TIME_CLASS_B = 10000,
- HNS_ROCE_CMD_TIME_CLASS_C = 10000,
-};
-
struct hns_roce_cmd_mailbox {
void *buf;
dma_addr_t dma;
diff --git a/drivers/infiniband/hw/hns/hns_roce_cq.c b/drivers/infiniband/hw/hns/hns_roce_cq.c
index 5dc8d92..461a273 100644
--- a/drivers/infiniband/hw/hns/hns_roce_cq.c
+++ b/drivers/infiniband/hw/hns/hns_roce_cq.c
@@ -77,7 +77,7 @@ static int hns_roce_sw2hw_cq(struct hns_roce_dev *dev,
unsigned long cq_num)
{
return hns_roce_cmd_mbox(dev, mailbox->dma, 0, cq_num, 0,
- HNS_ROCE_CMD_SW2HW_CQ, HNS_ROCE_CMD_TIME_CLASS_A);
+ HNS_ROCE_CMD_SW2HW_CQ, HNS_ROCE_CMD_TIMEOUT_MSECS);
}
static int hns_roce_cq_alloc(struct hns_roce_dev *hr_dev, int nent,
@@ -176,7 +176,7 @@ static int hns_roce_hw2sw_cq(struct hns_roce_dev *dev,
{
return hns_roce_cmd_mbox(dev, 0, mailbox ? mailbox->dma : 0, cq_num,
mailbox ? 0 : 1, HNS_ROCE_CMD_HW2SW_CQ,
- HNS_ROCE_CMD_TIME_CLASS_A);
+ HNS_ROCE_CMD_TIMEOUT_MSECS);
}
static void hns_roce_free_cq(struct hns_roce_dev *hr_dev,
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
index b835a55..509ea75 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c
@@ -1871,12 +1871,12 @@ static int hns_roce_v1_qp_modify(struct hns_roce_dev *hr_dev,
if (op[cur_state][new_state] == HNS_ROCE_CMD_2RST_QP)
return hns_roce_cmd_mbox(hr_dev, 0, 0, hr_qp->qpn, 2,
HNS_ROCE_CMD_2RST_QP,
- HNS_ROCE_CMD_TIME_CLASS_A);
+ HNS_ROCE_CMD_TIMEOUT_MSECS);
if (op[cur_state][new_state] == HNS_ROCE_CMD_2ERR_QP)
return hns_roce_cmd_mbox(hr_dev, 0, 0, hr_qp->qpn, 2,
HNS_ROCE_CMD_2ERR_QP,
- HNS_ROCE_CMD_TIME_CLASS_A);
+ HNS_ROCE_CMD_TIMEOUT_MSECS);
mailbox = hns_roce_alloc_cmd_mailbox(hr_dev);
if (IS_ERR(mailbox))
@@ -1886,7 +1886,7 @@ static int hns_roce_v1_qp_modify(struct hns_roce_dev *hr_dev,
ret = hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, hr_qp->qpn, 0,
op[cur_state][new_state],
- HNS_ROCE_CMD_TIME_CLASS_C);
+ HNS_ROCE_CMD_TIMEOUT_MSECS);
hns_roce_free_cmd_mailbox(hr_dev, mailbox);
return ret;
@@ -2681,7 +2681,7 @@ static int hns_roce_v1_query_qpc(struct hns_roce_dev *hr_dev,
ret = hns_roce_cmd_mbox(hr_dev, 0, mailbox->dma, hr_qp->qpn, 0,
HNS_ROCE_CMD_QUERY_QP,
- HNS_ROCE_CMD_TIME_CLASS_A);
+ HNS_ROCE_CMD_TIMEOUT_MSECS);
if (!ret)
memcpy(hr_context, mailbox->buf, sizeof(*hr_context));
else
diff --git a/drivers/infiniband/hw/hns/hns_roce_mr.c b/drivers/infiniband/hw/hns/hns_roce_mr.c
index d87d189..a5bd645 100644
--- a/drivers/infiniband/hw/hns/hns_roce_mr.c
+++ b/drivers/infiniband/hw/hns/hns_roce_mr.c
@@ -53,7 +53,7 @@ static int hns_roce_sw2hw_mpt(struct hns_roce_dev *hr_dev,
{
return hns_roce_cmd_mbox(hr_dev, mailbox->dma, 0, mpt_index, 0,
HNS_ROCE_CMD_SW2HW_MPT,
- HNS_ROCE_CMD_TIME_CLASS_B);
+ HNS_ROCE_CMD_TIMEOUT_MSECS);
}
static int hns_roce_hw2sw_mpt(struct hns_roce_dev *hr_dev,
@@ -62,7 +62,7 @@ static int hns_roce_hw2sw_mpt(struct hns_roce_dev *hr_dev,
{
return hns_roce_cmd_mbox(hr_dev, 0, mailbox ? mailbox->dma : 0,
mpt_index, !mailbox, HNS_ROCE_CMD_HW2SW_MPT,
- HNS_ROCE_CMD_TIME_CLASS_B);
+ HNS_ROCE_CMD_TIMEOUT_MSECS);
}
static int hns_roce_buddy_alloc(struct hns_roce_buddy *buddy, int order,
--
1.7.9.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox