diff options
author | Roland Dreier <rolandd@cisco.com> | 2007-03-08 12:24:21 -0800 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2007-03-08 12:24:21 -0800 |
commit | 768efce599ae1eb06949ff4c25aa85da254d59c1 (patch) | |
tree | e95fdf981adda2c0b08bfd6f105ad4cddda9bbb6 | |
parent | 6dc3f25d9ddbc4e2da95e6bff3af1e91a6263890 (diff) | |
download | libmthca-768efce599ae1eb06949ff4c25aa85da254d59c1.tar.gz |
Check mthca kernel driver's ABI
Have libmthca ignore devices whose device-specific ABI is newer than
expected. This avoids the possibility of an old library failing in a
hard-to-diagnose way when used with a too-new kernel.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | src/mthca-abi.h | 2 | ||||
-rw-r--r-- | src/mthca.c | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/mthca-abi.h b/src/mthca-abi.h index 1215412..2557274 100644 --- a/src/mthca-abi.h +++ b/src/mthca-abi.h @@ -36,6 +36,8 @@ #include <infiniband/kern-abi.h> +#define MTHCA_UVERBS_ABI_VERSION 1 + struct mthca_alloc_ucontext_resp { struct ibv_get_context_resp ibv_resp; __u32 qp_tab_size; diff --git a/src/mthca.c b/src/mthca.c index 81ac891..0f7e953 100644 --- a/src/mthca.c +++ b/src/mthca.c @@ -282,6 +282,12 @@ static struct ibv_device *mthca_driver_init(const char *uverbs_sys_path, return NULL; found: + if (abi_version > MTHCA_UVERBS_ABI_VERSION) { + fprintf(stderr, PFX "Fatal: ABI version %d of %s is too new (expected %d)\n", + abi_version, uverbs_sys_path, MTHCA_UVERBS_ABI_VERSION); + return NULL; + } + dev = malloc(sizeof *dev); if (!dev) { fprintf(stderr, PFX "Fatal: couldn't allocate device for %s\n", |