mlx4: make sure experimental device query is implemented
authorOlga Shern <olgas@mellanox.com>
Tue, 30 Jun 2015 09:27:49 +0000 (11:27 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 1 Jul 2015 08:48:17 +0000 (10:48 +0200)
HAVE_EXP_QUERY_DEVICE is used to check whether ibv_exp_query_device() can be
used. RSS and inline receive features depend on it.

Signed-off-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
drivers/net/mlx4/Makefile
drivers/net/mlx4/mlx4.c

index 97b364a..ce1f2b0 100644 (file)
@@ -112,6 +112,10 @@ mlx4_autoconf.h: $(RTE_SDK)/scripts/auto-config-h.sh
                SEND_RAW_WR_SUPPORT \
                infiniband/verbs.h \
                type 'struct ibv_send_wr_raw' $(AUTOCONF_OUTPUT)
+       $Q sh -- '$<' '$@' \
+               HAVE_EXP_QUERY_DEVICE \
+               infiniband/verbs.h \
+               type 'struct ibv_exp_device_attr' $(AUTOCONF_OUTPUT)
 
 mlx4.o: mlx4_autoconf.h
 
index ad37e01..bd20569 100644 (file)
@@ -4458,17 +4458,18 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                struct ibv_pd *pd = NULL;
                struct priv *priv = NULL;
                struct rte_eth_dev *eth_dev;
-#if defined(INLINE_RECV) || defined(RSS_SUPPORT)
+#ifdef HAVE_EXP_QUERY_DEVICE
                struct ibv_exp_device_attr exp_device_attr;
-#endif
+#endif /* HAVE_EXP_QUERY_DEVICE */
                struct ether_addr mac;
                union ibv_gid temp_gid;
 
+#ifdef HAVE_EXP_QUERY_DEVICE
+               exp_device_attr.comp_mask = IBV_EXP_DEVICE_ATTR_EXP_CAP_FLAGS;
 #ifdef RSS_SUPPORT
-               exp_device_attr.comp_mask =
-                       (IBV_EXP_DEVICE_ATTR_EXP_CAP_FLAGS |
-                        IBV_EXP_DEVICE_ATTR_RSS_TBL_SZ);
+               exp_device_attr.comp_mask |= IBV_EXP_DEVICE_ATTR_RSS_TBL_SZ;
 #endif /* RSS_SUPPORT */
+#endif /* HAVE_EXP_QUERY_DEVICE */
 
                DEBUG("using port %u (%08" PRIx32 ")", port, test);
 
@@ -4513,11 +4514,12 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                priv->port = port;
                priv->pd = pd;
                priv->mtu = ETHER_MTU;
-#ifdef RSS_SUPPORT
+#ifdef HAVE_EXP_QUERY_DEVICE
                if (ibv_exp_query_device(ctx, &exp_device_attr)) {
-                       INFO("experimental ibv_exp_query_device");
+                       ERROR("ibv_exp_query_device() failed");
                        goto port_error;
                }
+#ifdef RSS_SUPPORT
                if ((exp_device_attr.exp_device_cap_flags &
                     IBV_EXP_DEVICE_QPG) &&
                    (exp_device_attr.exp_device_cap_flags &
@@ -4569,6 +4571,7 @@ mlx4_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                             priv->inl_recv_size);
                }
 #endif /* INLINE_RECV */
+#endif /* HAVE_EXP_QUERY_DEVICE */
 
                (void)mlx4_getenv_int;
                priv->vf = vf;