New upstream version 16.11.3
[deb_dpdk.git] / drivers / net / mlx4 / mlx4.c
index 83f9143..4a03d34 100644 (file)
@@ -3157,6 +3157,13 @@ mlx4_rx_burst_sp(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
                        NB_SEGS(rep) = 0x2a;
                        PORT(rep) = 0x2a;
                        rep->ol_flags = -1;
+                       /*
+                        * Clear special flags in mbuf to avoid
+                        * crashing while freeing.
+                        */
+                       rep->ol_flags &=
+                               ~(uint64_t)(IND_ATTACHED_MBUF |
+                                           CTRL_MBUF_FLAG);
 #endif
                        assert(rep->buf_len == seg->buf_len);
                        /* Reconfigure sge to use rep instead of seg. */
@@ -5618,8 +5625,10 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
        ibv_dev = list[i];
 
        DEBUG("device opened");
-       if (ibv_query_device(attr_ctx, &device_attr))
+       if (ibv_query_device(attr_ctx, &device_attr)) {
+               err = EINVAL;
                goto error;
+       }
        INFO("%u port(s) detected", device_attr.phys_port_cnt);
 
        for (i = 0; i < device_attr.phys_port_cnt; i++) {
@@ -5645,19 +5654,23 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                DEBUG("using port %u (%08" PRIx32 ")", port, test);
 
                ctx = ibv_open_device(ibv_dev);
-               if (ctx == NULL)
+               if (ctx == NULL) {
+                       err = ENODEV;
                        goto port_error;
+               }
 
                /* Check port status. */
                err = ibv_query_port(ctx, port, &port_attr);
                if (err) {
                        ERROR("port query failed: %s", strerror(err));
+                       err = ENODEV;
                        goto port_error;
                }
 
                if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
                        ERROR("port %d is not configured in Ethernet mode",
                              port);
+                       err = EINVAL;
                        goto port_error;
                }
 
@@ -5694,6 +5707,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 #ifdef HAVE_EXP_QUERY_DEVICE
                if (ibv_exp_query_device(ctx, &exp_device_attr)) {
                        ERROR("ibv_exp_query_device() failed");
+                       err = ENODEV;
                        goto port_error;
                }
 #ifdef RSS_SUPPORT
@@ -5769,6 +5783,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
                if (priv_get_mac(priv, &mac.addr_bytes)) {
                        ERROR("cannot get MAC address, is mlx4_en loaded?"
                              " (errno: %s)", strerror(errno));
+                       err = ENODEV;
                        goto port_error;
                }
                INFO("port %u MAC address is %02x:%02x:%02x:%02x:%02x:%02x",